aboutsummaryrefslogtreecommitdiffstats
path: root/ScreenManager.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-08-27 07:48:10 +0200
committerDaniel Lange <DLange@git.local>2020-08-27 07:48:10 +0200
commitf3147ea2d1598914c2db53e8cfb34c8ff81e2ff4 (patch)
tree3ee82b2af2ab3d38b6e4b07f3994516aac72f742 /ScreenManager.c
parentdf568a576f7b44ac5a2b9b7222c7f39d9932f626 (diff)
downloaddebian_htop-f3147ea2d1598914c2db53e8cfb34c8ff81e2ff4.tar.gz
debian_htop-f3147ea2d1598914c2db53e8cfb34c8ff81e2ff4.tar.bz2
debian_htop-f3147ea2d1598914c2db53e8cfb34c8ff81e2ff4.zip
New upstream version 3.0.0upstream/3.0.0
Diffstat (limited to 'ScreenManager.c')
-rw-r--r--ScreenManager.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/ScreenManager.c b/ScreenManager.c
index 05e1c02..8e5f697 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -145,14 +145,12 @@ static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTi
}
static void ScreenManager_drawPanels(ScreenManager* this, int focus) {
- int nPanels = this->panelCount;
+ const int nPanels = this->panelCount;
for (int i = 0; i < nPanels; i++) {
Panel* panel = (Panel*) Vector_get(this->panels, i);
Panel_draw(panel, i == focus);
- if (i < nPanels) {
- if (this->orientation == HORIZONTAL) {
- mvvline(panel->y, panel->x+panel->w, ' ', panel->h+1);
- }
+ if (this->orientation == HORIZONTAL) {
+ mvvline(panel->y, panel->x+panel->w, ' ', panel->h+1);
}
}
}
@@ -165,7 +163,7 @@ static Panel* setCurrentPanel(Panel* panel) {
void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
bool quit = false;
int focus = 0;
-
+
Panel* panelFocus = setCurrentPanel((Panel*) Vector_get(this->panels, focus));
double oldTime = 0.0;
@@ -183,7 +181,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
if (this->header) {
checkRecalculation(this, &oldTime, &sortTimeout, &redraw, &rescan, &timedOut);
}
-
+
if (redraw) {
ScreenManager_drawPanels(this, focus);
}
@@ -192,8 +190,24 @@ 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) {
+ if (ch == KEY_MOUSE && this->settings->enableMouse) {
ch = ERR;
MEVENT mevent;
int ok = getmouse(&mevent);
@@ -271,7 +285,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
quit = true;
continue;
}
-
+
switch (ch) {
case KEY_RESIZE:
{

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