1
0
forked from aniani/vim

updated for version 7.0f02

This commit is contained in:
Bram Moolenaar
2006-04-27 00:02:13 +00:00
parent 551dbcc9b6
commit f193fffd16
59 changed files with 3044 additions and 658 deletions

View File

@@ -2695,6 +2695,9 @@ serverInitMessaging(void)
s_hinst, NULL);
}
/* Used by serverSendToVim() to find an alternate server name. */
static char_u *altname_buf_ptr = NULL;
/*
* Get the title of the window "hwnd", which is the Vim server name, in
* "name[namelen]" and return the length.
@@ -2732,6 +2735,15 @@ enumWindowsGetServer(HWND hwnd, LPARAM lparam)
return FALSE;
}
/* If we are looking for an alternate server, remember this name. */
if (altname_buf_ptr != NULL
&& STRNICMP(server, id->name, STRLEN(id->name)) == 0
&& vim_isdigit(server[STRLEN(id->name)]))
{
STRCPY(altname_buf_ptr, server);
altname_buf_ptr = NULL; /* don't use another name */
}
/* Otherwise, keep looking */
return TRUE;
}
@@ -2871,10 +2883,22 @@ serverSendToVim(name, cmd, result, ptarget, asExpr, silent)
int asExpr; /* Expression or keys? */
int silent; /* don't complain about no server */
{
HWND target = findServer(name);
HWND target;
COPYDATASTRUCT data;
char_u *retval = NULL;
int retcode = 0;
char_u altname_buf[MAX_PATH];
/* If the server name does not end in a digit then we look for an
* alternate name. e.g. when "name" is GVIM the we may find GVIM2. */
if (STRLEN(name) > 1 && !vim_isdigit(name[STRLEN(name) - 1]))
altname_buf_ptr = altname_buf;
altname_buf[0] = NUL;
target = findServer(name);
altname_buf_ptr = NULL;
if (target == 0 && altname_buf[0] != NUL)
/* Use another server name we found. */
target = findServer(altname_buf);
if (target == 0)
{