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