Handle mouse clicks on the scrollbar
This commit is contained in:
parent
49c6a31742
commit
91b6a799c8
9
nncmpp.c
9
nncmpp.c
|
@ -1324,6 +1324,15 @@ app_process_left_mouse_click (int line, int column)
|
|||
|| row_index >= (int) tab->item_count - tab->item_top)
|
||||
return;
|
||||
|
||||
// TODO: handle the scrollbar a bit better than this
|
||||
int visible_items = app_visible_items ();
|
||||
if ((int) tab->item_count > visible_items && column == COLS - 1)
|
||||
{
|
||||
tab->item_top = (float) row_index / visible_items
|
||||
* (int) tab->item_count - visible_items / 2;
|
||||
app_fix_view_range ();
|
||||
}
|
||||
else
|
||||
tab->item_selected = row_index + tab->item_top;
|
||||
app_redraw_view ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue