top: ensure those potential focused tasks stay focused

When that 'F' focus command has been applied to a task
in forest view it should remain as the topmost process
in a particular window. But without this patch that is
not guaranteed. Newly forked/cloned tasks 'above' such
a process result in task(s) appearing which shouldn't.

The effect was as if that up arrow key scrolled beyond
the topmost parent task, which would never be allowed.

[ since scrolling is permitted within a focus range, ]
[ when any task 'above' our focus/topmost task ends, ]
[ we respond as if scrolled with the down arrow key. ]

[ that result is completely appropriate. if the user ]
[ wishes to return to a focused parent, the up arrow ]
[ or home key can be used to accomplish such a goal. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2021-09-23 00:00:00 -05:00 committed by Craig Small
parent f11f43b4f7
commit 69978e3650

View File

@ -4598,6 +4598,11 @@ static void forest_config (WIN_t *q) {
while (i+1 < PIDSmaxt && rSv(i+1) > level)
++i;
q->focus_end = i + 1; // make 'focus_end' a proper fencpost
// watch out for newly forked/cloned tasks 'above' us ...
if (q->begtask < q->focus_beg) {
q->begtask = q->focus_beg;
q->begnext = 0; // as 'mkVIZoff' but in any window
}
}
#undef rSv
} // end: forest_config
@ -6213,7 +6218,7 @@ static void window_hlp (void) {
reversed = 0;
// potentially scroll forward ...
if (w->begnext > beg) {
if (w->begnext > 0) {
fwd_redux:
for (i = w->begtask; i < end; i++) {
if (wins_usrselect(w, i)