-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
CSI 18t "Report Size In Characters" not working. #13944
Comments
We just don't support any of the I should also say I'd recommend against relying on |
So, you mean that way:
?? I couldn't find a Linux Terminal not supporting |
You make it sound like it's a complicated serious of operations, but it's essentially just a longer escape sequence. Something like
Admittedly I don't always have the latest version of every terminal, and it's been a while since I last tested these sequences, so maybe things have improved a lot since then. At the time I think there were a half dozen or so that didn't support |
Uh, please do not misunderstand me. |
I'll toss this on the backlog. No arguments that we should support it, even if there is a viable (albeit, verbose) alternative. |
For me it looks much more logical to call a GetScreenSize-Function if I want to know the ScreenSize, than to call some functions to be able to use GetCursorPos as a substitute for GetScreenSize. I have to set a flag NextCurserPosIsAScreenSize and have to check on each incoming CursorPos if it's not a ScreenSize... That's in coding really not a thing - but on a 2560 it's 1 byte global RAM, ~8 additional cpu cycles per incoming CursorPos, and ~30 Bytes program memory.
|
Implementation would be fairly trivial.
I'll mark this up as a good first issue, cause the implementation should be pretty straightforward. |
@zadjii-msft, @PitWD, @j4james I have a branch to support this ready for PR, but I am unsure about interoperability. My apprehension is about microsoft/terminal rendering escape characters when not read, which differs from Ubuntu (bash, xterm-256color). What's more, is that PowerShell and cmd.exe do render CSI 18t differently when not read (PowerShell does not render \033 while cmd.exe does render \033[8). Kindly please advise if this is the desired behavior. For test code:
Terminal (both PowerShell and Conhost): and for Ubuntu test code:
and for microsoft/terminal test code:
Kindly please advise if this is the desired behavior. |
Honestly that looks right to me. Every shell is gonna do something different with an escape character they didn't expect to read. I'm under the impression that if you're emitthing the sequence to query the terminal, you're also expected to read the response. There's other issues scattered around where like, vim will ask the terminal for something, then ssh dies, and now the terminal replies to a shell that wasn't expecting it, and you get the same effect. |
@zadjii-msft cool, is it OK for me to propose PR for this one, then? BTW, should I write a TAEF test for this? |
Please do! I'd file the PR with or without tests (though, tests are always appreciated 😉) |
I'll try to figure out the tests before I submit the PR. |
@michalnpl I just want to note something regarding the dimensions that this sequence should be reporting. @zadjii-msft previously suggested you should be using the viewport dimensions, but I suspect that apps are more likely to expect the dimensions of the addressable cell range, which for us is determined by the buffer width combined with the viewport height. The viewport width can potentially be narrower than the buffer width, but that's a user-configurable UI constraint. The only thing an application should care about is the point at which the text will wrap, which is the buffer width. |
@zadjii-msft , @j4james, my best effort couldn't figure out TAEF tests; if you can add it to PR, I would be in debt. |
Adds support for CSI 18t to report the buffer screen size in characters. This pull request adds support for **CSI 18t**. When submitted to the terminal, it will respond with **"\033[8;{A};{B}t"** where **A** is equal to the **height** and **B** is equal to the **width** of the screen buffer in the number of characters (not pixels). ## Validation Steps Performed Manual tests against PowerShell 7 and ConHost. Added adapterTest Closes #13944
Windows Terminal version
1.15.2282.0
Windows build number
10.0.19044.1889
Other Software
Own project.
Steps to reproduce
Start CMD or PS within Terminal.
Run app which activates VT-Modes for IN and OUT.
Send CSI 18 t to stdout.
Read (wait for) response on stdin.
Expected Behavior
A response from the Terminal a la:
CSI 'Decimal-Rows' ; 'Decimal-Columns' t
Actual Behavior
No response from the Terminal.
But i.e. sending CSI 6 n (Report Actual Cursor Position) results as expected in a response a la:
CSI 'Decimal-Row' ; 'Decimal-Column' R
The text was updated successfully, but these errors were encountered: