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

tig window flickers #1180

Closed
jirislaby opened this issue Jan 28, 2022 · 6 comments · Fixed by #1182
Closed

tig window flickers #1180

jirislaby opened this issue Jan 28, 2022 · 6 comments · Fixed by #1182

Comments

@jirislaby
Copy link

jirislaby commented Jan 28, 2022

Very often, it happens that the tig window flickers or show half screen old+half screen new content. This happens especially when paging (pg-up, pg-down) through history or patch.
If I run for example this in the linux kernel:

tig v5.16-rc1..v5.16

I see this:
start
Then, if I navigate through it, I see:
https://user-images.githubusercontent.com/530775/151510043-2aab187f-516c-46f4-9b89-1495e4d02a03.mp4

I don't know if this is tig's, curses, compositor (plasma on wayland), or gfx driver (i915 -- KMS) issue. However, I don't see it with any other app (incl. kernel's menuconfig, vim, less -- the latter two seem to use only tinfo, not curses).

@koutcher
Copy link
Collaborator

Have you tried with a different terminal emulator ?

@jirislaby
Copy link
Author

@koutcher right, happens only in xterm which I use. In, konsole, does not reproduce.

@koutcher
Copy link
Collaborator

@jirislaby, the flickering on your video looks a bit like some double-buffer artefact, maybe you can confirm with strace if tig is doing something while it happens. Tig is using some optimisation tricks (see init_display() in src/display.c), you could try to unset XTERM_VERSION and try with TERM_PROGRAM set either to gnome-terminal or Apple_Terminal to see if one helps.

@jirislaby
Copy link
Author

jirislaby commented Jan 31, 2022

Wow:

unset XTERM_VERSION
export TERM_PROGRAM=gnome-terminal
tig v5.16-rc1..v5.16

The issue is gone, the same as with:

unset XTERM_VERSION
export TERM_PROGRAM=Apple_Terminal
tig v5.16-rc1..v5.16

For confirmation, the issue is back with:

export XTERM_VERSION='XTerm(370)'
tig v5.16-rc1..v5.16

So it's use_scroll_redrawwin causing issues if I got it right:

tig/src/display.c

Lines 695 to 723 in 7218788

term = getenv("XTERM_VERSION")
? NULL
: (getenv("TERM_PROGRAM") ? getenv("TERM_PROGRAM") : getenv("COLORTERM"));
if (term && !strcmp(term, "gnome-terminal")) {
/* In the gnome-terminal-emulator, the warning message
* shown when scrolling up one line while the cursor is
* on the first line followed by scrolling down one line
* corrupts the status line. This is fixed by calling
* wclear. */
use_scroll_status_wclear = true;
use_scroll_redrawwin = false;
} else if (term &&
(!strcmp(term, "xrvt-xpm") || !strcmp(term, "Apple_Terminal") ||
!strcmp(term, "iTerm.app"))) {
/* No problems with full optimizations in
* xrvt-(unicode)
* aterm
* Terminal.app
* iTerm2 */
use_scroll_status_wclear = use_scroll_redrawwin = false;
} else {
/* When scrolling in (u)xterm the last line in the
* scrolling direction will update slowly. This is
* the conservative default. */
use_scroll_redrawwin = true;
use_scroll_status_wclear = false;
}

@jirislaby
Copy link
Author

It's also slightly problematic over ssh. XTERM_VERSION is not sent by default. Only these are (TERM is documented in ssh's man):

$ env|grep TERM
COLORTERM=1
TERM=xterm-256color

So the detection above doesn't work there too.

koutcher added a commit to koutcher/tig that referenced this issue Feb 3, 2022
The extra redrawwin() added by b445bae
to fix a scrolling bug in (u)xterm is causing flickering when paging
in XTerm(370).

As the original issues with xterm and gnome-terminal cannot be
reproduced anymore even on a now antique distro, revert the
associated workarounds.

Fixes jonas#1180
@koutcher
Copy link
Collaborator

koutcher commented Feb 3, 2022

I tried to reproduce the original issues with xterm and gnome-terminal on a venerable RHEL 4 and couldn't succeed, so I think it is not unreasonable to believe we can now remove these hacks safely.

koutcher added a commit that referenced this issue May 7, 2022
The extra redrawwin() added by b445bae
to fix a scrolling bug in (u)xterm is causing flickering when paging
in XTerm(370).

As the original issues with xterm and gnome-terminal cannot be
reproduced anymore even on a now antique distro, revert the
associated workarounds.

Fixes #1180
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants