krader1961 · GitHub

When issues like #3989 and #4011 are opened I frequently find myself hacking a fish binary to tell me what fish_wcswidth() returns for the non-ASCII characters. There really should be a standard mechanism for getting that information. It seems like a string width subcommand is what is needed. By default it reports the cumulative width of each string one per line. With the -i / --individual flag it would report the width of each individual character in each string. With the -v / --verbose flag it would print a symbolic representation of each char and its width.

This would allow you to type string width \u009C to learn that fish thinks that char has width -1 (i.e., the width is undefined).

The first implementation would not support ANSI X3.64 escape sequences. So it couldn't be used to determine the "visual" width of something like the output of fish_prompt. That's an enhancement we might add in the future.

Read the original on github.com ↗