Merge branch 'fix-zsh-escaping' of https://github.com/jirassimok/kitty

This commit is contained in:
Kovid Goyal
2025-06-24 08:41:00 +05:30
2 changed files with 5 additions and 2 deletions

View File

@@ -161,6 +161,9 @@ RPS1="{rps1}"
pty.write_to_child('\x04')
pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM)
self.assert_command(pty)
# Check escaping of inputs
pty.send_cmd_to_child("-f-this-command-must-not-exist")
self.assert_command(pty, exit_status=127)
with self.run_shell(rc=f'''PS1="{ps1}"''') as pty:
pty.callbacks.clear()
pty.send_cmd_to_child('printf "%s\x16\a%s" "a" "b"')
@@ -273,7 +276,7 @@ function _set_status_prompt; function fish_prompt; echo -n "$pipestatus $status
def assert_command(self, pty, cmd='', exit_status=0):
cmd = cmd or pty.last_cmd
pty.wait_till(lambda: pty.callbacks.last_cmd_exit_status == 0, timeout_msg=lambda: f'{pty.callbacks.last_cmd_exit_status=} != {exit_status}')
pty.wait_till(lambda: pty.callbacks.last_cmd_exit_status == exit_status, timeout_msg=lambda: f'{pty.callbacks.last_cmd_exit_status=} != {exit_status}')
pty.wait_till(lambda: pty.callbacks.last_cmd_cmdline == cmd, timeout_msg=lambda: f'{pty.callbacks.last_cmd_cmdline=!r} != {cmd!r}')
@unittest.skipUnless(bash_ok(), 'bash not installed, too old, or debug build')

View File

@@ -222,7 +222,7 @@ _ksi_deferred_init() {
# its preexec hook before us, we'll incorrectly mark its output as
# belonging to the command (as if the user typed it into zle) rather
# than command output.
builtin print -nu "$_ksi_fd" -f '\e]133;C;cmdline=%q\a' "$1"
builtin print -nu "$_ksi_fd" -f '\e]133;C;cmdline=%q\a' -- "$1"
(( _ksi_state = 1 ))
}