aboutsummaryrefslogtreecommitdiff
path: root/ui.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-09-13 17:49:38 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-10-05 15:54:30 +0200
commita76057df97157dc76959bcd40649f5953aebc9d3 (patch)
tree75df46b238edacc60ede00ee5821d47cb814b316 /ui.h
parentfa950307aeb2a060be72fc73e0017e5497cb4ace (diff)
downloadvis-a76057df97157dc76959bcd40649f5953aebc9d3.tar.gz
vis-a76057df97157dc76959bcd40649f5953aebc9d3.tar.xz
vis: rework input handling using libtermkey
Key bindings are now specified as symbolic key strings, this will eventually allow run time configurable key mappings. This introduces a bulid time dependency on libtermkey which can be found at: http://www.leonerd.org.uk/code/libtermkey/
Diffstat (limited to 'ui.h')
-rw-r--r--ui.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/ui.h b/ui.h
index 4f61ec1..797b73a 100644
--- a/ui.h
+++ b/ui.h
@@ -15,13 +15,9 @@ enum UiOption {
UI_OPTION_LINE_NUMBERS_RELATIVE = 1 << 1,
};
-typedef struct {
- char str[6]; /* UTF8 character or terminal escape code */
- int code; /* curses KEY_* constant */
-} Key;
-
#include <stdbool.h>
#include <stdarg.h>
+#include <termkey.h>
#include "text.h"
#include "view.h"
#include "editor.h"
@@ -44,10 +40,11 @@ struct Ui {
void (*update)(Ui*);
void (*suspend)(Ui*);
void (*resume)(Ui*);
- Key (*getkey)(Ui*);
+ const char* (*getkey)(Ui*);
bool (*haskey)(Ui*);
void (*terminal_save)(Ui*);
void (*terminal_restore)(Ui*);
+ TermKey* (*termkey_get)(Ui*);
};
struct UiWin {