0
0
mirror of https://github.com/vim/vim.git synced 2025-09-04 21:33:48 -04:00

patch 8.2.3699: the +title feature adds a lot of #ifdef but little code

Problem:    The +title feature adds a lot of #ifdef but little code.
Solution:   Graduate the +title feature.
This commit is contained in:
Bram Moolenaar 2021-11-29 20:39:38 +00:00
parent 0c359af5c0
commit 651fca85c7
34 changed files with 56 additions and 244 deletions

View File

@ -4190,8 +4190,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'icon'* *'noicon'* *'icon'* *'noicon'*
'icon' boolean (default off, on when title can be restored) 'icon' boolean (default off, on when title can be restored)
global global
{not available when compiled without the |+title|
feature}
When on, the icon text of the window will be set to the value of When on, the icon text of the window will be set to the value of
'iconstring' (if it is not empty), or to the name of the file 'iconstring' (if it is not empty), or to the name of the file
currently being edited. Only the last part of the name is used. currently being edited. Only the last part of the name is used.
@ -4208,8 +4206,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'iconstring'* *'iconstring'*
'iconstring' string (default "") 'iconstring' string (default "")
global global
{not available when compiled without the |+title|
feature}
When this option is not empty, it will be used for the icon text of When this option is not empty, it will be used for the icon text of
the window. This happens only when the 'icon' option is on. the window. This happens only when the 'icon' option is on.
Only works if the terminal supports setting window icon text Only works if the terminal supports setting window icon text
@ -8141,8 +8137,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'title'* *'notitle'* *'title'* *'notitle'*
'title' boolean (default off, on when title can be restored) 'title' boolean (default off, on when title can be restored)
global global
{not available when compiled without the |+title|
feature}
When on, the title of the window will be set to the value of When on, the title of the window will be set to the value of
'titlestring' (if it is not empty), or to: 'titlestring' (if it is not empty), or to:
filename [+=-] (path) - VIM filename [+=-] (path) - VIM
@ -8176,8 +8170,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'titlelen'* *'titlelen'*
'titlelen' number (default 85) 'titlelen' number (default 85)
global global
{not available when compiled without the |+title|
feature}
Gives the percentage of 'columns' to use for the length of the window Gives the percentage of 'columns' to use for the length of the window
title. When the title is longer, only the end of the path name is title. When the title is longer, only the end of the path name is
shown. A '<' character before the path name is used to indicate this. shown. A '<' character before the path name is used to indicate this.
@ -8191,8 +8183,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'titleold'* *'titleold'*
'titleold' string (default "Thanks for flying Vim") 'titleold' string (default "Thanks for flying Vim")
global global
{only available when compiled with the |+title|
feature}
This option will be used for the window title when exiting Vim if the This option will be used for the window title when exiting Vim if the
original title cannot be restored. Only happens if 'title' is on or original title cannot be restored. Only happens if 'title' is on or
'titlestring' is not empty. 'titlestring' is not empty.
@ -8201,8 +8191,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'titlestring'* *'titlestring'*
'titlestring' string (default "") 'titlestring' string (default "")
global global
{not available when compiled without the |+title|
feature}
When this option is not empty, it will be used for the title of the When this option is not empty, it will be used for the title of the
window. This happens only when the 'title' option is on. window. This happens only when the 'title' option is on.
Only works if the terminal supports setting window titles (currently Only works if the terminal supports setting window titles (currently

View File

@ -471,7 +471,7 @@ N *+textobjects* |text-objects| selection
N *+textprop* |text-properties| N *+textprop* |text-properties|
*+tgetent* non-Unix only: able to use external termcap *+tgetent* non-Unix only: able to use external termcap
N *+timers* the |timer_start()| function N *+timers* the |timer_start()| function
N *+title* Setting the window 'title' and 'icon' N *+title* Setting the window 'title' and 'icon'; Always enabled
N *+toolbar* |gui-toolbar| N *+toolbar* |gui-toolbar|
T *+user_commands* User-defined commands. |user-commands| T *+user_commands* User-defined commands. |user-commands|
Always enabled since 8.1.1210. Always enabled since 8.1.1210.

View File

@ -421,9 +421,7 @@ free_all_mem(void)
# endif # endif
} }
# ifdef FEAT_TITLE
free_titles(); free_titles();
# endif
# if defined(FEAT_SEARCHPATH) # if defined(FEAT_SEARCHPATH)
free_findfile(); free_findfile();
# endif # endif

View File

