diff --git a/CategoriesPanel.c b/CategoriesPanel.c index 24316f396a97a4c74cfdb974acc32648440e401d..b3cb3aa9385697cdb44b0747c4789062c46cb337 100644 --- a/CategoriesPanel.c +++ b/CategoriesPanel.c @@ -79,7 +79,9 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) { result = HANDLED; break; case KEY_UP: + case KEY_CTRLP: case KEY_DOWN: + case KEY_CTRLN: case KEY_NPAGE: case KEY_PPAGE: case KEY_HOME: diff --git a/ChangeLog b/ChangeLog index af148520637cc7965ed57154fd7a98a7ebd6dbb7..52b06b40ad271cbb7f957f96b4213d2fe9c84293 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,10 @@ What's new in version 0.8.4 (thanks to Tom Callaway) * getopt-based long options and --no-color (thanks to Vincent Launchbury) +* BUGFIX: Fix memory leak + (thanks to Pavol Rusnak) +* Add Bash/emacs style navigation keys + (thanks to Daniel Schuler) What's new in version 0.8.3 diff --git a/Panel.c b/Panel.c index 438cf614126cbd3cd0aff4b0352a6b22a9107d9d..f4f286e5c42e9e23deda7b69206c3653acb87aa1 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; diff --git a/Panel.h b/Panel.h index 9af9ace9d2f61fbf967f3103dd86aa8229bae28d..667232511ccadd66228d864b2f0644f32e83a6fc 100644 --- a/Panel.h +++ b/Panel.h @@ -65,6 +65,10 @@ extern char* PANEL_CLASS; #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); diff --git a/ScreenManager.c b/ScreenManager.c index 2c6180d14963eac8d92c7acdff0d0dc28f877169..2be94f6c6a009afdf4e359d55996f3cd6bbcbee7 100644 --- a/ScreenManager.c +++ b/ScreenManager.c @@ -184,6 +184,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { continue; } case KEY_LEFT: + case KEY_CTRLB: tryLeft: if (focus > 0) focus--; @@ -192,6 +193,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { goto tryLeft; break; case KEY_RIGHT: + case KEY_CTRLF: case 9: tryRight: if (focus < this->itemCount - 1)