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

Visual glitches in linux console. #4317

Closed
GeorgMeore opened this issue Aug 28, 2021 · 13 comments
Closed

Visual glitches in linux console. #4317

GeorgMeore opened this issue Aug 28, 2021 · 13 comments
Labels

Comments

@GeorgMeore
Copy link

GeorgMeore commented Aug 28, 2021

Steps

use add-highlighter global/ number-lines -relative
Open file in linux tty and start scrolling with j and k.

Outcome

Visual glitches.

@GeorgMeore GeorgMeore added the bug label Aug 28, 2021
@GeorgMeore
Copy link
Author

Without -relative everything seems fine.

evanrelf pushed a commit to evanrelf/dotfiles that referenced this issue Aug 30, 2021
I didn't use relative line numbers very often, and they seem to cause
visual flickering with Kakoune's new terminal rendering machinery which
replaced `ncurses` ([related issue][issue]).

[issue]: mawww/kakoune#4317
@mawww
Copy link
Owner

mawww commented Sep 1, 2021

This would indicate the linux console renders every intermediate state instead of what most terminals do: render once there is no more terminal output pending. Its unfortunate because it means the current code that optimize for the amount of data on the wire leads to this flickering.

The linux console is a pretty important use case, even if I rarely use it, I think it is important for Kakoune to be comfortably useable there. To fix this we can either add an option to disable the use of scrolling optimizations or just remove them altogether.

@evanrelf
Copy link
Contributor

evanrelf commented Sep 1, 2021

FWIW I get the same flickering in the kitty terminal in tmux on macOS. It seemed to show up after I moved to the latest release, and it went away after disabling relative line numbers.

@valpackett
Copy link

Just encountered something like that in wezterm. To be clear, do these glitches (both linux console and kitty) look like one frame is rendered with some lines in the middle skipped, or is this something different?

@valpackett
Copy link

Interesting comment from Wez re: this happening in modern terminal emulators: wez/wezterm#1128 (comment)

So, I'll try changing 428ddeb to emit the new de-facto standard sync sequences (that are supported by iTerm2 too now). I think these new sequences should avoid the "Synchronized output does not work well with various terminals (including the linux console)" problem? (i.e. Linux console should ignore them?)

@wez
Copy link

wez commented Sep 8, 2021

Let's copy in @christianparpart who has been pushing/tracking the new sync sequence as well in case he has any additional insights/recommendations!

@mawww mawww closed this as completed in b3a1017 Sep 8, 2021
@valpackett
Copy link

I can confirm that using the new (supported in wezterm) escape sequences did fix the problem, without the whole pessimization done in b3a1017 :)

@mawww please consider re-applying the cool optimizations but only when the terminal supports synchronization (it can be queried with DECRQM as described in https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036) and it is enabled (and with new sequences it can and should be on by default)

@mawww
Copy link
Owner

mawww commented Sep 9, 2021

@unrelentingtech Unfortunately this will not be enough to fix the linux console which does not seem to support any kind of synchronization. I guess the choice we have is either to have the nice scrolling optimizations (which will detect line deletions and scrolling) or to ensure no flickering on linux console. I have been trying to see if there is any way to have the scrolling optimization while avoiding intermediate states with lines at a wrong locations, but could not come up with any satisfying solution.

This mostly happens with relative line numbers so an alternative would be to just say that linux console will flicker with that setting.

@valpackett
Copy link

I mean, if you do it conditionally — the Linux console would not report support for the new sync, so the unoptimized codepath would be used on it.

@mawww
Copy link
Owner

mawww commented Sep 9, 2021

Sounds like a nice approach, I'll see how it goes (my main concern is the added code complexity if we really need two separate code path)

@christianparpart
Copy link

I am not sure this will necessarily lead to duplicate code paths IMHO. But i am glad to see more software taking advantage of the synchronized output feature. :-)

@lenormf
Copy link
Contributor

lenormf commented Sep 9, 2021

Dupe of #3429 ?

mawww added a commit that referenced this issue Sep 26, 2021
terminal_synchronized ui_option now also controls this behaviour,
update out of date documentation for ui_options as well.

As discussed in #4317
@mawww
Copy link
Owner

mawww commented Sep 26, 2021

@unrelentingtech Implemented opt-in behaviour to the smart diff based screen update if terminal_synchornized is set, now that we use a DECSM/DECRM sequence we can actually opt-in even if the terminal does not actually support synchronization and still get less terminal traffic.

I intend to use DECRQM eventually to set the default for that behaviour.

mawww added a commit that referenced this issue Oct 22, 2021
Enable it if supported by default, let the user override it with
the existing terminal_synchronized ui option.

This should finalize work discussed on #4317
Gskartwii pushed a commit to Gskartwii/kakoune that referenced this issue Nov 7, 2021
Enable it if supported by default, let the user override it with
the existing terminal_synchronized ui option.

This should finalize work discussed on mawww#4317
TeddyDD pushed a commit to TeddyDD/kakoune that referenced this issue Aug 19, 2022
Just validate if line changed or not. This should avoid flickering
on terminals such as the linux console that eagerly redraw on line
deletions. Unfortunately this means drawing will use more data and
might add a bit of latency on slow links.

Fixes mawww#4317
Fixes mawww#4320
TeddyDD pushed a commit to TeddyDD/kakoune that referenced this issue Aug 19, 2022
terminal_synchronized ui_option now also controls this behaviour,
update out of date documentation for ui_options as well.

As discussed in mawww#4317
TeddyDD pushed a commit to TeddyDD/kakoune that referenced this issue Aug 19, 2022
Enable it if supported by default, let the user override it with
the existing terminal_synchronized ui option.

This should finalize work discussed on mawww#4317
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

7 participants