mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 02:02:14 +02:00
readline: Automatically do word completion based on history
This commit is contained in:
@@ -156,6 +156,9 @@ func New(loop *loop.Loop, r RlInit) *Readline {
|
||||
completions: completions{completer: r.Completer},
|
||||
kill_ring: kill_ring{items: list.New().Init()},
|
||||
}
|
||||
if ans.completions.completer == nil && r.HistoryPath != "" {
|
||||
ans.completions.completer = ans.HistoryCompleter
|
||||
}
|
||||
ans.prompt = ans.make_prompt(r.Prompt, false)
|
||||
t := ""
|
||||
if r.ContinuationPrompt != "" || !r.EmptyContinuationPrompt {
|
||||
@@ -168,6 +171,10 @@ func New(loop *loop.Loop, r RlInit) *Readline {
|
||||
return ans
|
||||
}
|
||||
|
||||
func (self *Readline) HistoryCompleter(before_cursor, after_cursor string) *cli.Completions {
|
||||
return self.history_completer(before_cursor, after_cursor)
|
||||
}
|
||||
|
||||
func (self *Readline) SetPrompt(prompt string) {
|
||||
self.prompt = self.make_prompt(prompt, false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user