forked from aniani/vim
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:
@@ -1626,7 +1626,11 @@ vgetc(void)
|
||||
#if defined(FEAT_GUI_MSWIN) && defined(FEAT_MENU) && defined(FEAT_TEAROFF)
|
||||
// Handle K_TEAROFF here, the caller of vgetc() doesn't need to
|
||||
// know that a menu was torn off
|
||||
if (c == K_TEAROFF)
|
||||
if (
|
||||
# ifdef VIMDLL
|
||||
gui.in_use &&
|
||||
# endif
|
||||
c == K_TEAROFF)
|
||||
{
|
||||
char_u name[200];
|
||||
int i;
|
||||
@@ -3113,6 +3117,7 @@ fix_input_buffer(char_u *buf, int len)
|
||||
p += 2;
|
||||
i -= 2;
|
||||
}
|
||||
# ifndef MSWIN
|
||||
/* When the GUI is not used CSI needs to be escaped. */
|
||||
else if (!gui.in_use && p[0] == CSI)
|
||||
{
|
||||
@@ -3122,12 +3127,16 @@ fix_input_buffer(char_u *buf, int len)
|
||||
*p = (int)KE_CSI;
|
||||
len += 2;
|
||||
}
|
||||
# endif
|
||||
else
|
||||
#endif
|
||||
if (p[0] == NUL || (p[0] == K_SPECIAL
|
||||
/* timeout may generate K_CURSORHOLD */
|
||||
&& (i < 2 || p[1] != KS_EXTRA || p[2] != (int)KE_CURSORHOLD)
|
||||
#if defined(MSWIN) && !defined(FEAT_GUI)
|
||||
#if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL))
|
||||
# ifdef VIMDLL
|
||||
&& !gui.in_use
|
||||
# endif
|
||||
/* Win32 console passes modifiers */
|
||||
&& (i < 2 || p[1] != KS_MODIFIER)
|
||||
#endif
|
||||
@@ -5232,20 +5241,21 @@ check_map(
|
||||
|
||||
#if defined(MSWIN) || defined(MACOS_X)
|
||||
|
||||
#define VIS_SEL (VISUAL+SELECTMODE) /* abbreviation */
|
||||
# define VIS_SEL (VISUAL+SELECTMODE) /* abbreviation */
|
||||
|
||||
/*
|
||||
* Default mappings for some often used keys.
|
||||
*/
|
||||
static struct initmap
|
||||
struct initmap
|
||||
{
|
||||
char_u *arg;
|
||||
int mode;
|
||||
} initmappings[] =
|
||||
};
|
||||
|
||||
# ifdef FEAT_GUI_MSWIN
|
||||
/* Use the Windows (CUA) keybindings. (GUI) */
|
||||
static struct initmap initmappings[] =
|
||||
{
|
||||
#if defined(MSWIN)
|
||||
/* Use the Windows (CUA) keybindings. */
|
||||
# ifdef FEAT_GUI
|
||||
/* paste, copy and cut */
|
||||
{(char_u *)"<S-Insert> \"*P", NORMAL},
|
||||
{(char_u *)"<S-Insert> \"-d\"*P", VIS_SEL},
|
||||
@@ -5255,7 +5265,13 @@ static struct initmap
|
||||
{(char_u *)"<C-Del> \"*d", VIS_SEL},
|
||||
{(char_u *)"<C-X> \"*d", VIS_SEL},
|
||||
/* Missing: CTRL-C (cancel) and CTRL-V (block selection) */
|
||||
# else
|
||||
};
|
||||
# endif
|
||||
|
||||
# if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL))
|
||||
/* Use the Windows (CUA) keybindings. (Console) */
|
||||
static struct initmap cinitmappings[] =
|
||||
{
|
||||
{(char_u *)"\316w <C-Home>", NORMAL+VIS_SEL},
|
||||
{(char_u *)"\316w <C-Home>", INSERT+CMDLINE},
|
||||
{(char_u *)"\316u <C-End>", NORMAL+VIS_SEL},
|
||||
@@ -5278,10 +5294,12 @@ static struct initmap
|
||||
{(char_u *)"\316\327 d", VIS_SEL}, /* SHIFT-Del is d */
|
||||
{(char_u *)"\316\330 d", VIS_SEL}, /* CTRL-Del is d */
|
||||
# endif
|
||||
};
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MACOS_X)
|
||||
# if defined(MACOS_X)
|
||||
static struct initmap initmappings[] =
|
||||
{
|
||||
/* Use the Standard MacOS binding. */
|
||||
/* paste, copy and cut */
|
||||
{(char_u *)"<D-v> \"*P", NORMAL},
|
||||
@@ -5290,8 +5308,8 @@ static struct initmap
|
||||
{(char_u *)"<D-c> \"*y", VIS_SEL},
|
||||
{(char_u *)"<D-x> \"*d", VIS_SEL},
|
||||
{(char_u *)"<Backspace> \"-d", VIS_SEL},
|
||||
#endif
|
||||
};
|
||||
# endif
|
||||
|
||||
# undef VIS_SEL
|
||||
#endif
|
||||
@@ -5305,8 +5323,20 @@ init_mappings(void)
|
||||
#if defined(MSWIN) || defined(MACOS_X)
|
||||
int i;
|
||||
|
||||
# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))
|
||||
# ifdef VIMDLL
|
||||
if (!gui.starting)
|
||||
# endif
|
||||
{
|
||||
for (i = 0;
|
||||
i < (int)(sizeof(cinitmappings) / sizeof(struct initmap)); ++i)
|
||||
add_map(cinitmappings[i].arg, cinitmappings[i].mode);
|
||||
}
|
||||
# endif
|
||||
# if defined(FEAT_GUI_MSWIN) || defined(MACOS_X)
|
||||
for (i = 0; i < (int)(sizeof(initmappings) / sizeof(struct initmap)); ++i)
|
||||
add_map(initmappings[i].arg, initmappings[i].mode);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user