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 // Keep the previous cursor position
prev := rl.pos //prev := rl.pos
new, err := rl.StartEditorWithBuffer(multiline, "") new, err := rl.StartEditorWithBuffer(multiline, "")
if err != nil || len(new) == 0 || string(new) == string(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. // Clean the shell and put the new buffer, with adjusted pos if needed.
rl.clearLine() rl.clearLine()
rl.line = new rl.line = new
if prev > len(rl.line) { rl.pos = len(rl.line)
rl.pos = len(rl.line) - 1 /*if prev > len(rl.line) {
} else { } else {
rl.pos = prev rl.pos = prev
} }*/
case 'w': case 'w':
// If we were not yanking // If we were not yanking