Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoine committed Apr 15, 2024
1 parent bf7b07f commit 27ba247
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,24 @@ fn render_data(frame: &mut Frame, app: &mut App, config: &Config) {

if show_line_numbers {
let rect_lines_without_bottom_bar = Rect::new(0, 0, line_numbers_width, data_frame_height);

// skip the two first lines
let mut lines = vec![ListItem::new(Line::from("")); 2];
for i in 1..(selected + 1 - margin_offset) {
// add the lines at the top
for i in (1..(selected + 1 - margin_offset)).rev() {
lines.push(ListItem::new(Line::from(format!("{}", i))));
}
// add selected line
lines.push(ListItem::new(Line::from(format!("{}", selected + 1))));
// add the lines at the top
for i in 1..(height as usize - selected - 1) {
lines.push(ListItem::new(Line::from(format!("{}", i))));
}

frame.render_stateful_widget(
List::new(lines),
List::new(lines).highlight_style(highlight_style),
rect_lines_without_bottom_bar,
&mut ListState::default().with_offset(margin_offset),
&mut ListState::default().with_selected(Some(selected)),
);
}

Expand Down

0 comments on commit 27ba247

Please sign in to comment.