Flag emojis are 2 characters
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:
deleting half the flag:

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

it is possible to delete half the flag in vim as well.
How do you insert these characters?
How do you insert these characters?
I pasted it
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.
How do you insert these characters?
https://github.com/hrsh7th/cmp-emoji/ works too.
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.
After #19674 this can achieve the same thing as #19259:
:call setcellwidths([[0x1f1e6, 0x1f1ff, 1]])
#19686 will make the behavior same as Vim, but will also make the workaround above no longer work.
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.
⚠️ 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
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.![]()
⚠️ 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 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.
: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).
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
This issue contains some outdated information. Closing in favor of #22014, which describes behavior in latest version.