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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using some emoji in kitty causes errors while typing #5625

Closed
beelzebielsk opened this issue Oct 26, 2022 · 9 comments
Closed

Using some emoji in kitty causes errors while typing #5625

beelzebielsk opened this issue Oct 26, 2022 · 9 comments
Labels

Comments

@beelzebielsk
Copy link

beelzebielsk commented Oct 26, 2022

Describe the bug
Kitty doesn't handle some emoji correctly. I don't know about everything that goes wrong, but one example is if you paste "☀️" emoji into the terminal and then move the cursor behind it and keep typing, what the terminal shows will be different from what you typed.

I think the issue is for multibyte emoji. They don't need to have zero-width joiners, as I think the Sunny emoji doesn't use that. So I don't think this is a duplicate of #3810.

To Reproduce
Steps to reproduce the behavior:

  1. Paste "☀️" into the terminal.
  2. Press left on keyboard.
  3. Type asdf several times.
  4. See that the sunny emoji is written a lot instead of asdf.

Screenshots

kitty-emoji-bug-2022-10-26_18.54.59.mp4

In the second line, you see what was really typed: "asdfasdfasdf☀️". But what's in the first line is what is shown instead.

Environment details

kitty 0.25.2 created by Kovid Goyal
Linux GOONIESTRONK 5.15.61-1-lts #1 SMP Wed, 17 Aug 2022 15:11:32 +0000 x86_64
Arch Linux 5.15.61-1-lts (/dev/tty)

DISTRIB_ID="Arch"
DISTRIB_RELEASE="rolling"
DISTRIB_DESCRIPTION="Arch Linux"
Running under: X11
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /bin/bash

Config options different from defaults:

Important environment variables seen by the kitty process:
	PATH                                /home/adam/.gem/ruby/3.0.0/bin:/usr/local/vitasdk/bin:/home/adam/perl5/bin:/home/adam/local/bin:/opt/google-cloud-sdk/bin:/home/adam/.gem/ruby/3.0.0/bin:/usr/local/vitasdk/bin:/home/adam/perl5/bin:/home/adam/local/bin:/home/adam/.gem/ruby/3.0.0/bin:/usr/local/vitasdk/bin:/home/adam/perl5/bin:/home/adam/local/bin:/opt/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/android-sdk/platform-tools:/usr/lib/jvm/default/bin
	LANG                                en_US.UTF-8
	VISUAL                              /usr/bin/nvim
	EDITOR                              /usr/bin/nvim
	SHELL                               /bin/bash
	DISPLAY                             :0
	USER                                adam
	XDG_CONFIG_DIRS                     /etc/xdg
	XDG_MENU_PREFIX                     xfce-
	XDG_SEAT                            seat0
	XDG_SESSION_TYPE                    tty
	XDG_CURRENT_DESKTOP                 XFCE
	XDG_SESSION_CLASS                   user
	XDG_VTNR                            1
	XDG_SESSION_ID                      1
	XDG_RUNTIME_DIR                     /run/user/1000
	XDG_DATA_DIRS                       /home/adam/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/usr/share

Additional context
You can produce this with kitty --config NONE. The video I posted uses no config.

@page-down
Copy link
Contributor

... multibyte emoji ... I think the Sunny emoji doesn't use that.

The Sun emoji is a combination of two escaped characters.

  • U+2600 Black Sun With Rays
  • U+FE0F Variation Selector-16

So you need to move the cursor by two characters.
Also, many shells are broken when handling unicode characters.

@beelzebielsk
Copy link
Author

beelzebielsk commented Oct 27, 2022

Moving the cursor twice changes nothing. Even if that were the case, I'd still consider that a bug. I shouldn't be able to "split" an emoji like that.

Are you saying this may be a problem with my shell and not kitty? I can tell you that this bug doesn't happen in xfce4-terminal or gnome-terminal. It also doesn't happen if I repeat these steps in kitty while using neovim.

@kovidgoyal
Copy link
Owner

This is an issue with your shell, try pasting you rmoji into a program
that understands emoji variation selectors and handles them correctly,
such as a recent build of vim.

@beelzebielsk
Copy link
Author

beelzebielsk commented Oct 27, 2022

That's not clear from what I've seen. Yes, this doesn't happen in vim. But this also doesn't happen when using the same shell in other terminal emulators.

It doesn't seem like you read my comment, else you would've known I already tried pasting into vim and noticed this wasn't a problem.

@kovidgoyal
Copy link
Owner

Because the terminal emulators in question will have the same bug as the
shell you are using and the two bugs just happen to cancel each other
out in this instance.

@beelzebielsk
Copy link
Author

beelzebielsk commented Oct 27, 2022

Ok. Given what I've read in the other issues around emoji reported here, I can believe that. Thanks.

@page-down
Copy link
Contributor

It doesn't seem like you read my comment, else you would've known ...

Your reply is edited at least 7 times, then the viewer is not looking at the last one when replying (e.g. only the first sent reply will be received in the mailbox), even if the GitHub live update feature is working.

See other related issues to learn more.
The terminal and the command line program need to work together and need to have the same consensus.
However, some shells are not modern enough.

@beelzebielsk
Copy link
Author

It didn't occur to me that editing could be a reason why it wasn't seen. Thanks for pointing that out. Sorry.

I spent about two hours looking at issues here and at one or two related neovim issues as well since that's where I first noticed problems. I still don't know how to tell what program is responsible for the issues. Or more importantly what to do next.

@beelzebielsk
Copy link
Author

I looked at those issues before making my issue here.

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

No branches or pull requests

3 participants