3 ms·
Ansi escape codes are fun tho! My favorite so far's been finding a way to scroll the screen up or down by one line [1] in a way that works on as many terminal e
by tripflag 4y ago
Ansi escape codes are fun tho! My favorite so far's been finding a way to scroll the screen up or down by one line [1] in a way that works on as many terminal emulators as possible - the spec says how to do it, but most actual terminals don't implement it correctly.
Another fun one was asking the terminal how big it is [2] (and also figuring out the modem speed as a side effect) -- especially when a major telnet client fails as soon as the width is above 256 characters [3]...
Both of these would have been simple if the terminal is a local one, but the fun part is dealing with an unknown implementation at the other end of tcp - and the fact that that's even possible :-)
[1]: https://github.com/9001/r0c/blob/master/r0c/ivt100.py#L1651-L1668 https://github.com/9001/r0c/blob/master/r0c/ivt100.py#L1651-...
[2]: https://github.com/9001/r0c/blob/master/r0c/ivt100.py#L625-L628 https://github.com/9001/r0c/blob/master/r0c/ivt100.py#L625-L...
[3]: https://github.com/9001/r0c/commit/5e7d64d7f81cab3350259b0cd2bc84c078badcfb https://github.com/9001/r0c/commit/5e7d64d7f81cab3350259b0cd...
- EthanHeilman 4y agor0c is a really cool project. I should dig through this codebase and see what tricks I can learn.