Skip to content

Commit b311f24

Browse files
committed
refactor: move hint insert to function
1 parent a59394e commit b311f24

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

readline/hint.go

+7
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,10 @@ func (rl *Instance) resetHintText() {
5656
//rl.hintY = 0
5757
rl.hintText = []rune{}
5858
}
59+
60+
func (rl *Instance) insertHintText() {
61+
if len(rl.hintText) != 0 {
62+
// fill in hint text
63+
rl.insert(rl.hintText)
64+
}
65+
}

readline/readline.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -708,10 +708,8 @@ func (rl *Instance) escapeSeq(r []rune) {
708708
return
709709
}
710710

711-
if len(rl.hintText) != 0 {
712-
// fill in hint text
713-
rl.insert(rl.hintText)
714-
}
711+
rl.insertHintText()
712+
715713
if (rl.modeViMode == VimInsert && rl.pos < len(rl.line)) ||
716714
(rl.modeViMode != VimInsert && rl.pos < len(rl.line)-1) {
717715
rl.moveCursorByAdjust(1)

0 commit comments

Comments
 (0)