File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -286,14 +286,20 @@ impl Tile {
286286 Some ( Message :: ChangeFocus ( ArrowKey :: Down , 1 ) )
287287 }
288288 keyboard:: Key :: Character ( chr) => {
289- if modifiers. command ( ) && chr. to_string ( ) == "r" {
289+ let s = chr. to_string ( ) ;
290+ if modifiers. command ( ) && s == "r" {
290291 Some ( Message :: ReloadConfig )
291- } else if chr. to_string ( ) == "p" && modifiers. control ( ) {
292+ } else if modifiers. command ( ) {
293+ s. parse :: < usize > ( )
294+ . ok ( )
295+ . filter ( |& n| n >= 1 && n <= 9 )
296+ . map ( |n| Message :: OpenResult ( ( n - 1 ) as u32 ) )
297+ } else if s == "p" && modifiers. control ( ) {
292298 Some ( Message :: ChangeFocus ( ArrowKey :: Up , 1 ) )
293- } else if chr . to_string ( ) == "n" && modifiers. control ( ) {
299+ } else if s == "n" && modifiers. control ( ) {
294300 Some ( Message :: ChangeFocus ( ArrowKey :: Down , 1 ) )
295301 } else {
296- Some ( Message :: FocusTextInput ( Move :: Forwards ( chr . to_string ( ) ) ) )
302+ Some ( Message :: FocusTextInput ( Move :: Forwards ( s ) ) )
297303 }
298304 }
299305 keyboard:: Key :: Named ( Named :: Enter ) => Some ( Message :: OpenFocused ) ,
You can’t perform that action at this time.
0 commit comments