summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-01-10 16:43:24 +0100
committerChristian Göttsche <cgzones@googlemail.com>2021-01-10 16:43:24 +0100
commitfbaa0cd146a5d615057d01222bb85fec661b3c7c (patch)
treef11a1b0f287c1b24b4988c2131cc66ba7f8b9a2e
parenta076488809b2f4a05a1aa19d6599a9cfc9a97018 (diff)
Exit follow mode cleanly after followed process dies
-rw-r--r--ProcessList.c12
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;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy