mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 14:34:52 +02:00
All completion tests pass again
This commit is contained in:
@@ -31,6 +31,8 @@ type Command struct {
|
||||
ArgCompleter CompletionFunc
|
||||
// Stop completion processing at this arg num
|
||||
StopCompletingAtArg int
|
||||
// Consider all args as non-options args
|
||||
OnlyArgsAllowed bool
|
||||
// Specialised arg aprsing
|
||||
ParseArgsForCompletion func(cmd *Command, args []string, completions *Completions)
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ func completion_parse_args(cmd *Command, words []string, completions *Completion
|
||||
cmd = sc
|
||||
arg_num = 0
|
||||
completions.CurrentWordIdxInParent = 0
|
||||
only_args_allowed = false
|
||||
only_args_allowed = cmd.OnlyArgsAllowed
|
||||
if cmd.ParseArgsForCompletion != nil {
|
||||
cmd.ParseArgsForCompletion(cmd, words[i+1:], completions)
|
||||
return
|
||||
|
||||
@@ -155,7 +155,7 @@ func ChainCompleters(completers ...CompletionFunc) CompletionFunc {
|
||||
|
||||
func CompletionForWrapper(wrapped_cmd string) func(completions *Completions, word string, arg_num int) {
|
||||
return func(completions *Completions, word string, arg_num int) {
|
||||
completions.Delegate.NumToRemove = completions.CurrentWordIdx + 1
|
||||
completions.Delegate.NumToRemove = completions.CurrentWordIdx
|
||||
completions.Delegate.Command = wrapped_cmd
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user