mirror of https://github.com/xzeldon/htop.git
Don't select last item when clicking past the end of the panel.
This commit is contained in:
parent
6082db2121
commit
3c4326b450
5
Panel.c
5
Panel.c
|
@ -254,7 +254,10 @@ int Panel_size(Panel* this) {
|
||||||
void Panel_setSelected(Panel* this, int selected) {
|
void Panel_setSelected(Panel* this, int selected) {
|
||||||
assert (this != NULL);
|
assert (this != NULL);
|
||||||
|
|
||||||
selected = MIN(Vector_size(this->items) - 1, selected);
|
int size = Vector_size(this->items);
|
||||||
|
if (selected >= size) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (selected < 0)
|
if (selected < 0)
|
||||||
selected = 0;
|
selected = 0;
|
||||||
this->selected = selected;
|
this->selected = selected;
|
||||||
|
|
Loading…
Reference in New Issue