diff --git a/CHANGELOG.md b/CHANGELOG.md index cb4a73a71..da47d49d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed +- core: add refresh of window title on buffer switch, when option weechat.look.window_title is set - core: consider all keys are safe in cursor context ([#2244](https://github.com/weechat/weechat/issues/2244)) - irc: display nick changes and quit messages when option irc.look.ignore_tag_messages is enabled ([#2241](https://github.com/weechat/weechat/issues/2241)) - perl: fix build when multiplicity is not available ([#2243](https://github.com/weechat/weechat/issues/2243)) diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 7ebabdb71..c3328c5ce 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -15532,8 +15532,8 @@ void weechat_window_set_title (const char *title); Arguments: -* _title_: new title for terminal (NULL to reset title); string is evaluated, - so variables like `${info:version}` can be used +* _title_: new title for terminal; string is evaluated, so variables like + `${info:version}` can be used (see <<_string_eval_expression,string_eval_expression>>) C example: diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index 84b19a3c6..95ab86d6f 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -15873,9 +15873,9 @@ void weechat_window_set_title (const char *title); Paramètres : -* _title_ : nouveau titre pour le terminal (NULL pour réinitialiser le titre) ; - la chaîne est évaluée, donc les variables comme `${info:version}` peuvent - être utilisées (voir <<_string_eval_expression,string_eval_expression>>) +* _title_ : nouveau titre pour le terminal ; la chaîne est évaluée, donc les variables + comme `${info:version}` peuvent être utilisées + (voir <<_string_eval_expression,string_eval_expression>>) Exemple en C : diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index 9e404b802..3b3300a80 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -16302,8 +16302,8 @@ void weechat_window_set_title (const char *title); Argomenti: // TRANSLATION MISSING -* _title_: nuovo titolo per il terminale (NULL per resettarlo); - string is evaluated, so variables like `${info:version}` can be used +* _title_: nuovo titolo per il terminale; string is evaluated, so variables + like `${info:version}` can be used (see <<_string_eval_expression,string_eval_expression>>) Esempio in C: diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index 76804e712..251297c8f 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -15798,8 +15798,8 @@ void weechat_window_set_title (const char *title); 引数: -* _title_: 端末の新しいタイトル (タイトルをリセットする場合は NULL); - この文字列は評価されるため、文字列内に `${info:version}` などの変数を含めることが可能です +* _title_: 端末の新しいタイトル; この文字列は評価されるため、文字列内に + `${info:version}` などの変数を含めることが可能です (<<_string_eval_expression,string_eval_expression>> を参照) C 言語での使用例: diff --git a/doc/sr/weechat_plugin_api.sr.adoc b/doc/sr/weechat_plugin_api.sr.adoc index 492213a5e..41692e0c8 100644 --- a/doc/sr/weechat_plugin_api.sr.adoc +++ b/doc/sr/weechat_plugin_api.sr.adoc @@ -15100,7 +15100,9 @@ void weechat_window_set_title (const char *title); Аргументи: -* _title_: нови наслов за терминал (NULL ако желите да ресетујете наслов); стринг се израчунава, тако да је могуће коришћење променљивих као што је `${info:version}` (погледајте <<_string_eval_expression,string_eval_expression>>) +* _title_: нови наслов за терминал; стринг се израчунава, тако да је могуће + коришћење променљивих као што је `${info:version}` + (погледајте <<_string_eval_expression,string_eval_expression>>) C пример: diff --git a/src/core/core-config.c b/src/core/core-config.c index bfea1400b..69b5e03b3 100644 --- a/src/core/core-config.c +++ b/src/core/core-config.c @@ -500,12 +500,8 @@ config_change_window_title (const void *pointer, void *data, (void) data; (void) option; - if (gui_init_ok - || (CONFIG_STRING(config_look_window_title) - && CONFIG_STRING(config_look_window_title)[0])) - { + if (gui_init_ok) gui_window_set_title (CONFIG_STRING(config_look_window_title)); - } } /* diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 04a32f576..42a7f3302 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -233,12 +233,7 @@ gui_main_init (void) gui_term_cols, gui_term_lines, 100, 100)) { gui_current_window = gui_windows; - - if (CONFIG_STRING(config_look_window_title) - && CONFIG_STRING(config_look_window_title)[0]) - { - gui_window_set_title (CONFIG_STRING(config_look_window_title)); - } + gui_window_set_title (CONFIG_STRING(config_look_window_title)); } /* switch to buffer */ @@ -528,13 +523,6 @@ gui_main_end (int clean_exit) /* delete global history */ gui_history_global_free (); - /* reset title */ - if (CONFIG_STRING(config_look_window_title) - && CONFIG_STRING(config_look_window_title)[0]) - { - gui_window_set_title (NULL); - } - /* end color */ gui_color_end (); diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index 002c2901c..bdebae2a7 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -2481,13 +2481,11 @@ gui_window_refresh_screen (int full_refresh) refresh (); gui_window_read_terminal_size (); refresh (); - gui_window_set_title ( - (CONFIG_STRING(config_look_window_title) - && CONFIG_STRING(config_look_window_title)[0]) ? - CONFIG_STRING(config_look_window_title) : NULL); } gui_window_refresh_windows (); + + gui_window_set_title (CONFIG_STRING(config_look_window_title)); } /* @@ -2575,15 +2573,17 @@ gui_window_set_title (const char *title) { char *new_title, *envterm, *envshell, *shell, *shellname; - envterm = getenv ("TERM"); - if (!envterm) + if (!title || !title[0]) return; - new_title = (title && title[0]) ? - eval_expression (title, NULL, NULL, NULL) : NULL; + new_title = eval_expression (title, NULL, NULL, NULL); if (!new_title) return; + envterm = getenv ("TERM"); + if (!envterm) + return; + if (strcmp (envterm, "sun-cmd") == 0) { printf ("\033]l%s\033\\", new_title);