kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
22.85k stars 923 forks source link

Text selection doesn't account for unicode grapheme clusters #4200

Closed hhirtz closed 2 years ago

hhirtz commented 2 years ago

Describe the bug Selected text in kitty is shown with reverted colors. On grapheme clusters (e.g. emoji chains with ZWJ) the selection area seems to expand the width of codepoints taken individually, instead of using the width of the whole cluster.

To Reproduce Steps to reproduce the behavior:

  1. echo -e '👨\u200d👩\u200d👧\u200d👧'
  2. Select output of echo with a double click for example
  3. See error

Screenshots screen-20211106234741

Environment details

kitty 0.23.1 created by Kovid Goyal
Linux vroom 5.14.14-arch1-1 #1 SMP PREEMPT Wed, 20 Oct 2021 21:35:18 +0000 x86_64
Arch Linux \r (\l)
LSB_VERSION=1.4
DISTRIB_ID=Arch
DISTRIB_RELEASE=rolling
DISTRIB_DESCRIPTION="Arch Linux"
Running under:Wayland
Loaded config files:
  /home/hubert/.config/kitty/kitty.conf

Config options different from defaults:
font_family JetBrains Mono
font_size   13.0
Added shortcuts:
    shift+page_up KeyAction('scroll_page_up')
    shift+page_down KeyAction('scroll_page_down')
kovidgoyal commented 2 years ago

dupe of #3810