fix(readline): home and end buttons not putting the cursor in the right place

pull/143/head
TorchedSammy 2022-04-18 16:04:56 -04:00
parent 4e8aa7ed1d
commit 1e48a3e03d
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 6 additions and 10 deletions

View File

@ -689,8 +689,7 @@ func (rl *Instance) escapeSeq(r []rune) {
}
if (rl.modeViMode == VimInsert && rl.pos < len(rl.line)) ||
(rl.modeViMode != VimInsert && rl.pos < len(rl.line)-1) {
moveCursorForwards(1)
rl.pos++
rl.moveCursorByAdjust(1)
}
rl.updateHelpers()
rl.viUndoSkipAppend = true
@ -705,10 +704,7 @@ func (rl *Instance) escapeSeq(r []rune) {
rl.renderHelpers()
return
}
if rl.pos > 0 {
moveCursorBackwards(1)
rl.pos--
}
rl.moveCursorByAdjust(-1)
rl.viUndoSkipAppend = true
rl.updateHelpers()
@ -749,16 +745,16 @@ func (rl *Instance) escapeSeq(r []rune) {
if rl.modeTabCompletion {
return
}
moveCursorBackwards(rl.pos)
rl.pos = 0
rl.moveCursorByAdjust(-rl.pos)
rl.updateHelpers()
rl.viUndoSkipAppend = true
case seqEnd, seqEndSc:
if rl.modeTabCompletion {
return
}
moveCursorForwards(len(rl.line) - rl.pos)
rl.pos = len(rl.line)
rl.moveCursorByAdjust(len(rl.line) - rl.pos)
rl.updateHelpers()
rl.viUndoSkipAppend = true
case seqAltB: