cleanup
This commit is contained in:
+13
-24
@@ -34,11 +34,6 @@ const KEY_TAB: u32 = 15;
|
||||
const KEY_Q: u32 = 16;
|
||||
const KEY_ENTER: u32 = 28;
|
||||
const KEY_LEFTCTRL: u32 = 29;
|
||||
// hjkl, by physical position: the same keys as vim on a qwerty layout.
|
||||
const KEY_H: u32 = 35;
|
||||
const KEY_J: u32 = 36;
|
||||
const KEY_K: u32 = 37;
|
||||
const KEY_L: u32 = 38;
|
||||
const KEY_LEFTSHIFT: u32 = 42;
|
||||
const KEY_RIGHTSHIFT: u32 = 54;
|
||||
const KEY_LEFTALT: u32 = 56;
|
||||
@@ -59,12 +54,7 @@ const KEY_RIGHTMETA: u32 = 126;
|
||||
fn is_trigger_modifier(code: u32) -> bool {
|
||||
matches!(
|
||||
code,
|
||||
KEY_LEFTALT
|
||||
| KEY_RIGHTALT
|
||||
| KEY_LEFTMETA
|
||||
| KEY_RIGHTMETA
|
||||
| KEY_LEFTCTRL
|
||||
| KEY_RIGHTCTRL
|
||||
KEY_LEFTALT | KEY_RIGHTALT | KEY_LEFTMETA | KEY_RIGHTMETA | KEY_LEFTCTRL | KEY_RIGHTCTRL
|
||||
)
|
||||
}
|
||||
|
||||
@@ -81,10 +71,6 @@ fn is_repeatable_key(code: u32) -> bool {
|
||||
| KEY_END
|
||||
| KEY_PGUP
|
||||
| KEY_PGDN
|
||||
| KEY_H
|
||||
| KEY_J
|
||||
| KEY_K
|
||||
| KEY_L
|
||||
)
|
||||
}
|
||||
|
||||
@@ -358,10 +344,10 @@ impl App {
|
||||
self.ending = Ending::Picked;
|
||||
}
|
||||
KEY_TAB if self.shift => self.move_sel(-1, qh),
|
||||
KEY_TAB | KEY_RIGHT | KEY_L => self.move_sel(1, qh),
|
||||
KEY_LEFT | KEY_H => self.move_sel(-1, qh),
|
||||
KEY_DOWN | KEY_J => self.move_row(1, qh),
|
||||
KEY_UP | KEY_K => self.move_row(-1, qh),
|
||||
KEY_TAB | KEY_RIGHT => self.move_sel(1, qh),
|
||||
KEY_LEFT => self.move_sel(-1, qh),
|
||||
KEY_DOWN => self.move_sel(1, qh),
|
||||
KEY_UP => self.move_sel(-1, qh),
|
||||
KEY_HOME => self.select(0, qh),
|
||||
KEY_END => self.select(self.tiles.len().saturating_sub(1), qh),
|
||||
KEY_PGUP => self.move_row(-self.layout.visible_rows, qh),
|
||||
@@ -396,10 +382,10 @@ impl App {
|
||||
// Re-run the navigation action without re-arming the delay.
|
||||
match code {
|
||||
KEY_TAB if self.shift => self.move_sel(-1, qh),
|
||||
KEY_TAB | KEY_RIGHT | KEY_L => self.move_sel(1, qh),
|
||||
KEY_LEFT | KEY_H => self.move_sel(-1, qh),
|
||||
KEY_DOWN | KEY_J => self.move_row(1, qh),
|
||||
KEY_UP | KEY_K => self.move_row(-1, qh),
|
||||
KEY_TAB | KEY_RIGHT => self.move_sel(1, qh),
|
||||
KEY_LEFT => self.move_sel(-1, qh),
|
||||
KEY_DOWN => self.move_sel(1, qh),
|
||||
KEY_UP => self.move_sel(-1, qh),
|
||||
KEY_HOME => self.select(0, qh),
|
||||
KEY_END => self.select(self.tiles.len().saturating_sub(1), qh),
|
||||
KEY_PGUP => self.move_row(-self.layout.visible_rows, qh),
|
||||
@@ -415,7 +401,10 @@ impl App {
|
||||
.map(|chunk| u32::from_ne_bytes(chunk.try_into().unwrap()))
|
||||
.collect();
|
||||
|
||||
if held_keys.iter().any(|&k| k == KEY_LEFTSHIFT || k == KEY_RIGHTSHIFT) {
|
||||
if held_keys
|
||||
.iter()
|
||||
.any(|&k| k == KEY_LEFTSHIFT || k == KEY_RIGHTSHIFT)
|
||||
{
|
||||
self.shift = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user