forked from mirror/readline
changes completed
This commit is contained in:
parent
77fbb66748
commit
1c411ac48c
|
@ -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
|
||||
|
|
6
utils.go
6
utils.go
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue