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 {
|
} 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
|
||||||
|
|
6
utils.go
6
utils.go
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue