Skip to content

Commit

Permalink
refactor: move hint insert to function
Browse files Browse the repository at this point in the history
  • Loading branch information
TorchedSammy committed Dec 22, 2024
1 parent a59394e commit b311f24
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 7 additions & 0 deletions readline/hint.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ func (rl *Instance) resetHintText() {
//rl.hintY = 0
rl.hintText = []rune{}
}

func (rl *Instance) insertHintText() {
if len(rl.hintText) != 0 {
// fill in hint text
rl.insert(rl.hintText)
}
}
6 changes: 2 additions & 4 deletions readline/readline.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,10 +708,8 @@ func (rl *Instance) escapeSeq(r []rune) {
return
}

if len(rl.hintText) != 0 {
// fill in hint text
rl.insert(rl.hintText)
}
rl.insertHintText()

if (rl.modeViMode == VimInsert && rl.pos < len(rl.line)) ||
(rl.modeViMode != VimInsert && rl.pos < len(rl.line)-1) {
rl.moveCursorByAdjust(1)
Expand Down

0 comments on commit b311f24

Please sign in to comment.