diff --git a/docs/en/src/messages.md b/docs/en/src/messages.md
index 6631ef7..a4ec19b 100644
--- a/docs/en/src/messages.md
+++ b/docs/en/src/messages.md
@@ -281,7 +281,7 @@ YAML: `FollowSymlink`
Set the input prompt temporarily, until the input buffer is reset.
-Type: { SetInputPrompt = nullable string }
+Type: { SetInputPrompt = string }
Example:
diff --git a/src/app.rs b/src/app.rs
index e3ff7da..6612254 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -154,7 +154,7 @@ pub struct LuaContextLight {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct InputBuffer {
pub buffer: Option,
- pub prompt: Option,
+ pub prompt: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -285,7 +285,7 @@ impl App {
let input = InputBuffer {
buffer: Default::default(),
- prompt: config.general.prompt.format.clone(),
+ prompt: config.general.prompt.format.clone().unwrap_or_default(),
};
let mut app = Self {
@@ -808,7 +808,7 @@ impl App {
}
}
- fn set_input_prompt(mut self, p: Option) -> Result {
+ fn set_input_prompt(mut self, p: String) -> Result {
self.input.prompt = p;
Ok(self)
}
@@ -883,7 +883,13 @@ impl App {
fn reset_input_buffer(mut self) -> Result {
self.input = InputBuffer {
buffer: Default::default(),
- prompt: self.config.general.prompt.format.clone(),
+ prompt: self
+ .config
+ .general
+ .prompt
+ .format
+ .to_owned()
+ .unwrap_or_default(),
};
Ok(self)
}
diff --git a/src/msg/in_/external.rs b/src/msg/in_/external.rs
index e67cede..6922d98 100644
--- a/src/msg/in_/external.rs
+++ b/src/msg/in_/external.rs
@@ -242,13 +242,13 @@ pub enum ExternalMsg {
/// Set the input prompt temporarily, until the input buffer is reset.
///
- /// Type: { SetInputPrompt = nullable string }
+ /// Type: { SetInputPrompt = string }
///
/// Example:
///
/// - Lua: `{ SetInputPrompt = "→" }`
/// - YAML: `SetInputPrompt: →`
- SetInputPrompt(Option),
+ SetInputPrompt(String),
/// Update the input buffer using cursor based operations.
///
diff --git a/src/ui.rs b/src/ui.rs
index e138254..d17c86d 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -817,12 +817,7 @@ fn draw_input_buffer(
1
} else {
0
- } + app
- .input
- .prompt
- .as_ref()
- .map(|t| t.chars().count() as u16)
- .unwrap_or(0);
+ } + app.input.prompt.chars().count() as u16;
let cursor_offset_right = if config
.borders
@@ -841,7 +836,7 @@ fn draw_input_buffer(
let input_buf = Paragraph::new(Spans::from(vec![
Span::styled(
- app.input.prompt.to_owned().unwrap_or_default(),
+ app.input.prompt.to_owned(),
app.config.general.prompt.style.to_owned().into(),
),
Span::raw(input.value()),