[Tcsh] Multi-byte characters in promptchars
Kimmo Suominen
kim at netbsd.org
Fri Sep 20 14:38:18 UTC 2024
On Fri, Sep 20, 2024 at 10:46:49AM +0200, H.Merijn Brand wrote:
> With multibyte promptchars and a complicated prompt like
>
> promptchars
> prompt xyz%{\e[47;34m0392\e[0m%} %U%m:%u%{\e[1m%}%/ %h %{\e[0;38;2;255;24;0m%}%#%{\e[0m%}
>
> Positioning inside the line when editing still frequently messes up. A
> control-R fixes that, but I guess it should be smooth
I think the issue is highlighted by this question I made:
On Fri, 5 Apr 2024 12:47:05 +0300, Kimmo Suominen <kim at netbsd.org> wrote:
> Why does it only apply to NLSCLASS_ILLEGAL2?
I think the whole logic there across the NLSCLASS_ILLEGALn cases is
incorrect.
> Do we have something already that correctly provides the rendering
> width of the character? Here is a Stack Overflow answer that points
> to using wcwidth(3) and wcswidth(3):
>
> https://stackoverflow.com/a/9145712/1511370
>
> https://man.netbsd.org/wcwidth.3
> https://man.netbsd.org/wcswidth.3
I think the correct implementation needs to include the detection of the
rendering width of the characters.
Kind regards,
+ Kimmo
More information about the Tcsh
mailing list