Merge pull request #18145 from bfredl/term_opt

feat(api): allow remote UI to set terminal options
This commit is contained in:
bfredl
2022-04-20 14:50:04 +02:00
committed by GitHub
5 changed files with 89 additions and 12 deletions

View File

@@ -4921,6 +4921,23 @@ bool set_tty_option(const char *name, char *value)
return false;
}
void set_tty_background(const char *value)
{
if (option_was_set("bg") || strequal((char *)p_bg, value)) {
// background is already set... ignore
return;
}
if (starting) {
// Wait until after startup, so OptionSet is triggered.
do_cmdline_cmd((value[0] == 'l')
? "autocmd VimEnter * ++once ++nested set bg=light"
: "autocmd VimEnter * ++once ++nested set bg=dark");
} else {
set_option_value("bg", 0L, value, 0);
reset_option_was_set("bg");
}
}
/// Find index for an option
///
/// @param[in] arg Option name.