contour icon indicating copy to clipboard operation
contour copied to clipboard

Alt screen does not move cursor same amount as primary screen for some emoji

Open rockorager opened this issue 1 year ago • 2 comments
trafficstars

Contour Terminal version

contour-git from AUR

Installer source

something else (please specify below)

Operating System

Arch linux

Architecture

x86-64

Other Software

No response

Steps to reproduce

#!/bin/sh

echo "primary screen:"
echo "|--|"
echo "|🏳️‍🌈|"
echo "|📎|"
echo "|📡|"
sleep 5

echo -e "\x1b[?1049h\x1b[?2027h" # enter alt screen and turn on 2027
echo "alternate screen:"
echo "|--|"
echo "|🏳️‍🌈|"
echo "|📎|"
echo "|📡|"

sleep 5

echo -e "\x1b[?1049l"

Expected Behavior

In the alt screen, the cursor only moves one cell for some emoji

Actual Behavior

The cursor should move the same (correct) amount in the primary screen and alt screen

Additional notes

No response

rockorager avatar Feb 10 '24 13:02 rockorager

Cursor movement mistakes are most likely a bug in unicode grapheme cluster's width handling. I wonder why it's only happening on alt screen and not on primary. Will figure it out. Many thanks for your report, @rockorager :)

christianparpart avatar Feb 10 '24 19:02 christianparpart

Okay, this is a dup of #1375 - technically speaking. I am having a PR open over at libunicode that attempts to fix this (with better API and implementation). this should be fixed by the next major Contour release :)

christianparpart avatar Feb 20 '24 18:02 christianparpart