kitty @ shell: Integrate completions from history
This commit is contained in:
parent
ef6693a239
commit
018bf46ddb
@ -215,7 +215,17 @@ func shell_main(cmd *cli.Command, args []string) (int, error) {
|
|||||||
}
|
}
|
||||||
fmt.Println(amsg)
|
fmt.Println(amsg)
|
||||||
}
|
}
|
||||||
rl := readline.New(nil, readline.RlInit{Prompt: prompt, Completer: completions, HistoryPath: filepath.Join(utils.CacheDir(), "shell.history.json")})
|
var rl *readline.Readline
|
||||||
|
combined_completer := func(before_cursor, after_cursor string) *cli.Completions {
|
||||||
|
ans := completions(before_cursor, after_cursor)
|
||||||
|
history := rl.HistoryCompleter(before_cursor, after_cursor)
|
||||||
|
for _, group := range history.Groups {
|
||||||
|
ans.MergeMatchGroup(group)
|
||||||
|
}
|
||||||
|
return ans
|
||||||
|
}
|
||||||
|
|
||||||
|
rl = readline.New(nil, readline.RlInit{Prompt: prompt, Completer: combined_completer, HistoryPath: filepath.Join(utils.CacheDir(), "shell.history.json")})
|
||||||
defer func() {
|
defer func() {
|
||||||
rl.Shutdown()
|
rl.Shutdown()
|
||||||
}()
|
}()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user