diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bab4ab6e..2db3e7765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # WeeChat ChangeLog +## Version 4.6.2 (under dev) + +### Fixed + +- core: add refresh of window title on buffer switch, when option weechat.look.window_title is set + ## Version 4.6.1 (2025-04-09) ### Fixed diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index 9b3d4dc2d..dee34c980 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -15528,8 +15528,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 edc42a929..7a2dbcb3a 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -15869,9 +15869,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 6c8dec4c3..929b2577e 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 d8e71a057..0c7385589 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -15797,8 +15797,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 0bef452ed..acc531e82 100644 --- a/doc/sr/weechat_plugin_api.sr.adoc +++ b/doc/sr/weechat_plugin_api.sr.adoc @@ -15104,7 +15104,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 c67dd6284..6923c6031 100644 --- a/src/core/core-config.c +++ b/src/core/core-config.c @@ -498,12 +498,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 9f3e76bec..8be7f3835 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -231,12 +231,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 */ @@ -526,13 +521,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 fd8aa017a..1aea45fbd 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -2479,13 +2479,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)); } /* @@ -2573,15 +2571,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);