mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-25 06:24:26 +00:00
Merge pull request #107 from lj3954/refactor_key_handling
refactor: Small improvements to formatting of key handling
This commit is contained in:
commit
a8eaf54fd8
17
src/list.rs
17
src/list.rs
|
@ -268,10 +268,10 @@ impl CustomList {
|
||||||
// so the scroll does not happen in the main window as well
|
// so the scroll does not happen in the main window as well
|
||||||
if self.preview_window_state.is_some() {
|
if self.preview_window_state.is_some() {
|
||||||
self.scroll_preview_window_down();
|
self.scroll_preview_window_down();
|
||||||
return None;
|
} else {
|
||||||
|
self.list_state.select_next();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.list_state.select_next();
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
KeyCode::Char('k') | KeyCode::Up => {
|
KeyCode::Char('k') | KeyCode::Up => {
|
||||||
|
@ -279,10 +279,10 @@ impl CustomList {
|
||||||
// so the scroll does not happen in the main window as well
|
// so the scroll does not happen in the main window as well
|
||||||
if self.preview_window_state.is_some() {
|
if self.preview_window_state.is_some() {
|
||||||
self.scroll_preview_window_up();
|
self.scroll_preview_window_up();
|
||||||
return None;
|
} else {
|
||||||
|
self.list_state.select_previous();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.list_state.select_previous();
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
// The 'p' key toggles the preview on and off
|
// The 'p' key toggles the preview on and off
|
||||||
|
@ -290,14 +290,7 @@ impl CustomList {
|
||||||
self.toggle_preview_window(state);
|
self.toggle_preview_window(state);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
KeyCode::Enter if self.preview_window_state.is_none() => self.handle_enter(),
|
||||||
KeyCode::Enter => {
|
|
||||||
if self.preview_window_state.is_none() {
|
|
||||||
self.handle_enter()
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user