Skip to content

Commit

Permalink
Fix bug of issue #3
Browse files Browse the repository at this point in the history
Bug:
- When pressing 'backspace' in TUI while one of the InputModes Add,
  Remove or Search is active, a character is printed instead of
  deleting the last character.
  • Loading branch information
robert-lag committed Oct 2, 2022
1 parent c1da0e5 commit f2c50cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "brn"
version = "2.3.1"
version = "2.3.2"
authors = ["Robert Lag <[email protected]"]
edition = "2018"

Expand All @@ -24,4 +24,4 @@ clipboard = "~0.5.0"
serde = { version = "~1.0.137", features = ["derive"] }
serde_json = "~1.0.82"
string-builder = "~0.2.0"
include_dir = "0.6"
include_dir = "0.6"
22 changes: 11 additions & 11 deletions src/brn_tui/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ impl BrnTui {
tui_data.edit_text.clear();
tui_data.note_name_cache.clear();
}
}
KeyCode::Char(c) => {
tui_data.edit_text.push(c);
},
KeyCode::Backspace => {
tui_data.edit_text.pop();
},
KeyCode::Char(c) => {
tui_data.edit_text.push(c);
},
_ => (),
},
InputMode::Remove => match key.code {
Expand All @@ -143,13 +143,13 @@ impl BrnTui {
}
}
tui_data.input_mode = InputMode::Normal;
}
KeyCode::Char(c) => {
tui_data.edit_text.push(c);
},
KeyCode::Backspace => {
tui_data.edit_text.pop();
},
KeyCode::Char(c) => {
tui_data.edit_text.push(c);
},
_ => (),
},
InputMode::Search => match key.code {
Expand All @@ -158,13 +158,13 @@ impl BrnTui {
tui_data.input_mode = InputMode::Normal;
BrnTui::execute_search(tui_data, settings);
tui_data.note_list_title = tui_data.search_text.get_displayed_text();
}
KeyCode::Char(c) => {
tui_data.search_text.push(c);
},
KeyCode::Backspace => {
tui_data.search_text.pop();
},
KeyCode::Char(c) => {
tui_data.search_text.push(c);
},
_ => (),
},
}
Expand Down Expand Up @@ -193,7 +193,7 @@ impl BrnTui {
].as_ref()
)
.split(vertical_chunks[0]);

BrnTui::render_note_list(f, horizontal_chunks[0], tui_data);
BrnTui::render_note_preview(f, horizontal_chunks[1], tui_data);
BrnTui::render_message_block(f, vertical_chunks[1].inner(&Margin {vertical: 0, horizontal: 1}), tui_data);
Expand Down Expand Up @@ -371,4 +371,4 @@ impl BrnTui {
EnableMouseCapture
).unwrap();
}
}
}
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ fn exec_get_name_command(matches: &ArgMatches, settings: &mut Settings) {
if !Directory::is_zettelkasten_dir(&settings.notes_dir, false) {
return;
}

let note_id = matches.value_of("id").unwrap_or_default();
NoteUtility::print_note_name_of(note_id);
}
Expand All @@ -360,7 +360,7 @@ fn exec_get_file_name_command(matches: &ArgMatches, settings: &mut Settings) {
if !Directory::is_zettelkasten_dir(&settings.notes_dir, false) {
return;
}

let note_id = matches.value_of("id").unwrap_or_default();
NoteUtility::print_file_name_of(note_id);
}
Expand All @@ -377,4 +377,4 @@ fn exec_graph_command(_matches: &ArgMatches, settings: &mut Settings) {
Message::error(&error);
}
}
}
}

0 comments on commit f2c50cb

Please sign in to comment.