Skip to content

Commit

Permalink
Clear previous lines in select(), fix code blocks
Browse files Browse the repository at this point in the history
Signed-off-by: Slendi <[email protected]>
  • Loading branch information
slendidev committed Feb 22, 2025
1 parent 021fbcf commit 135dcea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ impl CLI {
clear(stdout, visible_count);

for i in offset..(offset + visible_count).min(options.len()) {
execute!(io::stdout(), terminal::Clear(ClearType::CurrentLine)).unwrap();
if i == current_index {
print!("> ");
} else {
Expand Down
9 changes: 8 additions & 1 deletion src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,18 @@ pub async fn process_response(

println!("```{}", language);
if stdout_is_terminal {
let mut language = language.trim().to_owned();
if language == "csharp" {
language = "c#".to_owned();
} else if language == "fsharp" {
language = "f#".to_owned();
}

let mut pp = PrettyPrinter::new();
pp.input_from_bytes(current_code_block_content.as_bytes())
.colored_output(true);

if !language.trim().is_empty() {
if !language.is_empty() {
pp.language(&language);
}

Expand Down

0 comments on commit 135dcea

Please sign in to comment.