mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 22:04:26 +08:00
Improve hold browser keyboard behavior
* unselected Up now selects the last *visible* item * fix top selection warping regression
This commit is contained in:
+8
-3
@@ -731,11 +731,16 @@ int Fl_Browser_::handle(int event) {
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
case FL_Up:
|
case FL_Up:
|
||||||
l = nullptr; // Preselected item is useless here
|
|
||||||
if (selection_)
|
if (selection_)
|
||||||
|
// find the item before the selected one
|
||||||
l = item_prev(selection_);
|
l = item_prev(selection_);
|
||||||
if (!l)
|
else {
|
||||||
l = item_last();
|
// find the last visible item
|
||||||
|
l = find_item(y()+h()-incr_height()/2);
|
||||||
|
if (!l)
|
||||||
|
// if that fails, start from the end of the list
|
||||||
|
l = item_last();
|
||||||
|
}
|
||||||
while (l) {
|
while (l) {
|
||||||
if (item_height(l)>0) {
|
if (item_height(l)>0) {
|
||||||
select_only(l, when() & ~FL_WHEN_NOT_CHANGED);
|
select_only(l, when() & ~FL_WHEN_NOT_CHANGED);
|
||||||
|
|||||||
Reference in New Issue
Block a user