mirror of https://github.com/xzeldon/htop.git
commit
c5770c26af
4
Action.c
4
Action.c
|
@ -206,12 +206,12 @@ static Htop_Reaction actionSortByTime(State* st) {
|
||||||
|
|
||||||
static Htop_Reaction actionToggleKernelThreads(State* st) {
|
static Htop_Reaction actionToggleKernelThreads(State* st) {
|
||||||
st->settings->hideKernelThreads = !st->settings->hideKernelThreads;
|
st->settings->hideKernelThreads = !st->settings->hideKernelThreads;
|
||||||
return HTOP_RECALCULATE | HTOP_SAVE_SETTINGS;
|
return HTOP_RECALCULATE | HTOP_SAVE_SETTINGS | HTOP_KEEP_FOLLOWING;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Htop_Reaction actionToggleUserlandThreads(State* st) {
|
static Htop_Reaction actionToggleUserlandThreads(State* st) {
|
||||||
st->settings->hideUserlandThreads = !st->settings->hideUserlandThreads;
|
st->settings->hideUserlandThreads = !st->settings->hideUserlandThreads;
|
||||||
return HTOP_RECALCULATE | HTOP_SAVE_SETTINGS;
|
return HTOP_RECALCULATE | HTOP_SAVE_SETTINGS | HTOP_KEEP_FOLLOWING;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Htop_Reaction actionToggleProgramPath(State* st) {
|
static Htop_Reaction actionToggleProgramPath(State* st) {
|
||||||
|
|
|
@ -514,6 +514,7 @@ void ProcessList_rebuildPanel(ProcessList* this) {
|
||||||
Panel_prune(this->panel);
|
Panel_prune(this->panel);
|
||||||
int size = ProcessList_size(this);
|
int size = ProcessList_size(this);
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
bool foundFollowed = false;
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
Process* p = ProcessList_get(this, i);
|
Process* p = ProcessList_get(this, i);
|
||||||
|
@ -527,12 +528,19 @@ void ProcessList_rebuildPanel(ProcessList* this) {
|
||||||
Panel_set(this->panel, idx, (Object*)p);
|
Panel_set(this->panel, idx, (Object*)p);
|
||||||
|
|
||||||
if (this->following != -1 && p->pid == this->following) {
|
if (this->following != -1 && p->pid == this->following) {
|
||||||
|
foundFollowed = true;
|
||||||
Panel_setSelected(this->panel, idx);
|
Panel_setSelected(this->panel, idx);
|
||||||
this->panel->scrollV = currScrollV;
|
this->panel->scrollV = currScrollV;
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->following != -1 && !foundFollowed) {
|
||||||
|
/* Reset if current followed pid not found */
|
||||||
|
this->following = -1;
|
||||||
|
Panel_setSelectionColor(this->panel, PANEL_SELECTION_FOCUS);
|
||||||
|
}
|
||||||
|
|
||||||
if (this->following == -1) {
|
if (this->following == -1) {
|
||||||
/* If the last item was selected, keep the new last item selected */
|
/* If the last item was selected, keep the new last item selected */
|
||||||
if (currPos > 0 && currPos == currSize - 1)
|
if (currPos > 0 && currPos == currSize - 1)
|
||||||
|
|
Loading…
Reference in New Issue