jesseduffield/lazygit

Emoji in commit log cause extra characters right after the emoji

Opened this issue · 1 comments

Describe the bug
When using emoji in commit log, the following character will sometimes display twice.

To Reproduce
Steps to reproduce the behavior:

  1. Use emoji in commit log, I use these at the commit logs beginning: 🚧 🧹 🔧 🏷️
  2. In the Commits section, when the commit logs are selected by the cursor, irregular extra characters appear right after the emoji. (pic 1)
  3. And if you use Enter to go into the commit, the issue might be easier to observe. (pic 2)
  4. I have added an extra space after the emoji; otherwise, it will look like pic 3, the first commit log.
  5. Also, the emoji causes the view border to display incorrectly. (pic 4)

Seems like the width calculation issue about Unicode Emoji.

Expected behavior
Not showing extra characters and calculate the Emoji's width correctly.
Here is the correct display in vim:
image

Screenshots

image image image image

Version info:
Run lazygit --version and paste the result here

commit=3675570a391b1a49ddd198b4c7e71e17701d4404, build date=2024-03-23T09:09:11Z, build source=binaryRelease, version=0.41.0, os=darwin, arch=arm64, git version=2.39.3 (Apple Git-146)

Run git --version and paste the result here

git version 2.39.3 (Apple Git-146)

Additional context

The screenshots pic 1 to pic 3 is from a older version lazygit, pic 4 is the latest version. Here is the older version's info:

commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=darwin, arch=arm64, git version=2.39.3 (Apple Git-146)

One sample commit log for debugging:
🏷️ Update Version Number to v2.7.0(195)

Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

image The latest version seems to also have a cursor position issue when typing emojis in the commit log, which is normal in the older version I have mentioned. The correct cursor position should be one character leading.