diff options
author | Daniel Lange <DLange@git.local> | 2021-01-11 09:36:25 +0100 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2021-01-11 09:36:25 +0100 |
commit | 0b89c66f58b5d79d3948ba80da6faab139afdcc9 (patch) | |
tree | f11a1b0f287c1b24b4988c2131cc66ba7f8b9a2e | |
parent | a076488809b2f4a05a1aa19d6599a9cfc9a97018 (diff) | |
parent | fbaa0cd146a5d615057d01222bb85fec661b3c7c (diff) |
Merge branch 'following_exit' of cgzones/htop
-rw-r--r-- | ProcessList.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ProcessList.c b/ProcessList.c index ed6459ca..055ad1f1 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -148,7 +148,7 @@ void ProcessList_remove(ProcessList* this, Process* p) { Process* pp = Hashtable_remove(this->processTable, p->pid); assert(pp == p); (void)pp; - unsigned int pid = p->pid; + pid_t pid = p->pid; int idx = Vector_indexOf(this->processes, p, Process_pidCompare); assert(idx != -1); @@ -156,7 +156,12 @@ void ProcessList_remove(ProcessList* this, Process* p) { Vector_remove(this->processes, idx); } - assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid; + if (this->following != -1 && this->following == pid) { + this->following = -1; + Panel_setSelectionColor(this->panel, PANEL_SELECTION_FOCUS); + } + + assert(Hashtable_get(this->processTable, pid) == NULL); assert(Hashtable_count(this->processTable) == Vector_count(this->processes)); } @@ -493,7 +498,6 @@ void ProcessList_rebuildPanel(ProcessList* this) { const char* incFilter = this->incFilter; int currPos = Panel_getSelectedIndex(this->panel); - pid_t currPid = this->following != -1 ? this->following : 0; int currScrollV = this->panel->scrollV; Panel_prune(this->panel); @@ -509,7 +513,7 @@ void ProcessList_rebuildPanel(ProcessList* this) { continue; Panel_set(this->panel, idx, (Object*)p); - if ((this->following == -1 && idx == currPos) || (this->following != -1 && p->pid == currPid)) { + if ((this->following == -1 && idx == currPos) || (this->following != -1 && p->pid == this->following)) { Panel_setSelected(this->panel, idx); this->panel->scrollV = currScrollV; } |