From 67a83e5379555cfd379168046fefd20989a52357 Mon Sep 17 00:00:00 2001 From: rob Date: Fri, 5 Dec 2025 02:48:51 -0400 Subject: [PATCH] fix: Change undo/redo keys to Ctrl+U/Ctrl+R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ctrl+Z is the Unix suspend signal (SIGTSTP) which suspends the process before urwid can intercept it. Changed to: - Ctrl+U for undo - Ctrl+R for redo 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/smarttools/ui_urwid.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/smarttools/ui_urwid.py b/src/smarttools/ui_urwid.py index 5a99219..18f8aac 100644 --- a/src/smarttools/ui_urwid.py +++ b/src/smarttools/ui_urwid.py @@ -345,9 +345,11 @@ class UndoableEdit(urwid.Edit): """A multiline Edit with undo/redo support. Features: - - Undo with Ctrl+Z (up to 50 states) - - Redo with Ctrl+Y or Ctrl+Shift+Z + - Undo with Ctrl+U (up to 50 states) + - Redo with Ctrl+R - Tab passes through for focus cycling + + Note: Ctrl+Z cannot be used as it's the Unix suspend signal (SIGTSTP). """ MAX_UNDO = 50 # Maximum undo history size @@ -368,13 +370,13 @@ class UndoableEdit(urwid.Edit): self._save_undo_state(self._last_saved_text, self.edit_pos) self._last_saved_text = current_text - # Handle undo (Ctrl+Z) - if key == 'ctrl z': + # Handle undo (Ctrl+U) - can't use Ctrl+Z as it's Unix suspend signal + if key == 'ctrl u': self._undo() return None - # Handle redo (Ctrl+Y or Ctrl+Shift+Z) - if key in ('ctrl y', 'ctrl shift z'): + # Handle redo (Ctrl+R) + if key == 'ctrl r': self._redo() return None @@ -1685,7 +1687,7 @@ class SmartToolsUI: default_file = existing.code_file if existing and existing.code_file else f"{default_output_var}.py" file_edit = urwid.Edit(('label', "File: "), default_file) - # Multiline code editor with undo/redo (Ctrl+Z / Ctrl+Y) + # Multiline code editor with undo/redo (Ctrl+U / Ctrl+R) default_code = existing.code if existing else f"{default_output_var} = input.upper()" code_edit = UndoableEdit( edit_text=default_code,