From 71aec52b8c8cd296b165e51b272f341026a6e338 Mon Sep 17 00:00:00 2001 From: Anund Date: Sun, 15 Dec 2024 01:28:52 +1100 Subject: [PATCH 1/2] fish: raise eval quota inline with other completions, add -e --- src/build/fish_completions.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build/fish_completions.zig b/src/build/fish_completions.zig index 5212dab61..049ff06be 100644 --- a/src/build/fish_completions.zig +++ b/src/build/fish_completions.zig @@ -9,7 +9,7 @@ pub const fish_completions = comptimeGenerateFishCompletions(); fn comptimeGenerateFishCompletions() []const u8 { comptime { - @setEvalBranchQuota(18000); + @setEvalBranchQuota(50000); var counter = std.io.countingWriter(std.io.null_writer); try writeFishCompletions(&counter.writer()); @@ -38,7 +38,7 @@ fn writeFishCompletions(writer: anytype) !void { try writer.writeAll("complete -c ghostty -f\n"); - try writer.writeAll("complete -c ghostty -l help -f\n"); + try writer.writeAll("complete -c ghostty -s e -l help -f\n"); try writer.writeAll("complete -c ghostty -n \"not __fish_seen_subcommand_from $commands\" -l version -f\n"); for (@typeInfo(Config).Struct.fields) |field| { From 5195042f96dc2ebb973fd4054c0656f93016aefb Mon Sep 17 00:00:00 2001 From: Anund Date: Sun, 15 Dec 2024 01:29:34 +1100 Subject: [PATCH 2/2] zsh: add -e completion, fix incorrectly copied sed expression skip +version +help to keep completions the same across bash/zsh/fish --- src/build/zsh_completions.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/build/zsh_completions.zig b/src/build/zsh_completions.zig index 78d256ee2..6a4e88a66 100644 --- a/src/build/zsh_completions.zig +++ b/src/build/zsh_completions.zig @@ -32,7 +32,7 @@ fn writeZshCompletions(writer: anytype) !void { \\} \\ \\_themes() { - \\ local theme_list=$(ghostty +list-themes | sed -E 's/^(.*) \(.*\$/\0/') + \\ local theme_list=$(ghostty +list-themes | sed -E 's/^(.*) \(.*$/\1/') \\ local themes=(${(f)theme_list}) \\ _describe -t themes 'themes' themes \\} @@ -101,13 +101,13 @@ fn writeZshCompletions(writer: anytype) !void { \\_ghostty() { \\ typeset -A opt_args \\ local context state line - \\ local opt=('--help' '--version') + \\ local opt=('-e' '--help' '--version') \\ \\ _arguments -C \ \\ '1:actions:->actions' \ \\ '*:: :->rest' \ \\ - \\ if [[ "$line[1]" == "--help" || "$line[1]" == "--version" ]]; then + \\ if [[ "$line[1]" == "--help" || "$line[1]" == "--version" || "$line[1]" == "-e" ]]; then \\ return \\ fi \\ @@ -127,6 +127,9 @@ fn writeZshCompletions(writer: anytype) !void { var count: usize = 0; const padding = " "; for (@typeInfo(Action).Enum.fields) |field| { + if (std.mem.eql(u8, "help", field.name)) continue; + if (std.mem.eql(u8, "version", field.name)) continue; + try writer.writeAll(padding ++ "'+"); try writer.writeAll(field.name); try writer.writeAll("'\n");