Hacker News new | ask | show | jobs
by dankamongmen 1742 days ago
The key is ending the device query string with DA1 aka "Primary Device Attributes", which literally every terminal i've managed to test with responds to. Guaranteed that one answer, you completely avoid nasty timeouts. This is required for even VT100 conformance, so it can be expected on even hardware terminals (though not necessarily those outside the DEC family).

I tested over 24 terminals personally, and the only one I found which didn't respond to DA1 was Terminology from EFL, which crashed forty ways to a friday anyway so who really cares?

i'm glad you asked, as i'm hella proud of this entire system. you can check the code at:

https://github.com/dankamongmen/notcurses/blob/master/src/li...

and

https://github.com/dankamongmen/notcurses/blob/master/src/li...

i mean, it's tricky, and you have to think some things out pretty carefully, but it works. everything hinges on DA1.

many props to @dknl of the "foot" terminal emulator, who just kicks ass in general and first turned me on to DA1:

you can see the history in bugs starting with https://github.com/dankamongmen/notcurses/issues/1469

hack on!