mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-22 02:41:23 +01:00
better directory vs file completion
This commit is contained in:
parent
81c564aca9
commit
adca87e9db
@ -480,9 +480,9 @@ func makeInfoFromComps(compType string, comps []string, hasMore bool) sstore.Upd
|
||||
sort.Strings(comps)
|
||||
update := sstore.InfoUpdate{
|
||||
Info: &sstore.InfoMsgType{
|
||||
InfoTitle: fmt.Sprintf("%s completions", compType),
|
||||
InfoStrings: comps,
|
||||
InfoStringsMore: hasMore,
|
||||
InfoTitle: fmt.Sprintf("%s completions", compType),
|
||||
InfoComps: comps,
|
||||
InfoCompsMore: hasMore,
|
||||
},
|
||||
}
|
||||
return update
|
||||
@ -508,6 +508,9 @@ func longestPrefix(root string, comps []string) string {
|
||||
if len(comps) == 1 {
|
||||
comp := comps[0]
|
||||
if len(comp) >= len(root) && strings.HasPrefix(comp, root) {
|
||||
if strings.HasSuffix(comp, "/") {
|
||||
return comps[0]
|
||||
}
|
||||
return comps[0] + " "
|
||||
}
|
||||
}
|
||||
|
@ -75,12 +75,12 @@ func (LineUpdate) UpdateType() string {
|
||||
}
|
||||
|
||||
type InfoMsgType struct {
|
||||
InfoTitle string `json:"infotitle"`
|
||||
InfoError string `json:"infoerror,omitempty"`
|
||||
InfoMsg string `json:"infomsg,omitempty"`
|
||||
InfoStrings []string `json:"infostrings"`
|
||||
InfoStringsMore bool `json:"infostringsmore"`
|
||||
TimeoutMs int64 `json:"timeoutms,omitempty"`
|
||||
InfoTitle string `json:"infotitle"`
|
||||
InfoError string `json:"infoerror,omitempty"`
|
||||
InfoMsg string `json:"infomsg,omitempty"`
|
||||
InfoComps []string `json:"infocomps"`
|
||||
InfoCompsMore bool `json:"infocompssmore"`
|
||||
TimeoutMs int64 `json:"timeoutms,omitempty"`
|
||||
}
|
||||
|
||||
type CmdLineType struct {
|
||||
|
Loading…
Reference in New Issue
Block a user