summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2020-09-15 09:33:58 +1000
committerNathan Scott <nathans@redhat.com>2020-09-15 09:33:58 +1000
commitc9ecd0fa74a11278afcab063c905325873462dd2 (patch)
tree88ab7f0efeac6e8ee9e34c208f85d472f35e75bd
parentf6662f97fdfa6f18a9be9504018158f1353d4cd9 (diff)
Revert the vim_mode setting for now, needs a rethink
There have been too many bugs reported in vim_mode, and the proposed fixes are increasingly fragile - hence we have decided to back it out for now. For reference: https://github.com/htop-dev/htop/issues/69 https://github.com/htop-dev/htop/pull/37 https://github.com/htop-dev/htop/pull/106 The whitespace changes also arrived in commit 12805f61d not sure what that was about, but backed out as well.
-rw-r--r--DisplayOptionsPanel.c1
-rw-r--r--ScreenManager.c16
-rw-r--r--Settings.c10
-rw-r--r--Settings.h2
4 files changed, 0 insertions, 29 deletions
diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c
index cfbaba90..6978e238 100644
--- a/DisplayOptionsPanel.c
+++ b/DisplayOptionsPanel.c
@@ -87,7 +87,6 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Also show CPU percentage numerically"), &(settings->showCPUUsage)));
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Also show CPU frequency"), &(settings->showCPUFrequency)));
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Enable the mouse"), &(settings->enableMouse)));
- Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Enable vim mode"), &(settings->vimMode)));
#ifdef HAVE_LIBHWLOC
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Show topology when selecting affinity by default"), &(settings->topologyAffinity)));
#endif
diff --git a/ScreenManager.c b/ScreenManager.c
index 24d292dd..92e792b4 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -163,22 +163,6 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
set_escdelay(25);
ch = getch();
- if (this->settings->vimMode) {
- switch (ch) {
- case 'h': ch = KEY_LEFT; break;
- case 'j': ch = KEY_DOWN; break;
- case 'k': ch = KEY_UP; break;
- case 'l': ch = KEY_RIGHT; break;
- case KEY_LEFT: ch = 'h'; break;
- case KEY_DOWN: ch = 'j'; break;
- case KEY_UP: ch = 'k'; break;
- case KEY_RIGHT: ch = 'l'; break;
- case 'K': ch = 'k'; break;
- case 'J': ch = 'K'; break;
- case 'L': ch = 'l'; break;
- }
- }
-
HandlerResult result = IGNORED;
if (ch == KEY_MOUSE && this->settings->enableMouse) {
ch = ERR;
diff --git a/Settings.c b/Settings.c
index c9c75d4a..d6ef53b9 100644
--- a/Settings.c
+++ b/Settings.c
@@ -63,7 +63,6 @@ static void Settings_defaultMeters(Settings* this) {
this->columns[i].modes = xCalloc(sizes[i], sizeof(int));
this->columns[i].len = sizes[i];
}
-
int r = 0;
if (this->cpuCount > 8) {
this->columns[0].names[0] = xStrdup("LeftCPUs2");
@@ -83,7 +82,6 @@ static void Settings_defaultMeters(Settings* this) {
this->columns[0].modes[1] = BAR_METERMODE;
this->columns[0].names[2] = xStrdup("Swap");
this->columns[0].modes[2] = BAR_METERMODE;
-
this->columns[1].names[r] = xStrdup("Tasks");
this->columns[1].modes[r++] = TEXT_METERMODE;
this->columns[1].names[r] = xStrdup("LoadAverage");
@@ -114,13 +112,11 @@ static void readFields(ProcessField* fields, int* flags, const char* line) {
static bool Settings_read(Settings* this, const char* fileName) {
FILE* fd;
-
CRT_dropPrivileges();
fd = fopen(fileName, "r");
CRT_restorePrivileges();
if (!fd)
return false;
-
bool didReadMeters = false;
bool didReadFields = false;
for (;;) {
@@ -199,8 +195,6 @@ static bool Settings_read(Settings* this, const char* fileName) {
} else if (String_eq(option[0], "right_meter_modes")) {
Settings_readMeterModes(this, option[1], 1);
didReadMeters = true;
- } else if (String_eq(option[0], "vim_mode")) {
- this->vimMode = atoi(option[1]);
#ifdef HAVE_LIBHWLOC
} else if (String_eq(option[0], "topology_affinity")) {
this->topologyAffinity = !!atoi(option[1]);
@@ -284,7 +278,6 @@ bool Settings_write(Settings* this) {
fprintf(fd, "left_meter_modes="); writeMeterModes(this, fd, 0);
fprintf(fd, "right_meters="); writeMeters(this, fd, 1);
fprintf(fd, "right_meter_modes="); writeMeterModes(this, fd, 1);
- fprintf(fd, "vim_mode=%d\n", (int) this->vimMode);
#ifdef HAVE_LIBHWLOC
fprintf(fd, "topology_affinity=%d\n", (int) this->topologyAffinity);
#endif
@@ -293,7 +286,6 @@ bool Settings_write(Settings* this) {
}
Settings* Settings_new(int cpuCount) {
-
Settings* this = xCalloc(1, sizeof(Settings));
this->sortKey = PERCENT_CPU;
@@ -317,7 +309,6 @@ Settings* Settings_new(int cpuCount) {
#ifdef HAVE_LIBHWLOC
this->topologyAffinity = false;
#endif
-
this->fields = xCalloc(Platform_numberOfFields+1, sizeof(ProcessField));
// TODO: turn 'fields' into a Vector,
// (and ProcessFields into proper objects).
@@ -348,7 +339,6 @@ Settings* Settings_new(int cpuCount) {
htopDir = String_cat(home, "/.config/htop");
}
legacyDotfile = String_cat(home, "/.htoprc");
-
CRT_dropPrivileges();
(void) mkdir(configDir, 0700);
(void) mkdir(htopDir, 0700);
diff --git a/Settings.h b/Settings.h
index 0188b614..e1518eca 100644
--- a/Settings.h
+++ b/Settings.h
@@ -20,7 +20,6 @@ typedef struct {
typedef struct Settings_ {
char* filename;
-
MeterColumnSettings columns[2];
ProcessField* fields;
@@ -50,7 +49,6 @@ typedef struct Settings_ {
bool accountGuestInCPUMeter;
bool headerMargin;
bool enableMouse;
- bool vimMode;
#ifdef HAVE_LIBHWLOC
bool topologyAffinity;
#endif

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