refactor: move hint insert to function

hinter-autocomplete
sammyette 2024-12-22 12:07:23 -04:00
parent a59394ec2b
commit b311f24b3f
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 9 additions and 4 deletions

View File

@ -56,3 +56,10 @@ func (rl *Instance) resetHintText() {
//rl.hintY = 0 //rl.hintY = 0
rl.hintText = []rune{} rl.hintText = []rune{}
} }
func (rl *Instance) insertHintText() {
if len(rl.hintText) != 0 {
// fill in hint text
rl.insert(rl.hintText)
}
}

View File

@ -708,10 +708,8 @@ func (rl *Instance) escapeSeq(r []rune) {
return return
} }
if len(rl.hintText) != 0 { rl.insertHintText()
// fill in hint text
rl.insert(rl.hintText)
}
if (rl.modeViMode == VimInsert && rl.pos < len(rl.line)) || if (rl.modeViMode == VimInsert && rl.pos < len(rl.line)) ||
(rl.modeViMode != VimInsert && rl.pos < len(rl.line)-1) { (rl.modeViMode != VimInsert && rl.pos < len(rl.line)-1) {
rl.moveCursorByAdjust(1) rl.moveCursorByAdjust(1)