@ -770,9 +770,7 @@ ex_argedit(exarg_T *eap)
if (do_arglist(eap->arg, AL_ADD, i, TRUE) == FAIL) if (do_arglist(eap->arg, AL_ADD, i, TRUE) == FAIL)
return; return;
#ifdef FEAT_TITLE
maketitle(); maketitle();
#endif
if (curwin->w_arg_idx == 0 if (curwin->w_arg_idx == 0
&& (curbuf->b_ml.ml_flags & ML_EMPTY) && (curbuf->b_ml.ml_flags & ML_EMPTY)
@ -792,9 +790,7 @@ ex_argadd(exarg_T *eap)
do_arglist(eap->arg, AL_ADD, do_arglist(eap->arg, AL_ADD,
eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1, eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1,
FALSE); FALSE);
#ifdef FEAT_TITLE
maketitle(); maketitle();
#endif
} }
/* /*
@ -853,9 +849,7 @@ ex_argdelete(exarg_T *eap)
} }
else else
do_arglist(eap->arg, AL_DEL, 0, FALSE); do_arglist(eap->arg, AL_DEL, 0, FALSE);
#ifdef FEAT_TITLE
maketitle(); maketitle();
#endif
} }
/* /*

View File

@ -2253,10 +2253,8 @@ apply_autocmds_group(
|| event == EVENT_VIMLEAVE || event == EVENT_VIMLEAVE
|| event == EVENT_VIMLEAVEPRE)) || event == EVENT_VIMLEAVEPRE))
{ {
#ifdef FEAT_TITLE
if (curbuf->b_changed != save_changed) if (curbuf->b_changed != save_changed)
need_maketitle = TRUE; need_maketitle = TRUE;
#endif
curbuf->b_changed = save_changed; curbuf->b_changed = save_changed;
} }

View File

@ -44,9 +44,7 @@ static int buf_same_ino(buf_T *buf, stat_T *stp);
#else #else
static int otherfile_buf(buf_T *buf, char_u *ffname); static int otherfile_buf(buf_T *buf, char_u *ffname);
#endif #endif
#ifdef FEAT_TITLE
static int value_changed(char_u *str, char_u **last); static int value_changed(char_u *str, char_u **last);
#endif
static int append_arg_number(win_T *wp, char_u *buf, int buflen, int add_file); static int append_arg_number(win_T *wp, char_u *buf, int buflen, int add_file);
static void free_buffer(buf_T *); static void free_buffer(buf_T *);
static void free_buffer_stuff(buf_T *buf, int free_options); static void free_buffer_stuff(buf_T *buf, int free_options);
@ -1856,9 +1854,7 @@ enter_buffer(buf_T *buf)
buflist_getfpos(); buflist_getfpos();
check_arg_idx(curwin); // check for valid arg_idx check_arg_idx(curwin); // check for valid arg_idx
#ifdef FEAT_TITLE
maketitle(); maketitle();
#endif
// when autocmds didn't change it // when autocmds didn't change it
if (curwin->w_topline == 1 && !curwin->w_topline_was_set) if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
scroll_cursor_halfway(FALSE); // redisplay at correct position scroll_cursor_halfway(FALSE); // redisplay at correct position
@ -3461,9 +3457,7 @@ buf_name_changed(buf_T *buf)
if (curwin->w_buffer == buf) if (curwin->w_buffer == buf)
check_arg_idx(curwin); // check file name for arg list check_arg_idx(curwin); // check file name for arg list
#ifdef FEAT_TITLE
maketitle(); // set window title maketitle(); // set window title
#endif
status_redraw_all(); // status lines need to be redrawn status_redraw_all(); // status lines need to be redrawn
fmarks_check_names(buf); // check named file marks fmarks_check_names(buf); // check named file marks
ml_timestamp(buf); // reset timestamp ml_timestamp(buf); // reset timestamp
@ -3780,7 +3774,6 @@ col_print(
vim_snprintf((char *)buf, buflen, "%d-%d", col, vcol); vim_snprintf((char *)buf, buflen, "%d-%d", col, vcol);
} }
#if defined(FEAT_TITLE) || defined(PROTO)
static char_u *lasttitle = NULL; static char_u *lasttitle = NULL;
static char_u *lasticon = NULL; static char_u *lasticon = NULL;
@ -4045,7 +4038,6 @@ free_titles(void)
} }
# endif # endif
#endif // FEAT_TITLE
#if defined(FEAT_STL_OPT) || defined(FEAT_GUI_TABLINE) || defined(PROTO) #if defined(FEAT_STL_OPT) || defined(FEAT_GUI_TABLINE) || defined(PROTO)

View File

@ -1630,9 +1630,7 @@ buf_write(
if (forceit && overwriting && vim_strchr(p_cpo, CPO_KEEPRO) == NULL) if (forceit && overwriting && vim_strchr(p_cpo, CPO_KEEPRO) == NULL)
{ {
buf->b_p_ro = FALSE; buf->b_p_ro = FALSE;
#ifdef FEAT_TITLE
need_maketitle = TRUE; // set window title later need_maketitle = TRUE; // set window title later
#endif
status_redraw_all(); // redraw status lines later status_redraw_all(); // redraw status lines later
} }

View File

@ -146,9 +146,7 @@ changed_internal(void)
ml_setflags(curbuf); ml_setflags(curbuf);
check_status(curbuf); check_status(curbuf);
redraw_tabline = TRUE; redraw_tabline = TRUE;
#ifdef FEAT_TITLE
need_maketitle = TRUE; // set window title later need_maketitle = TRUE; // set window title later
#endif
} }
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
@ -892,9 +890,7 @@ unchanged(buf_T *buf, int ff, int always_inc_changedtick)
save_file_ff(buf); save_file_ff(buf);
check_status(buf); check_status(buf);
redraw_tabline = TRUE; redraw_tabline = TRUE;
#ifdef FEAT_TITLE
need_maketitle = TRUE; // set window title later need_maketitle = TRUE; // set window title later
#endif
++CHANGEDTICK(buf); ++CHANGEDTICK(buf);
} }
else if (always_inc_changedtick) else if (always_inc_changedtick)

View File

@ -610,15 +610,14 @@ showruler(int always)
win_redr_ruler(curwin, always, FALSE); win_redr_ruler(curwin, always, FALSE);
#endif #endif
#ifdef FEAT_TITLE
if (need_maketitle if (need_maketitle
# ifdef FEAT_STL_OPT #ifdef FEAT_STL_OPT
|| (p_icon && (stl_syntax & STL_IN_ICON)) || (p_icon && (stl_syntax & STL_IN_ICON))
|| (p_title && (stl_syntax & STL_IN_TITLE)) || (p_title && (stl_syntax & STL_IN_TITLE))
# endif #endif
) )
maketitle(); maketitle();
#endif
// Redraw the tab pages line if needed. // Redraw the tab pages line if needed.
if (redraw_tabline) if (redraw_tabline)
draw_tabline(); draw_tabline();

View File

@ -5787,13 +5787,7 @@ f_has(typval_T *argvars, typval_T *rettv)
0 0
#endif #endif
}, },
{"title", {"title", 1},
#ifdef FEAT_TITLE
1
#else
0
#endif
},
{"toolbar", {"toolbar",
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
1 1

View File

@ -3082,9 +3082,7 @@ do_ecmd(
// Even when cursor didn't move we need to recompute topline. // Even when cursor didn't move we need to recompute topline.
changed_line_abv_curs(); changed_line_abv_curs();
#ifdef FEAT_TITLE
maketitle(); maketitle();
#endif
#if defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX) #if defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)
if (WIN_IS_POPUP(curwin) && curwin->w_p_pvw && retval != FAIL) if (WIN_IS_POPUP(curwin) && curwin->w_p_pvw && retval != FAIL)
popup_set_title(curwin); popup_set_title(curwin);

View File

@ -6205,14 +6205,10 @@ ex_stop(exarg_T *eap)
out_flush(); out_flush();
stoptermcap(); stoptermcap();
out_flush(); // needed for SUN to restore xterm buffer out_flush(); // needed for SUN to restore xterm buffer
#ifdef FEAT_TITLE
mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles
#endif
ui_suspend(); // call machine specific function ui_suspend(); // call machine specific function
#ifdef FEAT_TITLE
maketitle(); maketitle();
resettitle(); // force updating the title resettitle(); // force updating the title
#endif
starttermcap(); starttermcap();
scroll_start(); // scroll screen before redrawing scroll_start(); // scroll screen before redrawing
redraw_later_clear(); redraw_later_clear();
@ -7047,14 +7043,10 @@ do_exedit(
{ {
if (eap->do_ecmd_cmd != NULL) if (eap->do_ecmd_cmd != NULL)
do_cmd_argument(eap->do_ecmd_cmd); do_cmd_argument(eap->do_ecmd_cmd);
#ifdef FEAT_TITLE
n = curwin->w_arg_idx_invalid; n = curwin->w_arg_idx_invalid;
#endif
check_arg_idx(curwin); check_arg_idx(curwin);
#ifdef FEAT_TITLE
if (n != curwin->w_arg_idx_invalid) if (n != curwin->w_arg_idx_invalid)
maketitle(); maketitle();
#endif
} }
/* /*
@ -8178,10 +8170,8 @@ ex_redraw(exarg_T *eap)
validate_cursor(); validate_cursor();
update_topline(); update_topline();
update_screen(eap->forceit ? CLEAR : VIsual_active ? INVERTED : 0); update_screen(eap->forceit ? CLEAR : VIsual_active ? INVERTED : 0);
#ifdef FEAT_TITLE
if (need_maketitle) if (need_maketitle)
maketitle(); maketitle();
#endif
#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) #if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
# ifdef VIMDLL # ifdef VIMDLL
if (!gui.in_use) if (!gui.in_use)

View File

@ -109,6 +109,7 @@
* +insert_expand CTRL-N/CTRL-P/CTRL-X in insert mode. * +insert_expand CTRL-N/CTRL-P/CTRL-X in insert mode.
* +modify_fname modifiers for file name. E.g., "%:p:h". * +modify_fname modifiers for file name. E.g., "%:p:h".
* +comments 'comments' option. * +comments 'comments' option.
* +title 'title' and 'icon' options
* *
* Obsolete: * Obsolete:
* +tag_old_static Old style static tags: "file:tag file ..". * +tag_old_static Old style static tags: "file:tag file ..".
@ -360,17 +361,9 @@
#endif #endif
/* /*
* +title 'title' and 'icon' options
* +statusline 'statusline', 'rulerformat' and special format of * +statusline 'statusline', 'rulerformat' and special format of
* 'titlestring' and 'iconstring' options. * 'titlestring' and 'iconstring' options.
* +byte_offset '%o' in 'statusline' and builtin functions line2byte()
* and byte2line().
* Note: Required for Macintosh.
*/ */
#if defined(FEAT_NORMAL)
# define FEAT_TITLE
#endif
#ifdef FEAT_NORMAL #ifdef FEAT_NORMAL
# define FEAT_STL_OPT # define FEAT_STL_OPT
# ifndef FEAT_CMDL_INFO # ifndef FEAT_CMDL_INFO
@ -378,6 +371,11 @@
# endif # endif
#endif #endif
/*
* +byte_offset '%o' in 'statusline' and builtin functions line2byte()
* and byte2line().
* Note: Required for Macintosh.
*/
#ifdef FEAT_NORMAL #ifdef FEAT_NORMAL
# define FEAT_BYTEOFF # define FEAT_BYTEOFF
#endif #endif

