-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[ubuntu] Fast scroll in fzf leaves garbage on screen #1526
Comments
Thanks for reporting. Please provide a static (preferably short) text file I can use to reproduce the problem myself. i.e. |
Hi @junegunn |
I've also confirmed this issue with another terminal emulator (urxvt). So this seems something not terminal-dependent. |
I couldn't reproduce on my system (macOS, iterm2). Are you on tmux? I've noticed that tmux has some issues rendering unicode characters. |
Thanks @junegunn for testing it.
No I'm on pure bash and using neither tmux nor something similar to it. I've also found that this doesn't occur on the login console. (i.e. the console not on gnome/gtk but directly on frame buffer console, can be shown hitting Ctrl+Alt+F1 on ubuntu) On this console I'm using exactly same .profile as issue-reproducable ones. So this might be something gnome/gtk-related. If you have any idea for narrowing down the issue (like: testing some other CLI apps using same library as fzf), please note me. |
fzf does not rely on a library but directly uses low-level control codes to render the screen. So I wouldn't be too surprised to find some visual glitches. Anyway, it's hard to fix the issue without an automated test script that can reliably reproduce the problem. For what it's worth, you can hit CTRL-L to trigger a redraw of the screen. |
Unfortunately redrawing is not suitable for me since these glitches occurs quite often in my actual usecase of scrolling git-log with ANSI-colorized pretty format.
Okay, I'll take a look using my macbook at some early date. |
Hi, I also encounter a similar issue to this ticket. I analyzed this issue and figured out that https://github.com/mattn/go-runewidth returns 2 for some Unicode char, but actually it's printed as 1 width char in my terminal. For example, ━ as
But may terminal prints it as: Confirmed this in tests with my local docker. This test is failing with the latest master. When
So nextLine.width > prevLine.width and it doesn't fill any: Lines 1116 to 1119 in 34fe5ab
But my terminal print ━ with 1 width char like -, so actually last 2 char(OL here) will remain
For a preview, when print ━━━━EOL, it's move and clear from x=11, but the actual width is 7(4*1+3), so the previous char in 8~10 will remain: Lines 961 to 966 in 34fe5ab
I confirmed my change to clear everything before write fix this issue: I understand this have a tradeoff between visibility improvement for some environment and less performance(deoptimization). I'm glad if you can fix this issue in some other way or improve my change 🙇 |
@bitterfox Thanks for the investigation. Would it help to update mattn/go-runewidth to the latest ( |
Upgrading the library doesn't seem to help. I didn't know that |
@bitterfox Does it help in your case to set |
This is also a problem for some emoji that can be rendered as text. Mostly There is this setting that could help: https://github.com/mattn/go-runewidth/blob/master/runewidth.go#L16 but I am not sure about the implications. It seems like the same underlying problem as the east asian characters. testing this can be done using:
shows up with trailing ; This is on linux with foot terminal, but I also tested with alacritty and it's the same. Edit: this reproduces on osx+iterm2. |
I looked into the runewidth code: https://github.com/mattn/go-runewidth/blob/master/runewidth.go#L106 I don't see an option to accommodate everything one's setup in the fzf optimized version. It's not possible to know what exactly the width of a line will be given emoji+east asian characters in a line. There's a couple of solutions:
It seems that 2 with double width is the nicest solution? https://github.com/junegunn/fzf/blob/master/src/terminal.go#L1139 ->
I tested this locally and it fixes the emoji problem at least! |
This is reproducible on my laptop, but not on my desktop computer. On my laptop, if I execute fzf on bash in a tmux session, this issue seems to disappear |
After comparing the output of See if |
When I preview some quite long contents in fzf such as
$ git log --oneline --pretty=format:'%an <%ae> | fzf'
and scroll them fast with holding PageDown key down, occasionally 1-2 characters of end part of lines are left on screen.I've confirmed this issue with fzf 0.17.5 (5d16b28). And also confirmed that there is no issue when I scroll same contents in
less
command.screenshot:
The text was updated successfully, but these errors were encountered: