aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-02-05 16:17:23 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2019-02-05 19:41:38 +0100
commitbaf93d96063ceab109ecf16046a51e861a9c2c26 (patch)
tree206993aff9892e2beee704c84448221accebdb15 /src
parent36378c33c6ca6b5c906b8ab326db508feb32c859 (diff)
downloadrneovim-baf93d96063ceab109ecf16046a51e861a9c2c26.tar.gz
rneovim-baf93d96063ceab109ecf16046a51e861a9c2c26.tar.bz2
rneovim-baf93d96063ceab109ecf16046a51e861a9c2c26.zip
UI: always use contrete colors for default_colors_set
But add an escape hatch needed for external TUI, so it still can use terminal emulator defaults.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/ui.c11
-rw-r--r--src/nvim/ui.c3
-rw-r--r--src/nvim/ui.h2
3 files changed, 14 insertions, 2 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index b77516d588..a934f18dbf 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -210,8 +210,9 @@ static void ui_set_option(UI *ui, bool init, String name, Object value,
return;
}
ui->rgb = value.data.boolean;
- // A little drastic, but only legacy uis need to use this option
- if (!init) {
+ // A little drastic, but only takes effect for legacy uis. For linegrid UI
+ // only changes metadata for nvim_list_uis(), no refresh needed.
+ if (!init && !ui->ui_ext[kUILinegrid]) {
ui_refresh();
}
return;
@@ -355,6 +356,12 @@ static void remote_ui_default_colors_set(UI *ui, Integer rgb_fg,
Integer rgb_bg, Integer rgb_sp,
Integer cterm_fg, Integer cterm_bg)
{
+ if (!ui->ui_ext[kUITermColors]) {
+ bool dark = (*p_bg == 'd');
+ rgb_fg = rgb_fg != -1 ? rgb_fg : (dark ? 0xFFFFFF : 0x000000);
+ rgb_bg = rgb_bg != -1 ? rgb_bg : (dark ? 0x000000 : 0xFFFFFF);
+ rgb_sp = rgb_sp != -1 ? rgb_sp : 0xFF0000;
+ }
Array args = ARRAY_DICT_INIT;
ADD(args, INTEGER_OBJ(rgb_fg));
ADD(args, INTEGER_OBJ(rgb_bg));
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 6a7cbd36cc..9b2f9c6fe6 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -310,6 +310,9 @@ void ui_set_ext_option(UI *ui, UIExtension ext, bool active)
ui->option_set(ui, cstr_as_string((char *)ui_ext_names[ext]),
BOOLEAN_OBJ(active));
}
+ if (ext == kUITermColors) {
+ ui_default_colors_set();
+ }
}
void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol,
diff --git a/src/nvim/ui.h b/src/nvim/ui.h
index a5a0fa8b75..49a30fe78b 100644
--- a/src/nvim/ui.h
+++ b/src/nvim/ui.h
@@ -18,6 +18,7 @@ typedef enum {
kUILinegrid,
kUIMultigrid,
kUIHlState,
+ kUITermColors,
kUIExtCount,
} UIExtension;
@@ -29,6 +30,7 @@ EXTERN const char *ui_ext_names[] INIT(= {
"ext_linegrid",
"ext_multigrid",
"ext_hlstate",
+ "ext_termcolors",
});