Skip to content

Commit

Permalink
Fix select
Browse files Browse the repository at this point in the history
Signed-off-by: Slendi <[email protected]>
  • Loading branch information
slendidev committed Feb 25, 2025
1 parent 135dcea commit e319457
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ impl CLI {
terminal::enable_raw_mode().expect("Failed to set terminal to raw mode.");

let mut selected_indices: Vec<usize> = selected.to_vec();
println!("selected_indices: {:?}", selected_indices);
let mut current_index = selected.first().copied().unwrap_or(0);
let visible_count = 5.min(options.len());
write!(std::io::stdout(), "{}\r", prompt).unwrap();
Expand All @@ -475,9 +476,7 @@ impl CLI {
)
.unwrap();
}
for _ in 0..visible_count {
execute!(stdout, cursor::MoveUp(1)).unwrap();
}
execute!(stdout, cursor::MoveUp(visible_count as u16)).unwrap();
}

fn draw<T: ToString>(
Expand Down Expand Up @@ -566,7 +565,6 @@ impl CLI {
KeyCode::Char('c')
if key_event.modifiers.contains(KeyModifiers::CONTROL) =>
{
selected_indices.clear();
break;
}
_ => {}
Expand Down

0 comments on commit e319457

Please sign in to comment.