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-24 00:00:00 -05:00 committed by Craig Small
parent 474847ed35
commit d7e6c27a79

View File

@ -4937,6 +4937,11 @@ static void forest_excluded (WIN_t *q) {
while (i+1 < Frame_maxtask && q->ppt[i+1]->pad_3 > 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
}
}
} // end: forest_excluded
@ -6511,7 +6516,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)