mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Call _command_offset from bash-completion framework only if available
This commit is contained in:
@@ -35,9 +35,11 @@ func bash_output_serializer(completions []*Completions, shell_state map[string]s
|
|||||||
f := func(format string, args ...any) { fmt.Fprintf(&output, format+"\n", args...) }
|
f := func(format string, args ...any) { fmt.Fprintf(&output, format+"\n", args...) }
|
||||||
n := completions[0].Delegate.NumToRemove
|
n := completions[0].Delegate.NumToRemove
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
f("compopt +o nospace")
|
f("if builtin declare -F _command_offset >/dev/null; then")
|
||||||
f("COMP_WORDS[%d]=%s", n, utils.QuoteStringForSH(completions[0].Delegate.Command))
|
f(" compopt +o nospace")
|
||||||
f("_command_offset %d", n)
|
f(" COMP_WORDS[%d]=%s", n, utils.QuoteStringForSH(completions[0].Delegate.Command))
|
||||||
|
f(" _command_offset %d", n)
|
||||||
|
f("fi")
|
||||||
} else {
|
} else {
|
||||||
for _, mg := range completions[0].Groups {
|
for _, mg := range completions[0].Groups {
|
||||||
mg.remove_common_prefix()
|
mg.remove_common_prefix()
|
||||||
|
|||||||
Reference in New Issue
Block a user