Remove the fish integration prompt end B prompt marking

Currently kitty does not use the B prompt marking.
This is consistent with the zsh and bash implementations.
Improve compatibility with most user configurations.
This commit is contained in:
pagedown 2022-03-07 12:12:52 +08:00
parent 817ac82968
commit 1b68e41db4
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB
2 changed files with 2 additions and 25 deletions

View File

@ -213,16 +213,8 @@ function _set_status_prompt; function fish_prompt; echo -n "$pipestatus $status
pty.write_to_child('i')
pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM)
pty.send_cmd_to_child('_set_key default')
# pipestatus
pty.send_cmd_to_child('clear;false|true|false')
pty.send_cmd_to_child('echo $pipestatus $status')
pty.wait_till(lambda: pty.screen_contents().count(right_prompt) == 2)
self.ae(pty.last_cmd_output(), '1 0 1 1')
pty.send_cmd_to_child('_set_status_prompt')
pty.send_cmd_to_child('false|true|false')
pty.wait_till(lambda: pty.screen_contents().count(right_prompt) == 4)
self.assertTrue(str(pty.screen.line(pty.screen.cursor.y)).startswith(f'1 0 1 1 {fish_prompt}'))
pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM)
pty.send_cmd_to_child('exit')

View File

@ -19,7 +19,7 @@ end
status is-interactive || exit 0
not functions -q __ksi_schedule || exit 0
# Check fish version 3.3.0+ efficiently and fallback to check the last working version 3.2.0, exit on outdated versions.
# Check fish version 3.3.0+ efficiently and fallback to check the minimum working version 3.2.0, exit on outdated versions.
# "Warning: Update fish to version 3.3.0+ to enable kitty shell integration.\n"
set -q fish_killring || set -q status_generation || string match -qnv "3.1.*" "$version"
or echo -en "\eP@kitty-print|V2FybmluZzogVXBkYXRlIGZpc2ggdG8gdmVyc2lvbiAzLjMuMCsgdG8gZW5hYmxlIGtpdHR5IHNoZWxsIGludGVncmF0aW9uLgo=\e\\" && exit 0 || exit 0
@ -80,21 +80,6 @@ function __ksi_schedule --on-event fish_prompt -d "Setup kitty integration after
end
__ksi_mark_prompt_start
functions -c fish_prompt __ksi_original_fish_prompt
function fish_prompt
# fish trims one trailing newline from the output of fish_prompt, so
# we need to do the same. See https://github.com/kovidgoyal/kitty/issues/4032
# op is a list because fish splits on newlines in command substitution
set --local op (__ksi_original_fish_prompt)
# print all but last element of the list, each followed by a new line
set -q op[2]
and printf '%s\n' $op[1..-2]
# print the last component without a newline
printf '%s' $op[-1]
set --global __ksi_prompt_state prompt-end
echo -en "\e]133;B\a"
end
function __ksi_mark_output_start --on-event fish_preexec
set --global __ksi_prompt_state pre-exec
echo -en "\e]133;C\a"