aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
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/screen.c
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/screen.c')
-rw-r--r--src/nvim/screen.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 0225eb72c1..c0a909f147 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -5824,9 +5824,12 @@ static void screen_start_highlight(int attr)
attrentry_T *aep = NULL;
screen_attr = attr;
- if (full_screen
- ) {
- {
+ if (full_screen) {
+ if (abstract_ui) {
+ char buf[20];
+ sprintf(buf, "\033|%dh", attr);
+ OUT_STR(buf);
+ } else {
if (attr > HL_ALL) { /* special HL attr. */
if (t_colors > 1)
aep = syn_cterm_attr2entry(attr);
@@ -5877,9 +5880,13 @@ void screen_stop_highlight(void)
{
int do_ME = FALSE; /* output T_ME code */
- if (screen_attr != 0
- ) {
- {
+ if (screen_attr != 0) {
+ if (abstract_ui) {
+ // Handled in ui.c
+ char buf[20];
+ sprintf(buf, "\033|%dH", screen_attr);
+ OUT_STR(buf);
+ } else {
if (screen_attr > HL_ALL) { /* special HL attr. */
attrentry_T *aep;
@@ -6558,11 +6565,14 @@ static void screenclear2(void)
{
int i;
- if (starting == NO_SCREEN || ScreenLines == NULL
- )
+ if (starting == NO_SCREEN || ScreenLines == NULL) {
return;
+ }
+
+ if (!abstract_ui) {
+ screen_attr = -1; /* force setting the Normal colors */
+ }
- screen_attr = -1; /* force setting the Normal colors */
screen_stop_highlight(); /* don't want highlighting here */
@@ -8156,14 +8166,19 @@ void screen_resize(int width, int height, int mustset)
++busy;
-
- if (mustset || (ui_get_shellsize() == FAIL && height != 0)) {
+ // TODO(tarruda): "mustset" is still used in the old tests, which don't use
+ // "abstract_ui" yet. This will change when a new TUI is merged.
+ if (abstract_ui || mustset || (ui_get_shellsize() == FAIL && height != 0)) {
Rows = height;
Columns = width;
- check_shellsize();
+ }
+ check_shellsize();
+
+ if (abstract_ui) {
+ ui_resize(width, height);
+ } else {
mch_set_shellsize();
- } else
- check_shellsize();
+ }
/* The window layout used to be adjusted here, but it now happens in
* screenalloc() (also invoked from screenclear()). That is because the