Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with certain emojis #875

Closed
rightaway opened this issue Sep 6, 2018 · 20 comments
Closed

Problems with certain emojis #875

rightaway opened this issue Sep 6, 2018 · 20 comments

Comments

@rightaway
Copy link

When I paste emojis into the terminal and delete them it mostly works fine, but with some emojis like the flag emojis (like 馃嚘馃嚝 馃嚘馃嚱 馃嚘馃嚤 馃嚛馃嚳 馃嚘馃嚫) pasting it pastes extra space characters, and trying to delete them results in some strange display issues, and having to press delete multiple times to delete a single emoji, and then I can't get to the beginning of the line to delete everything.

@kovidgoyal
Copy link
Owner

This is likely caused by issues in your shell not kitty. Try running cat and then pasting your flag emojis and deleting them, they will work fine. If not let me know.

@maximbaz
Copy link
Contributor

maximbaz commented Sep 6, 2018

It is reproducible in cat:

peek 2018-09-06 16-46

@kovidgoyal
Copy link
Owner

OK I'll take a look at it when I have a moment

@kovidgoyal kovidgoyal reopened this Sep 6, 2018
@rightaway
Copy link
Author

@maximbaz Thanks for double checking. How did you take that screen video?

@maximbaz
Copy link
Contributor

maximbaz commented Sep 6, 2018

Using https://github.com/phw/peek, but be aware of this bug phw/peek#331

@Luflosi
Copy link
Contributor

Luflosi commented Sep 6, 2018

I can also reproduce this bug. I think the unicode flag symbols consist of two special unicode characters next to each other. This would explain, why it's possible to press backspace twice and why there is a weird character when pressing backspace once.

@kovidgoyal
Copy link
Owner

Yeah I looked at it, its not realy a bug. flags are two unicode symbols. So when you pres backspace one of them get deleted, leaving the other behind. Sadly the unicode committee did not make flags combining symbols so that is expected behavior.

@maximbaz
Copy link
Contributor

maximbaz commented Sep 6, 2018

Pressing backspace twice is understandable, but see my gif, I cannot get rid of (A) emoji no matter how many times I press backspace

@kovidgoyal
Copy link
Owner

OK I'll open it again, this looks like its going to go on all night :)

@kovidgoyal kovidgoyal reopened this Sep 6, 2018
@Snuggle
Copy link

Snuggle commented Sep 6, 2018

This happens with other emojis too. It causes a ton of issues when needing to use emojis in a terminal. I can't backspace either, and some of the emojis don't actually exist if I try to echo them etc.

Here's a recording showing flag emojis at first and then normal single-character emojis

asciicast

@kovidgoyal
Copy link
Owner

@Snuggle like I said initially, dont use a shell. Different shells have widely arying support for emoji. Try to reproduce the problem in cat. Flags are not emoji and have special problems. As far as I know all actual emojis work fine in kitty.

@ssoriche
Copy link

ssoriche commented Sep 7, 2018

I get it with 鉁奿n fish, cat, bash, weechat, and irssi. 鈽侊笍 Takes 2 presses of backspace is ok, but after the first press of backspace on 鉁妋oves the cursor, after that nothing happens and the 鉁 is still displayed.

@kovidgoyal
Copy link
Owner

Works fine for me in vim. But sure, I can probably look into making the erase_char operation detect wide characters and act intelligently on it. I just hope doing that does not screw it up in vim. Probably have to make it zero both cells and then move one cell back. That should work in both cat and vim.

@maximbaz
Copy link
Contributor

maximbaz commented Sep 7, 2018

The issue with flag and fist emojis is fixed on master, thanks 馃槈

I was wondering if in 7f0674a you should have removed removed all wide characters before the cursor, no only one wide character before the cursor.


Also if you are not sick of emojis yet, can you have a look at these ones?

  • 馃懆鈥嶐煈 (U+1F468, 鈥峌+200D, U+1F466) - kitty requires pressing backspace twice even though there is a joiner
  • 馃懆鈥嶐煈р嶐煈 (U+1F468, 鈥峌+200D, U+1F467, 鈥峌+200D, U+1F466) - similarly requires 3 times to press backspace

@kovidgoyal
Copy link
Owner

Why would I want to remove all wide characters? Pressing backspace once should remove one wide character, not all of them.

kitty does not support joiners beyon treating them as basic combining characters.

@blahgeek
Copy link
Contributor

blahgeek commented Sep 9, 2018

Commit 7f0674a breaks backspace for unicode characters in NeoVim for me:

With content 鈥滀綘濂解 in neovim, pressing backspace once would delete two instead of one character.

@kovidgoyal
Copy link
Owner

Still works in vim. This is what I was basically afraid of. There is no standard that I can find about what backspace is supposed to do with wide characters. Which means that no matter what choice I make, something will not work.

Presumably neovim expect the terminal to do what kitty did before this patch. I'm not sure how vim is able to handle both behaviors, probably it manages cursor position manually when dealing with wide characters to get around differences in terminal behavior.

Maybe @justinmk would like to comment on what neovim does.

@kovidgoyal
Copy link
Owner

Actually, I think I am going to revert this patch. Most terminal applications seem to expect the terminal emulator to not special case backspacing of emoji. They want to handle it themselves. That means that whether backspacing any particular wide character works or not depends entirely on whether the application you are running inside the terminal knows that the character is an wide character.

For instance without this patch:

with the raised fist emoji: backspacing works for me with up-to-date bash and zsh and vim and nvim
but not in cat and fish. Which tells me that fish is using an outdated wide character database.

With the patch, it works in vim and cat and fish but not in zsh, bash and nvim.

with the flag on the other hand, without the patch: it works in vim and nvim but not in any of the shells or cat. You will simply have to wait for the shells to update their wide character database to include the flags.

Given that terminal applications want to handle backspacing themselves, I dont think this is an issue that can be resolved in the terminal emulator.

@kovidgoyal kovidgoyal reopened this Sep 9, 2018
@toonn
Copy link
Contributor

toonn commented Jan 7, 2019

Hmm, is this an instance of the same issue? Running cat (in fish, in kitty, on mac os). I insert an emoji 馃槃, then backspace, then insert another 馃巹, the smiley remains visible, only when pressing enter the christmas tree becomes visible on the next line.

@kovidgoyal
Copy link
Owner

yeah cat is dumb, so it will never know how to backspace emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants