fix(tui): do not set ui_client_termname if it is already set (#21607)

It is fine to initialize ui_client_termname to NULL as it is only used
after tui_start().
This commit is contained in:
zeertzjq 2023-01-01 23:18:19 +08:00 committed by GitHub
parent f60cff8f9a
commit c590641feb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -310,11 +310,12 @@ static void terminfo_start(UI *ui)
#endif
// Set up unibilium/terminfo.
ui_client_termname = NULL;
if (term) {
data->ut = unibi_from_term(term);
if (data->ut) {
ui_client_termname = xstrdup(term);
if (!ui_client_termname) {
ui_client_termname = xstrdup(term);
}
if (!data->term) {
data->term = xstrdup(term);
}

View File

@ -34,7 +34,7 @@ EXTERN TriState ui_client_bg_respose INIT(= kNone);
/// by convention, this uses fd=3 (next free number after stdio)
EXTERN bool ui_client_forward_stdin INIT(= false);
EXTERN char *ui_client_termname INIT(= "null");
EXTERN char *ui_client_termname INIT(= NULL);
#define UI_CLIENT_STDIN_FD 3
#ifdef INCLUDE_GENERATED_DECLARATIONS