changes completed

This commit is contained in:
Pristáš Michal 2015-10-23 13:16:45 +02:00
parent 77fbb66748
commit 1c411ac48c
2 changed files with 12 additions and 0 deletions

View File

@ -108,6 +108,12 @@ func (t *Terminal) ioloop() {
} else if isEscapeEx {
isEscapeEx = false
r = escapeExKey(r)
// if hw delete button is pressed it is specified as set ot 4 runes [27,91,51,126]. we are now at 51
if r == CharDelete {
if d, _, err := buf.ReadRune(); err != nil || d != 126 {
buf.UnreadRune()
}
}
}
expectNextChar = true

View File

@ -40,6 +40,8 @@ func IsPrintable(key rune) bool {
// translate Esc[X
func escapeExKey(r rune) rune {
switch r {
case 51:
r = CharDeleteKey
case 'D':
r = CharBackward
case 'C':
@ -48,6 +50,10 @@ func escapeExKey(r rune) rune {
r = CharPrev
case 'B':
r = CharNext
case 'H':
r = CharLineStart
case 'F':
r = CharLineEnd
}
return r
}