Add support for Presentation State reports #19531

Closed
opened 2026-01-31 06:46:17 +00:00 by claunia · 10 comments
Owner

Originally created by @j4james on GitHub (Mar 12, 2023).

Description of the new feature/enhancement

There are two reports that can be queried with the DECRQPSR (request presentation state) escape sequence. The one returns the active tab stops, and the other returns what they call "cursor information", which includes things like cursor position, SGR attributes, and character set designations.

There is also then a corresponding DECRSPS sequence (restore presentation state) which can restore the saved information from the above mentioned reports.

There are a number of uses for these sequences, but the main reason I want to support them is because they're needed to meet the requirements of the TSI (terminal state interrogation) feature, which is itself a requirement for level 3 compliance.

Proposed technical implementation details (optional)

This will require some additional work in the TerminalOuput class to track the actual IDs of the designated character sets so we can return that information in the report. I think most of the other information we need should be easy to access.

Originally created by @j4james on GitHub (Mar 12, 2023). # Description of the new feature/enhancement There are two reports that can be queried with the [`DECRQPSR`](https://www.vt100.net/docs/vt510-rm/DECRQPSR.html) (request presentation state) escape sequence. The one returns the active tab stops, and the other returns what they call "cursor information", which includes things like cursor position, SGR attributes, and character set designations. There is also then a corresponding [`DECRSPS`](https://www.vt100.net/docs/vt510-rm/DECRSPS.html) sequence (restore presentation state) which can restore the saved information from the above mentioned reports. There are a number of uses for these sequences, but the main reason I want to support them is because they're needed to meet the requirements of the TSI (terminal state interrogation) feature, which is itself a requirement for level 3 compliance. # Proposed technical implementation details (optional) This will require some additional work in the `TerminalOuput` class to track the actual IDs of the designated character sets so we can return that information in the report. I think most of the other information we need should be easy to access.
claunia added the Help WantedIssue-TaskIn-PRArea-VTNeeds-Tag-Fix labels 2026-01-31 06:46:17 +00:00
Author
Owner

@j4james commented on GitHub (Mar 12, 2023):

@al20878 I've got another couple of tests which I'd previously created for these reports. They were written as bash scripts, though, so just let me know if that's a problem and I can rewrite them in Python.

Also, note that they don't actually log anything, the results are displayed on the screen, so I'd be grateful if you could take a photograph of each run and post that here.

This is for the tab stop report:
https://gist.github.com/j4james/a25e6290772353c06f85c584007c2aa0

And this one is for the cursor information report:
https://gist.github.com/j4james/570a9b7dd28dbdd8b626be2770567210

@j4james commented on GitHub (Mar 12, 2023): @al20878 I've got another couple of tests which I'd previously created for these reports. They were written as bash scripts, though, so just let me know if that's a problem and I can rewrite them in Python. Also, note that they don't actually log anything, the results are displayed on the screen, so I'd be grateful if you could take a photograph of each run and post that here. This is for the tab stop report: https://gist.github.com/j4james/a25e6290772353c06f85c584007c2aa0 And this one is for the cursor information report: https://gist.github.com/j4james/570a9b7dd28dbdd8b626be2770567210
Author
Owner

@j4james commented on GitHub (Mar 12, 2023):

I forgot to say, I'd ideally like to see this run on a VT525 - specifically the cursor information report - because I think it might include additional information for the active SGR colors that other terminals wouldn't include.

@j4james commented on GitHub (Mar 12, 2023): I forgot to say, I'd ideally like to see this run on a VT525 - specifically the cursor information report - because I think it might include additional information for the active SGR colors that other terminals wouldn't include.
Author
Owner

@al20878 commented on GitHub (Mar 12, 2023):

Shell scripts are fine, I'll be running them on Linux (Raspbian), so it's all good, I hope. Downloaded both, will post the results.

@al20878 commented on GitHub (Mar 12, 2023): Shell scripts are fine, I'll be running them on Linux (Raspbian), so it's all good, I hope. Downloaded both, will post the results.
Author
Owner

@al20878 commented on GitHub (Mar 12, 2023):

Unfortunately, I'm having issues with these two... The first one (dectabsr.sh) makes the terminal reset and then appears like it also generates some garbage on the screen. Attaching the final pic, but I also shot a video of how it's run.

dectabsr

The other one, too, appears to behave erratically but not as bad. The final screenshot is here (and, there's a video as well, I'll post the links to both in a few):

deccir

