summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaoru <k@warpnine.io>2023-12-04 21:12:10 +0900
committerkaoru <k@warpnine.io>2023-12-04 21:12:10 +0900
commit9bfa48bf2b954b8659dded135cdd11db5e3b12ee (patch)
treeba26ec20f9b615fd44274f3c15f06ef23abe65e5
parent7ca831204017a8bb907fcdfd955fe321d4cd14cb (diff)
fix: handle modifier for `c` command correctly
-rw-r--r--src/run.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/run.rs b/src/run.rs
index 16245b8..d589b57 100644
--- a/src/run.rs
+++ b/src/run.rs
@@ -1181,9 +1181,9 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
code, modifiers, ..
}) = event::read()?
{
- match code {
+ match (code, modifiers) {
//rename item
- KeyCode::Enter => {
+ (KeyCode::Enter, KeyModifiers::NONE) => {
let rename = rename.iter().collect::<String>();
let mut to = state.current_dir.clone();
to.push(rename);
@@ -1208,14 +1208,14 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
break;
}
- KeyCode::Esc => {
+ (KeyCode::Esc, KeyModifiers::NONE) => {
go_to_info_line_and_reset();
hide_cursor();
state.move_cursor(state.layout.y);
break;
}
- KeyCode::Left => {
+ (KeyCode::Left, KeyModifiers::NONE) => {
if current_char_pos == 0 {
continue;
};
@@ -1230,7 +1230,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
}
}
- KeyCode::Right => {
+ (KeyCode::Right, KeyModifiers::NONE) => {
if current_char_pos == rename.len() {
continue;
};
@@ -1245,9 +1245,8 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
}
}
- KeyCode::Backspace | KeyCode::Char('h')
- if modifiers == KeyModifiers::CONTROL =>
- {
+ (KeyCode::Backspace, KeyModifiers::NONE)
+ | (KeyCode::Char('h'), KeyModifiers::CONTROL) => {
if current_char_pos == 0 {
continue;
};
@@ -1267,7 +1266,7 @@ fn _run(mut state: State, session_path: PathBuf) -> Result<(), FxError> {
}
}
- KeyCode::Char(c) => {
+ (KeyCode::Char(c), KeyModifiers::NONE) => {
if let Some(to_be_added) =
unicode_width::UnicodeWidthChar::width(c)
{