fish integration: drop redundant OSC 133 markers in upcoming fish 3.8

The upcoming fish 3.8 release will output OSC 133 sequences
unconditionally [1].

I tested ctrl-shift-{g,x,z} bindings both without and with kitty's
shell integration on top; everything seems to work.

Let's simplify kitty integration by removing the markers for the
upcoming fish >= 3.8.

I have hopes that the native OSC 133 implementation address #7200
though I'm not sure if I could reproduce this bug (I only saw a
similar bug when `fish_handle_reflow` was not enabled, which fish
also does now (same commit)).
cc @iacore let me know if you can reproduce #7200 with latest fish master.

[1]: 3b9e3e251b
This commit is contained in:
Johannes Altmanninger
2024-04-06 22:35:14 +02:00
parent 4dc1e733a7
commit 8951581815
2 changed files with 25 additions and 18 deletions

View File

@@ -71,27 +71,32 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
# Enable prompt marking with OSC 133
if not contains "no-prompt-mark" $_ksi and not set -q __ksi_prompt_state
function __ksi_mark_prompt_start --on-event fish_prompt --on-event fish_cancel --on-event fish_posterror
test "$__ksi_prompt_state" != prompt-start
and echo -en "\e]133;D\a"
set --global __ksi_prompt_state prompt-start
echo -en "\e]133;A;special_key=1\a"
end
__ksi_mark_prompt_start
# fish 3.8 emits prompt markers, so we don't need to.
# Cheesily detect that version by probing for another feature.
if not bind --function-names | string match -q forward-char-passive
function __ksi_mark_prompt_start --on-event fish_prompt --on-event fish_cancel --on-event fish_posterror
test "$__ksi_prompt_state" != prompt-start
and echo -en "\e]133;D\a"
set --global __ksi_prompt_state prompt-start
echo -en "\e]133;A;special_key=1\a"
end
__ksi_mark_prompt_start
function __ksi_mark_output_start --on-event fish_preexec
set --global __ksi_prompt_state pre-exec
echo -en "\e]133;C\a"
function __ksi_mark_output_start --on-event fish_preexec
set --global __ksi_prompt_state pre-exec
echo -en "\e]133;C\a"
end
function __ksi_mark_output_end --on-event fish_postexec
set --global __ksi_prompt_state post-exec
echo -en "\e]133;D;$status\a"
end
# With prompt marking, kitty clears the current prompt on resize,
# so we need fish to redraw it.
set --global fish_handle_reflow 1
end
function __ksi_mark_output_end --on-event fish_postexec
set --global __ksi_prompt_state post-exec
echo -en "\e]133;D;$status\a"
end
# With prompt marking, kitty clears the current prompt on resize,
# so we need fish to redraw it.
set --global fish_handle_reflow 1
# Binding for special key to move cursor on mouse click without triggering any
# autocompletion or other effects
set --local suffix ''