Skip to content

Commit 5edc8bd

Browse files
authored
Merge branch 'master' into better-settings-UI
2 parents 4da29b5 + d6ff197 commit 5edc8bd

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/app/tile.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,20 @@ impl Tile {
289289
Some(Message::ChangeFocus(ArrowKey::Down, 1))
290290
}
291291
keyboard::Key::Character(chr) => {
292-
if modifiers.command() && chr.to_string() == "r" {
292+
let s = chr.to_string();
293+
if modifiers.command() && s == "r" {
293294
Some(Message::ReloadConfig)
294-
} else if chr.to_string() == "p" && modifiers.control() {
295+
} else if modifiers.command() {
296+
s.parse::<usize>()
297+
.ok()
298+
.filter(|&n| n >= 1 && n <= 9)
299+
.map(|n| Message::OpenResult((n - 1) as u32))
300+
} else if s == "p" && modifiers.control() {
295301
Some(Message::ChangeFocus(ArrowKey::Up, 1))
296-
} else if chr.to_string() == "n" && modifiers.control() {
302+
} else if s == "n" && modifiers.control() {
297303
Some(Message::ChangeFocus(ArrowKey::Down, 1))
298304
} else {
299-
Some(Message::FocusTextInput(Move::Forwards(chr.to_string())))
305+
Some(Message::FocusTextInput(Move::Forwards(s)))
300306
}
301307
}
302308
keyboard::Key::Named(Named::Enter) => Some(Message::OpenFocused),

0 commit comments

Comments
 (0)