View File

@ -252,9 +252,7 @@ EXTERN int no_wait_return INIT(= 0); // don't wait for return for now
EXTERN int need_wait_return INIT(= 0); // need to wait for return later 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 EXTERN int did_wait_return INIT(= FALSE); // wait_return() was used and
// nothing written since then // nothing written since then
#ifdef FEAT_TITLE
EXTERN int need_maketitle INIT(= TRUE); // call maketitle() soon EXTERN int need_maketitle INIT(= TRUE); // call maketitle() soon
#endif
EXTERN int quit_more INIT(= FALSE); // 'q' hit at "--more--" msg EXTERN int quit_more INIT(= FALSE); // 'q' hit at "--more--" msg
#if defined(UNIX) || defined(VMS) || defined(MACOS_X) #if defined(UNIX) || defined(VMS) || defined(MACOS_X)
@ -1037,17 +1035,26 @@ EXTERN vimconv_T output_conv; // type of output conversion
*/ */
// length of char in bytes, including following composing chars // length of char in bytes, including following composing chars
EXTERN int (*mb_ptr2len)(char_u *p) INIT(= latin_ptr2len); EXTERN int (*mb_ptr2len)(char_u *p) INIT(= latin_ptr2len);
// idem, with limit on string length // idem, with limit on string length
EXTERN int (*mb_ptr2len_len)(char_u *p, int size) INIT(= latin_ptr2len_len); EXTERN int (*mb_ptr2len_len)(char_u *p, int size) INIT(= latin_ptr2len_len);
// byte length of char // byte length of char
EXTERN int (*mb_char2len)(int c) INIT(= latin_char2len); EXTERN int (*mb_char2len)(int c) INIT(= latin_char2len);
// convert char to bytes, return the length
// Convert char "c" to bytes in "buf", return the length. "buf" must have room
// for at least 6 bytes.
EXTERN int (*mb_char2bytes)(int c, char_u *buf) INIT(= latin_char2bytes); EXTERN int (*mb_char2bytes)(int c, char_u *buf) INIT(= latin_char2bytes);
EXTERN int (*mb_ptr2cells)(char_u *p) INIT(= latin_ptr2cells); EXTERN int (*mb_ptr2cells)(char_u *p) INIT(= latin_ptr2cells);
EXTERN int (*mb_ptr2cells_len)(char_u *p, int size) INIT(= latin_ptr2cells_len); EXTERN int (*mb_ptr2cells_len)(char_u *p, int size) INIT(= latin_ptr2cells_len);
EXTERN int (*mb_char2cells)(int c) INIT(= latin_char2cells); EXTERN int (*mb_char2cells)(int c) INIT(= latin_char2cells);
EXTERN int (*mb_off2cells)(unsigned off, unsigned max_off) INIT(= latin_off2cells); EXTERN int (*mb_off2cells)(unsigned off, unsigned max_off) INIT(= latin_off2cells);
EXTERN int (*mb_ptr2char)(char_u *p) INIT(= latin_ptr2char); EXTERN int (*mb_ptr2char)(char_u *p) INIT(= latin_ptr2char);
// Byte offset from "p" to the start of a character, including any composing
// characters. "base" must be the start of the string, which must be NUL
// terminated.
EXTERN int (*mb_head_off)(char_u *base, char_u *p) INIT(= latin_head_off); EXTERN int (*mb_head_off)(char_u *base, char_u *p) INIT(= latin_head_off);
# if defined(USE_ICONV) && defined(DYNAMIC_ICONV) # if defined(USE_ICONV) && defined(DYNAMIC_ICONV)
@ -1402,7 +1409,7 @@ EXTERN struct subs_expr_S *substitute_instr INIT(= NULL);
// table to store parsed 'wildmode' // table to store parsed 'wildmode'
EXTERN char_u wim_flags[4]; EXTERN char_u wim_flags[4];
#if defined(FEAT_TITLE) && defined(FEAT_STL_OPT) #if defined(FEAT_STL_OPT)
// whether titlestring and iconstring contains statusline syntax // whether titlestring and iconstring contains statusline syntax
# define STL_IN_ICON 1 # define STL_IN_ICON 1
# define STL_IN_TITLE 2 # define STL_IN_TITLE 2

View File

@ -138,7 +138,7 @@ gui_start(char_u *arg UNUSED)
// Back to old term settings // Back to old term settings
// //
// FIXME: If we got here because a child process failed and flagged to // FIXME: If we got here because a child process failed and flagged to
// the parent to resume, and X11 is enabled with FEAT_TITLE, this will // the parent to resume, and X11 is enabled, this will
// hit an X11 I/O error and do a longjmp(), leaving recursive // hit an X11 I/O error and do a longjmp(), leaving recursive
// permanently set to 1. This is probably not as big a problem as it // permanently set to 1. This is probably not as big a problem as it
// sounds, because gui_mch_init() in both gui_x11.c and gui_gtk_x11.c // sounds, because gui_mch_init() in both gui_x11.c and gui_gtk_x11.c
@ -146,9 +146,7 @@ gui_start(char_u *arg UNUSED)
// actually hit this case. // actually hit this case.
termcapinit(old_term); termcapinit(old_term);
settmode(TMODE_RAW); // restart RAW mode settmode(TMODE_RAW); // restart RAW mode
#ifdef FEAT_TITLE
set_title_defaults(); // set 'title' and 'icon' again set_title_defaults(); // set 'title' and 'icon' again
#endif
#if defined(GUI_MAY_SPAWN) && defined(EXPERIMENTAL_GUI_CMD) #if defined(GUI_MAY_SPAWN) && defined(EXPERIMENTAL_GUI_CMD)
if (msg) if (msg)
emsg(msg); emsg(msg);
@ -741,10 +739,9 @@ gui_init(void)
*/ */
if (gui_mch_open() != FAIL) if (gui_mch_open() != FAIL)
{ {
#ifdef FEAT_TITLE
maketitle(); maketitle();
resettitle(); resettitle();
#endif
init_gui_options(); init_gui_options();
#ifdef FEAT_ARABIC #ifdef FEAT_ARABIC
// Our GUI can't do bidi. // Our GUI can't do bidi.
@ -4413,10 +4410,8 @@ gui_update_scrollbars(
} }
} }
#ifdef FEAT_TITLE
// update the title, it may show the scroll position // update the title, it may show the scroll position
maketitle(); maketitle();
#endif
prev_curwin = curwin; prev_curwin = curwin;
--hold_gui_events; --hold_gui_events;
@ -5558,9 +5553,7 @@ drop_callback(void *cookie)
# ifdef FEAT_MENU # ifdef FEAT_MENU
gui_update_menus(0); gui_update_menus(0);
# endif # endif
#ifdef FEAT_TITLE
maketitle(); maketitle();
#endif
setcursor(); setcursor();
out_flush_cursor(FALSE, FALSE); out_flush_cursor(FALSE, FALSE);
} }

