mirror of https://github.com/Hilbis/Hilbish
fix(readline): put cursor at end of text when exiting editor
parent
308e257872
commit
b4ca5bfda3
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue