Looking for a way to consistently get a user's screen/term size/mode that works across Syncterm, netRunner, MagiTerm, etc.
The normal way would be to send the cursor to row 255, column 255 (esc[255;255H), then request the cursor position from the terminal (esc[6n) and parse the response (esc[row;columnR).
Some terminals may not handle values > 255 gracefully. I don't think many people are using a 255x255 terminal (or larger) anyway.
If the terminal is smaller than the requested position, the expected behaviour is that the cursor would go to the very bottom right.
At one point I was using 255,255 for ENiG then switched it to 999,999 and I can't remember at all why. I _think_ I may have run into it with a full screen Linux telnet session where 255 wasn't big enough?
All of this because "cursor home" is a thing but "cursor end" is not. :|
Looking for a way to consistently get a user's screen/term size/mode that works across Syncterm, netRunner, MagiTerm, etc.
Working on a little ansi art door and i'd like to be able to serve the 80 or 132 columns version automatically.
For Telnet connections, you can ask for NAWS which some support. You
can also ask for environment variables, which works for some terminals
as well. There is also a trick that works for some: Move the cursor to
a very large bottom right coordinate (I use 999,999) then issue a ANSI
query for cursor position. Not all respond so you have to time out if
you get nothing back.
ENiGMA offers ways to ask the system itself what the user currently
has and I imagine many others do as well -- but of course if you've
left to a door already that could be lost.
Older door.sys formats and some others included some of this
information. Not present in door32 or dorinfo#.def though =) Perhaps querying the system and passing it at the command line.
...so again, it's complicated :D
Sysop: | Gary Ailes |
---|---|
Location: | Pittsburgh, PA |
Users: | 132 |
Nodes: | 5 (0 / 5) |
Uptime: | 108:59:33 |
Calls: | 733 |
Files: | 2,171 |
Messages: | 81,483 |