@@ -1942,26 +1942,25 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
19421942 ..
19431943 } ) = event:: read ( ) ?
19441944 {
1945- // <C-r> to put the item name(s) in register
1946- if modifiers == KeyModifiers :: CONTROL
1947- && code == KeyCode :: Char ( 'r' )
1948- {
1949- if let Event :: Key ( KeyEvent {
1950- code,
1951- kind : KeyEventKind :: Press ,
1952- ..
1953- } ) = event:: read ( ) ?
1954- {
1955- if let Some ( reg) = state. registers . check_reg ( & code)
1945+ match ( code, modifiers) {
1946+ ( KeyCode :: Char ( 'r' ) , KeyModifiers :: CONTROL ) => {
1947+ if let Event :: Key ( KeyEvent {
1948+ code,
1949+ kind : KeyEventKind :: Press ,
1950+ ..
1951+ } ) = event:: read ( ) ?
19561952 {
1957- if !reg. is_empty ( ) {
1958- let to_be_inserted = reg
1959- . iter ( )
1960- . map ( |x| x. file_name . clone ( ) )
1961- . collect :: < Vec < String > > ( )
1962- . join ( " " ) ;
1963- for c in to_be_inserted. chars ( ) {
1964- if let Some ( to_be_added) =
1953+ if let Some ( reg) =
1954+ state. registers . check_reg ( & code)
1955+ {
1956+ if !reg. is_empty ( ) {
1957+ let to_be_inserted = reg
1958+ . iter ( )
1959+ . map ( |x| x. file_name . clone ( ) )
1960+ . collect :: < Vec < String > > ( )
1961+ . join ( " " ) ;
1962+ for c in to_be_inserted. chars ( ) {
1963+ if let Some ( to_be_added) =
19651964 unicode_width:: UnicodeWidthChar :: width ( c)
19661965 {
19671966 if current_pos + to_be_added as u16
@@ -1973,33 +1972,32 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
19731972 current_char_pos += 1 ;
19741973 current_pos += to_be_added as u16 ;
19751974 }
1975+ }
1976+ go_to_info_line_and_reset ( ) ;
1977+ print ! (
1978+ ":{}" ,
1979+ & command. iter( ) . collect:: <String >( ) ,
1980+ ) ;
1981+ move_to ( current_pos, 2 ) ;
1982+ screen. flush ( ) ?;
1983+ continue ;
1984+ } else {
1985+ continue ;
19761986 }
1977- go_to_info_line_and_reset ( ) ;
1978- print ! (
1979- ":{}" ,
1980- & command. iter( ) . collect:: <String >( ) ,
1981- ) ;
1982- move_to ( current_pos, 2 ) ;
1983- screen. flush ( ) ?;
1984- continue ;
19851987 } else {
19861988 continue ;
19871989 }
1988- } else {
1989- continue ;
19901990 }
19911991 }
1992- }
19931992
1994- match code {
1995- KeyCode :: Esc => {
1993+ ( KeyCode :: Esc , KeyModifiers :: NONE ) => {
19961994 go_to_info_line_and_reset ( ) ;
19971995 hide_cursor ( ) ;
19981996 state. move_cursor ( state. layout . y ) ;
19991997 break ' command;
20001998 }
20011999
2002- KeyCode :: Left => {
2000+ ( KeyCode :: Left , KeyModifiers :: NONE ) => {
20032001 if current_char_pos == 0 {
20042002 continue ;
20052003 } ;
@@ -2014,7 +2012,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
20142012 }
20152013 }
20162014
2017- KeyCode :: Right => {
2015+ ( KeyCode :: Right , KeyModifiers :: NONE ) => {
20182016 if current_char_pos == command. len ( ) {
20192017 continue ;
20202018 } ;
@@ -2029,7 +2027,8 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
20292027 }
20302028 }
20312029
2032- KeyCode :: Backspace => {
2030+ ( KeyCode :: Backspace , KeyModifiers :: NONE )
2031+ | ( KeyCode :: Char ( 'h' ) , KeyModifiers :: CONTROL ) => {
20332032 if current_char_pos == 0 {
20342033 continue ;
20352034 } ;
@@ -2049,7 +2048,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
20492048 }
20502049 }
20512050
2052- KeyCode :: Char ( c) => {
2051+ ( KeyCode :: Char ( c) , KeyModifiers :: NONE ) => {
20532052 if let Some ( to_be_added) =
20542053 unicode_width:: UnicodeWidthChar :: width ( c)
20552054 {
@@ -2071,7 +2070,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
20712070 }
20722071 }
20732072
2074- KeyCode :: Enter => {
2073+ ( KeyCode :: Enter , KeyModifiers :: NONE ) => {
20752074 hide_cursor ( ) ;
20762075 //Set the command and argument(s).
20772076 let commands: String = command. iter ( ) . collect ( ) ;
0 commit comments