aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/msgpack_rpc/remote_ui.c16
-rw-r--r--src/nvim/syntax.c3
-rw-r--r--src/nvim/ui.c14
-rw-r--r--src/nvim/ui.h2
-rw-r--r--test/functional/ui/screen.lua8
5 files changed, 43 insertions, 0 deletions
diff --git a/src/nvim/msgpack_rpc/remote_ui.c b/src/nvim/msgpack_rpc/remote_ui.c
index f980a77b4c..af7b82dfd4 100644
--- a/src/nvim/msgpack_rpc/remote_ui.c
+++ b/src/nvim/msgpack_rpc/remote_ui.c
@@ -67,6 +67,8 @@ Object remote_ui_attach(uint64_t channel_id, uint64_t request_id, Array args,
ui->put = remote_ui_put;
ui->bell = remote_ui_bell;
ui->visual_bell = remote_ui_visual_bell;
+ ui->update_fg = remote_ui_update_fg;
+ ui->update_bg = remote_ui_update_bg;
ui->flush = remote_ui_flush;
ui->suspend = remote_ui_suspend;
pmap_put(uint64_t)(connected_uis, channel_id, ui);
@@ -266,6 +268,20 @@ static void remote_ui_visual_bell(UI *ui)
push_call(ui, "visual_bell", args);
}
+static void remote_ui_update_fg(UI *ui, int fg)
+{
+ Array args = ARRAY_DICT_INIT;
+ ADD(args, INTEGER_OBJ(fg));
+ push_call(ui, "update_fg", args);
+}
+
+static void remote_ui_update_bg(UI *ui, int bg)
+{
+ Array args = ARRAY_DICT_INIT;
+ ADD(args, INTEGER_OBJ(bg));
+ push_call(ui, "update_bg", args);
+}
+
static void remote_ui_flush(UI *ui)
{
UIData *data = ui->data;
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index f35da39bb3..8f686ca59f 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -45,6 +45,7 @@
#include "nvim/strings.h"
#include "nvim/syntax_defs.h"
#include "nvim/term.h"
+#include "nvim/ui.h"
#include "nvim/os/os.h"
#include "nvim/os/time.h"
@@ -6528,6 +6529,7 @@ do_highlight (
if (is_normal_group) {
normal_fg = HL_TABLE()[idx].sg_rgb_fg;
+ ui_fg_updated();
}
} else if (STRCMP(key, "GUIBG") == 0) {
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
@@ -6546,6 +6548,7 @@ do_highlight (
if (is_normal_group) {
normal_bg = HL_TABLE()[idx].sg_rgb_bg;
+ ui_bg_updated();
}
} else if (STRCMP(key, "GUISP") == 0) {
// Ignored
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 9c58193e8c..b37bc92b1a 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -113,6 +113,18 @@ void ui_write(uint8_t *s, int len)
free(tofree);
}
+void ui_fg_updated(void)
+{
+ UI_CALL(update_fg, normal_fg);
+ UI_CALL(flush);
+}
+
+void ui_bg_updated(void)
+{
+ UI_CALL(update_bg, normal_bg);
+ UI_CALL(flush);
+}
+
/*
* If the machine has job control, use it to suspend the program,
* otherwise fake it by starting a new shell.
@@ -167,6 +179,8 @@ void ui_cursor_shape(void)
void ui_resize(int width, int height)
{
+ ui_fg_updated();
+ ui_bg_updated();
sr.top = 0;
sr.bot = height - 1;
sr.left = 0;
diff --git a/src/nvim/ui.h b/src/nvim/ui.h
index d0933055cc..7c4a233d79 100644
--- a/src/nvim/ui.h
+++ b/src/nvim/ui.h
@@ -32,6 +32,8 @@ struct ui_t {
void (*bell)(UI *ui);
void (*visual_bell)(UI *ui);
void (*flush)(UI *ui);
+ void (*update_fg)(UI *ui, int fg);
+ void (*update_bg)(UI *ui, int bg);
void (*suspend)(UI *ui);
};
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 7917fff1e7..c9c9d5a197 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -278,6 +278,14 @@ function Screen:_handle_visual_bell()
self._visual_bell = true
end
+function Screen:_handle_update_fg(fg)
+ self._fg = fg
+end
+
+function Screen:_handle_update_bg(bg)
+ self._bg = bg
+end
+
function Screen:_handle_suspend()
self._suspended = true
end