fix(readline): put cursor at end of text when exiting editor

builtins
TorchedSammy 2022-10-10 18:19:24 -04:00
parent 308e257872
commit b4ca5bfda3
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 4 additions and 4 deletions

View File

@ -245,7 +245,7 @@ func (rl *Instance) vi(r rune) {
}
// Keep the previous cursor position
prev := rl.pos
//prev := rl.pos
new, err := rl.StartEditorWithBuffer(multiline, "")
if err != nil || len(new) == 0 || string(new) == string(multiline) {
@ -257,11 +257,11 @@ func (rl *Instance) vi(r rune) {
// Clean the shell and put the new buffer, with adjusted pos if needed.
rl.clearLine()
rl.line = new
if prev > len(rl.line) {
rl.pos = len(rl.line) - 1
rl.pos = len(rl.line)
/*if prev > len(rl.line) {
} else {
rl.pos = prev
}
}*/
case 'w':
// If we were not yanking