Wip: refacto
This commit is contained in:
20
src/input.rs
20
src/input.rs
@@ -902,7 +902,27 @@ fn handle_help_page(ctx: &mut InputContext, key: KeyEvent) -> InputResult {
|
||||
fn handle_dict_page(ctx: &mut InputContext, key: KeyEvent) -> InputResult {
|
||||
use crate::state::DictFocus;
|
||||
|
||||
let ctrl = key.modifiers.contains(KeyModifiers::CONTROL);
|
||||
|
||||
// Handle search input mode
|
||||
if ctx.app.ui.dict_search_active {
|
||||
match key.code {
|
||||
KeyCode::Esc => ctx.dispatch(AppCommand::DictClearSearch),
|
||||
KeyCode::Enter => ctx.dispatch(AppCommand::DictSearchConfirm),
|
||||
KeyCode::Backspace => ctx.dispatch(AppCommand::DictSearchBackspace),
|
||||
KeyCode::Char(c) if !ctrl => ctx.dispatch(AppCommand::DictSearchInput(c)),
|
||||
_ => {}
|
||||
}
|
||||
return InputResult::Continue;
|
||||
}
|
||||
|
||||
match key.code {
|
||||
KeyCode::Char('/') | KeyCode::Char('f') if key.code == KeyCode::Char('/') || ctrl => {
|
||||
ctx.dispatch(AppCommand::DictActivateSearch);
|
||||
}
|
||||
KeyCode::Esc if !ctx.app.ui.dict_search_query.is_empty() => {
|
||||
ctx.dispatch(AppCommand::DictClearSearch);
|
||||
}
|
||||
KeyCode::Tab => ctx.dispatch(AppCommand::DictToggleFocus),
|
||||
KeyCode::Char('j') | KeyCode::Down => {
|
||||
match ctx.app.ui.dict_focus {
|
||||
|
||||
Reference in New Issue
Block a user