summaryrefslogtreecommitdiffstats
path: root/runtime/pack
diff options
context:
space:
mode:
authorK.Takata <kentkt@csc.jp>2022-06-17 20:05:40 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-17 20:05:40 +0100
commitf9f2a330b961fe1623d428b61afdc52f0af0a666 (patch)
tree0dfa84d89fac5c70d3044db1e42e274752bb59e4 /runtime/pack
parent7d149f899d423b7bf2b90d7b11ebe3e560c462b9 (diff)
patch 8.2.5118: MS-Windows: sending a message to another Vim may hangv8.2.5118
Problem: MS-Windows: sending a message to another Vim may hang if that Vim is halted. Solution: Add a timeout to serverSendToVim(). (Ken Takata, closes #10585)
Diffstat (limited to 'runtime/pack')
-rw-r--r--runtime/pack/dist/opt/editexisting/plugin/editexisting.vim50
1 files changed, 27 insertions, 23 deletions
diff --git a/runtime/pack/dist/opt/editexisting/plugin/editexisting.vim b/runtime/pack/dist/opt/editexisting/plugin/editexisting.vim
index d9877a0591..5eda29047d 100644
--- a/runtime/pack/dist/opt/editexisting/plugin/editexisting.vim
+++ b/runtime/pack/dist/opt/editexisting/plugin/editexisting.vim
@@ -1,6 +1,6 @@
" Vim Plugin: Edit the file with an existing Vim if possible
" Maintainer: Bram Moolenaar
-" Last Change: 2016 Mar 28
+" Last Change: 2022 Jun 17
" To use add ":packadd! editexisting" in your vimrc file.
@@ -35,32 +35,36 @@ func s:EditElsewhere(filename)
endif
" Check if this server is editing our file.
- if remote_expr(servername, "bufloaded('" . fname_esc . "')")
- " Yes, bring it to the foreground.
- if has("win32")
- call remote_foreground(servername)
- endif
- call remote_expr(servername, "foreground()")
+ try
+ if remote_expr(servername, "bufloaded('" . fname_esc . "')")
+ " Yes, bring it to the foreground.
+ if has("win32")
+ call remote_foreground(servername)
+ endif
+ call remote_expr(servername, "foreground()")
- if remote_expr(servername, "exists('*EditExisting')")
- " Make sure the file is visible in a window (not hidden).
- " If v:swapcommand exists and is set, send it to the server.
- if exists("v:swapcommand")
- let c = substitute(v:swapcommand, "'", "''", "g")
- call remote_expr(servername, "EditExisting('" . fname_esc . "', '" . c . "')")
- else
- call remote_expr(servername, "EditExisting('" . fname_esc . "', '')")
+ if remote_expr(servername, "exists('*EditExisting')")
+ " Make sure the file is visible in a window (not hidden).
+ " If v:swapcommand exists and is set, send it to the server.
+ if exists("v:swapcommand")
+ let c = substitute(v:swapcommand, "'", "''", "g")
+ call remote_expr(servername, "EditExisting('" . fname_esc . "', '" . c . "')")
+ else
+ call remote_expr(servername, "EditExisting('" . fname_esc . "', '')")
+ endif
endif
- endif
- if !(has('vim_starting') && has('gui_running') && has('gui_win32'))
- " Tell the user what is happening. Not when the GUI is starting
- " though, it would result in a message box.
- echomsg "File is being edited by " . servername
- sleep 2
+ if !(has('vim_starting') && has('gui_running') && has('gui_win32'))
+ " Tell the user what is happening. Not when the GUI is starting
+ " though, it would result in a message box.
+ echomsg "File is being edited by " . servername
+ sleep 2
+ endif
+ return 'q'
endif
- return 'q'
- endif
+ catch /^Vim\%((\a\+)\)\=:E241:/
+ " Unable to send to this server, ignore it.
+ endtry
endwhile
return ''
endfunc