Bug#921537: gnome-terminal: mouse wheel scrolling sends 6 key up / key down escape sequences (kcuu1 / kcud1) in alternate screen

Vincent Lefevre vincent at vinc17.net
Mon May 23 17:37:50 BST 2022


Control: reassign -1 libvte-2.91-0 0.68.0-1
Control: retitle -1 libvte-2.91-0: mouse wheel scrolling setting XTERM_ALTBUF_SCROLL is not preserved by a screen reset

Summary of the issue: VTE took the mouse wheel scrolling feature in
alternate screen from xterm. So one expects it to behave like xterm
(possibly except for the default behavior). With xterm, a terminal
reset (e.g. with the "reset" command) preserves this setting (just
like a reset will preserve the terminal size and other UI settings,
as opposed to content-related settings). But with VTE-based terminals
like GNOME Terminal and xfce4-terminal, the mouse wheel behavior is
reset to the hardcoded default. This can be tested with:

  printf '\e[?1007h' ; reset ; less some_file
  printf '\e[?1007l' ; reset ; less some_file

in the chosen terminal.

One consequence is that with GNU Screen, it is impossible to choose
the mouse wheel behavior when the real terminal is based on VTE
(see below), while the generated key up / key down events may be
destructive in some applications.

On 2019-04-03 14:03:51 +0200, Vincent Lefevre wrote:
> On 2019-04-03 13:42:50 +0200, Vincent Lefevre wrote:
> > On 2019-02-07 13:43:20 +0100, Egmont Koblinger wrote:
> > > You can disable this behavior with:
> > > 
> > >   printf '\e[?1007l'
> > 
> > This has no effect when using GNU Screen. For instance:
> > 
> > $ printf '\e[?1007l' ; screen sleep 20
> > 
> > then when using the mouse wheel:
> > 
> > ^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A
> > 
> > There isn't such an issue with xterm. It is not Screen that enables
> > Alternate Scroll Mode, otherwise one would get the same behavior in
> > xterm.
> > 
> > I suspect that GNOME Terminal "forgets" this setting under some
> > conditions.
> 
> I think that the cause is that Screen does a reset (since it starts
> a virtual terminal), as I can reproduce the same issue after a
> "tput reset". Thus "printf '\e[?1007l'" is not sufficient. Actually,
> a reset should not have an effect on the Alternate Scroll Mode, as
> in xterm, it doesn't as shown by:
> 
> $ printf '\e[?1007l'
> $ screen sleep 20
> $ printf '\e[?1007h'
> $ screen sleep 20
> 
> and using the mouse wheel in Screen for both instances (after the
> printf '\e[?1007h', the Alternate Scroll Mode remains enabled while
> the default is disabled in xterm).
> 
> Note: Executing "printf '\e[?1007l'" inside screen as a workaround is
> incorrect as there is no way to know whether the parent terminal will
> accept this sequence or will behave in a strange manner. Moreover,
> this is not possible when "screen" is followed by a command.

In fact, \e[?1007l and \e[?1007h inside a GNU Screen window are
ignored. So
  * With xterm, GNU Screen uses the current setting of xterm.
    For instance, one can choose it in a limited way with
      printf '\e[?1007h' ; screen -r
      printf '\e[?1007l' ; screen -r
  * But with VTE-based terminals, this is reset to the default,
    i.e. mouse wheel events always send key up / key down escape
    sequences, and there doesn't seem to be anyway to change it.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



More information about the pkg-gnome-maintainers mailing list