fix(tui): Press ctrl-a twice should jump to beginning of line (#2246)

This commit is contained in:
eth3lbert 2024-07-10 15:49:58 +08:00 committed by GitHub
parent 6d254c6946
commit e45979c9af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -206,7 +206,10 @@ impl State {
let esc_allow_exit = !(self.tab_index == 0 && self.keymap_mode == KeymapMode::VimInsert);
// support ctrl-a prefix, like screen or tmux
if ctrl && input.code == KeyCode::Char(settings.keys.prefix.chars().next().unwrap_or('a')) {
if !self.prefix
&& ctrl
&& input.code == KeyCode::Char(settings.keys.prefix.chars().next().unwrap_or('a'))
{
self.prefix = true;
return InputAction::Continue;
}
@ -301,6 +304,8 @@ impl State {
}
KeyCode::Char('a') => {
self.search.input.start();
// This prevents pressing ctrl-a twice while still in prefix mode
self.prefix = false;
return InputAction::Continue;
}
_ => {}