terminfo icon indicating copy to clipboard operation
terminfo copied to clipboard

Update README.md

Open scrouthtv opened this issue 4 years ago • 4 comments

Here's a quick heads-up.

The example in the README is broken: it accesses the terminfo. constants which are simply numbered using iota.

The correct way would be to (I guess) use StringCapabilites() and then get the correct pair out of that map.

I don't know if this project is dead, I just wanted to let you know.

scrouthtv avatar Feb 16 '21 14:02 scrouthtv

Just a bit of brief history: I forked this from a completely unmaintained project and cleaned it up. I did not bother messing with the documentation. The reason it appears to be "unmaintained" is that there is nothing to maintain. The terminfo file format has been more or less unchanged for decades. While I might clean the code up, there isn't really anything to add in terms of features or capabilities.

At one point I had larger ambitions of producing a higher level library that used this, in the vein of a Go ncurses support, but that would be a higher level package and not associated with this.

kenshaw avatar Feb 16 '21 22:02 kenshaw

I'll see if I can get into repairing the README one of the next days.

Thanks for your work.

Do you by any chance know why xterm and derivates send the wrong escape codes when I press the enter keys?

According to both this library and the terminfo / termcap file, the sequence should be \x1b [ A through \x1b [ D. But xterm actually sends \x1b O A through \x1b O D.

scrouthtv avatar Feb 17 '21 12:02 scrouthtv

@scrouthtv I could only speculate why it's not using the escape codes you'd expect. This package only uses the system's data, so likely if this package is also giving you bad codes, then your TERM configuration / data is likely incorrect for the terminal (TTY) type that you have. You can always force a different terminal by setting the TERM environment setting to some other terminal type. Alternately, you could build your own termcap file and use that.

I'd suggest checking out the infocmp tool. Hope that can help you resolve your issue. Cheers.

kenshaw avatar Feb 17 '21 20:02 kenshaw

Do you by any chance know why xterm and derivates send the wrong escape codes when I press the enter keys?

The ANSI codes (used by xterm, vt100 and friends) has two modes for special keys. A 'normal' mode and an 'application' mode. Terminfo db assumes that you are in application mode and defines two values for the cursor handling; cuu1 (ESC [ A) to send to the screen to move the cursor and kcuu1 (ESC O A) to expect from the keyboard for the up arrow key. There is also a cuu which can be sent to the screen to move 'n' number of positions. You can set/remove the keypad transmit mode with smkx / rmkx. These last two set both the cursor mode (DECCKM) and keypad app/num mode (DECKPAM/DECKPNM)

scottross8 avatar Mar 14 '21 03:03 scottross8