diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer.c | 13 | ||||
-rw-r--r-- | src/nvim/globals.h | 1 | ||||
-rw-r--r-- | src/nvim/option.c | 1 | ||||
-rw-r--r-- | src/nvim/os_unix.c | 7 |
4 files changed, 19 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 724a8578ac..950010b13b 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -3069,9 +3069,16 @@ static bool ti_change(char_u *str, char_u **last) /// Set current window title void resettitle(void) { - ui_call_set_title(cstr_as_string((char *)lasttitle)); - ui_call_set_icon(cstr_as_string((char *)lasticon)); - ui_flush(); + // if icon change, should the title be reset too? + if (p_icon) { + ui_call_set_title(cstr_as_string((char *)lasttitle)); + ui_call_set_icon(cstr_as_string((char *)lasticon)); + } else if (p_title) { + ui_call_set_title(cstr_as_string((char *)lasttitle)); + } + if (p_title || p_icon) { + ui_flush(); + } } # if defined(EXITFREE) diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 300e506854..62bb817c4c 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -279,6 +279,7 @@ EXTERN int need_wait_return INIT(= 0); /* need to wait for return later */ EXTERN int did_wait_return INIT(= FALSE); /* wait_return() was used and nothing written since then */ EXTERN int need_maketitle INIT(= TRUE); /* call maketitle() soon */ +EXTERN int did_enable_title INIT(= FALSE); /* did set title */ EXTERN int quit_more INIT(= FALSE); /* 'q' hit at "--more--" msg */ #if defined(UNIX) || defined(MACOS_X) diff --git a/src/nvim/option.c b/src/nvim/option.c index 13aadb71bb..3a7499f195 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1953,6 +1953,7 @@ did_set_title ( if (starting != NO_SCREEN) { maketitle(); resettitle(); + did_enable_title = true; } } diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index 692bcc97f4..5855a874c4 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -15,6 +15,7 @@ #include <string.h> #include "nvim/api/private/handle.h" +#include "nvim/api/private/helpers.h" #include "nvim/vim.h" #include "nvim/ascii.h" #include "nvim/os_unix.h" @@ -137,6 +138,12 @@ void mch_exit(int r) FUNC_ATTR_NORETURN { exiting = true; + if ((p_title + || (did_enable_title + && (p_titlestring == NULL || STRLEN(p_titlestring) == 0))) + && p_titleold != NULL) { + ui_call_set_title(cstr_as_string((char *)p_titleold)); + } ui_builtin_stop(); ui_flush(); ml_close_all(true); // remove all memfiles |