summaryrefslogtreecommitdiff
path: root/Panel.c
diff options
context:
space:
mode:
authorloderunner <loderunner@63cc0a6c-1f0e-0410-841e-f6a342073da8>2010-03-03 21:13:33 +0000
committerloderunner <loderunner@63cc0a6c-1f0e-0410-841e-f6a342073da8>2010-03-03 21:13:33 +0000
commit6ec3644dcffae8a084d034926fdd9f7832d51b53 (patch)
treea017ffab35707ff1335db6a6efba4017fba00dbd /Panel.c
parent1dc04a30ba43bf3614d5230afadbc6686802fd0c (diff)
downloadhtop-6ec3644dcffae8a084d034926fdd9f7832d51b53.tar.gz
* Add Bash/emacs style navigation keys
(thanks to Daniel Schuler) git-svn-id: svn://svn.code.sf.net/p/htop/code/trunk@178 63cc0a6c-1f0e-0410-841e-f6a342073da8
Diffstat (limited to 'Panel.c')
-rw-r--r--Panel.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Panel.c b/Panel.c
index 438cf61..f4f286e 100644
--- a/Panel.c
+++ b/Panel.c
@@ -64,6 +64,10 @@ char* PANEL_CLASS = "Panel";
#define PANEL_CLASS NULL
#endif
+#define KEY_CTRLN 0016 /* control-n key */
+#define KEY_CTRLP 0020 /* control-p key */
+#define KEY_CTRLF 0006 /* control-f key */
+#define KEY_CTRLB 0002 /* control-b key */
Panel* Panel_new(int x, int y, int w, int h, char* type, bool owner, Object_Compare compare) {
Panel* this;
@@ -330,10 +334,12 @@ bool Panel_onKey(Panel* this, int key) {
assert (this != NULL);
switch (key) {
case KEY_DOWN:
+ case KEY_CTRLN:
if (this->selected + 1 < Vector_size(this->items))
this->selected++;
return true;
case KEY_UP:
+ case KEY_CTRLP:
if (this->selected > 0)
this->selected--;
return true;
@@ -360,12 +366,14 @@ bool Panel_onKey(Panel* this, int key) {
return true;
#endif
case KEY_LEFT:
+ case KEY_CTRLB:
if (this->scrollH > 0) {
this->scrollH -= 5;
this->needsRedraw = true;
}
return true;
case KEY_RIGHT:
+ case KEY_CTRLF:
this->scrollH += 5;
this->needsRedraw = true;
return true;