diff --git a/docs/changelog.rst b/docs/changelog.rst index 3cd1b9e4d..e8b69a058 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -137,6 +137,10 @@ Detailed list of changes - Shell integration: bash: Fix rendering of multiline prompts with more than two lines (:iss:`4681`) +- Shell integration: fish: Check fish version 3.3.0+ and exit on outdated versions (:pull:`4745`) + +- Shell integration: fish: Fix pipestatus being overwritten (:pull:`4756`) + - Linux: Fix fontconfig alias not being used if the aliased font is dual spaced instead of monospaced (:iss:`4649`) - macOS: Add an option :opt:`macos_menubar_title_max_length` to control the max length of the window title displayed in the global menubar (:iss:`2132`) diff --git a/kitty_tests/shell_integration.py b/kitty_tests/shell_integration.py index 540c686f3..ab0675953 100644 --- a/kitty_tests/shell_integration.py +++ b/kitty_tests/shell_integration.py @@ -151,7 +151,9 @@ RPS1="{rps1}" set -g fish_greeting function fish_prompt; echo -n "{fish_prompt}"; end function fish_right_prompt; echo -n "{right_prompt}"; end -function _ksi_test_comp; contains "{completions_dir}" $fish_complete_path; and echo ok; end +function _test_comp_path; contains "{completions_dir}" $fish_complete_path; and echo ok; end +function _set_key; set -g fish_key_bindings fish_$argv[1]_key_bindings; end +function _set_status_prompt; function fish_prompt; echo -n "$pipestatus $status {fish_prompt}"; end; end ''') as pty: q = fish_prompt + ' ' * (pty.screen.columns - len(fish_prompt) - len(right_prompt)) + right_prompt pty.wait_till(lambda: pty.screen_contents().count(right_prompt) == 1) @@ -164,7 +166,7 @@ function _ksi_test_comp; contains "{completions_dir}" $fish_complete_path; and e # completion and prompt marking pty.send_cmd_to_child('clear') - pty.send_cmd_to_child('_ksi_test_comp') + pty.send_cmd_to_child('_test_comp_path') pty.wait_till(lambda: pty.screen_contents().count(right_prompt) == 2) q = '\n'.join(str(pty.screen.line(i)) for i in range(1, pty.screen.cursor.y)) self.ae(q, 'ok') @@ -196,16 +198,30 @@ function _ksi_test_comp; contains "{completions_dir}" $fish_complete_path; and e pty.wait_till(lambda: pty.screen.cursor.shape == 0 and pty.screen.cursor.y > 1) pty.write_to_child('\x04') pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM) - pty.send_cmd_to_child('fish_vi_key_bindings') + pty.send_cmd_to_child('_set_key vi') pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BLOCK) - pty.write_to_child('i') pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM) pty.write_to_child('\x1b') pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BLOCK) pty.write_to_child('r') pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_UNDERLINE) + pty.write_to_child('\x1b') + pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BLOCK) + pty.write_to_child('i') + pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM) + pty.send_cmd_to_child('_set_key default') - pty.write_to_child('\x1biexit\r') + # 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.send_cmd_to_child('exit') @unittest.skipUnless(bash_ok(), 'bash not installed or too old') def test_bash_integration(self):