xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
17.62k stars 1.63k forks source link

implement alternateScroll settings #5194

Open CendioOssman opened 5 days ago

CendioOssman commented 5 days ago

Details

Steps to reproduce

  1. less file.txt
  2. Scroll mouse one click

Expected outcome

File scrolls the same 3 lines you get in the scrollback buffer, or as commonly seen in almost all other terminals.

Actual outcome

File scrolls a single line.

Additional details

If I do an strace of less, I can see the other terminals send three \33OB on one mouse scroll click, whilst xterm.js only sends the one. Which fully explains things.

I couldn't find any setting in vscode that affected this. Workarounds are welcome.

CendioOssman commented 5 days ago

Note that it might be relevant if high-resolution scrolling is supported or not. I'm only seeing this in a VNC environment that only has the classical "stepped" wheel events.

jerch commented 4 days ago

Thats related to this line: https://github.com/xtermjs/xterm.js/blob/f701d073d15f7b312a9d051e719f748665701cef/src/browser/CoreBrowserTerminal.ts#L813 As far as I can see with git blame, it has always been like that in the last 6 years.

File scrolls the same 3 lines you get in the scrollback buffer, or as commonly seen in almost all other terminals.

Which terminals show that behavior? (xterm does not on my system...)

CendioOssman commented 2 days ago

As far as I can see with git blame, it has always been like that in the last 6 years.

That might very well be. I'm a new vscode user, so I'm comparing to other terminals, not to any previous xterm.js behaviour. :)

Which terminals show that behavior? (xterm does not on my system...)

Odd. I'm seeing it in xterm¹, GNOME terminal and MATE terminal (fork of GNOME 2 terminal). Tested on RHEL 9 and Fedora 40.

Three lines is also what xterm.js scrolls per click for me in the "normal" scrollback, so it's a bit confusing when the scroll distance changes when I open a less.

¹ xterm actually jumps 5 lines for me, not 3

CendioOssman commented 2 days ago

Perhaps that sequence should be multiplied by the various settings affecting the scrollback, so they stay in sync?

jerch commented 1 day ago

I checked the xterm sources - thats basically linked there to alternateScroll or DECSET 1007. For some reason thats disabled on my system (ubuntu here).

Perhaps that sequence should be multiplied by the various settings affecting the scrollback, so they stay in sync?

I agree, we should strive to sync that with other scroll handling like on the normal scroll buffer.

So what we need here: