nvi2 icon indicating copy to clipboard operation
nvi2 copied to clipboard

Issue representing multi byte green checkmark?

Open risner opened this issue 1 year ago • 5 comments

First, thanks for this release. It has vastly improved my life (and continued ability to use nvi).

My issue is about using this checkmark symbol: ✅

I have nvi version 2.2.1 (2023-09-25 installed and when I use this symbol I see a multibyte code and it has difficulty with cursor position on the line after. The displayed code on screen is \u2705. I'm not sure if I'm using it incorrectly or have a feature disabled that is causing this. But many other codes seem to work perfectly.

risner avatar Dec 22 '24 19:12 risner

I don't notice an issue... Please share a video/gif clip if possible. Also, which terminal you're using? I'm using mintty.

lichray avatar Dec 22 '24 20:12 lichray

Alacrity 0.14.0 (1)

Sorry it is so long...

Alacrity displays correctly when cat'ing the file, just not in nvi2. https://github.com/user-attachments/assets/6b352ae7-ddd2-43b3-a128-39ad6cf8f6a1

risner avatar Dec 22 '24 21:12 risner

When cat'ing something, it's only terminal in play. nvi2 is a program that obeys your locale. When you see some Unicode characters displayed as-is but not others, it may be because your locale does not consider the character printable. What's your current locale? Please share environment variables such as LANG and LC_CTYPE. In my case, if I set LC_CTYPE to zh_CN.GB18030 and terminal mode to GBK, I can edit Chinese but see the checkmark displayed as \u2705. If I set LC_CTYPE to zh_CN.UTF-8 and terminal mode to UTF-8, I can see the checkmark displayed as a checkmark. Note that different OSs name locale differently; the appropriate locale on your system may not be any of these.

About the cursor behavior around \u2705, this is a nvi2 feature to display something that cannot be printed in multiple glyphs. It's still one character, so you won't be able to point to 2 or 5.

If you found some U+1nnnn characters to be displayed as-is but U+2nnn characters to be displayed in this fallback mechanism, that behavior would sound like a bug (although solving it doesn't address your issue).

lichray avatar Dec 22 '24 22:12 lichray

% setenv | egrep 'LANG|LC_CTYPE'

% stty speed 9600 baud; lflags: echoe echoke echoctl pendin iflags: iutf8 oflags: -oxtabs cflags: cs8 -parenb

% echo $TERM xterm-256color

I don't typically set any of those environment variables. Also, I'm on macOS 15.1 (24B83) M3

risner avatar Dec 23 '24 03:12 risner

It seems that Alacrity at least tried to follow system locale (https://github.com/alacritty/alacritty/commit/7901b454ee04c7873e611986ed2dbe5c3d6331eb#diff-35bac35ab4fe2dcd2348a1e8ea0541e66f4a5dfd0ee9569cfa33479a21c3f3a3R64) so I'm not sure how do you have LC_CTYPE not set, but you can set it manually according to the last few comments in alacritty/alacritty#2566. Anyhow, please give locale names such as en_US.UTF-8 a try.

lichray avatar Dec 23 '24 05:12 lichray