diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-04-27 00:02:13 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-04-27 00:02:13 +0000 |
commit | f193fffd16563cfbe7c02a21e19c8bb11707581d (patch) | |
tree | 4bae3092421aa986103b8000b1012989a9ea49e6 /src/os_mswin.c | |
parent | 551dbcc9b604c2992f908fb475e797fcc116315b (diff) | |
download | vim-git-f193fffd16563cfbe7c02a21e19c8bb11707581d.tar.gz |
updated for version 7.0f02v7.0f02
Diffstat (limited to 'src/os_mswin.c')
-rw-r--r-- | src/os_mswin.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/os_mswin.c b/src/os_mswin.c index efbd01d73..26d8533aa 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -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) { |