diff options
-rw-r--r-- | runtime/doc/deprecated.txt | 2 | ||||
-rw-r--r-- | runtime/doc/news.txt | 4 | ||||
-rw-r--r-- | runtime/doc/ui.txt | 1 | ||||
-rw-r--r-- | src/nvim/api/ui.c | 1 | ||||
-rw-r--r-- | src/nvim/ui.c | 5 | ||||
-rw-r--r-- | src/nvim/ui.h | 3 | ||||
-rw-r--r-- | src/nvim/ui_client.c | 5 | ||||
-rw-r--r-- | src/nvim/ui_client.h | 4 | ||||
-rw-r--r-- | test/functional/api/ui_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/ui/options_spec.lua | 16 |
10 files changed, 13 insertions, 30 deletions
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 7f7c498880..0a07f06c75 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -202,6 +202,8 @@ UI EXTENSIONS - `["wildmenu_show", items]` - `["wildmenu_select", selected]` - `["wildmenu_hide"]` +- *term_background* Unused. The terminal background color is now detected + by the Nvim core directly instead of the TUI. VARIABLES - *b:terminal_job_pid* PID of the top-level process in a |:terminal|. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 9d531b8efc..ee48bddc4d 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -340,4 +340,8 @@ release. • vim.treesitter.languagetree functions: - |LanguageTree:for_each_child()| Use |LanguageTree:children()| (non-recursive) instead. +• The "term_background" UI option |ui-ext-options| is deprecated and no longer + populated. Background color detection is now performed in Lua by the Nvim + core, not the TUI. + vim:tw=78:ts=8:sw=2:et:ft=help:norl: diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index 9cf0e59854..ab99b0446f 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -52,7 +52,6 @@ with these (optional) keys: - `ext_termcolors` Use external default colors. - `term_name` Sets the name of the terminal 'term'. - `term_colors` Sets the number of supported colors 't_Co'. -- `term_background` Sets the default value of 'background'. - `stdin_fd` Read buffer 1 from this fd as if it were stdin |--|. Only from |--embed| UI on startup. |ui-startup-stdin| - `stdin_tty` Tells if `stdin` is a `tty` or not. diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index a215317a83..e6d9035b0d 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -120,7 +120,6 @@ void remote_ui_disconnect(uint64_t channel_id) // Destroy `ui`. XFREE_CLEAR(ui->term_name); - XFREE_CLEAR(ui->term_background); xfree(ui); } diff --git a/src/nvim/ui.c b/src/nvim/ui.c index dc38c061b0..3e5bfba315 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -623,7 +623,10 @@ Array ui_array(void) // TUI fields. (`stdin_fd` is intentionally omitted.) PUT(info, "term_name", CSTR_TO_OBJ(ui->term_name)); - PUT(info, "term_background", CSTR_TO_OBJ(ui->term_background)); + + // term_background is deprecated. Populate with an empty string + PUT(info, "term_background", CSTR_TO_OBJ("")); + PUT(info, "term_colors", INTEGER_OBJ(ui->term_colors)); PUT(info, "stdin_tty", BOOLEAN_OBJ(ui->stdin_tty)); PUT(info, "stdout_tty", BOOLEAN_OBJ(ui->stdout_tty)); diff --git a/src/nvim/ui.h b/src/nvim/ui.h index d399802c99..3feb0bf603 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -104,7 +104,8 @@ struct ui_t { // TUI fields. char *term_name; - char *term_background; + char *term_background; ///< Deprecated. No longer needed since background color detection happens + ///< in Lua. To be removed in a future release. int term_colors; bool stdin_tty; bool stdout_tty; diff --git a/src/nvim/ui_client.c b/src/nvim/ui_client.c index dac690822b..2f91257a5d 100644 --- a/src/nvim/ui_client.c +++ b/src/nvim/ui_client.c @@ -84,10 +84,7 @@ void ui_client_attach(int width, int height, char *term) if (term) { PUT_C(opts, "term_name", CSTR_AS_OBJ(term)); } - if (ui_client_bg_response != kNone) { - bool is_dark = (ui_client_bg_response == kTrue); - PUT_C(opts, "term_background", CSTR_AS_OBJ(is_dark ? "dark" : "light")); - } + PUT_C(opts, "term_colors", INTEGER_OBJ(t_colors)); if (!ui_client_is_remote) { PUT_C(opts, "stdin_tty", BOOLEAN_OBJ(stdin_isatty)); diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index fbee942cdf..db1ab463f8 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -31,10 +31,6 @@ EXTERN int ui_client_exit_status INIT( = 0); /// Whether ui client has sent nvim_ui_attach yet EXTERN bool ui_client_attached INIT( = false); -/// Whether ui client has gotten a response about the bg color of the terminal, -/// kTrue=dark, kFalse=light, kNone=no response yet -EXTERN TriState ui_client_bg_response INIT( = kNone); - /// The ui client should forward its stdin to the nvim process /// by convention, this uses fd=3 (next free number after stdio) EXTERN bool ui_client_forward_stdin INIT( = false); diff --git a/test/functional/api/ui_spec.lua b/test/functional/api/ui_spec.lua index a668d47448..6efb6726fe 100644 --- a/test/functional/api/ui_spec.lua +++ b/test/functional/api/ui_spec.lua @@ -36,8 +36,6 @@ describe('nvim_ui_attach()', function() pcall_err(meths.ui_attach, 80, 24, { term_name=true })) eq("Invalid 'term_colors': expected Integer, got Boolean", pcall_err(meths.ui_attach, 80, 24, { term_colors=true })) - eq("Invalid 'term_background': expected String, got Boolean", - pcall_err(meths.ui_attach, 80, 24, { term_background=true })) eq("Invalid 'stdin_fd': expected Integer, got String", pcall_err(meths.ui_attach, 80, 24, { stdin_fd='foo' })) eq("Invalid 'stdin_tty': expected Boolean, got String", diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua index f3817856f7..6af1820430 100644 --- a/test/functional/ui/options_spec.lua +++ b/test/functional/ui/options_spec.lua @@ -210,22 +210,6 @@ describe('UI can set terminal option', function() screen = Screen.new(20,5) end) - it('term_background', function() - eq('dark', eval '&background') - - screen:attach {term_background='light'} - eq('light', eval '&background') - end) - - it("term_background but not if 'background' already set by user", function() - eq('dark', eval '&background') - command 'set background=dark' - - screen:attach {term_background='light'} - - eq('dark', eval '&background') - end) - it('term_name', function() eq('nvim', eval '&term') |