View File

@ -4540,7 +4540,6 @@ gui_mch_set_shellsize(int width, int height,
gui_mch_update(); gui_mch_update();
} }
#if defined(FEAT_TITLE) || defined(PROTO)
void void
gui_mch_settitle(char_u *title, char_u *icon UNUSED) gui_mch_settitle(char_u *title, char_u *icon UNUSED)
{ {
@ -4552,7 +4551,6 @@ gui_mch_settitle(char_u *title, char_u *icon UNUSED)
if (output_conv.vc_type != CONV_NONE) if (output_conv.vc_type != CONV_NONE)
vim_free(title); vim_free(title);
} }
#endif // FEAT_TITLE
#if defined(FEAT_MENU) || defined(PROTO) #if defined(FEAT_MENU) || defined(PROTO)
void void

View File

@ -314,9 +314,7 @@ DoRegisterName(Display *dpy, char_u *name)
set_vim_var_string(VV_SEND_SERVER, name, -1); set_vim_var_string(VV_SEND_SERVER, name, -1);
#endif #endif
serverName = vim_strsave(name); serverName = vim_strsave(name);
#ifdef FEAT_TITLE
need_maketitle = TRUE; need_maketitle = TRUE;
#endif
return 0; return 0;
} }
return -2; return -2;

View File

@ -390,9 +390,7 @@ ex_language(exarg_T *eap)
// Set v:lang, v:lc_time, v:collate and v:ctype to the final result. // Set v:lang, v:lc_time, v:collate and v:ctype to the final result.
set_lang_var(); set_lang_var();
# endif # endif
# ifdef FEAT_TITLE
maketitle(); maketitle();
# endif
} }
} }
} }

View File

@ -668,7 +668,7 @@ vim_main2(void)
scroll_region_reset(); // In case Rows changed scroll_region_reset(); // In case Rows changed
scroll_start(); // may scroll the screen to the right position scroll_start(); // may scroll the screen to the right position
#if defined(FEAT_TITLE) && (defined(UNIX) || defined(VMS) || defined(MACOS_X)) #if defined(UNIX) || defined(VMS) || defined(MACOS_X)
term_push_title(SAVE_RESTORE_BOTH); term_push_title(SAVE_RESTORE_BOTH);
#endif #endif
@ -1395,10 +1395,8 @@ main_loop(
else if (redraw_cmdline || clear_cmdline) else if (redraw_cmdline || clear_cmdline)
showmode(); showmode();
redraw_statuslines(); redraw_statuslines();
#ifdef FEAT_TITLE
if (need_maketitle) if (need_maketitle)
maketitle(); maketitle();
#endif
#ifdef FEAT_VIMINFO #ifdef FEAT_VIMINFO
curbuf->b_last_used = vim_time(); curbuf->b_last_used = vim_time();
#endif #endif

View File

@ -1735,9 +1735,7 @@ set_fileformat(
// This may cause the buffer to become (un)modified. // This may cause the buffer to become (un)modified.
check_status(curbuf); check_status(curbuf);
redraw_tabline = TRUE; redraw_tabline = TRUE;
#ifdef FEAT_TITLE
need_maketitle = TRUE; // set window title later need_maketitle = TRUE; // set window title later
#endif
} }
/* /*

View File

@ -1669,9 +1669,7 @@ nb_do_cmd(
buf->bufp = curbuf; buf->bufp = curbuf;
buf->initDone = TRUE; buf->initDone = TRUE;
do_update = 1; do_update = 1;
#if defined(FEAT_TITLE)
maketitle(); maketitle();
#endif
#if defined(FEAT_MENU) && defined(FEAT_GUI) #if defined(FEAT_MENU) && defined(FEAT_GUI)
if (gui.in_use) if (gui.in_use)
gui_update_menus(0); gui_update_menus(0);
@ -1748,9 +1746,7 @@ nb_do_cmd(
{ {
check_status(buf->bufp); check_status(buf->bufp);
redraw_tabline = TRUE; redraw_tabline = TRUE;
#ifdef FEAT_TITLE
maketitle(); maketitle();
#endif
update_screen(0); update_screen(0);
} }
// ===================================================================== // =====================================================================

View File

@ -1102,9 +1102,7 @@ set_init_3(void)
set_fileformat(default_fileformat(), OPT_LOCAL); set_fileformat(default_fileformat(), OPT_LOCAL);
} }
#ifdef FEAT_TITLE
set_title_defaults(); set_title_defaults();
#endif
} }
#if defined(FEAT_MULTI_LANG) || defined(PROTO) #if defined(FEAT_MULTI_LANG) || defined(PROTO)
@ -1148,7 +1146,6 @@ set_helplang_default(char_u *lang)
} }
#endif #endif
#ifdef FEAT_TITLE
/* /*
* 'title' and 'icon' only default to true if they have not been set or reset * 'title' and 'icon' only default to true if they have not been set or reset
* in .vimrc and we can read the old value. * in .vimrc and we can read the old value.
@ -1192,7 +1189,6 @@ set_title_defaults(void)
p_icon = val; p_icon = val;
} }
} }
#endif
void void
ex_set(exarg_T *eap) ex_set(exarg_T *eap)
@ -2272,7 +2268,6 @@ string_to_key(char_u *arg, int multi_byte)
return *arg; return *arg;
} }
#ifdef FEAT_TITLE
/* /*
* When changing 'title', 'titlestring', 'icon' or 'iconstring', call * When changing 'title', 'titlestring', 'icon' or 'iconstring', call
* maketitle() to create and display it. * maketitle() to create and display it.
@ -2289,7 +2284,6 @@ did_set_title(void)
) )
maketitle(); maketitle();
} }
#endif
/* /*
* set_options_bin - called when 'bin' changes value. * set_options_bin - called when 'bin' changes value.
@ -2558,7 +2552,6 @@ insecure_flag(int opt_idx, int opt_flags)
} }
#endif #endif
#if defined(FEAT_TITLE) || defined(PROTO)
/* /*
* Redraw the window title and/or tab page text later. * Redraw the window title and/or tab page text later.
*/ */
@ -2567,7 +2560,6 @@ void redraw_titles(void)
need_maketitle = TRUE; need_maketitle = TRUE;
redraw_tabline = TRUE; redraw_tabline = TRUE;
} }
#endif
/* /*
* Return TRUE if "val" is a valid name: only consists of alphanumeric ASCII * Return TRUE if "val" is a valid name: only consists of alphanumeric ASCII
@ -2809,9 +2801,7 @@ set_bool_option(
if (curbuf->b_p_ro) if (curbuf->b_p_ro)
curbuf->b_did_warn = FALSE; curbuf->b_did_warn = FALSE;
#ifdef FEAT_TITLE
redraw_titles(); redraw_titles();
#endif
} }
#ifdef FEAT_GUI #ifdef FEAT_GUI
@ -2834,11 +2824,8 @@ set_bool_option(
return N_("E946: Cannot make a terminal with running job modifiable"); return N_("E946: Cannot make a terminal with running job modifiable");
} }
# endif # endif
# ifdef FEAT_TITLE
redraw_titles(); redraw_titles();
# endif
} }
#ifdef FEAT_TITLE
// when 'endofline' is changed, redraw the window title // when 'endofline' is changed, redraw the window title
else if ((int *)varp == &curbuf->b_p_eol) else if ((int *)varp == &curbuf->b_p_eol)
{ {
@ -2854,15 +2841,12 @@ set_bool_option(
{ {
redraw_titles(); redraw_titles();
} }
#endif
// when 'bin' is set also set some other options // when 'bin' is set also set some other options
else if ((int *)varp == &curbuf->b_p_bin) else if ((int *)varp == &curbuf->b_p_bin)
{ {
set_options_bin(old_value, curbuf->b_p_bin, opt_flags); set_options_bin(old_value, curbuf->b_p_bin, opt_flags);
#ifdef FEAT_TITLE
redraw_titles(); redraw_titles();
#endif
} }
// when 'buflisted' changes, trigger autocommands // when 'buflisted' changes, trigger autocommands
@ -2996,21 +2980,17 @@ set_bool_option(
} }
#endif #endif
#ifdef FEAT_TITLE
// when 'title' changed, may need to change the title; same for 'icon' // when 'title' changed, may need to change the title; same for 'icon'
else if ((int *)varp == &p_title || (int *)varp == &p_icon) else if ((int *)varp == &p_title || (int *)varp == &p_icon)
{ {
did_set_title(); did_set_title();
} }
#endif
else if ((int *)varp == &curbuf->b_changed) else if ((int *)varp == &curbuf->b_changed)
{ {
if (!value) if (!value)
save_file_ff(curbuf); // Buffer is unchanged save_file_ff(curbuf); // Buffer is unchanged
#ifdef FEAT_TITLE
redraw_titles(); redraw_titles();
#endif
modified_was_set = value; modified_was_set = value;
} }
@ -3566,7 +3546,6 @@ set_num_option(
p_imsearch = curbuf->b_p_imsearch; p_imsearch = curbuf->b_p_imsearch;
} }
#ifdef FEAT_TITLE
// if 'titlelen' has changed, redraw the title // if 'titlelen' has changed, redraw the title
else if (pp == &p_titlelen) else if (pp == &p_titlelen)
{ {
@ -3578,7 +3557,6 @@ set_num_option(
if (starting != NO_SCREEN && old_value != p_titlelen) if (starting != NO_SCREEN && old_value != p_titlelen)
need_maketitle = TRUE; need_maketitle = TRUE;
} }
#endif
// if p_ch changed value, change the command line height // if p_ch changed value, change the command line height
else if (pp == &p_ch) else if (pp == &p_ch)
@ -4971,9 +4949,7 @@ clear_termoptions(void)
* screen will be cleared later, so this is OK. * screen will be cleared later, so this is OK.
*/ */
mch_setmouse(FALSE); // switch mouse off mch_setmouse(FALSE); // switch mouse off
#ifdef FEAT_TITLE
mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles
#endif
#if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI) #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI)
// When starting the GUI close the display opened for the clipboard. // When starting the GUI close the display opened for the clipboard.
// After restoring the title, because that will need the display. // After restoring the title, because that will need the display.

