neovim icon indicating copy to clipboard operation
neovim copied to clipboard

Flag emojis are 2 characters

Open ModProg opened this issue 4 years ago • 11 comments

Neovim version (nvim -v)

NVIM v0.6.0-dev+518-g1dbbaf89b

Vim (not Nvim) behaves the same?

partialiy, 8.2.3582

Operating system/version

arch linux

Terminal name/version

XTerm(369) or wezterm 20211125-225427-0bc43473

$TERM environment variable

xterm-256color or wezterm

Installation

AUR

How to reproduce the issue

nvim --clean :e test i sometext 🇩🇪 somefurther text

Expected behavior

The last position of the cursor should be on the last t not two behind. It should be possible to delete the flag as one character not two.

Actual behavior

last position of cursor: grafik deleting half the flag: grafik

In vim it is slightly different, the extra spacing is behind the flag and the cursor is correctly positioned: grafik

it is possible to delete half the flag in vim as well.

ModProg avatar Nov 26 '21 15:11 ModProg

How do you insert these characters?

clason avatar Nov 26 '21 15:11 clason

How do you insert these characters?

I pasted it

ModProg avatar Nov 26 '21 15:11 ModProg

I think the corresponding emoji is U+1F1E9+U+1F1EA from the Emoji Flag Sequence. At the moment, neovim cannot properly handle such emoji (Emoji Flag Sequence) as well as emoji modifiers, etc.

Ref. #7151, #12435.

erw7 avatar Nov 26 '21 16:11 erw7

How do you insert these characters?

https://github.com/hrsh7th/cmp-emoji/ works too.

WhyNotHugo avatar Jun 01 '22 10:06 WhyNotHugo

If anyone interested in this issue is able to test PR #19259 in order to see if it is a reasonable solution to this problem, it'd be helpful. Especially since it isn't an ideal fix, but just improves the situation for now, until a perfect solution emerges.

loops avatar Jul 09 '22 23:07 loops

After #19674 this can achieve the same thing as #19259:

:call setcellwidths([[0x1f1e6, 0x1f1ff, 1]])

zeertzjq avatar Aug 08 '22 23:08 zeertzjq

#19686 will make the behavior same as Vim, but will also make the workaround above no longer work.

zeertzjq avatar Aug 09 '22 07:08 zeertzjq

I'm also getting major issues when displaying emojis in neovim (although I sometimes have 📂 displayed in my airline statusline and I've gotten that to work without issues I think). Anyway, I defined a ⚠️ gutter sign and it causes drawing issues as soon as it gets displayed anywhere (see the doubled lines and partially-rendered statusline in the image below). I wasn't sure if it was neovim, my terminal, a vim/neovim plugin, etc., but after coming across these GitHub issues it sounds like it's probably neovim causing the issues.

Screen Shot 2022-09-04 at 6 22 31 PM

⚠️ warning Unicode: U+26A0 U+FE0F, UTF-8: E2 9A A0 EF B8 8F

📂 open file folder Unicode: U+1F4C2, UTF-8: F0 9F 93 82

It looks like 📂 doesn't use a variation selector? So perhaps that is why it doesn't cause me issues while ⚠️ (which the U+FE0F variation selector) does?

@erw7 ... At the moment, neovim cannot properly handle such emoji (Emoji Flag Sequence) as well as emoji modifiers, etc.

Ref. #7151, #12435.

Is it known what's causing this? What are the workarounds exactly? Thanks

tmillr avatar Sep 05 '22 01:09 tmillr

I'm also getting major issues when displaying emojis in neovim (although I sometimes have 📂 displayed in my airline statusline and I've gotten that to work without issues I think). Anyway, I defined a ⚠️ gutter sign and it causes drawing issues as soon as it gets displayed anywhere (see the doubled lines and partially-rendered status-line in the image below). I wasn't sure if it was neovim, my terminal, a vim/neovim plugin, etc., but after coming across these GitHub issues it sounds like it's probably neovim causing the issues.

Screen Shot 2022-09-04 at 6 22 31 PM

⚠️ warning Unicode: U+26A0 U+FE0F, UTF-8: E2 9A A0 EF B8 8F

📂 open file folder Unicode: U+1F4C2, UTF-8: F0 9F 93 82

It looks like 📂 doesn't use a variation selector? So perhaps that is why it doesn't cause me issues while ⚠️ does?

Is it known what's causing this? What are the workarounds exactly? Thanks

#7151 is the issue for variation selector. Some character width problems have been fixed in recent months, so if you are on stable release, try nightly release.

zeertzjq avatar Sep 05 '22 01:09 zeertzjq

@zeertzjq awesome thank you

I'm using v0.7.2. I just use the latest brew install neovim and then let HomeBrew take care of updates for me, but I'll look into getting a nightly/beta version to see if that helps.

I don't know if this would be appropriate, but I wonder if this issue could be documented in neovim's README and/or neovim's .txt help files (e.g. maybe in :help vim_diff) until it gets fixed? Especially if this issue does not occur in regular Vim. I feel like customizing neovim with emojis is probably common and this issue can be very confusing and hard to figure out/pinpoint the cause of.

tmillr avatar Sep 05 '22 02:09 tmillr

:call setcellwidths([[0x1f1e6, 0x1f1ff, 1]])

This just resulted in different issues for me (the character eventually disappeared from screen when moving the cursor, even though it's not deleted and still in the buffer).

WhyNotHugo avatar Sep 05 '22 08:09 WhyNotHugo

Until the issue is fixed, I recommend using vi for the situations where flag emoji are needed. vi supports multi-character emoji fine. Just my 2 cents

MRAAGH avatar Sep 23 '22 08:09 MRAAGH

This issue contains some outdated information. Closing in favor of #22014, which describes behavior in latest version.

zeertzjq avatar Jan 27 '23 02:01 zeertzjq