PHP omnicompletion opens a new window when reading in the full text of the
body of a class.  If multiple windows are open, and the user is not in the
bottom-right-most window, the result of opening a file and then closing it is
that the window changes, which is disallowed by omnicompletion rules.  To fix
it, keep track of the window in which we started, then return to that window
after the newly-created buffer is wiped out.


-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
# HG changeset patch
# User Benjamin R. Haskell <[email protected]>
# Date 1316216940 14400
# Node ID 883f1855b57d458d7e2a09b2e3d5583c22e3c442
# Parent  15b934a1664197ea570303f1c57cb1fc1f4d8a61
Fix PHP omnicompletion window-changing behavior

PHP omnicompletion opens a new window when reading in the full text of the
body of a class.  If multiple windows are open, and the user is not in the
bottom-right-most window, the result of opening a file and then closing it is
that the window changes, which is disallowed by omnicompletion rules.  To fix
it, keep track of the window in which we started, then return to that window
after the newly-created buffer is wiped out.

diff -r 15b934a16641 -r 883f1855b57d runtime/autoload/phpcomplete.vim
--- a/runtime/autoload/phpcomplete.vim	Wed Sep 14 19:04:16 2011 +0200
+++ b/runtime/autoload/phpcomplete.vim	Fri Sep 16 19:48:36 2011 -0400
@@ -650,6 +650,7 @@
 	" this is the most efficient way. The other way
 	" is to go through the looong string looking for
 	" matching {}
+	let original_window = winnr()
 	below 1new
 	0put =cfile
 	call search('class\s\+'.a:name)
@@ -667,6 +668,9 @@
 	let classcontent = join(classc, "\n")
 
 	bw! %
+	" go back to where we started
+	exe original_window.'wincmd w'
+
 	if extends_class != ''
 		let classlocation = phpcomplete#GetClassLocation(extends_class)
 		if filereadable(classlocation)

Raspunde prin e-mail lui