2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-21 13:03:22 +00:00

fix(readline): change input text if it doesnt match supplied prefix for completions

This commit is contained in:
TorchedSammy 2022-04-20 18:27:29 -04:00
parent c6bb8bc663
commit f360671e2a
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

View File

@ -73,7 +73,12 @@ func (rl *Instance) insertCandidate() {
// Ensure no indexing error happens with 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 {
rl.insert([]rune(" "))
}