Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/ox-tui/src/app/tests/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ fn undo_and_redo_chords_restore_and_reapply_input_edits() {
assert_eq!(app.input(), "hello ");

app.handle_key(KeyEvent::new(
KeyCode::Char('_'),
KeyCode::Char('Z'),
KeyModifiers::ALT | KeyModifiers::SHIFT,
));
assert_eq!(app.input(), "hello world");

app.handle_key(KeyEvent::new(KeyCode::Char('w'), KeyModifiers::CONTROL));
assert_eq!(app.input(), "hello ");
app.handle_key(KeyEvent::new(KeyCode::Char('_'), KeyModifiers::CONTROL));
app.handle_key(KeyEvent::new(KeyCode::Char('z'), KeyModifiers::ALT));
assert_eq!(app.input(), "hello world");

app.handle_key(KeyEvent::new(KeyCode::Char('z'), KeyModifiers::SUPER));
Expand Down
17 changes: 6 additions & 11 deletions crates/ox-tui/src/input/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,28 +713,23 @@ fn bind_default_undo_redo(bindings: &mut HashMap<KeySequence, CommandId>) {
),
CommandId::Undo,
);
insert_chord(bindings, KeyChord::alt('z'), CommandId::Undo);
insert_chord(
bindings,
KeyChord::new(KeyCode::Char('z'), KeyModifiers::SUPER),
CommandId::Undo,
);
insert_chord(
bindings,
KeyChord::new(
KeyCode::Char('z'),
KeyModifiers::SUPER | KeyModifiers::SHIFT,
),
CommandId::Redo,
);
insert_chord(bindings, KeyChord::alt('_'), CommandId::Redo);
insert_chord(
bindings,
KeyChord::new(KeyCode::Char('_'), KeyModifiers::ALT | KeyModifiers::SHIFT),
KeyChord::new(KeyCode::Char('z'), KeyModifiers::ALT | KeyModifiers::SHIFT),
CommandId::Redo,
);
insert_chord(
bindings,
KeyChord::new(KeyCode::Char('-'), KeyModifiers::ALT | KeyModifiers::SHIFT),
KeyChord::new(
KeyCode::Char('z'),
KeyModifiers::SUPER | KeyModifiers::SHIFT,
),
CommandId::Redo,
);
}
Expand Down
24 changes: 12 additions & 12 deletions crates/ox-tui/src/input/keymap/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,19 @@ fn default_keymap_maps_undo_redo_history_and_scroll_chords() {
),
CommandId::Undo,
),
(KeyChord::alt('z'), CommandId::Undo),
(
KeyChord::new(KeyCode::Char('z'), KeyModifiers::SUPER),
CommandId::Undo,
),
(
KeyChord::new(KeyCode::Char('Z'), KeyModifiers::ALT | KeyModifiers::SHIFT),
CommandId::Redo,
),
(
KeyChord::new(KeyCode::Char('z'), KeyModifiers::ALT | KeyModifiers::SHIFT),
CommandId::Redo,
),
(
KeyChord::new(
KeyCode::Char('Z'),
Expand All @@ -187,15 +196,6 @@ fn default_keymap_maps_undo_redo_history_and_scroll_chords() {
),
CommandId::Redo,
),
(KeyChord::alt('_'), CommandId::Redo),
(
KeyChord::new(KeyCode::Char('_'), KeyModifiers::ALT | KeyModifiers::SHIFT),
CommandId::Redo,
),
(
KeyChord::new(KeyCode::Char('-'), KeyModifiers::ALT | KeyModifiers::SHIFT),
CommandId::Redo,
),
(KeyChord::plain(KeyCode::Up), CommandId::HistoryPrev),
(KeyChord::plain(KeyCode::Down), CommandId::HistoryNext),
(
Expand Down Expand Up @@ -365,11 +365,11 @@ fn chords_for_orders_plain_shift_ctrl_alt_cmd() {
),
(CommandId::KillWordRight, &["Ctrl+Delete", "Alt+Delete"]),
(CommandId::KillToLineStart, &["Ctrl+U", "Cmd+Backspace"]),
(CommandId::Undo, &["Ctrl+Shift+-", "Ctrl+_", "Cmd+Z"]),
(
CommandId::Redo,
&["Alt+Shift+-", "Alt+Shift+_", "Alt+_", "Shift+Cmd+Z"],
CommandId::Undo,
&["Ctrl+Shift+-", "Ctrl+_", "Alt+Z", "Cmd+Z"],
),
(CommandId::Redo, &["Alt+Shift+Z", "Shift+Cmd+Z"]),
(CommandId::HistoryPrev, &["Up", "Ctrl+P"]),
(CommandId::HistoryNext, &["Down", "Ctrl+N"]),
(CommandId::ScrollUp, &["Shift+Up"]),
Expand Down
24 changes: 12 additions & 12 deletions docs/reference/tui/keybindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ Default keyboard shortcuts for the interactive TUI, inline overlays, fullscreen

### Editing, Undo, and Clipboard

| Key | Action Name | Description |
| ---------------------------------------------------- | -------------------- | -------------------------------------------------- |
| `Backspace` | `backspace` | Delete character before the cursor |
| `Delete` | `delete` | Delete character at the cursor |
| `Ctrl+Backspace`, `Ctrl+W`, `Alt+Backspace` | `kill-word-left` | Kill the word before the cursor |
| `Ctrl+Delete`, `Alt+Delete` | `kill-word-right` | Kill the word after the cursor |
| `Ctrl+U`, `Cmd+Backspace` | `kill-to-line-start` | Kill text to the start of the current line |
| `Ctrl+K` | `kill-to-line-end` | Kill text to the end of the current line |
| `Ctrl+Y` | `yank` | Yank the most recently killed text at the cursor |
| `Ctrl+_`, `Ctrl+Shift+-`, `Cmd+Z` | `undo` | Undo last input edit |
| `Cmd+Shift+Z`, `Alt+_`, `Alt+Shift+_`, `Alt+Shift+-` | `redo` | Redo last undone input edit |
| `Ctrl+V`, `Alt+V` | `paste-clipboard` | Paste an image or text from the local OS clipboard |
| Key | Action Name | Description |
| ------------------------------------------- | -------------------- | -------------------------------------------------- |
| `Backspace` | `backspace` | Delete character before the cursor |
| `Delete` | `delete` | Delete character at the cursor |
| `Ctrl+Backspace`, `Ctrl+W`, `Alt+Backspace` | `kill-word-left` | Kill the word before the cursor |
| `Ctrl+Delete`, `Alt+Delete` | `kill-word-right` | Kill the word after the cursor |
| `Ctrl+U`, `Cmd+Backspace` | `kill-to-line-start` | Kill text to the start of the current line |
| `Ctrl+K` | `kill-to-line-end` | Kill text to the end of the current line |
| `Ctrl+Y` | `yank` | Yank the most recently killed text at the cursor |
| `Ctrl+_`, `Ctrl+Shift+-`, `Alt+Z`, `Cmd+Z` | `undo` | Undo last input edit |
| `Alt+Shift+Z`, `Cmd+Shift+Z` | `redo` | Redo last undone input edit |
| `Ctrl+V`, `Alt+V` | `paste-clipboard` | Paste an image or text from the local OS clipboard |

### History and Submission

Expand Down
Loading