summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2013-05-16 20:46:33 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2013-05-16 20:46:33 +0200
commitd07f80c0516e98f0b4d0b2527fe11590cb007409 (patch)
tree7c1df6af64d43ad8fb8182825e07f6bbb3163242 /src
parent11c16cc173340c6cc4f3f76fa4f4ba5c98c8aa2e (diff)
downloadtdv-d07f80c0516e98f0b4d0b2527fe11590cb007409.tar.gz
tdv-d07f80c0516e98f0b4d0b2527fe11590cb007409.tar.xz
tdv-d07f80c0516e98f0b4d0b2527fe11590cb007409.zip
Support Ctrl-A/E shortcuts
Diffstat (limited to 'src')
-rw-r--r--src/sdtui.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/sdtui.c b/src/sdtui.c
index 88dad87..01a2973 100644
--- a/src/sdtui.c
+++ b/src/sdtui.c
@@ -40,10 +40,12 @@
#include "stardict.h"
-#define KEY_ESCAPE 27 /**< Curses doesn't define this. */
+#define KEY_SOH 1 /**< Ctrl-A */
+#define KEY_ENQ 5 /**< Ctrl-E */
#define KEY_VT 11 /**< Ctrl-K */
#define KEY_NAK 21 /**< Ctrl-U */
#define KEY_ETB 23 /**< Ctrl-W */
+#define KEY_ESCAPE 27 /**< Curses doesn't define this. */
#define _(x) x /**< Fake gettext, for now. */
@@ -577,6 +579,14 @@ app_process_curses_event (Application *self, CursesEvent *event)
{
case KEY_ESCAPE:
return FALSE;
+ case KEY_SOH: // Ctrl-A -- move to the start of line
+ self->input_pos = 0;
+ app_redraw_top (self);
+ break;
+ case KEY_ENQ: // Ctrl-E -- move to the end of line
+ self->input_pos = self->input->len;
+ app_redraw_top (self);
+ break;
case KEY_VT: // Ctrl-K -- delete until the end of line
if (self->input_pos < self->input->len)
{