From 5646379bd7e93c5d44c16de07ba67bedd6002adf Mon Sep 17 00:00:00 2001 From: nicolargo Date: Mon, 20 Jul 2020 10:19:50 +0200 Subject: [PATCH] Make the kill feature works while in filtered mode --- glances/outputs/glances_curses.py | 3 ++- glances/processes.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 2a1afce3..2f892894 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -418,7 +418,8 @@ class _GlancesCurses(object): self.args.cursor_position -= 1 elif self.pressedkey == curses.KEY_DOWN or self.pressedkey == 66: # 'DOWN' > Down in the server list - if self.args.cursor_position < glances_processes.max_processes - 2: + # if self.args.cursor_position < glances_processes.max_processes - 2: + if self.args.cursor_position < glances_processes.processes_count: self.args.cursor_position += 1 elif self.pressedkey == ord('\x1b') or self.pressedkey == ord('q'): # 'ESC'|'q' > Quit diff --git a/glances/processes.py b/glances/processes.py index 6c05c39f..b7dfe70d 100644 --- a/glances/processes.py +++ b/glances/processes.py @@ -176,6 +176,11 @@ class GlancesProcesses(object): else: return None + @property + def processes_count(self): + """Get the current number of processes showed in the UI.""" + return min(self._max_processes - 2, glances_processes.processcount['total'] - 1) + @property def max_processes(self): """Get the maximum number of processes showed in the UI."""