This commit is contained in:
Kovid Goyal 2026-10-29 17:26:48 +05:30
parent 7e2220952a
commit 98a6b3ccd4
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 25 additions and 1 deletions

View file

@ -235,6 +235,10 @@ Detailed list of changes
scaled text and emoji sequences being split into multiple cells when
wrapped onto the next line (:pull:`10767`)
- zsh integration: Fix a "maximum nested function level reached" error at
every prompt after interrupting a command run at shell startup, for example
via a session file (:iss:`10768`)
- Fix changing text marker colors at runtime, for example with
:code:`kitten @ set-colors` or automatic dark/light theme switching, applying
the colors of each marker to the next one, with changes to ``mark3`` having

View file

@ -374,6 +374,18 @@ RPS1="{rps1}"
pty.wait_till(lambda: 'XXX' in pty.screen_contents())
self.assertIn('pre-start', pty.screen_contents())
self.assertTrue(pty.screen_contents().startswith('pre-start'))
# Interrupting the startup command must not leave integration half
# initialized. The marker is printed by the child itself so that we
# know it is the foreground job when we send SIGINT.
with self.run_shell(rc='PS1=XXX', extra_env={'KITTY_SI_RUN_COMMAND_AT_STARTUP': "sh -c 'echo pre-start; exec sleep 100'"}) as pty:
pty.wait_till(lambda: 'pre-start' in pty.screen_contents())
pty.write_to_child('\x03')
pty.wait_till(lambda: 'XXX' in pty.screen_contents())
pty.send_cmd_to_child('echo ok1')
pty.wait_till(lambda: '\nok1\n' in pty.screen_contents())
pty.send_cmd_to_child('echo ok2')
pty.wait_till(lambda: '\nok2\n' in pty.screen_contents())
self.assertNotIn('FUNCNEST', pty.screen_contents())
@unittest.skipUnless(shutil.which('fish'), 'fish not installed')
def test_fish_integration(self):

View file

@ -353,7 +353,15 @@ _ksi_deferred_init() {
# run startup command
if [[ -n "$krcs" ]]; then
builtin print -nu "$_ksi_fd" -f '\e]2;%s\e\\' -- "${(V)krcs}"
builtin eval "$krcs"
# If the command is interrupted with Ctrl-C, zsh aborts the rest of
# this function, leaving it in precmd_functions so it runs again on the
# next prompt and wraps our zle widgets around themselves, causing
# infinite recursion. Clear the interrupt so initialization completes.
{
builtin eval "$krcs"
} always {
TRY_BLOCK_INTERRUPT=0
}
fi
if (( $+functions[_ksi_preexec] )); then