feat: support configurable modified-key binding sequences
This commit is contained in:
+32
-1
@@ -1432,7 +1432,7 @@ fn draw_status(frame: &mut Frame, editor: &Editor, syntax: &SyntaxCache, status_
|
||||
} else {
|
||||
format!(" {}", editor.mode())
|
||||
};
|
||||
if let Some(sequence) = editor.leader_pending() {
|
||||
if let Some(sequence) = editor.sequence_pending() {
|
||||
write!(status, " leader: {sequence}").unwrap();
|
||||
}
|
||||
if editor.g_pending() {
|
||||
@@ -5270,6 +5270,37 @@ mod tests {
|
||||
terminal.get_cursor_position().unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modified_sequences_navigate_diff_files_and_readonly_panes() {
|
||||
let mut editor = Editor::open(None, vec![]).unwrap();
|
||||
editor.handle(Input::Char('|'));
|
||||
install_readonly_diff(
|
||||
&mut editor,
|
||||
syntax_diff_file("history.txt", "before", "after"),
|
||||
);
|
||||
editor
|
||||
.bind("normal", "ctrl+w h", Some("core.pane.focus_left".into()))
|
||||
.unwrap();
|
||||
let mut terminal = Terminal::new(ratatui::backend::TestBackend::new(120, 30)).unwrap();
|
||||
let mut views = BufferViewports::default();
|
||||
render_native_diff(&mut terminal, &mut views, &mut editor);
|
||||
assert_eq!(editor.diff().unwrap().focus, Focus::Files);
|
||||
editor.handle(Input::Ctrl('w'));
|
||||
assert_eq!(editor.sequence_pending(), Some("Ctrl+w"));
|
||||
assert!(editor.diff().unwrap().files_visible);
|
||||
editor.handle(Input::Char('h'));
|
||||
assert_eq!(editor.diff().unwrap().focus, Focus::After);
|
||||
render_native_diff(&mut terminal, &mut views, &mut editor);
|
||||
editor.handle(Input::Ctrl('w'));
|
||||
editor.handle(Input::Char('h'));
|
||||
assert_eq!(editor.diff().unwrap().focus, Focus::Before);
|
||||
render_native_diff(&mut terminal, &mut views, &mut editor);
|
||||
editor.handle(Input::Ctrl('w'));
|
||||
editor.handle(Input::Char('h'));
|
||||
assert_eq!(editor.pane_id(), 1);
|
||||
assert_eq!(editor.sequence_pending(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wrap_toggle_preserves_caret_screen_row_in_normal_buffers() {
|
||||
let directory = Directory::new();
|
||||
|
||||
Reference in New Issue
Block a user