@al20878 commented on GitHub (Mar 12, 2023): Unfortunately, I'm having issues with these two... The first one (`dectabsr.sh`) makes the terminal reset and then appears like it also generates some garbage on the screen. Attaching the final pic, but I also shot a video of how it's run. ![dectabsr](https://user-images.githubusercontent.com/44822487/224577804-99824439-8812-4c97-b672-6c7924f78030.png) The other one, too, appears to behave erratically but not as bad. The final screenshot is here (and, there's a video as well, I'll post the links to both in a few): ![deccir](https://user-images.githubusercontent.com/44822487/224577805-03acdf97-b03b-490a-b3ab-7d7245374d37.png)
Author
Owner
@al20878 commented on GitHub (Mar 12, 2023): https://drive.google.com/file/d/177clG0vFQdpNCaq_Q7CUR1tAoeT5IyMV/view?usp=share_link https://drive.google.com/file/d/174Fym-HVbidcwd0V34U7piNc81GTytKa/view?usp=share_link
Author
Owner

@j4james commented on GitHub (Mar 12, 2023):

@al20878 Thanks again. This is very useful. The cursor information report (the second one) is perfect. I think the weirdness you're seeing is just the test doing it's thing. It's moving the cursor to different positions on the screen, changing the active page, and setting margins, etc. and all the while it's requesting reports from the terminal which take a couple seconds. The final result is exactly what I was expecting to see. I had hoped there might also be color information, but that wasn't the case.

I think the problem with the first one is that I'm switching back and forth between 80 columns and 132 columns, and I suspect I need to give the terminal time to make that switch before throwing queries at it. If it's not ready to respond fast enough, the report reader probably times out, and the report then ends up written on to the screen.

I'll try and make some adjustments to the script to see if I can fix the issue and let you know when I have another version ready to test.

@j4james commented on GitHub (Mar 12, 2023): @al20878 Thanks again. This is very useful. The cursor information report (the second one) is perfect. I think the weirdness you're seeing is just the test doing it's thing. It's moving the cursor to different positions on the screen, changing the active page, and setting margins, etc. and all the while it's requesting reports from the terminal which take a couple seconds. The final result is exactly what I was expecting to see. I had hoped there might also be color information, but that wasn't the case. I think the problem with the first one is that I'm switching back and forth between 80 columns and 132 columns, and I suspect I need to give the terminal time to make that switch before throwing queries at it. If it's not ready to respond fast enough, the report reader probably times out, and the report then ends up written on to the screen. I'll try and make some adjustments to the script to see if I can fix the issue and let you know when I have another version ready to test.
Author
Owner

@j4james commented on GitHub (Mar 12, 2023):

@al20878 I've uploaded a revision of the dectabsr script with a one second delay after each column mode change, and a longer timeout on the report reader. Hopefully that should work better. When you have a chance, I'd appreciate you trying it again.

https://gist.github.com/j4james/a25e6290772353c06f85c584007c2aa0

@j4james commented on GitHub (Mar 12, 2023): @al20878 I've uploaded a revision of the `dectabsr` script with a one second delay after each column mode change, and a longer timeout on the report reader. Hopefully that should work better. When you have a chance, I'd appreciate you trying it again. https://gist.github.com/j4james/a25e6290772353c06f85c584007c2aa0
Author
Owner

@al20878 commented on GitHub (Mar 13, 2023):

Indeed, the new version runs absolutely clean (I mean I can now tell that the terminal switches between the modes, because previously it was just blinking like it was reset a couple times; also no garbage on screen). The result:
dectabsr

@al20878 commented on GitHub (Mar 13, 2023): Indeed, the new version runs absolutely clean (I mean I can now tell that the terminal switches between the modes, because previously it was just blinking like it was reset a couple times; also no garbage on screen). The result: ![dectabsr](https://user-images.githubusercontent.com/44822487/224586730-6a9cfcad-ff46-47e5-b3e5-96979e88f1bf.png)
Author
Owner

@j4james commented on GitHub (Mar 13, 2023):

@al20878 Perfect. That tells me everything I needed to know. Thank you so much for doing all this testing. This is going to keep me busy for a while, so I'll leave you in peace for a bit. 😉

@j4james commented on GitHub (Mar 13, 2023): @al20878 Perfect. That tells me everything I needed to know. Thank you so much for doing all this testing. This is going to keep me busy for a while, so I'll leave you in peace for a bit. 😉
Author
Owner

@al20878 commented on GitHub (Mar 13, 2023):

No problem, @j4james! I was happy to help :-)
Please feel free to reach out if you need any further testing. And good luck!

@al20878 commented on GitHub (Mar 13, 2023): No problem, @j4james! I was happy to help :-) Please feel free to reach out if you need any further testing. And good luck!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19531