Skip to content

Commit

Permalink
improve mouse position calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
nnyyxxxx committed Nov 13, 2024
1 parent c789c46 commit d339441
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tui/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ impl AppState {
if mouse_in_list {
self.focus = Focus::List;
if let Some(areas) = &self.areas {
let relative_y = position.y.saturating_sub(areas.list.y + 1);
let list_start = areas.list.y + 4;
let relative_y = position.y.saturating_sub(list_start);
let list_len = self.filter.item_list().len();
if relative_y < list_len as u16 {
self.selection.select(Some(relative_y as usize));
Expand Down

0 comments on commit d339441

Please sign in to comment.