Skip to content

Commit

Permalink
option to configure PromptInputLine prompt
Browse files Browse the repository at this point in the history
- Introduces an option to set custom prompt text
- If 'prompt' not passed in parameters, default value of "> " used
  • Loading branch information
mgpinf committed Aug 28, 2024
1 parent 30345b3 commit 354e2c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions config/src/keyassignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,13 @@ pub struct PromptInputLine {
/// Descriptive text to show ahead of prompt
#[dynamic(default)]
pub description: String,
/// Text to show for prompt
#[dynamic(default = "default_prompt")]
pub prompt: String,
}

fn default_prompt() -> String {
"> ".to_string()
}

#[derive(Debug, Clone, PartialEq, FromDynamic, ToDynamic)]
Expand Down
2 changes: 1 addition & 1 deletion wezterm-gui/src/overlay/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn show_line_prompt_overlay(

let mut host = PromptHost::new();
let mut editor = LineEditor::new(&mut term);
editor.set_prompt("> ");
editor.set_prompt(&args.prompt);
let line = editor.read_line(&mut host)?;

promise::spawn::spawn_into_main_thread(async move {
Expand Down

0 comments on commit 354e2c7

Please sign in to comment.