0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -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

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