'titleold': set UI title on exit #7191

closes #7129
ref #4063
This commit is contained in:
nate 2017-08-19 18:33:14 -07:00 committed by Justin M. Keyes
parent b7fe15d8f9
commit 5f4d2edeee
4 changed files with 19 additions and 3 deletions

View File

@ -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)

View File

@ -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)

View File

@ -1953,6 +1953,7 @@ did_set_title (
if (starting != NO_SCREEN) {
maketitle();
resettitle();
did_enable_title = true;
}
}

View File

@ -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