aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui.h
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-12-06 11:27:36 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-12-08 23:44:23 -0300
commit07e569a25dba4bf6d9743102a34666964efb45cb (patch)
treef0a1e6bc8546327365cae045505a6d059a87d64f /src/nvim/ui.h
parent8b6cfff6a18d839d11900cd1fade5938dc9a02d5 (diff)
downloadrneovim-07e569a25dba4bf6d9743102a34666964efb45cb.tar.gz
rneovim-07e569a25dba4bf6d9743102a34666964efb45cb.tar.bz2
rneovim-07e569a25dba4bf6d9743102a34666964efb45cb.zip
ui: Add abstract_ui termcap and split UI layer
This is how Nvim behaves when the "abstract_ui" termcap is activated: - No data is written/read to stdout/stdin by default. - Instead of sending data to stdout, ui_write will parse the termcap codes and invoke dispatch functions in the ui.c module. - The dispatch functions will forward the calls to all attached UI instances(each UI instance is an implementation of the UI layer and is registered with ui_attach). - Like with the "builtin_gui" termcap, "abstract_ui" does not contain any key sequences. Instead, vim key strings(<cr>, <esc>, etc) are parsed directly by input_enqueue and the translated strings are pushed to the input buffer. With this new input model, its not possible to send mouse events yet. Thats because mouse sequence parsing happens in term.c/check_termcodes which must return early when "abstract_ui" is activated.
Diffstat (limited to 'src/nvim/ui.h')
-rw-r--r--src/nvim/ui.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/nvim/ui.h b/src/nvim/ui.h
index b174af9abe..d0933055cc 100644
--- a/src/nvim/ui.h
+++ b/src/nvim/ui.h
@@ -1,7 +1,39 @@
#ifndef NVIM_UI_H
#define NVIM_UI_H
+#include <stddef.h>
#include <stdbool.h>
+#include <stdint.h>
+
+typedef struct {
+ bool bold, standout, underline, undercurl, italic, reverse;
+ int foreground, background;
+} HlAttrs;
+
+typedef struct ui_t UI;
+
+struct ui_t {
+ int width, height;
+ void *data;
+ void (*resize)(UI *ui, int rows, int columns);
+ void (*clear)(UI *ui);
+ void (*eol_clear)(UI *ui);
+ void (*cursor_goto)(UI *ui, int row, int col);
+ void (*cursor_on)(UI *ui);
+ void (*cursor_off)(UI *ui);
+ void (*mouse_on)(UI *ui);
+ void (*mouse_off)(UI *ui);
+ void (*insert_mode)(UI *ui);
+ void (*normal_mode)(UI *ui);
+ void (*set_scroll_region)(UI *ui, int top, int bot, int left, int right);
+ void (*scroll)(UI *ui, int count);
+ void (*highlight_set)(UI *ui, HlAttrs attrs);
+ void (*put)(UI *ui, uint8_t *str, size_t len);
+ void (*bell)(UI *ui);
+ void (*visual_bell)(UI *ui);
+ void (*flush)(UI *ui);
+ void (*suspend)(UI *ui);
+};
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui.h.generated.h"