fix: Change undo/redo keys to Ctrl+U/Ctrl+R
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 <noreply@anthropic.com>
This commit is contained in:
parent
6a4e153a62
commit
67a83e5379
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue