mirror of https://github.com/Hilbis/Hilbish
fix(readline): change input text if it doesnt match supplied prefix for completions
parent
c6bb8bc663
commit
f360671e2a
|
@ -73,7 +73,12 @@ func (rl *Instance) insertCandidate() {
|
||||||
|
|
||||||
// Ensure no indexing error happens with prefix
|
// Ensure no indexing error happens with prefix
|
||||||
if len(completion) >= prefix {
|
if len(completion) >= prefix {
|
||||||
rl.insert([]rune(completion[prefix:]))
|
comp := completion[prefix:]
|
||||||
|
if completion[:prefix] != rl.tcPrefix {
|
||||||
|
rl.viDeleteByAdjust(-prefix)
|
||||||
|
comp = completion
|
||||||
|
}
|
||||||
|
rl.insert([]rune(comp))
|
||||||
if !cur.TrimSlash && !cur.NoSpace {
|
if !cur.TrimSlash && !cur.NoSpace {
|
||||||
rl.insert([]rune(" "))
|
rl.insert([]rune(" "))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue