diff options
author | Kyohei Uto <im@kyoheiu.dev> | 2023-12-10 04:56:42 +0900 |
---|---|---|
committer | Kyohei Uto <im@kyoheiu.dev> | 2023-12-10 04:56:42 +0900 |
commit | 78a2daa77c50a30cae661ed5dc04121aea441807 (patch) | |
tree | 6c23f8944e7c902467f06834203bcc86a4d2f68f | |
parent | e82b2ce7baab98d1367a75a0b6faff23b7ba2fde (diff) |
Fix: Allow SHIFT key to enter char
-rw-r--r-- | src/run.rs | 94 |
1 files changed, 47 insertions, 47 deletions
@@ -766,7 +766,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> { } } - (KeyCode::Char(c), KeyModifiers::NONE) => { + (KeyCode::Char(c), _) => { command.insert( (current_pos - INITIAL_POS_Z).into(), c, @@ -922,28 +922,6 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> { } } - (KeyCode::Char(c), KeyModifiers::NONE) => { - if let Some(to_be_added) = - unicode_width::UnicodeWidthChar::width(c) - { - if current_pos + to_be_added as u16 - > state.layout.terminal_column - { - continue; - } - new_name.insert(current_char_pos, c); - current_char_pos += 1; - current_pos += to_be_added as u16; - - go_to_info_line_and_reset(); - print!( - " {}", - &new_name.iter().collect::<String>(), - ); - move_to(current_pos, 2); - } - } - (KeyCode::Enter, KeyModifiers::NONE) => { hide_cursor(); //Set the command and argument(s). @@ -968,6 +946,28 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> { break 'insert; } + (KeyCode::Char(c), _) => { + if let Some(to_be_added) = + unicode_width::UnicodeWidthChar::width(c) + { + if current_pos + to_be_added as u16 + > state.layout.terminal_column + { + continue; + } + new_name.insert(current_char_pos, c); + current_char_pos += 1; + current_pos += to_be_added as u16; + + go_to_info_line_and_reset(); + print!( + " {}", + &new_name.iter().collect::<String>(), + ); + move_to(current_pos, 2); + } + } + _ => continue, } screen.flush()?; @@ -1293,7 +1293,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> { } } - (KeyCode::Char(c), KeyModifiers::NONE) => { + (KeyCode::Char(c), _) => { if let Some(to_be_added) = unicode_width::UnicodeWidthChar::width(c) { @@ -1432,7 +1432,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> { } } - (KeyCode::Char(c), KeyModifiers::NONE) => { + (KeyCode::Char(c), _) => { if let Some(to_be_added) = unicode_width::UnicodeWidthChar::width(c) { @@ -2048,28 +2048,6 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> { } } - (KeyCode::Char(c), KeyModifiers::NONE) => { - if let Some(to_be_added) = - unicode_width::UnicodeWidthChar::width(c) - { - if current_pos + to_be_added as u16 - > state.layout.terminal_column - { - continue; - } - command.insert(current_char_pos, c); - current_char_pos += 1; - current_pos += to_be_added as u16; - - go_to_info_line_and_reset(); - print!( - ":{}", - &command.iter().collect::<String>(), - ); - move_to(current_pos, 2); - } - } - (KeyCode::Enter, KeyModifiers::NONE) => { hide_cursor(); //Set the command and argument(s). @@ -2228,6 +2206,28 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> { break 'command; } + (KeyCode::Char(c), _) => { + if let Some(to_be_added) = + unicode_width::UnicodeWidthChar::width(c) + { + if current_pos + to_be_added as u16 + > state.layout.terminal_column + { + continue; + } + command.insert(current_char_pos, c); + current_char_pos += 1; + current_pos += to_be_added as u16; + + go_to_info_line_and_reset(); + print!( + ":{}", + &command.iter().collect::<String>(), + ); + move_to(current_pos, 2); + } + } + _ => continue, } screen.flush()?; |