View File

@ -657,10 +657,8 @@ EXTERN int p_hkmapp; // 'hkmapp'
EXTERN int p_arshape; // 'arabicshape' EXTERN int p_arshape; // 'arabicshape'
# endif # endif
#endif #endif
#ifdef FEAT_TITLE
EXTERN int p_icon; // 'icon' EXTERN int p_icon; // 'icon'
EXTERN char_u *p_iconstring; // 'iconstring' EXTERN char_u *p_iconstring; // 'iconstring'
#endif
EXTERN int p_ic; // 'ignorecase' EXTERN int p_ic; // 'ignorecase'
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
EXTERN char_u *p_imak; // 'imactivatekey' EXTERN char_u *p_imak; // 'imactivatekey'
@ -986,12 +984,10 @@ EXTERN long p_tw; // 'textwidth'
EXTERN int p_to; // 'tildeop' EXTERN int p_to; // 'tildeop'
EXTERN int p_timeout; // 'timeout' EXTERN int p_timeout; // 'timeout'
EXTERN long p_tm; // 'timeoutlen' EXTERN long p_tm; // 'timeoutlen'
#ifdef FEAT_TITLE
EXTERN int p_title; // 'title' EXTERN int p_title; // 'title'
EXTERN long p_titlelen; // 'titlelen' EXTERN long p_titlelen; // 'titlelen'
EXTERN char_u *p_titleold; // 'titleold' EXTERN char_u *p_titleold; // 'titleold'
EXTERN char_u *p_titlestring; // 'titlestring' EXTERN char_u *p_titlestring; // 'titlestring'
#endif
EXTERN char_u *p_tsr; // 'thesaurus' EXTERN char_u *p_tsr; // 'thesaurus'
EXTERN int p_ttimeout; // 'ttimeout' EXTERN int p_ttimeout; // 'ttimeout'
EXTERN long p_ttm; // 'ttimeoutlen' EXTERN long p_ttm; // 'ttimeoutlen'

View File

@ -1313,18 +1313,10 @@ static struct vimoption options[] =
(char_u *)&p_hls, PV_NONE, (char_u *)&p_hls, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"icon", NULL, P_BOOL|P_VI_DEF, {"icon", NULL, P_BOOL|P_VI_DEF,
#ifdef FEAT_TITLE
(char_u *)&p_icon, PV_NONE, (char_u *)&p_icon, PV_NONE,
#else
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"iconstring", NULL, P_STRING|P_VI_DEF|P_MLE, {"iconstring", NULL, P_STRING|P_VI_DEF|P_MLE,
#ifdef FEAT_TITLE
(char_u *)&p_iconstring, PV_NONE, (char_u *)&p_iconstring, PV_NONE,
#else
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)"", (char_u *)0L} SCTX_INIT}, {(char_u *)"", (char_u *)0L} SCTX_INIT},
{"ignorecase", "ic", P_BOOL|P_VI_DEF, {"ignorecase", "ic", P_BOOL|P_VI_DEF,
(char_u *)&p_ic, PV_NONE, (char_u *)&p_ic, PV_NONE,
@ -2651,35 +2643,18 @@ static struct vimoption options[] =
(char_u *)&p_tm, PV_NONE, (char_u *)&p_tm, PV_NONE,
{(char_u *)1000L, (char_u *)0L} SCTX_INIT}, {(char_u *)1000L, (char_u *)0L} SCTX_INIT},
{"title", NULL, P_BOOL|P_VI_DEF, {"title", NULL, P_BOOL|P_VI_DEF,
#ifdef FEAT_TITLE
(char_u *)&p_title, PV_NONE, (char_u *)&p_title, PV_NONE,
#else
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"titlelen", NULL, P_NUM|P_VI_DEF, {"titlelen", NULL, P_NUM|P_VI_DEF,
#ifdef FEAT_TITLE
(char_u *)&p_titlelen, PV_NONE, (char_u *)&p_titlelen, PV_NONE,
#else
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)85L, (char_u *)0L} SCTX_INIT}, {(char_u *)85L, (char_u *)0L} SCTX_INIT},
{"titleold", NULL, P_STRING|P_VI_DEF|P_GETTEXT|P_SECURE|P_NO_MKRC, {"titleold", NULL, P_STRING|P_VI_DEF|P_GETTEXT|P_SECURE|P_NO_MKRC,
#ifdef FEAT_TITLE
(char_u *)&p_titleold, PV_NONE, (char_u *)&p_titleold, PV_NONE,
{(char_u *)N_("Thanks for flying Vim"), {(char_u *)N_("Thanks for flying Vim"),
(char_u *)0L} (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCTX_INIT}, SCTX_INIT},
{"titlestring", NULL, P_STRING|P_VI_DEF|P_MLE, {"titlestring", NULL, P_STRING|P_VI_DEF|P_MLE,
#ifdef FEAT_TITLE
(char_u *)&p_titlestring, PV_NONE, (char_u *)&p_titlestring, PV_NONE,
#else
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)"", (char_u *)0L} SCTX_INIT}, {(char_u *)"", (char_u *)0L} SCTX_INIT},
{"toolbar", "tb", P_STRING|P_ONECOMMA|P_VI_DEF|P_NODUP, {"toolbar", "tb", P_STRING|P_ONECOMMA|P_VI_DEF|P_NODUP,
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN) #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)

View File

@ -979,10 +979,8 @@ ambw_end:
errmsg = e_invarg; errmsg = e_invarg;
else else
{ {
#ifdef FEAT_TITLE
// May show a "+" in the title now. // May show a "+" in the title now.
redraw_titles(); redraw_titles();
#endif
// Add 'fileencoding' to the swap file. // Add 'fileencoding' to the swap file.
ml_setflags(curbuf); ml_setflags(curbuf);
} }
@ -999,9 +997,7 @@ ambw_end:
if (varp == &p_enc) if (varp == &p_enc)
{ {
errmsg = mb_init(); errmsg = mb_init();
#ifdef FEAT_TITLE
redraw_titles(); redraw_titles();
#endif
} }
} }
@ -1141,9 +1137,7 @@ ambw_end:
curbuf->b_p_tx = TRUE; curbuf->b_p_tx = TRUE;
else else
curbuf->b_p_tx = FALSE; curbuf->b_p_tx = FALSE;
#ifdef FEAT_TITLE
redraw_titles(); redraw_titles();
#endif
// update flag in swap file // update flag in swap file
ml_setflags(curbuf); ml_setflags(curbuf);
// Redraw needed when switching to/from "mac": a CR in the text // Redraw needed when switching to/from "mac": a CR in the text
@ -1603,11 +1597,10 @@ ambw_end:
fill_breakat_flags(); fill_breakat_flags();
#endif #endif
#ifdef FEAT_TITLE
// 'titlestring' and 'iconstring' // 'titlestring' and 'iconstring'
else if (varp == &p_titlestring || varp == &p_iconstring) else if (varp == &p_titlestring || varp == &p_iconstring)
{ {
# ifdef FEAT_STL_OPT #ifdef FEAT_STL_OPT
int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON; int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON;
// NULL => statusline syntax // NULL => statusline syntax
@ -1615,10 +1608,9 @@ ambw_end:
stl_syntax |= flagval; stl_syntax |= flagval;
else else
stl_syntax &= ~flagval; stl_syntax &= ~flagval;
# endif #endif
did_set_title(); did_set_title();
} }
#endif
#ifdef FEAT_GUI #ifdef FEAT_GUI
// 'guioptions' // 'guioptions'
@ -1805,9 +1797,7 @@ ambw_end:
redraw_later(VALID); redraw_later(VALID);
} }
curbuf->b_help = (curbuf->b_p_bt[0] == 'h'); curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
#ifdef FEAT_TITLE
redraw_titles(); redraw_titles();
#endif
} }
} }

