Skip to content

Commit a6773bc

Browse files
committed
update keybinding
1 parent 4f05609 commit a6773bc

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

src/app/key_binding.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ generate_keybindings! {
2424
esc,
2525
help,
2626
refresh,
27-
submit,
2827
toggle_theme,
2928
cycle_main_views,
3029
jump_to_decoder,
@@ -93,12 +92,6 @@ pub const DEFAULT_KEYBINDING: KeyBindings = KeyBindings {
9392
desc: "Help page",
9493
context: HContext::General,
9594
},
96-
submit: KeyBinding {
97-
key: Key::Enter,
98-
alt: None,
99-
desc: "Select item",
100-
context: HContext::General,
101-
},
10295
refresh: KeyBinding {
10396
key: Key::Ctrl('r'),
10497
alt: None,
@@ -184,8 +177,8 @@ pub const DEFAULT_KEYBINDING: KeyBindings = KeyBindings {
184177
context: HContext::Decoder,
185178
},
186179
toggle_input_edit: KeyBinding {
187-
key: Key::Char('e'),
188-
alt: None,
180+
key: Key::Enter,
181+
alt: Some(Key::Char('e')),
189182
desc: "Enable text input edit mode",
190183
context: HContext::Editable,
191184
},

src/handlers/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ pub fn handle_key_events(key: Key, key_event: KeyEvent, app: &mut App) {
6060
}
6161
_ if key == DEFAULT_KEYBINDING.cycle_main_views.key => app.cycle_main_routes(),
6262

63-
_ if key == DEFAULT_KEYBINDING.toggle_input_edit.key => handle_edit_event(app),
63+
_ if key == DEFAULT_KEYBINDING.toggle_input_edit.key
64+
|| key == DEFAULT_KEYBINDING.toggle_input_edit.alt.unwrap() =>
65+
{
66+
handle_edit_event(app)
67+
}
6468

6569
_ if key == DEFAULT_KEYBINDING.copy_to_clipboard.key => handle_copy_event(app),
6670

@@ -283,7 +287,7 @@ mod tests {
283287
app.route_decoder();
284288
assert_eq!(app.data.decoder.encoded.input_mode, InputMode::Normal);
285289

286-
let key_evt = KeyEvent::from(KeyCode::Char('e'));
290+
let key_evt = KeyEvent::from(KeyCode::Enter);
287291
handle_key_events(Key::from(key_evt), key_evt, &mut app);
288292
assert_eq!(app.data.decoder.encoded.input_mode, InputMode::Editing);
289293

src/ui/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ mod tests {
159159
.unwrap();
160160

161161
let mut expected = Buffer::with_lines(vec![
162-
r#"┌ Encoded Token (<e> edit | <c> copy) ───────────┐┌ Header: Algorithm & Token Type ────────────────┐"#,
162+
r#"┌ Encoded Token (<enter> edit | <c> copy) ───────┐┌ Header: Algorithm & Token Type ────────────────┐"#,
163163
r#"│┌──────────────────────────────────────────────┐││{ │"#,
164164
r#"││eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiO│││ "typ": "JWT", │"#,
165165
r#"││iIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF│││ "alg": "HS256" │"#,

src/ui/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ mod tests {
177177
.unwrap();
178178

179179
let mut expected = Buffer::with_lines(vec![
180-
r#"┌ Header: Algorithm & Token Type (<e> edit | <c> ┐┌ Verify Signature ──────────────────────────────┐"#,
180+
r#"┌ Header: Algorithm & Token Type (<enter> edit | ┐┌ Verify Signature ──────────────────────────────┐"#,
181181
r#"│┌──────────────────────────────────────────────┐││Prepend 'b64:' for base64 encoded secret. Prepen│"#,
182182
r#"││{ │││┌──────────────────────────────────────────────┐│"#,
183183
r#"││ "alg": "HS256", ││││secret ││"#,

src/ui/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ pub fn render_input_widget(
223223
pub fn get_hint(input_mode: &InputMode, is_active: bool) -> &str {
224224
if is_active {
225225
match input_mode {
226-
InputMode::Normal => "(<e> edit | <c> copy) ",
226+
InputMode::Normal => "(<enter> edit | <c> copy) ",
227227
InputMode::Editing => "(<esc> stop editing | <ctrl+d> clear) ",
228228
}
229229
} else {

0 commit comments

Comments
 (0)