jonas / tig

Text-mode interface for git
https://jonas.github.io/tig/
GNU General Public License v2.0
12.28k stars 604 forks source link

Terminal mouse focus reporting glitching tig since ncurses 6.4-20230514 #1292

Closed liskin closed 8 months ago

liskin commented 11 months ago

ncurses 6.4-20230514 unconditionally enables focus reporting in terminals supporting SGR-mouse, but tig unfortunately doesn't know how to interpret the sequences reported back to it by the terminal, so it results in those sequences triggering key bindings such as [ etc.:

https://github.com/jonas/tig/assets/300342/a3864f3c-b8c9-46ad-8277-cb6cb3a2ecd2

(Personally I don't think enabling focus reporting unconditionally was a good idea, but tig is the only app on my system that glitches. Others like htop work fine as long as the xterm+focus bits are included in the terminfo definition.)

Related issues:

paul-ri commented 10 months ago

This affects me too. No luck with the foot terminal and the suggestion to use the foot-extra terminfo. Nor using the latest ncurse (6.4.20230826) package.

Same with xterm.

I'd love to know any workaround

koutcher commented 10 months ago

Adding the following to your .tigrc should help:

bind generic    <Esc>[I :none                   # Ignore xterm focus events
bind generic    <Esc>[O :none

I'm not sure yet whether we should fix it with this simple trick or output a \033[?1004l to revert the focus reporting activation. Let's see first if it makes it to ncurses 6.5.

paul-ri commented 10 months ago

Woop woop! That makes loads of sense.

I had to be careful about what I was looking for in tig. I can go back to switching windows senselessly again

Thanks a lot : )

koutcher commented 8 months ago

Just wondering if this is still an issue after ncurses 6_4_20231028... Can anyone confirm ?

liskin commented 8 months ago

Just wondering if this is still an issue after ncurses 6_4_20231028... Can anyone confirm ?

Not an issue any more. :tada: Tested with the 6.4+20231118-1 that's in Debian unstable now.