mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-03-09 13:00:53 +01:00
fix comp complete
This commit is contained in:
parent
bd3595c954
commit
00356fc297
@ -319,7 +319,7 @@ func computeCompExtension(compPrefix string, crtn *CompReturn) (string, bool) {
|
|||||||
if lcp == compPrefix || len(lcp) < len(compPrefix) || !strings.HasPrefix(lcp, compPrefix) {
|
if lcp == compPrefix || len(lcp) < len(compPrefix) || !strings.HasPrefix(lcp, compPrefix) {
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
return lcp[len(compPrefix):], utilfn.ContainsStr(compStrs, lcp)
|
return lcp[len(compPrefix):], (utilfn.ContainsStr(compStrs, lcp) && !utilfn.IsPrefix(compStrs, lcp))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *CompPoint) FullyExtend(crtn *CompReturn) utilfn.StrWithPos {
|
func (p *CompPoint) FullyExtend(crtn *CompReturn) utilfn.StrWithPos {
|
||||||
|
@ -120,6 +120,15 @@ func ContainsStr(strs []string, test string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsPrefix(strs []string, test string) bool {
|
||||||
|
for _, s := range strs {
|
||||||
|
if len(s) > len(test) && strings.HasPrefix(s, test) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type StrWithPos struct {
|
type StrWithPos struct {
|
||||||
Str string
|
Str string
|
||||||
Pos int // this is a 'rune' position (not a byte position)
|
Pos int // this is a 'rune' position (not a byte position)
|
||||||
|
Loading…
Reference in New Issue
Block a user