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 { } else if isEscapeEx {
isEscapeEx = false isEscapeEx = false
r = escapeExKey(r) 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 expectNextChar = true

View File

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