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.
|
"""A multiline Edit with undo/redo support.
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
- Undo with Ctrl+Z (up to 50 states)
|
- Undo with Ctrl+U (up to 50 states)
|
||||||
- Redo with Ctrl+Y or Ctrl+Shift+Z
|
- Redo with Ctrl+R
|
||||||
- Tab passes through for focus cycling
|
- 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
|
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._save_undo_state(self._last_saved_text, self.edit_pos)
|
||||||
self._last_saved_text = current_text
|
self._last_saved_text = current_text
|
||||||
|
|
||||||
# Handle undo (Ctrl+Z)
|
# Handle undo (Ctrl+U) - can't use Ctrl+Z as it's Unix suspend signal
|
||||||
if key == 'ctrl z':
|
if key == 'ctrl u':
|
||||||
self._undo()
|
self._undo()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Handle redo (Ctrl+Y or Ctrl+Shift+Z)
|
# Handle redo (Ctrl+R)
|
||||||
if key in ('ctrl y', 'ctrl shift z'):
|
if key == 'ctrl r':
|
||||||
self._redo()
|
self._redo()
|
||||||
return None
|
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"
|
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)
|
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()"
|
default_code = existing.code if existing else f"{default_output_var} = input.upper()"
|
||||||
code_edit = UndoableEdit(
|
code_edit = UndoableEdit(
|
||||||
edit_text=default_code,
|
edit_text=default_code,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue