From 4ab166c9ac5e6d32fd0c0c65e10e9378fbdaad5c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 May 2026 23:30:27 +0530 Subject: [PATCH] Handle -- as flag terminator in sudo wrapper --- shell-integration/bash/kitty.bash | 1 + .../fish/vendor_conf.d/kitty-shell-integration.fish | 3 +++ shell-integration/zsh/kitty-integration | 1 + 3 files changed, 5 insertions(+) diff --git a/shell-integration/bash/kitty.bash b/shell-integration/bash/kitty.bash index 2d65d704d..65811835c 100644 --- a/shell-integration/bash/kitty.bash +++ b/shell-integration/bash/kitty.bash @@ -26,6 +26,7 @@ if [[ -n "$KITTY_BASH_INJECT" ]]; then is_sudoedit="y" builtin break; fi + [[ "$arg" == "--" ]] && builtin break # end of options [[ "$arg" != -* && "$arg" != *=* ]] && builtin break # command found done if [[ "$is_sudoedit" == "y" ]]; then diff --git a/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish b/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish index e48b8f791..6c40b5681 100644 --- a/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish +++ b/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish @@ -150,6 +150,9 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after set is_sudoedit "y" break end + if string match -q -- "--" "$arg" + break # end of options + end if not string match -r -q -- "^-" "$arg" and not string match -r -q -- "=" "$arg" break # reached the command end diff --git a/shell-integration/zsh/kitty-integration b/shell-integration/zsh/kitty-integration index d456d47e4..5133c4d28 100644 --- a/shell-integration/zsh/kitty-integration +++ b/shell-integration/zsh/kitty-integration @@ -412,6 +412,7 @@ _ksi_deferred_init() { is_sudoedit="y" builtin break; fi + [[ "$arg" == "--" ]] && builtin break # end of options [[ "$arg" != -* && "$arg" != *=* ]] && builtin break # command found done if [[ "$is_sudoedit" == "y" ]]; then