View File

@ -623,7 +623,6 @@ get_fib(char_u *fname)
return fib; return fib;
} }
#ifdef FEAT_TITLE
/* /*
* set the title of our window * set the title of our window
* icon name is not set * icon name is not set
@ -660,7 +659,6 @@ mch_can_restore_icon(void)
{ {
return FALSE; return FALSE;
} }
#endif
void void
mch_setmouse(int on UNUSED) mch_setmouse(int on UNUSED)
@ -940,9 +938,7 @@ mch_exit(int r)
out_flush(); out_flush();
} }
#ifdef FEAT_TITLE
mch_restore_title(SAVE_RESTORE_BOTH); // restore window title mch_restore_title(SAVE_RESTORE_BOTH); // restore window title
#endif
ml_close_all(TRUE); // remove all memfiles ml_close_all(TRUE); // remove all memfiles
@ -1442,9 +1438,7 @@ mch_call_shell(
cur_tmode = TMODE_UNKNOWN; cur_tmode = TMODE_UNKNOWN;
settmode(TMODE_RAW); // set to raw mode settmode(TMODE_RAW); // set to raw mode
} }
#ifdef FEAT_TITLE
resettitle(); resettitle();
#endif
if (term_console) if (term_console)
win_resize_on(); // window resize events activated win_resize_on(); // window resize events activated
return retval; return retval;

View File

@ -32,7 +32,7 @@
#endif #endif
#ifndef PROTO #ifndef PROTO
# if defined(FEAT_TITLE) && !defined(FEAT_GUI_MSWIN) # if !defined(FEAT_GUI_MSWIN)
# include <shellapi.h> # include <shellapi.h>
# endif # endif
@ -265,7 +265,6 @@ mch_input_isatty(void)
#endif #endif
} }
#ifdef FEAT_TITLE
/* /*
* mch_settitle(): set titlebar of our window * mch_settitle(): set titlebar of our window
*/ */
@ -274,16 +273,16 @@ mch_settitle(
char_u *title, char_u *title,
char_u *icon UNUSED) char_u *icon UNUSED)
{ {
# ifdef FEAT_GUI_MSWIN #ifdef FEAT_GUI_MSWIN
# ifdef VIMDLL # ifdef VIMDLL
if (gui.in_use) if (gui.in_use)
# endif # endif
{ {
gui_mch_settitle(title, icon); gui_mch_settitle(title, icon);
return; return;
} }
# endif #endif
# if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) #if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
if (title != NULL) if (title != NULL)
{ {
WCHAR *wp = enc_to_utf16(title, NULL); WCHAR *wp = enc_to_utf16(title, NULL);
@ -295,7 +294,7 @@ mch_settitle(
vim_free(wp); vim_free(wp);
return; return;
} }
# endif #endif
} }
@ -309,12 +308,12 @@ mch_settitle(
void void
mch_restore_title(int which UNUSED) mch_restore_title(int which UNUSED)
{ {
# if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) #if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL)
# ifdef VIMDLL # ifdef VIMDLL
if (!gui.in_use) if (!gui.in_use)
# endif
SetConsoleTitle(g_szOrigTitle);
# endif # endif
SetConsoleTitle(g_szOrigTitle);
#endif
} }
@ -336,7 +335,6 @@ mch_can_restore_icon(void)
{ {
return FALSE; return FALSE;
} }
#endif // FEAT_TITLE
/* /*
@ -937,9 +935,7 @@ Trace(
#endif //_DEBUG #endif //_DEBUG
#if !defined(FEAT_GUI) || defined(VIMDLL) || defined(PROTO) #if !defined(FEAT_GUI) || defined(VIMDLL) || defined(PROTO)
# ifdef FEAT_TITLE
extern HWND g_hWnd; // This is in os_win32.c. extern HWND g_hWnd; // This is in os_win32.c.
# endif
/* /*
* Showing the printer dialog is tricky since we have no GUI * Showing the printer dialog is tricky since we have no GUI
@ -953,14 +949,12 @@ GetConsoleHwnd(void)
if (s_hwnd != 0) if (s_hwnd != 0)
return; return;
# ifdef FEAT_TITLE
// Window handle may have been found by init code (Windows NT only) // Window handle may have been found by init code (Windows NT only)
if (g_hWnd != 0) if (g_hWnd != 0)
{ {
s_hwnd = g_hWnd; s_hwnd = g_hWnd;
return; return;
} }
# endif
s_hwnd = GetConsoleWindow(); s_hwnd = GetConsoleWindow();
} }
@ -2301,9 +2295,7 @@ serverSetName(char_u *name)
{ {
// Remember the name // Remember the name
serverName = ok_name; serverName = ok_name;
# ifdef FEAT_TITLE
need_maketitle = TRUE; // update Vim window title later need_maketitle = TRUE; // update Vim window title later
# endif
// Update the message window title // Update the message window title
SetWindowText(message_window, (LPCSTR)ok_name); SetWindowText(message_window, (LPCSTR)ok_name);

View File

@ -118,15 +118,12 @@ static void clip_update(void);
static void xterm_update(void); static void xterm_update(void);
# endif # endif
# if defined(FEAT_XCLIPBOARD) || defined(FEAT_TITLE)
Window x11_window = 0; Window x11_window = 0;
# endif
Display *x11_display = NULL; Display *x11_display = NULL;
#endif #endif
static int ignore_sigtstp = FALSE; static int ignore_sigtstp = FALSE;
#ifdef FEAT_TITLE
static int get_x11_title(int); static int get_x11_title(int);
static char_u *oldtitle = NULL; static char_u *oldtitle = NULL;
@ -134,7 +131,6 @@ static volatile sig_atomic_t oldtitle_outdated = FALSE;
static int unix_did_set_title = FALSE; static int unix_did_set_title = FALSE;
static char_u *oldicon = NULL; static char_u *oldicon = NULL;
static int did_set_icon = FALSE; static int did_set_icon = FALSE;
#endif
static void may_core_dump(void); static void may_core_dump(void);
@ -170,8 +166,7 @@ static RETSIGTYPE catch_sigusr1 SIGPROTOARG;
#if defined(SIGPWR) #if defined(SIGPWR)
static RETSIGTYPE catch_sigpwr SIGPROTOARG; static RETSIGTYPE catch_sigpwr SIGPROTOARG;
#endif #endif
#if defined(SIGALRM) && defined(FEAT_X11) \ #if defined(SIGALRM) && defined(FEAT_X11) && !defined(FEAT_GUI_GTK)
&& defined(FEAT_TITLE) && !defined(FEAT_GUI_GTK)
# define SET_SIG_ALARM # define SET_SIG_ALARM
static RETSIGTYPE sig_alarm SIGPROTOARG; static RETSIGTYPE sig_alarm SIGPROTOARG;
// volatile because it is used in signal handler sig_alarm(). // volatile because it is used in signal handler sig_alarm().
@ -1152,11 +1147,10 @@ deathtrap SIGDEFARG(sigarg)
static void static void
after_sigcont(void) after_sigcont(void)
{ {
# ifdef FEAT_TITLE
// Don't change "oldtitle" in a signal handler, set a flag to obtain it // Don't change "oldtitle" in a signal handler, set a flag to obtain it
// again later. // again later.
oldtitle_outdated = TRUE; oldtitle_outdated = TRUE;
# endif
settmode(TMODE_RAW); settmode(TMODE_RAW);
need_check_timestamps = TRUE; need_check_timestamps = TRUE;
did_check_timestamps = FALSE; did_check_timestamps = FALSE;
@ -1579,8 +1573,7 @@ mch_input_isatty(void)
#ifdef FEAT_X11 #ifdef FEAT_X11
# if defined(ELAPSED_TIMEVAL) \ # if defined(ELAPSED_TIMEVAL)
&& (defined(FEAT_XCLIPBOARD) || defined(FEAT_TITLE))
/* /*
* Give a message about the elapsed time for opening the X window. * Give a message about the elapsed time for opening the X window.
@ -1593,7 +1586,7 @@ xopen_message(long elapsed_msec)
# endif # endif
#endif #endif
#if defined(FEAT_X11) && (defined(FEAT_TITLE) || defined(FEAT_XCLIPBOARD)) #if defined(FEAT_X11)
/* /*
* A few functions shared by X11 title and clipboard code. * A few functions shared by X11 title and clipboard code.
*/ */
@ -1776,7 +1769,6 @@ test_x11_window(Display *dpy)
} }
#endif #endif
#ifdef FEAT_TITLE
#ifdef FEAT_X11 #ifdef FEAT_X11
@ -2316,7 +2308,6 @@ mch_restore_title(int which)
} }
} }
#endif // FEAT_TITLE
/* /*
* Return TRUE if "name" looks like some xterm name. * Return TRUE if "name" looks like some xterm name.
@ -3349,10 +3340,8 @@ mch_free_mem(void)
# if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) # if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
VIM_CLEAR(signal_stack); VIM_CLEAR(signal_stack);
# endif # endif
# ifdef FEAT_TITLE
vim_free(oldtitle); vim_free(oldtitle);
vim_free(oldicon); vim_free(oldicon);
# endif
} }
#endif #endif
@ -3403,14 +3392,13 @@ mch_exit(int r)
#endif #endif
{ {
settmode(TMODE_COOK); settmode(TMODE_COOK);
#ifdef FEAT_TITLE
if (!is_not_a_term()) if (!is_not_a_term())
{ {
// restore xterm title and icon name // restore xterm title and icon name
mch_restore_title(SAVE_RESTORE_BOTH); mch_restore_title(SAVE_RESTORE_BOTH);
term_pop_title(SAVE_RESTORE_BOTH); term_pop_title(SAVE_RESTORE_BOTH);
} }
#endif
/* /*
* When t_ti is not empty but it doesn't cause swapping terminal * When t_ti is not empty but it doesn't cause swapping terminal
* pages, need to output a newline when msg_didout is set. But when * pages, need to output a newline when msg_didout is set. But when
@ -4600,9 +4588,7 @@ mch_call_shell_system(
cur_tmode = TMODE_UNKNOWN; cur_tmode = TMODE_UNKNOWN;
settmode(TMODE_RAW); // set to raw mode settmode(TMODE_RAW); // set to raw mode
} }
# ifdef FEAT_TITLE
resettitle(); resettitle();
# endif
# if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
restore_clipboard(); restore_clipboard();
# endif # endif
@ -5441,9 +5427,7 @@ error:
if (!did_settmode) if (!did_settmode)
if (tmode == TMODE_RAW) if (tmode == TMODE_RAW)
settmode(TMODE_RAW); // set to raw mode settmode(TMODE_RAW); // set to raw mode
# ifdef FEAT_TITLE
resettitle(); resettitle();
# endif
vim_free(argv); vim_free(argv);
vim_free(tofree1); vim_free(tofree1);
vim_free(tofree2); vim_free(tofree2);

View File

@ -46,7 +46,7 @@
#endif #endif
#ifndef PROTO #ifndef PROTO
# if defined(FEAT_TITLE) && !defined(FEAT_GUI_MSWIN) # if !defined(FEAT_GUI_MSWIN)
# include <shellapi.h> # include <shellapi.h>
# endif # endif
#endif #endif
@ -2683,7 +2683,6 @@ static ConsoleBuffer g_cbOrig = { 0 };
static ConsoleBuffer g_cbNonTermcap = { 0 }; static ConsoleBuffer g_cbNonTermcap = { 0 };
static ConsoleBuffer g_cbTermcap = { 0 }; static ConsoleBuffer g_cbTermcap = { 0 };
# ifdef FEAT_TITLE
char g_szOrigTitle[256] = { 0 }; char g_szOrigTitle[256] = { 0 };
HWND g_hWnd = NULL; // also used in os_mswin.c HWND g_hWnd = NULL; // also used in os_mswin.c
static HICON g_hOrigIconSmall = NULL; static HICON g_hOrigIconSmall = NULL;
@ -2692,12 +2691,12 @@ static HICON g_hVimIcon = NULL;
static BOOL g_fCanChangeIcon = FALSE; static BOOL g_fCanChangeIcon = FALSE;
// ICON* are not defined in VC++ 4.0 // ICON* are not defined in VC++ 4.0
# ifndef ICON_SMALL # ifndef ICON_SMALL
# define ICON_SMALL 0 # define ICON_SMALL 0
# endif # endif
# ifndef ICON_BIG # ifndef ICON_BIG
# define ICON_BIG 1 # define ICON_BIG 1
# endif # endif
/* /*
* GetConsoleIcon() * GetConsoleIcon()
* Description: * Description:
@ -2789,7 +2788,6 @@ SaveConsoleTitleAndIcon(void)
if (g_hVimIcon != NULL) if (g_hVimIcon != NULL)
g_fCanChangeIcon = TRUE; g_fCanChangeIcon = TRUE;
} }
# endif
static int g_fWindInitCalled = FALSE; static int g_fWindInitCalled = FALSE;
static int g_fTermcapMode = FALSE; static int g_fTermcapMode = FALSE;
@ -2850,7 +2848,6 @@ mch_init_c(void)
GetConsoleMode(g_hConIn, &g_cmodein); GetConsoleMode(g_hConIn, &g_cmodein);
GetConsoleMode(g_hConOut, &g_cmodeout); GetConsoleMode(g_hConOut, &g_cmodeout);
# ifdef FEAT_TITLE
SaveConsoleTitleAndIcon(); SaveConsoleTitleAndIcon();
/* /*
* Set both the small and big icons of the console window to Vim's icon. * Set both the small and big icons of the console window to Vim's icon.
@ -2859,7 +2856,6 @@ mch_init_c(void)
*/ */
if (g_fCanChangeIcon) if (g_fCanChangeIcon)
SetConsoleIcon(g_hWnd, g_hVimIcon, g_hVimIcon); SetConsoleIcon(g_hWnd, g_hVimIcon, g_hVimIcon);
# endif
ui_get_shellsize(); ui_get_shellsize();
@ -2909,7 +2905,6 @@ mch_exit_c(int r)
if (g_fWindInitCalled) if (g_fWindInitCalled)
{ {
# ifdef FEAT_TITLE
mch_restore_title(SAVE_RESTORE_BOTH); mch_restore_title(SAVE_RESTORE_BOTH);
/* /*
* Restore both the small and big icons of the console window to * Restore both the small and big icons of the console window to
@ -2918,7 +2913,6 @@ mch_exit_c(int r)
*/ */
if (g_fCanChangeIcon && !g_fForceExit) if (g_fCanChangeIcon && !g_fForceExit)
SetConsoleIcon(g_hWnd, g_hOrigIconSmall, g_hOrigIcon); SetConsoleIcon(g_hWnd, g_hOrigIconSmall, g_hOrigIcon);
# endif
# ifdef MCH_WRITE_DUMP # ifdef MCH_WRITE_DUMP
if (fdDump) if (fdDump)
@ -4757,7 +4751,6 @@ mch_call_shell(
{ {
int x = 0; int x = 0;
int tmode = cur_tmode; int tmode = cur_tmode;
#ifdef FEAT_TITLE
WCHAR szShellTitle[512]; WCHAR szShellTitle[512];
// Change the title to reflect that we are in a subshell. // Change the title to reflect that we are in a subshell.
@ -4780,7 +4773,6 @@ mch_call_shell(
} }
} }
} }
#endif
out_flush(); out_flush();
@ -4813,9 +4805,7 @@ mch_call_shell(
{ {
// Use a terminal window to run the command in. // Use a terminal window to run the command in.
x = mch_call_shell_terminal(cmd, options); x = mch_call_shell_terminal(cmd, options);
# ifdef FEAT_TITLE
resettitle(); resettitle();
# endif
return x; return x;
} }
} }
@ -5062,9 +5052,7 @@ mch_call_shell(
smsg(_("shell returned %d"), x); smsg(_("shell returned %d"), x);
msg_putchar('\n'); msg_putchar('\n');
} }
#ifdef FEAT_TITLE
resettitle(); resettitle();
#endif
signal(SIGINT, SIG_DFL); signal(SIGINT, SIG_DFL);
#if defined(__GNUC__) && !defined(__MINGW32__) #if defined(__GNUC__) && !defined(__MINGW32__)
@ -5631,9 +5619,7 @@ termcap_mode_start(void)
ResizeConBufAndWindow(g_hConOut, Columns, Rows); ResizeConBufAndWindow(g_hConOut, Columns, Rows);
} }
# ifdef FEAT_TITLE
resettitle(); resettitle();
# endif
GetConsoleMode(g_hConIn, &cmodein); GetConsoleMode(g_hConIn, &cmodein);
if (g_fMouseActive) if (g_fMouseActive)

