From a76057df97157dc76959bcd40649f5953aebc9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 13 Sep 2015 17:49:38 +0200 Subject: 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/ --- ui.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'ui.h') 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 #include +#include #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 { -- cgit v1.2.3