diff options
author | Daniel Lange <DLange@git.local> | 2020-12-07 10:26:02 +0100 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2020-12-07 10:26:02 +0100 |
commit | d67ee86091f9e07f8d85c1fb77c7c58989e676bb (patch) | |
tree | 900f5e62bfd8e8c082be75a94f5348dea819beba /ColumnsPanel.c | |
parent | 3cbc50cde37fee19ce98ee8260b0a6095b829c4c (diff) | |
parent | 65357c8c46154de4e4eca14075bfe5523bb5fc14 (diff) | |
download | debian_htop-d67ee86091f9e07f8d85c1fb77c7c58989e676bb.tar.gz debian_htop-d67ee86091f9e07f8d85c1fb77c7c58989e676bb.tar.bz2 debian_htop-d67ee86091f9e07f8d85c1fb77c7c58989e676bb.zip |
Update upstream source from tag 'upstream/3.0.3'
Update to upstream version '3.0.3'
with Debian dir 8a3a733dc80e45b1cde220f88fcfd815869742f0
Diffstat (limited to 'ColumnsPanel.c')
-rw-r--r-- | ColumnsPanel.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/ColumnsPanel.c b/ColumnsPanel.c index 587175c..b2a8246 100644 --- a/ColumnsPanel.c +++ b/ColumnsPanel.c @@ -1,20 +1,22 @@ /* htop - ColumnsPanel.c (C) 2004-2011 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ #include "ColumnsPanel.h" -#include "Platform.h" -#include "StringUtils.h" -#include "ListItem.h" -#include "CRT.h" - -#include <assert.h> -#include <stdlib.h> #include <ctype.h> +#include <stdlib.h> + +#include "CRT.h" +#include "FunctionBar.h" +#include "ListItem.h" +#include "Object.h" +#include "Process.h" +#include "ProvideCurses.h" +#include "XUtils.h" static const char* const ColumnsFunctions[] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL}; @@ -43,7 +45,9 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) { if (selected < size - 1) { this->moving = !(this->moving); Panel_setSelectionColor(super, this->moving ? CRT_colors[PANEL_SELECTION_FOLLOW] : CRT_colors[PANEL_SELECTION_FOCUS]); - ((ListItem*)Panel_getSelected(super))->moving = this->moving; + ListItem* selectedItem = (ListItem*) Panel_getSelected(super); + if (selectedItem) + selectedItem->moving = this->moving; result = HANDLED; } break; @@ -91,7 +95,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) { } default: { - if (ch < 255 && isalpha(ch)) + if (0 < ch && ch < 255 && isgraph((unsigned char)ch)) result = Panel_selectByTyping(super, ch); if (result == BREAK_LOOP) result = IGNORED; @@ -103,7 +107,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) { return result; } -PanelClass ColumnsPanel_class = { +const PanelClass ColumnsPanel_class = { .super = { .extends = Class(Panel), .delete = ColumnsPanel_delete @@ -130,20 +134,11 @@ ColumnsPanel* ColumnsPanel_new(Settings* settings) { return this; } -int ColumnsPanel_fieldNameToIndex(const char* name) { - for (int j = 1; j <= Platform_numberOfFields; j++) { - if (String_eq(name, Process_fields[j].name)) { - return j; - } - } - return -1; -} - void ColumnsPanel_update(Panel* super) { ColumnsPanel* this = (ColumnsPanel*) super; int size = Panel_size(super); this->settings->changed = true; - this->settings->fields = xRealloc(this->settings->fields, sizeof(ProcessField) * (size+1)); + this->settings->fields = xRealloc(this->settings->fields, sizeof(ProcessField) * (size + 1)); this->settings->flags = 0; for (int i = 0; i < size; i++) { int key = ((ListItem*) Panel_get(super, i))->key; |