Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #2

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Update README.md #2

wants to merge 1 commit into from

Conversation

scrouthtv
Copy link

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.

Removed the example from the homepage because it's broken
@kenshaw
Copy link
Member

kenshaw commented Feb 16, 2021

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.

@scrouthtv
Copy link
Author

scrouthtv commented Feb 17, 2021

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.

@kenshaw
Copy link
Member

kenshaw commented Feb 17, 2021

@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.

@scottross8
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants