mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Problem: A lot of code is shared between vim.exe and gvim.exe. Solution: Optionally put the shared code in vim.dll. (Ken Takata, closes #4287)
This commit is contained in:
116
src/message.c
116
src/message.c
@@ -2563,8 +2563,12 @@ t_puts(
|
||||
msg_use_printf(void)
|
||||
{
|
||||
return (!msg_check_screen()
|
||||
#if defined(MSWIN) && !defined(FEAT_GUI_MSWIN)
|
||||
#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
|
||||
# ifdef VIMDLL
|
||||
|| (!gui.in_use && !termcap_active)
|
||||
# else
|
||||
|| !termcap_active
|
||||
# endif
|
||||
#endif
|
||||
|| (swapping_screen() && !termcap_active)
|
||||
);
|
||||
@@ -2940,15 +2944,10 @@ do_more_prompt(int typed_char)
|
||||
# undef mch_msg
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Give an error message. To be used when the screen hasn't been initialized
|
||||
* yet. When stderr can't be used, collect error messages until the GUI has
|
||||
* started and they can be displayed in a message box.
|
||||
*/
|
||||
void
|
||||
mch_errmsg(char *str)
|
||||
#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
|
||||
static void
|
||||
mch_errmsg_c(char *str)
|
||||
{
|
||||
#if defined(MSWIN) && !defined(FEAT_GUI_MSWIN)
|
||||
int len = (int)STRLEN(str);
|
||||
DWORD nwrite = 0;
|
||||
DWORD mode = 0;
|
||||
@@ -2966,34 +2965,57 @@ mch_errmsg(char *str)
|
||||
{
|
||||
fprintf(stderr, "%s", str);
|
||||
}
|
||||
#else
|
||||
int len;
|
||||
}
|
||||
#endif
|
||||
|
||||
# if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI)
|
||||
/*
|
||||
* Give an error message. To be used when the screen hasn't been initialized
|
||||
* yet. When stderr can't be used, collect error messages until the GUI has
|
||||
* started and they can be displayed in a message box.
|
||||
*/
|
||||
void
|
||||
mch_errmsg(char *str)
|
||||
{
|
||||
#if !defined(MSWIN) || defined(FEAT_GUI_MSWIN)
|
||||
int len;
|
||||
#endif
|
||||
|
||||
#if (defined(UNIX) || defined(FEAT_GUI)) && (!defined(ALWAYS_USE_GUI) || !defined(VIMDLL))
|
||||
/* On Unix use stderr if it's a tty.
|
||||
* When not going to start the GUI also use stderr.
|
||||
* On Mac, when started from Finder, stderr is the console. */
|
||||
if (
|
||||
# ifdef UNIX
|
||||
# ifdef MACOS_X
|
||||
# ifdef UNIX
|
||||
# ifdef MACOS_X
|
||||
(isatty(2) && strcmp("/dev/console", ttyname(2)) != 0)
|
||||
# else
|
||||
# else
|
||||
isatty(2)
|
||||
# endif
|
||||
# ifdef FEAT_GUI
|
||||
||
|
||||
# endif
|
||||
# endif
|
||||
# ifdef FEAT_GUI
|
||||
!(gui.in_use || gui.starting)
|
||||
||
|
||||
# endif
|
||||
# endif
|
||||
# ifdef FEAT_GUI
|
||||
!(gui.in_use || gui.starting)
|
||||
# endif
|
||||
)
|
||||
{
|
||||
fprintf(stderr, "%s", str);
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
|
||||
# ifdef VIMDLL
|
||||
if (!(gui.in_use || gui.starting))
|
||||
# endif
|
||||
{
|
||||
mch_errmsg_c(str);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(MSWIN) || defined(FEAT_GUI_MSWIN)
|
||||
/* avoid a delay for a message that isn't there */
|
||||
emsg_on_display = FALSE;
|
||||
|
||||
@@ -3028,15 +3050,10 @@ mch_errmsg(char *str)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Give a message. To be used when the screen hasn't been initialized yet.
|
||||
* When there is no tty, collect messages until the GUI has started and they
|
||||
* can be displayed in a message box.
|
||||
*/
|
||||
void
|
||||
mch_msg(char *str)
|
||||
#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
|
||||
static void
|
||||
mch_msg_c(char *str)
|
||||
{
|
||||
#if defined(MSWIN) && !defined(FEAT_GUI_MSWIN)
|
||||
int len = (int)STRLEN(str);
|
||||
DWORD nwrite = 0;
|
||||
DWORD mode;
|
||||
@@ -3055,32 +3072,53 @@ mch_msg(char *str)
|
||||
{
|
||||
printf("%s", str);
|
||||
}
|
||||
#else
|
||||
# if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Give a message. To be used when the screen hasn't been initialized yet.
|
||||
* When there is no tty, collect messages until the GUI has started and they
|
||||
* can be displayed in a message box.
|
||||
*/
|
||||
void
|
||||
mch_msg(char *str)
|
||||
{
|
||||
#if (defined(UNIX) || defined(FEAT_GUI)) && (!defined(ALWAYS_USE_GUI) || !defined(VIMDLL))
|
||||
/* On Unix use stdout if we have a tty. This allows "vim -h | more" and
|
||||
* uses mch_errmsg() when started from the desktop.
|
||||
* When not going to start the GUI also use stdout.
|
||||
* On Mac, when started from Finder, stderr is the console. */
|
||||
if (
|
||||
# ifdef UNIX
|
||||
# ifdef MACOS_X
|
||||
# ifdef UNIX
|
||||
# ifdef MACOS_X
|
||||
(isatty(2) && strcmp("/dev/console", ttyname(2)) != 0)
|
||||
# else
|
||||
# else
|
||||
isatty(2)
|
||||
# endif
|
||||
# ifdef FEAT_GUI
|
||||
||
|
||||
# endif
|
||||
# endif
|
||||
# ifdef FEAT_GUI
|
||||
!(gui.in_use || gui.starting)
|
||||
||
|
||||
# endif
|
||||
# endif
|
||||
# ifdef FEAT_GUI
|
||||
!(gui.in_use || gui.starting)
|
||||
# endif
|
||||
)
|
||||
{
|
||||
printf("%s", str);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
|
||||
# ifdef VIMDLL
|
||||
if (!(gui.in_use || gui.starting))
|
||||
# endif
|
||||
{
|
||||
mch_msg_c(str);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if !defined(MSWIN) || defined(FEAT_GUI_MSWIN)
|
||||
mch_errmsg(str);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user