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
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. :|
Sysop: | digital man |
---|---|
Location: | Riverside County, California |
Users: | 1,054 |
Nodes: | 15 (0 / 15) |
Uptime: | 55:22:05 |
Calls: | 500,777 |
Calls today: | 9 |
Files: | 109,358 |
D/L today: |
59,367 files (8,953M bytes) |
Messages: | 466,007 |
Posted today: | 3 |