Skip to content

Commit

Permalink
Allow customization of the submit command key
Browse files Browse the repository at this point in the history
  • Loading branch information
doonv committed Apr 26, 2024
1 parent 4afc25a commit 4e3a764
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ pub struct ConsoleConfig {
pub theme: ConsoleTheme,
/// The key used to open the developer console.
pub open_key: KeyCode,
/// The key used to submit a command to the command parser.
pub submit_key: KeyCode
}

impl Default for ConsoleConfig {
fn default() -> Self {
Self {
theme: ConsoleTheme::ONE_DARK,
open_key: KeyCode::Backquote,
submit_key: KeyCode::Enter
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub(crate) fn render_ui(
}
};

if key.just_pressed(KeyCode::Enter) {
if key.just_pressed(config.submit_key) {
submit_command(&mut state.command);
}

Expand Down

0 comments on commit 4e3a764

Please sign in to comment.