xterm.js icon indicating copy to clipboard operation
xterm.js copied to clipboard

onScroll event does not get fired on user scroll

Open AndreSilva1993 opened this issue 2 years ago • 5 comments

The documentation states that onScroll gets fired when the viewport's scroll position changes which is not true. This event is only fired when new lines are introduced.

AndreSilva1993 avatar Jun 16 '22 15:06 AndreSilva1993

Is it fixed?

TheBlindM avatar Jan 18 '23 06:01 TheBlindM

I think there is still that misconception at work here - onScroll was initially meant to indicate line scrolling in the terminal buffer, thus when the cursor addressable area gets moved. This is only partially linked to viewport scrolling in the case, that both happen together. Isolated viewport scrolling without any change on the terminal buffer is not handled by that.

I am not sure if we should fuse buffer scrolling and viewport scrolling any further into one event, they are really 2 different things for the terminal. From a technical viewpoint a separate onViewportScroll event makes more sense, which we dont have atm. @Tyriar Imho we already had several issues for that, but cant find them atm.

jerch avatar Jan 18 '23 09:01 jerch

Just to confirm this is still an issue in v5.4.0-beta.20.

I'll also just add a reference to the origin of this issue, where @Tyriar asked for a new thread to be made: https://github.com/xtermjs/xterm.js/pull/3205#issuecomment-1157774699

tabarra avatar Jan 14 '24 02:01 tabarra

Any update for this issue? My case is scroll top to load more data, I think it's a very command case. Do we have any workaround for this?

McDaddy avatar Feb 23 '24 03:02 McDaddy

@McDaddy Here is my workaround:
https://github.com/tabarra/txAdmin/blob/v7.0.0/panel/src/pages/LiveConsole/ScrollDownAddon.ts

tabarra avatar Feb 23 '24 03:02 tabarra