From f705b88e977cdd3c6abffb38cdb968c28a1d63ec Mon Sep 17 00:00:00 2001 From: Roland Schaer Date: Mon, 22 Jan 2024 11:14:17 -0300 Subject: [PATCH] fix: indent input by a space like the other inputs --- src/input.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/input.rs b/src/input.rs index e24b7e8..15b89fa 100644 --- a/src/input.rs +++ b/src/input.rs @@ -186,22 +186,22 @@ impl Input { out.set_color(&self.theme.title)?; match self.inline { true => write!(out, "{}", self.title)?, - false => writeln!(out, "{}", self.title)?, + false => writeln!(out, " {}", self.title)?, } out.set_color(&self.theme.description)?; if !self.description.is_empty() { match self.inline { true => write!(out, "{}", self.description)?, - false => writeln!(out, "{}", self.description)?, + false => writeln!(out, " {}", self.description)?, } } out.set_color(&self.theme.input_prompt)?; if !self.prompt.is_empty() { match self.inline { - true => write!(out, "> ")?, - false => write!(out, "{}", self.prompt)?, + true => write!(out, ">")?, + false => write!(out, " {}", self.prompt)?, } } out.reset()?; @@ -213,6 +213,7 @@ impl Input { .move_cursor_left(self.placeholder.chars().count())?; out.reset()?; } + write!(out, "{}", &self.render_input()?)?; Ok(std::str::from_utf8(out.as_slice()).unwrap().to_string()) @@ -229,7 +230,7 @@ impl Input { fn render_success(&mut self) -> io::Result { let mut out = Buffer::ansi(); out.set_color(&self.theme.title)?; - write!(out, "{}", self.title)?; + write!(out, " {}", self.title)?; out.set_color(&self.theme.selected_option)?; writeln!(out, " {}", &self.render_input()?.to_string())?; out.reset()?;