From e28aae620a9dd919d9a3e7fbbf009f78a587290b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 23 Feb 2022 07:48:42 +0530 Subject: [PATCH] Add tests for reset of cursor shape when running commands --- docs/changelog.rst | 2 +- kitty_tests/shell_integration.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 80ba3b10c..97b0e3ff5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -79,7 +79,7 @@ Detailed list of changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - BASH integration: No longer modify :file:`~/.bashrc` to load :ref:`shell integration `. - It is recommended to remove the lines used to load the shell integration from :file:`~/.bashrc`. + It is recommended to remove the lines used to load the shell integration from :file:`~/.bashrc` as they are no-ops. - macOS: Allow kitty to handle various URL types. Can be configured via :ref:`launch_actions` (:pull:`4618`) diff --git a/kitty_tests/shell_integration.py b/kitty_tests/shell_integration.py index e447d2a1c..22aa97a66 100644 --- a/kitty_tests/shell_integration.py +++ b/kitty_tests/shell_integration.py @@ -103,6 +103,14 @@ RPS1="{rps1}" pty.wait_till(lambda: pty.screen_contents().count(rps1) == 3) self.ae('40', str(pty.screen.line(pty.screen.cursor.y - 1))) self.ae(q, str(pty.screen.line(pty.screen.cursor.y - 2))) + pty.send_cmd_to_child('clear') + q = ps1 + ' ' * (pty.screen.columns - len(ps1) - len(rps1)) + rps1 + pty.wait_till(lambda: pty.screen_contents() == q) + pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM) + pty.send_cmd_to_child('cat') + pty.wait_till(lambda: pty.screen.cursor.shape == 0) + pty.write_to_child('\x04') + pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM) @unittest.skipUnless(not is_macos and shutil.which('bash'), 'macOS bash is too old' if is_macos else 'bash not installed') def test_bash_integration(self): @@ -140,6 +148,13 @@ PS1="{ps1}" pty.wait_till(lambda: pty.screen_contents().count(ps1) == 3) self.ae('40', str(pty.screen.line(pty.screen.cursor.y - 1))) self.ae(ps1 + 'echo $COLUMNS', str(pty.screen.line(pty.screen.cursor.y - 2))) + pty.send_cmd_to_child('clear') + pty.wait_till(lambda: pty.screen_contents() == ps1) + pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM) + pty.send_cmd_to_child('cat') + pty.wait_till(lambda: pty.screen.cursor.shape == 0) + pty.write_to_child('\x04') + pty.wait_till(lambda: pty.screen.cursor.shape == CURSOR_BEAM) for ps1 in ('line1\\nline\\2\\prompt> ', 'line1\nprompt> ', 'line1\\nprompt> ',): with self.subTest(ps1=ps1), self.run_shell(