Skip to content

Commit 7ce50bc

Browse files
fix: newline printing on requests, panic with /prompts (#355)
1 parent bed5a9b commit 7ce50bc

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

crates/chat-cli/src/cli/chat/cli/prompts.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ impl PromptsArgs {
170170
.is_some_and(|args| !args.is_empty())
171171
{
172172
let name_width = UnicodeWidthStr::width(bundle.prompt_get.name.as_str());
173-
let padding = arg_pos.saturating_sub(name_width) - UnicodeWidthStr::width("- ");
174-
" ".repeat(padding)
173+
let padding = arg_pos
174+
.saturating_sub(name_width)
175+
.saturating_sub(UnicodeWidthStr::width("- "));
176+
" ".repeat(padding.max(1))
175177
} else {
176178
"\n".to_owned()
177179
}

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,6 @@ impl ChatSession {
14271427
queue!(self.stderr, style::SetForegroundColor(Color::Magenta))?;
14281428
queue!(self.stderr, style::SetForegroundColor(Color::Reset))?;
14291429
queue!(self.stderr, cursor::Hide)?;
1430-
execute!(self.stderr, style::Print("\n"))?;
14311430

14321431
if self.interactive {
14331432
self.spinner = Some(Spinner::new(Spinners::Dots, "Thinking...".to_owned()));
@@ -1631,10 +1630,8 @@ impl ChatSession {
16311630
queue!(
16321631
self.stderr,
16331632
style::SetForegroundColor(Color::Reset),
1634-
terminal::Clear(terminal::ClearType::CurrentLine),
16351633
cursor::MoveToColumn(0),
16361634
cursor::Show,
1637-
cursor::MoveUp(1),
16381635
terminal::Clear(terminal::ClearType::CurrentLine),
16391636
)?;
16401637
}

0 commit comments

Comments
 (0)