Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: indent input by a space like the other inputs #18

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
Expand All @@ -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())
Expand All @@ -229,7 +230,7 @@ impl Input {
fn render_success(&mut self) -> io::Result<String> {
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()?;
Expand Down