Merge branch 'following_exit' of cgzones/htop

This commit is contained in:
Daniel Lange 2021-01-11 09:36:25 +01:00
commit 0b89c66f58
1 changed files with 8 additions and 4 deletions

View File

@ -148,7 +148,7 @@ void ProcessList_remove(ProcessList* this, Process* p) {
Process* pp = Hashtable_remove(this->processTable, p->pid); Process* pp = Hashtable_remove(this->processTable, p->pid);
assert(pp == p); (void)pp; assert(pp == p); (void)pp;
unsigned int pid = p->pid; pid_t pid = p->pid;
int idx = Vector_indexOf(this->processes, p, Process_pidCompare); int idx = Vector_indexOf(this->processes, p, Process_pidCompare);
assert(idx != -1); assert(idx != -1);
@ -156,7 +156,12 @@ void ProcessList_remove(ProcessList* this, Process* p) {
Vector_remove(this->processes, idx); 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)); assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
} }
@ -493,7 +498,6 @@ void ProcessList_rebuildPanel(ProcessList* this) {
const char* incFilter = this->incFilter; const char* incFilter = this->incFilter;
int currPos = Panel_getSelectedIndex(this->panel); int currPos = Panel_getSelectedIndex(this->panel);
pid_t currPid = this->following != -1 ? this->following : 0;
int currScrollV = this->panel->scrollV; int currScrollV = this->panel->scrollV;
Panel_prune(this->panel); Panel_prune(this->panel);
@ -509,7 +513,7 @@ void ProcessList_rebuildPanel(ProcessList* this) {
continue; continue;
Panel_set(this->panel, idx, (Object*)p); 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); Panel_setSelected(this->panel, idx);
this->panel->scrollV = currScrollV; this->panel->scrollV = currScrollV;
} }