-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Sending \u001Bc
escape sequence clears scrollback buffer
#3315
Comments
Why Terminal.app and iTerm keep the buffer on RIS I cant tell (maybe they have a custom setting for this?). It does not resemble the meaning of "reset" at all. Note that RIS is the only sequence with the power to fully reset and reinitialize the terminal, thus we cannot change it. |
@jerch do you know if VTE acts like us or the mac terminals? |
vte 0.52.2 also clears the buffer, and so does xterm. |
Ok let's close this as designed then as we want to act the same everywhere, xterm.js doesn't even know the true OS that the backend is on. FWIW VS Code also relies on this reset everything behavior and would need changes if we did this. |
Created sindresorhus/ansi-escapes#25 |
Already checking this with @sindresorhus and @Qix-. Thanks for creating the issue and for the feedback @jerch @Tyriar! |
@jerch @Tyriar I have a question which is somewhat related. I can create a new issue if this seems to be an xterm thing but want to check it with you guys first. So when sending RIS, the entire terminal resets, as well as the scrollback buffer and what not. So that's pretty clear behaviour. However, when doing a "clear scrollback buffer", the buffer is cleared, but the scrollbar is not being removed. I screencaptured the behaviour. Commands used in the screen capture
So ESC 3J should clear the scrollback buffer, which it does. But xterm.js still shows the scrollbar as if the scrollback buffer was not cleared. If you then scroll, nothing happens. |
I ended up using |
Thx for finding this one. Looks like a bug to me. @Tyriar Is that a regression around the event rework of the input handler? Seems the xterm.js/src/common/InputHandler.ts Lines 1284 to 1293 in e5c9b0e
while replacing it with the following works again: (this._bufferService as any)._onScroll.fire(0); |
So this means the Because it seems that if you only use |
Imho the |
@SamVerschueren Btw |
Do you know what VS Code uses internally when you press Cmd + k? Because I'm implementing that shortcut and want it to behave the same way. |
Seems it does clear & focus on the terminal instance: https://github.com/microsoft/vscode/blob/2000f36fdefb06321db6ceaa893e9b7e92e0f466/src/vs/workbench/contrib/terminal/browser/terminalActions.ts#L1513-L1537 Edit: Clear is fine to be used if the terminal is at rest waiting for input and the app on the other end is just using it as logging output. Or the other way around - clear will screw up output of ncurses apps or any app, that use line length calculations or rely on cursor positions to update content ("canvas mode"). |
The scrollbar thing looks like a bug, yes please create an issue 🙂
Yep VS Code uses |
Created an issue for this 🔝 Thanks for all the information. Really love the hard work you guys put into this 🙏 . |
Details
Steps to reproduce
ls
a couple of times and then executeprintf '\u001Bc'
. You will notice that the scrollback buffer is not cleared.I noticed the difference in behaviour because I was using ansi-escapes#clearscreen which shouldn't clear the buffer but it does in xterm.js.
The text was updated successfully, but these errors were encountered: