nsf / termbox-go

Pure Go termbox implementation
http://godoc.org/github.com/nsf/termbox-go
MIT License
4.66k stars 372 forks source link

Keybindings for Home and End are not triggered #196

Closed antonlindgren closed 3 years ago

antonlindgren commented 5 years ago

Hi,

I'm having issues binding to Home and End. For some reason it triggers it as decimal=126, hex=0x7E, octal=0176, string=~ (when running _demos/keyboard.go).

It doesn't even highlight Home or End. Though ins/del/pgup/pgdn works as intended. I'm running it through putty.

Any ideas on how I can solve this issue?

Thanks.

Best regards, Anton

scrouthtv commented 3 years ago

You can fix this manually by logging in through PuTTY and running this line before executing your command:

export TERM=putty

If you often use putty, I would suggest setting this variable in your .profile:

if [ -z "$SSH_CLIENT" ]; then
  export TERM=putty
fi

This would set the term variable to putty for every session that you're logged in using ssh.

The reason for this is that PuTTY falsely identifies as xterm (run echo $TERM). The terminfo file is a file that is used to identify which of these numbers in whatever terminal translates to what key (e. g. in PuTTY \E[1~ is the Home key, in xterm \EOH is the Home key). You can read them both under your Linux system by running infocmp xterm | grep khome and infocmp putty | grep khome.

If you're trying to ssh using putty into another Windows machine, that's a whole different story.

I hope I could help!