aboutsummaryrefslogtreecommitdiffstats
path: root/ColumnsPanel.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
committerDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
commit65357c8c46154de4e4eca14075bfe5523bb5fc14 (patch)
tree8f430ee5a0d5de377c4e7c94e47842a27c70d7e8 /ColumnsPanel.c
parentf80394a20254938142011855f2954b3f63fe5909 (diff)
downloaddebian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.gz
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.bz2
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.zip
New upstream version 3.0.3upstream/3.0.3
Diffstat (limited to 'ColumnsPanel.c')
-rw-r--r--ColumnsPanel.c37
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;

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