docs: deprecate the "term_background" UI field

This commit is contained in:
Gregory Anders 2023-11-07 11:31:21 -06:00
parent ab102f188e
commit 8d9789a0f3
10 changed files with 13 additions and 30 deletions

View File

@ -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|.

View File

@ -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:

View File

@ -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.

View File

@ -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);
}

View File

@ -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));

View File

@ -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;

View File

@ -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));

View File

@ -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);

View File

@ -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",

View File

@ -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')