default: // keep gcc happy
break;
}
- return Curwin = w;
+ Curwin = w;
+ mkVIZrow1(Curwin);
+ return Curwin;
} // end: win_select
; // avoid -Wunused-result
#endif
+ // with preserved 'other filters', ensure a visible task on row #1
+ mkVIZrow1(Curwin);
+
// lastly, initialize a signal set used to throttle one troublesome signal
sigemptyset(&Sigwinch_set);
#ifdef SIGNALS_LESS
if (!CHKw(q, Show_FOREST) || !p->pad_3) return which;
#ifndef TREE_VWINALL
- if (q == Curwin)
+ if (q == Curwin) // note: the following is NOT indented
#endif
if (p->pad_2 == 'x') {
snprintf(buf, sizeof(buf), "+%*s%s", ((4 * p->pad_3) - 1), "`- ", which);
}
}
if (i == Hide_tot) Hide_pid[Hide_tot++] = pid;
- // plenty of room, but if everything's expaned let's reset ...
+ // plenty of room, but if everything's expanded let's reset ...
for (i = 0; i < Hide_tot; i++)
if (Hide_pid[i] > 0) break;
if (i == Hide_tot) Hide_tot = 0;
case kbd_HOME:
#ifndef SCROLLVAR_NO
if (VIZCHKw(w)) if (CHKw(w, Show_IDLEPS)) w->begtask = w->begpflg = w->varcolbeg = 0;
+ mkVIZrow1(w);
#else
if (VIZCHKw(w)) if (CHKw(w, Show_IDLEPS)) w->begtask = w->begpflg = 0;
+ mkVIZrow1(w);
#endif
break;
case kbd_END:
pad_2: 'x' means a collapsed thread, 'z' means an unseen child
pad_3: where level number is stored (0 - 100) */
#ifndef TREE_VWINALL
- if (q == Curwin)
+ if (q == Curwin) // note: the following is NOT indented
#endif
if (CHKw(q, Show_FOREST) && p->pad_2 == 'z')
return "";
* A window_show *Helper* function ensuring that Curwin's 'begtask'
* represents a visible process (not any hidden/filtered-out task).
* In reality, this function is called:
- * 1) exclusively for the current window
- * 2) immediately after interacting with a user
- * 3) with the only key stuck: up, down, pgup, pgdn or end */
+ * 1) exclusively for the 'current' window
+ * 2) immediately after interacting with the user
+ * 3) who struck 1 of these: up, down, pgup, pgdn, home or end
+ * 4) or upon the user switching from one window to another window */
static void window_hlp (void) {
WIN_t *w = Curwin; // avoid gcc bloat with a local copy
- int i;
+ int i, reversed;
SETw(w, NOPRINT_xxx);
w->begtask += w->begnext;
- if (w->begtask < 0) w->begtask = 0;
- if (w->begtask >= Frame_maxtask) w->begtask = Frame_maxtask - 1;
+ // next 'if' will force a forward scan ...
+ if (w->begtask <= 0) { w->begtask = 0; w->begnext = +1; }
+ else if (w->begtask >= Frame_maxtask) w->begtask = Frame_maxtask - 1;
+ reversed = 0;
// potentially scroll forward ...
if (w->begnext > 0) {
+fwd_redux:
for (i = w->begtask; i < Frame_maxtask; i++) {
if (user_matched(w, w->ppt[i])
&& (*task_show(w, w->ppt[i])))
&& (*task_show(w, w->ppt[i])))
break;
}
- w->begtask = i;
+ // reached the top, but maybe this guy ain't visible
+ if (!(w->begtask = i) && !reversed) {
+ if (!(user_matched(w, w->ppt[0]))
+ || (!(*task_show(w, w->ppt[0])))) {
+ reversed = 1;
+ goto fwd_redux;
+ }
+ }
wrap_up:
w->begnext = 0;