View File

@ -2746,8 +2746,7 @@ report_re_switch(char_u *pat)
} }
#endif #endif
#if (defined(FEAT_X11) && (defined(FEAT_TITLE) || defined(FEAT_XCLIPBOARD))) \ #if defined(FEAT_X11) || defined(PROTO)
|| defined(PROTO)
/* /*
* Return whether "prog" is currently being executed. * Return whether "prog" is currently being executed.
*/ */

View File

@ -2123,9 +2123,7 @@ set_termname(char_u *term)
{ {
starttermcap(); // may change terminal mode starttermcap(); // may change terminal mode
setmouse(); // may start using the mouse setmouse(); // may start using the mouse
#ifdef FEAT_TITLE
maketitle(); // may display window title maketitle(); // may display window title
#endif
} }
// display initial screen after ttest() checking. jw. // display initial screen after ttest() checking. jw.
@ -3091,8 +3089,7 @@ term_ul_rgb_color(guicolor_T rgb)
} }
#endif #endif
#if (defined(FEAT_TITLE) && (defined(UNIX) || defined(VMS) \ #if (defined(UNIX) || defined(VMS) || defined(MACOS_X)) || defined(PROTO)
|| defined(MACOS_X))) || defined(PROTO)
/* /*
* Generic function to set window title, using t_ts and t_fs. * Generic function to set window title, using t_ts and t_fs.
*/ */
@ -3505,9 +3502,8 @@ set_shellsize(int width, int height, int mustset)
if (starting != NO_SCREEN) if (starting != NO_SCREEN)
{ {
#ifdef FEAT_TITLE
maketitle(); maketitle();
#endif
changed_line_abv_curs(); changed_line_abv_curs();
invalidate_botline(); invalidate_botline();

View File

@ -1175,11 +1175,10 @@ ui_focus_change(
gui_update_scrollbars(FALSE); gui_update_scrollbars(FALSE);
# endif # endif
} }
#ifdef FEAT_TITLE
// File may have been changed from 'readonly' to 'noreadonly' // File may have been changed from 'readonly' to 'noreadonly'
if (need_maketitle) if (need_maketitle)
maketitle(); maketitle();
#endif
} }
#if defined(HAVE_INPUT_METHOD) || defined(PROTO) #if defined(HAVE_INPUT_METHOD) || defined(PROTO)

View File

@ -652,11 +652,7 @@ static char *(features[]) =
#else #else
"-timers", "-timers",
#endif #endif
#ifdef FEAT_TITLE
"+title", "+title",
#else
"-title",
#endif
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
"+toolbar", "+toolbar",
#else #else
@ -757,6 +753,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3699,
/**/ /**/
3698, 3698,
/**/ /**/

View File

@ -4818,9 +4818,7 @@ win_enter_ext(win_T *wp, int flags)
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
} }
#ifdef FEAT_TITLE
maketitle(); maketitle();
#endif
curwin->w_redr_status = TRUE; curwin->w_redr_status = TRUE;
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
if (bt_terminal(curwin->w_buffer)) if (bt_terminal(curwin->w_buffer))