source: patches/vim-7.3-branch_update-1.patch@ eef46e9

Last change on this file since eef46e9 was 6c5a343, checked in by Joe Ciccone <jciccone@…>, 14 years ago

Update Vim to 7.3.

  • Property mode set to 100644
File size: 216.7 KB
RevLine 
[6c5a343]1Submitted By: Joe Ciccone <jciccone@gmail.com>
2Date: 01-08-2010
3Initial Package Version: 7.3
4Origin: Upstream
5Upstream Status: From Upstream
6Description: Contains all upstream patches between 7.3.001 and 7.3.099
7
8diff -Naur vim73.orig/runtime/doc/eval.txt vim73/runtime/doc/eval.txt
9--- vim73.orig/runtime/doc/eval.txt 2010-08-15 08:23:20.000000000 -0400
10+++ vim73/runtime/doc/eval.txt 2011-01-08 21:01:18.986656145 -0500
11@@ -1657,6 +1657,15 @@
12 *v:warningmsg* *warningmsg-variable*
13 v:warningmsg Last given warning message. It's allowed to set this variable.
14
15+ *v:windowid* *windowid-variable*
16+v:windowid When any X11 based GUI is running or when running in a
17+ terminal and Vim connects to the X server (|-X|) this will be
18+ set to the window ID.
19+ When an MS-Windows GUI is running this will be set to the
20+ window handle.
21+ Otherwise the value is zero.
22+ Note: for windows inside Vim use |winnr()|.
23+
24 ==============================================================================
25 4. Builtin Functions *functions*
26
27@@ -1822,7 +1831,7 @@
28 log( {expr}) Float natural logarithm (base e) of {expr}
29 log10( {expr}) Float logarithm of Float {expr} to base 10
30 map( {expr}, {string}) List/Dict change each item in {expr} to {expr}
31-maparg( {name}[, {mode} [, {abbr}]])
32+maparg( {name}[, {mode} [, {abbr} [, {dict}]]])
33 String rhs of mapping {name} in mode {mode}
34 mapcheck( {name}[, {mode} [, {abbr}]])
35 String check for mappings matching {name}
36@@ -3966,23 +3975,51 @@
37 further items in {expr} are processed.
38
39
40-maparg({name}[, {mode} [, {abbr}]]) *maparg()*
41- Return the rhs of mapping {name} in mode {mode}. When there
42- is no mapping for {name}, an empty String is returned.
43+maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()*
44+ When {dict} is omitted or zero: Return the rhs of mapping
45+ {name} in mode {mode}. The returned String has special
46+ characters translated like in the output of the ":map" command
47+ listing.
48+
49+ When there is no mapping for {name}, an empty String is
50+ returned.
51+
52+ The {name} can have special key names, like in the ":map"
53+ command.
54+
55 {mode} can be one of these strings:
56 "n" Normal
57- "v" Visual
58+ "v" Visual (including Select)
59 "o" Operator-pending
60 "i" Insert
61 "c" Cmd-line
62+ "s" Select
63+ "x" Visual
64 "l" langmap |language-mapping|
65 "" Normal, Visual and Operator-pending
66 When {mode} is omitted, the modes for "" are used.
67+
68 When {abbr} is there and it is non-zero use abbreviations
69 instead of mappings.
70- The {name} can have special key names, like in the ":map"
71- command. The returned String has special characters
72- translated like in the output of the ":map" command listing.
73+
74+ When {dict} is there and it is non-zero return a dictionary
75+ containing all the information of the mapping with the
76+ following items:
77+ "lhs" The {lhs} of the mapping.
78+ "rhs" The {rhs} of the mapping as typed.
79+ "silent" 1 for a |:map-silent| mapping, else 0.
80+ "noremap" 1 if the {rhs} of the mapping is remappable.
81+ "expr" 1 for an expression mapping (|:map-<expr>|).
82+ "buffer" 1 for a buffer local mapping (|:map-local|).
83+ "mode" Modes for which the mapping is defined. In
84+ addition to the modes mentioned above, these
85+ characters will be used:
86+ " " Normal, Visual and Operator-pending
87+ "!" Insert and Commandline mode
88+ (|mapmpde-ic|)
89+ "sid" the Script local ID, used for <sid> mappings
90+ (|<SID>|)
91+
92 The mappings local to the current buffer are checked first,
93 then the global mappings.
94 This function can be used to map a key even when it's already
95diff -Naur vim73.orig/runtime/doc/netbeans.txt vim73/runtime/doc/netbeans.txt
96--- vim73.orig/runtime/doc/netbeans.txt 2010-08-15 08:23:21.000000000 -0400
97+++ vim73/runtime/doc/netbeans.txt 2011-01-08 21:01:18.782656702 -0500
98@@ -1,4 +1,4 @@
99-*netbeans.txt* For Vim version 7.3. Last change: 2010 Jul 20
100+*netbeans.txt* For Vim version 7.3. Last change: 2010 Aug 20
101
102
103 VIM REFERENCE MANUAL by Gordon Prieur et al.
104@@ -118,7 +118,8 @@
105 uncommenting a line with "--disable-netbeans" in the Makefile.
106
107 Currently the NetBeans interface is supported by Vim running in a terminal and
108-by GVim when it is run with one of the following GUIs: GTK, GNOME, and Motif.
109+by GVim when it is run with one of the following GUIs: GTK, GNOME, Windows,
110+Athena and Motif.
111
112 If Motif support is required the user must supply XPM libraries. See
113 |workshop-xpm| for details on obtaining the latest version of XPM.
114diff -Naur vim73.orig/runtime/doc/options.txt vim73/runtime/doc/options.txt
115--- vim73.orig/runtime/doc/options.txt 2010-08-15 08:23:21.000000000 -0400
116+++ vim73/runtime/doc/options.txt 2011-01-08 21:01:19.258656350 -0500
117@@ -1434,6 +1434,15 @@
118 explicitly accessed using the "* notation. Also see
119 |gui-clipboard|.
120
121+ unnamedplus A variant of "unnamed" flag which uses the clipboard
122+ register '+' (|quoteplus|) instead of register '*' for
123+ all operations except yank. Yank shall copy the text
124+ into register '+' and also into '*' when "unnamed" is
125+ included.
126+ Only available with the |+x11| feature.
127+ Availability can be checked with: >
128+ if has('unnamedplus')
129+<
130 autoselect Works like the 'a' flag in 'guioptions': If present,
131 then whenever Visual mode is started, or the Visual
132 area extended, Vim tries to become the owner of the
133@@ -7530,8 +7539,9 @@
134 ! When included, save and restore global variables that start
135 with an uppercase letter, and don't contain a lowercase
136 letter. Thus "KEEPTHIS and "K_L_M" are stored, but "KeepThis"
137- and "_K_L_M" are not. Only String and Number types are
138- stored.
139+ and "_K_L_M" are not. Nested List and Dict items may not be
140+ read back correctly, you end up with a string representation
141+ instead.
142 " Maximum number of lines saved for each register. Old name of
143 the '<' item, with the disadvantage that you need to put a
144 backslash before the ", otherwise it will be recognized as the
145@@ -7747,6 +7757,17 @@
146 a pattern from the list. This avoids problems when a future version
147 uses another default.
148
149+
150+ *'wildignorecase* *'wic'* *'nowildignorecase* *'nowic'*
151+'wildignorecase' 'wic' boolean (default off)
152+ global
153+ {not in Vi}
154+ When set case is ignored when completing file names and directories.
155+ Has no effect on systems where file name case is generally ignored.
156+ Does not apply when the shell is used to expand wildcards, which
157+ happens when there are special characters.
158+
159+
160 *'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
161 'wildmenu' 'wmnu' boolean (default off)
162 global
163diff -Naur vim73.orig/src/GvimExt/Make_ming.mak vim73/src/GvimExt/Make_ming.mak
164--- vim73.orig/src/GvimExt/Make_ming.mak 2010-05-15 07:04:10.000000000 -0400
165+++ vim73/src/GvimExt/Make_ming.mak 2011-01-08 21:01:19.490656530 -0500
166@@ -17,6 +17,17 @@
167 # check also the executables
168 MINGWOLD = no
169
170+# Link against the shared versions of libgcc/libstdc++ by default. Set
171+# STATIC_STDCPLUS to "yes" to link against static versions instead.
172+STATIC_STDCPLUS=no
173+#STATIC_STDCPLUS=yes
174+
175+# Note: -static-libstdc++ is not available until gcc 4.5.x.
176+LDFLAGS += -shared
177+ifeq (yes, $(STATIC_STDCPLUS))
178+LDFLAGS += -static-libgcc -static-libstdc++
179+endif
180+
181 ifeq ($(CROSS),yes)
182 DEL = rm
183 ifeq ($(MINGWOLD),yes)
184@@ -34,6 +45,8 @@
185 endif
186 CXX := $(CROSS_COMPILE)g++
187 WINDRES := $(CROSS_COMPILE)windres
188+WINDRES_CXX = $(CXX)
189+WINDRES_FLAGS = --preprocessor="$(WINDRES_CXX) -E -xc" -DRC_INVOKED
190 LIBS := -luuid
191 RES := gvimext.res
192 DEFFILE = gvimext_ming.def
193@@ -46,7 +59,7 @@
194 all: all-before $(DLL) all-after
195
196 $(DLL): $(OBJ) $(RES) $(DEFFILE)
197- $(CXX) -shared $(CXXFLAGS) -s -o $@ \
198+ $(CXX) $(LDFLAGS) $(CXXFLAGS) -s -o $@ \
199 -Wl,--enable-auto-image-base \
200 -Wl,--enable-auto-import \
201 -Wl,--whole-archive \
202@@ -58,7 +71,7 @@
203 $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@
204
205 $(RES): gvimext_ming.rc
206- $(WINDRES) --input-format=rc --output-format=coff -DMING $? -o $@
207+ $(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@
208
209 clean: clean-custom
210 -$(DEL) $(OBJ) $(RES) $(DLL)
211diff -Naur vim73.orig/src/Make_cyg.mak vim73/src/Make_cyg.mak
212--- vim73.orig/src/Make_cyg.mak 2010-08-02 15:09:22.000000000 -0400
213+++ vim73/src/Make_cyg.mak 2011-01-08 21:01:19.102656144 -0500
214@@ -1,6 +1,6 @@
215 #
216 # Makefile for VIM on Win32, using Cygnus gcc
217-# Last updated by Dan Sharp. Last Change: 2010 Feb 24
218+# Last updated by Dan Sharp. Last Change: 2010 Nov 03
219 #
220 # Also read INSTALLpc.txt!
221 #
222@@ -27,6 +27,7 @@
223 # MZSCHEME_VER define to version of MzScheme being used (209_000)
224 # DYNAMIC_MZSCHEME no or yes: use yes to load the MzScheme DLLs dynamically (yes)
225 # MZSCHEME_DLLS path to MzScheme DLLs (libmzgc and libmzsch), for "static" build.
226+# MZSCHEME_USE_RACKET define to use "racket" instead of "mzsch".
227 # LUA define to path to Lua dir to get Lua support (not defined)
228 # LUA_VER define to version of Lua being used (51)
229 # DYNAMIC_LUA no or yes: use yes to load the Lua DLL dynamically (yes)
230@@ -254,16 +255,22 @@
231 MZSCHEME_GENERATE_BASE=no
232 endif
233
234+ifndef MZSCHEME_USE_RACKET
235+MZSCHEME_MAIN_LIB=mzsch
236+else
237+MZSCHEME_MAIN_LIB=racket
238+endif
239+
240 ifeq (yes, $(DYNAMIC_MZSCHEME))
241-DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
242+DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
243 else
244 ifndef MZSCHEME_DLLS
245 MZSCHEME_DLLS = $(MZSCHEME)
246 endif
247 ifeq (yes,$(MZSCHEME_PRECISE_GC))
248-MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
249+MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
250 else
251-MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
252+MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
253 endif
254 EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB)
255 endif
256diff -Naur vim73.orig/src/Make_ming.mak vim73/src/Make_ming.mak
257--- vim73.orig/src/Make_ming.mak 2010-08-02 15:09:43.000000000 -0400
258+++ vim73/src/Make_ming.mak 2011-01-08 21:01:19.490656530 -0500
259@@ -56,6 +56,12 @@
260 NETBEANS=$(GUI)
261
262
263+# Link against the shared version of libstdc++ by default. Set
264+# STATIC_STDCPLUS to "yes" to link against static version instead.
265+ifndef STATIC_STDCPLUS
266+STATIC_STDCPLUS=no
267+endif
268+
269 # If the user doesn't want gettext, undefine it.
270 ifeq (no, $(GETTEXT))
271 GETTEXT=
272@@ -141,11 +147,17 @@
273 MZSCHEME_GENERATE_BASE=no
274 endif
275
276+ifndef MZSCHEME_USE_RACKET
277+MZSCHEME_MAIN_LIB=mzsch
278+else
279+MZSCHEME_MAIN_LIB=racket
280+endif
281+
282 ifeq (no,$(DYNAMIC_MZSCHEME))
283 ifeq (yes,$(MZSCHEME_PRECISE_GC))
284-MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
285+MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
286 else
287-MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
288+MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
289 endif
290 # the modern MinGW can dynamically link to dlls directly.
291 # point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
292@@ -304,11 +316,13 @@
293 endif
294 CC := $(CROSS_COMPILE)gcc
295 WINDRES := $(CROSS_COMPILE)windres
296+WINDRES_CC = $(CC)
297
298 #>>>>> end of choices
299 ###########################################################################
300
301 CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall
302+WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
303
304 ifdef GETTEXT
305 DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
306@@ -343,7 +357,7 @@
307 ifdef MZSCHEME
308 CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
309 ifeq (yes, $(DYNAMIC_MZSCHEME))
310-CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
311+CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
312 endif
313 endif
314
315@@ -571,8 +585,13 @@
316 endif
317
318 ifeq (yes, $(OLE))
319-LIB += -loleaut32 -lstdc++
320+LIB += -loleaut32
321 OBJ += $(OUTDIR)/if_ole.o
322+ifeq (yes, $(STATIC_STDCPLUS))
323+LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
324+else
325+LIB += -lstdc++
326+endif
327 endif
328
329 ifeq (yes, $(MBYTE))
330@@ -650,10 +669,10 @@
331 $(CC) -c $(CFLAGS) $< -o $@
332
333 $(OUTDIR)/vimres.res: vim.rc version.h gui_w32_rc.h
334- $(WINDRES) $(DEFINES) vim.rc $(OUTDIR)/vimres.res
335+ $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) vim.rc $(OUTDIR)/vimres.res
336
337 $(OUTDIR)/vimrc.o: $(OUTDIR)/vimres.res
338- $(WINDRES) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.o
339+ $(WINDRES) $(WINDRES_FLAGS) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.o
340
341 $(OUTDIR):
342 $(MKDIR) $(OUTDIR)
343diff -Naur vim73.orig/src/Make_mvc.mak vim73/src/Make_mvc.mak
344--- vim73.orig/src/Make_mvc.mak 2010-07-18 15:24:20.000000000 -0400
345+++ vim73/src/Make_mvc.mak 2011-01-08 21:01:19.314657721 -0500
346@@ -380,9 +380,6 @@
347 !if "$(_NMAKE_VER)" == "10.00.30319.01"
348 MSVCVER = 10.0
349 !endif
350-!if "$(_NMAKE_VER)" == "9.00.30729.01"
351-MSVCVER = 9.0
352-!endif
353 !endif
354
355 # Abort bulding VIM if version of VC is unrecognised.
356@@ -705,12 +702,18 @@
357 MZSCHEME_VER = 205_000
358 !endif
359 CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
360-!if EXIST("$(MZSCHEME)\collects\scheme\base.ss")
361-# for MzScheme 4.x we need to include byte code for basic Scheme stuff
362+!if EXIST("$(MZSCHEME)\collects\scheme\base.ss") \
363+ || EXIST("$(MZSCHEME)\collects\scheme\base.rkt")
364+# for MzScheme >= 4 we need to include byte code for basic Scheme stuff
365 MZSCHEME_EXTRA_DEP = mzscheme_base.c
366 CFLAGS = $(CFLAGS) -DINCLUDE_MZSCHEME_BASE
367 !endif
368-!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib") \
369+!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib")
370+MZSCHEME_MAIN_LIB=mzsch
371+!else
372+MZSCHEME_MAIN_LIB=racket
373+!endif
374+!if EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \
375 && !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib")
376 !message Building with Precise GC
377 MZSCHEME_PRECISE_GC = yes
378@@ -722,7 +725,7 @@
379 !endif
380 !message MzScheme DLLs will be loaded dynamically
381 CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME \
382- -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" \
383+ -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \
384 -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
385 !else
386 !if "$(MZSCHEME_DEBUG)" == "yes"
387@@ -730,10 +733,10 @@
388 !endif
389 !if "$(MZSCHEME_PRECISE_GC)" == "yes"
390 # Precise GC does not use separate dll
391-MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
392+MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
393 !else
394 MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \
395- $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
396+ $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
397 !endif
398 !endif
399 MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
400diff -Naur vim73.orig/src/Makefile vim73/src/Makefile
401--- vim73.orig/src/Makefile 2010-08-15 08:56:15.000000000 -0400
402+++ vim73/src/Makefile 2011-01-08 21:01:19.114655467 -0500
403@@ -414,12 +414,16 @@
404 # However, this may still cause problems, such as "import termios" failing.
405 # Build two separate versions of Vim in that case.
406 #CONF_OPT_PYTHON = --enable-pythoninterp
407+#CONF_OPT_PYTHON = --enable-pythoninterp=dynamic
408 #CONF_OPT_PYTHON3 = --enable-python3interp
409+#CONF_OPT_PYTHON3 = --enable-python3interp=dynamic
410
411 # RUBY
412 # Uncomment this when you want to include the Ruby interface.
413+# First one for static linking, second one for loading when used.
414 # Note: you need the development package (e.g., ruby1.9.1-dev on Ubuntu).
415 #CONF_OPT_RUBY = --enable-rubyinterp
416+#CONF_OPT_RUBY = --enable-rubyinterp=dynamic
417 #CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1
418
419 # TCL
420@@ -1047,8 +1051,9 @@
421 INSTALL_DATA = cp
422 INSTALL_DATA_R = cp -r
423
424-### Program to run on installed binary
425+### Program to run on installed binary. Use the second one to disable strip.
426 #STRIP = strip
427+#STRIP = /bin/true
428
429 ### Permissions for binaries {{{1
430 BINMOD = 755
431@@ -1321,7 +1326,7 @@
432 .SUFFIXES: .c .o .pro
433
434 PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
435-POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS)
436+POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(EXTRA_DEFS)
437
438 ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS)
439
440@@ -1329,7 +1334,7 @@
441 # with "-E".
442 OSDEF_CFLAGS = $(PRE_DEFS) $(POST_DEFS)
443
444-LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
445+LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(RUBY_CFLAGS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
446
447 LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)="
448
449@@ -1695,7 +1700,8 @@
450 $(CCC) version.c -o objects/version.o
451 @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \
452 -o $(VIMTARGET) $(OBJ) objects/version.o $(ALL_LIBS)" \
453- MAKE="$(MAKE)" sh $(srcdir)/link.sh
454+ MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \
455+ sh $(srcdir)/link.sh
456
457 xxd/xxd$(EXEEXT): xxd/xxd.c
458 cd xxd; CC="$(CC)" CFLAGS="$(CPPFLAGS) $(CFLAGS)" \
459@@ -2532,7 +2538,7 @@
460 $(CCC) $(PYTHON3_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) -o $@ if_python3.c
461
462 objects/if_ruby.o: if_ruby.c
463- $(CCC) -o $@ if_ruby.c
464+ $(CCC) $(RUBY_CFLAGS) -o $@ if_ruby.c
465
466 objects/if_sniff.o: if_sniff.c
467 $(CCC) -o $@ if_sniff.c
468diff -Naur vim73.orig/src/auto/configure vim73/src/auto/configure
469--- vim73.orig/src/auto/configure 2010-08-13 10:17:15.000000000 -0400
470+++ vim73/src/auto/configure 2011-01-08 21:01:19.190656939 -0500
471@@ -593,6 +593,7 @@
472
473 ac_subst_vars='LTLIBOBJS
474 LIBOBJS
475+LINK_AS_NEEDED
476 DEPEND_CFLAGS_FILTER
477 MAKEMO
478 MSGFMT
479@@ -1427,7 +1428,7 @@
480 --enable-pythoninterp=OPTS Include Python interpreter. default=no OPTS=no/yes/dynamic
481 --enable-python3interp=OPTS Include Python3 interpreter. default=no OPTS=no/yes/dynamic
482 --enable-tclinterp Include Tcl interpreter.
483- --enable-rubyinterp Include Ruby interpreter.
484+ --enable-rubyinterp=OPTS Include Ruby interpreter. default=no OPTS=no/yes/dynamic
485 --enable-cscope Include cscope interface.
486 --enable-workshop Include Sun Visual Workshop support.
487 --disable-netbeans Disable NetBeans integration support.
488@@ -4862,16 +4863,36 @@
489 else
490 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
491 $as_echo "no" >&6; }
492- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/plt/" >&5
493-$as_echo_n "checking if scheme.h can be found in /usr/include/plt/... " >&6; }
494- if test -f /usr/include/plt/scheme.h; then
495+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket" >&5
496+$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket... " >&6; }
497+ if test -f $vi_cv_path_mzscheme_pfx/include/racket/scheme.h; then
498 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
499 $as_echo "yes" >&6; }
500- SCHEME_INC=/usr/include/plt
501+ SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
502 else
503 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
504 $as_echo "no" >&6; }
505- vi_cv_path_mzscheme_pfx=
506+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/plt/" >&5
507+$as_echo_n "checking if scheme.h can be found in /usr/include/plt/... " >&6; }
508+ if test -f /usr/include/plt/scheme.h; then
509+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
510+$as_echo "yes" >&6; }
511+ SCHEME_INC=/usr/include/plt
512+ else
513+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
514+$as_echo "no" >&6; }
515+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/racket/" >&5
516+$as_echo_n "checking if scheme.h can be found in /usr/include/racket/... " >&6; }
517+ if test -f /usr/include/racket/scheme.h; then
518+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
519+$as_echo "yes" >&6; }
520+ SCHEME_INC=/usr/include/racket
521+ else
522+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
523+$as_echo "no" >&6; }
524+ vi_cv_path_mzscheme_pfx=
525+ fi
526+ fi
527 fi
528 fi
529 fi
530@@ -4883,12 +4904,22 @@
531 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
532 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
533 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
534- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
535+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then
536+ MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"
537+ MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
538+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.a"; then
539+ MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
540+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"; then
541 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
542 else
543 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
544 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
545 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
546+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.so"; then
547+ MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket3m"
548+ MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
549+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.so"; then
550+ MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket -lmzgc"
551 else
552 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
553 fi
554@@ -4901,10 +4932,20 @@
555 fi
556 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
557 SCHEME_COLLECTS=lib/plt/
558+ else
559+ if test -d $vi_cv_path_mzscheme_pfx/lib/racket/collects; then
560+ SCHEME_COLLECTS=lib/racket/
561+ fi
562 fi
563 if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
564- MZSCHEME_EXTRA="mzscheme_base.c"
565- MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
566+ MZSCHEME_EXTRA="mzscheme_base.c"
567+ else
568+ if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
569+ MZSCHEME_EXTRA="mzscheme_base.c"
570+ fi
571+ fi
572+ if test "X$MZSCHEME_EXTRA" != "X" ; then
573+ MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
574 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
575 fi
576 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
577@@ -5285,9 +5326,9 @@
578
579 PYTHON_LIBS="${vi_cv_path_python_plibs}"
580 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
581- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
582+ PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
583 else
584- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}"
585+ PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
586 fi
587 PYTHON_SRC="if_python.c"
588 if test "x$MACOSX" = "xyes"; then
589@@ -5298,7 +5339,7 @@
590 if test "${vi_cv_var_python_version}" = "1.4"; then
591 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
592 fi
593- PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
594+ PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
595
596 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5
597 $as_echo_n "checking if -pthread should be used... " >&6; }
598@@ -5560,9 +5601,9 @@
599
600 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
601 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
602- PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
603+ PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
604 else
605- PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}"
606+ PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
607 fi
608 PYTHON3_SRC="if_python3.c"
609 if test "x$MACOSX" = "xyes"; then
610@@ -5667,10 +5708,10 @@
611
612 $as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h
613
614- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL" >&5
615-$as_echo_n "checking whether we can do without RTLD_GLOBAL... " >&6; }
616+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python" >&5
617+$as_echo_n "checking whether we can do without RTLD_GLOBAL for Python... " >&6; }
618 cflags_save=$CFLAGS
619- CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
620+ CFLAGS="$CFLAGS $PYTHON_CFLAGS"
621 ldflags_save=$LDFLAGS
622 LDFLAGS="$LDFLAGS -ldl"
623 if test "$cross_compiling" = yes; then :
624@@ -5689,15 +5730,17 @@
625 * Only the first pyhton version used will be switched on.
626 */
627
628- int no_rtl_global_needed_for(char *python_instsoname)
629+ int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
630 {
631 int needed = 0;
632 void* pylib = dlopen(python_instsoname, RTLD_LAZY);
633 if (pylib != 0)
634 {
635+ void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
636 void (*init)(void) = dlsym(pylib, "Py_Initialize");
637 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
638 void (*final)(void) = dlsym(pylib, "Py_Finalize");
639+ (*pfx)(prefix);
640 (*init)();
641 needed = (*simple)("import termios") == -1;
642 (*final)();
643@@ -5709,7 +5752,7 @@
644 int main(int argc, char** argv)
645 {
646 int not_needed = 0;
647- if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0"))
648+ if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}"))
649 not_needed = 1;
650 return !not_needed;
651 }
652@@ -5726,8 +5769,76 @@
653 conftest.$ac_objext conftest.beam conftest.$ac_ext
654 fi
655
656+
657 CFLAGS=$cflags_save
658 LDFLAGS=$ldflags_save
659+
660+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python3" >&5
661+$as_echo_n "checking whether we can do without RTLD_GLOBAL for Python3... " >&6; }
662+ cflags_save=$CFLAGS
663+ CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
664+ ldflags_save=$LDFLAGS
665+ LDFLAGS="$LDFLAGS -ldl"
666+ if test "$cross_compiling" = yes; then :
667+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
668+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
669+as_fn_error "cannot run test program while cross compiling
670+See \`config.log' for more details." "$LINENO" 5; }
671+else
672+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
673+/* end confdefs.h. */
674+
675+ #include <dlfcn.h>
676+ #include <wchar.h>
677+ /* If this program fails, then RTLD_GLOBAL is needed.
678+ * RTLD_GLOBAL will be used and then it is not possible to
679+ * have both python versions enabled in the same vim instance.
680+ * Only the first pyhton version used will be switched on.
681+ */
682+
683+ int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
684+ {
685+ int needed = 0;
686+ void* pylib = dlopen(python_instsoname, RTLD_LAZY);
687+ if (pylib != 0)
688+ {
689+ void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
690+ void (*init)(void) = dlsym(pylib, "Py_Initialize");
691+ int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
692+ void (*final)(void) = dlsym(pylib, "Py_Finalize");
693+ (*pfx)(prefix);
694+ (*init)();
695+ needed = (*simple)("import termios") == -1;
696+ (*final)();
697+ dlclose(pylib);
698+ }
699+ return !needed;
700+ }
701+
702+ int main(int argc, char** argv)
703+ {
704+ int not_needed = 0;
705+ if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}"))
706+ not_needed = 1;
707+ return !not_needed;
708+ }
709+_ACEOF
710+if ac_fn_c_try_run "$LINENO"; then :
711+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
712+$as_echo "yes" >&6; };$as_echo "#define PY3_NO_RTLD_GLOBAL 1" >>confdefs.h
713+
714+else
715+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
716+$as_echo "no" >&6; }
717+fi
718+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
719+ conftest.$ac_objext conftest.beam conftest.$ac_ext
720+fi
721+
722+
723+ CFLAGS=$cflags_save
724+ LDFLAGS=$ldflags_save
725+
726 PYTHON_SRC="if_python.c"
727 PYTHON_OBJ="objects/if_python.o"
728 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
729@@ -6103,7 +6214,7 @@
730
731 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rubyinterp" >&5
732 $as_echo "$enable_rubyinterp" >&6; }
733-if test "$enable_rubyinterp" = "yes"; then
734+if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
735 { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-ruby-command argument" >&5
736 $as_echo_n "checking --with-ruby-command argument... " >&6; }
737
738@@ -6209,6 +6320,13 @@
739 RUBY_PRO="if_ruby.pro"
740 $as_echo "#define FEAT_RUBY 1" >>confdefs.h
741
742+ if test "$enable_rubyinterp" = "dynamic"; then
743+ libruby=`$vi_cv_path_ruby -r rbconfig -e 'printf "lib%s.%s\n", Config::CONFIG["RUBY_SO_NAME"], Config::CONFIG["DLEXT"]'`
744+ $as_echo "#define DYNAMIC_RUBY 1" >>confdefs.h
745+
746+ RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
747+ RUBY_LIBS=
748+ fi
749 else
750 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found; disabling Ruby" >&5
751 $as_echo "not found; disabling Ruby" >&6; }
752@@ -12357,6 +12475,23 @@
753 fi
754
755
756+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5
757+$as_echo_n "checking linker --as-needed support... " >&6; }
758+LINK_AS_NEEDED=
759+# Check if linker supports --as-needed and --no-as-needed options
760+if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
761+ LDFLAGS="$LDFLAGS -Wl,--as-needed"
762+ LINK_AS_NEEDED=yes
763+fi
764+if test "$LINK_AS_NEEDED" = yes; then
765+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
766+$as_echo "yes" >&6; }
767+else
768+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
769+$as_echo "no" >&6; }
770+fi
771+
772+
773 ac_config_files="$ac_config_files auto/config.mk:config.mk.in"
774
775 cat >confcache <<\_ACEOF
776diff -Naur vim73.orig/src/buffer.c vim73/src/buffer.c
777--- vim73.orig/src/buffer.c 2010-08-13 05:14:35.000000000 -0400
778+++ vim73/src/buffer.c 2011-01-08 21:01:19.026657243 -0500
779@@ -639,6 +639,9 @@
780 {
781 clear_wininfo(buf); /* including window-local options */
782 free_buf_options(buf, TRUE);
783+#ifdef FEAT_SPELL
784+ ga_clear(&buf->b_s.b_langp);
785+#endif
786 }
787 #ifdef FEAT_EVAL
788 vars_clear(&buf->b_vars.dv_hashtab); /* free all internal variables */
789@@ -661,9 +664,6 @@
790 vim_free(buf->b_start_fenc);
791 buf->b_start_fenc = NULL;
792 #endif
793-#ifdef FEAT_SPELL
794- ga_clear(&buf->b_s.b_langp);
795-#endif
796 }
797
798 /*
799@@ -1288,9 +1288,12 @@
800 /* Go to the other buffer. */
801 set_curbuf(buf, action);
802
803-#if defined(FEAT_LISTCMDS) && defined(FEAT_SCROLLBIND)
804+#if defined(FEAT_LISTCMDS) \
805+ && (defined(FEAT_SCROLLBIND) || defined(FEAT_CURSORBIND))
806 if (action == DOBUF_SPLIT)
807- curwin->w_p_scb = FALSE; /* reset 'scrollbind' */
808+ {
809+ RESET_BINDING(curwin); /* reset 'scrollbind' and 'cursorbind' */
810+ }
811 #endif
812
813 #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
814@@ -1917,9 +1920,7 @@
815 tabpage_new();
816 else if (win_split(0, 0) == FAIL) /* Open in a new window */
817 return FAIL;
818-# ifdef FEAT_SCROLLBIND
819- curwin->w_p_scb = FALSE;
820-# endif
821+ RESET_BINDING(curwin);
822 }
823 }
824 #endif
825diff -Naur vim73.orig/src/config.h.in vim73/src/config.h.in
826--- vim73.orig/src/config.h.in 2010-08-13 09:45:27.000000000 -0400
827+++ vim73/src/config.h.in 2011-01-08 21:01:19.038657206 -0500
828@@ -349,6 +349,9 @@
829 /* Define if you want to include the Ruby interpreter. */
830 #undef FEAT_RUBY
831
832+/* Define for linking via dlopen() or LoadLibrary() */
833+#undef DYNAMIC_RUBY
834+
835 /* Define if you want to include the Tcl interpreter. */
836 #undef FEAT_TCL
837
838diff -Naur vim73.orig/src/config.mk.in vim73/src/config.mk.in
839--- vim73.orig/src/config.mk.in 2010-07-17 11:28:51.000000000 -0400
840+++ vim73/src/config.mk.in 2011-01-08 21:01:19.118661627 -0500
841@@ -30,6 +30,7 @@
842 CPP = @CPP@
843 CPP_MM = @CPP_MM@
844 DEPEND_CFLAGS_FILTER = @DEPEND_CFLAGS_FILTER@
845+LINK_AS_NEEDED = @LINK_AS_NEEDED@
846 X_CFLAGS = @X_CFLAGS@
847 X_LIBS_DIR = @X_LIBS@
848 X_PRE_LIBS = @X_PRE_LIBS@
849diff -Naur vim73.orig/src/configure.in vim73/src/configure.in
850--- vim73.orig/src/configure.in 2010-08-13 10:15:17.000000000 -0400
851+++ vim73/src/configure.in 2011-01-08 21:01:19.186662333 -0500
852@@ -568,13 +568,27 @@
853 SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
854 else
855 AC_MSG_RESULT(no)
856- AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
857- if test -f /usr/include/plt/scheme.h; then
858+ AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket)
859+ if test -f $vi_cv_path_mzscheme_pfx/include/racket/scheme.h; then
860 AC_MSG_RESULT(yes)
861- SCHEME_INC=/usr/include/plt
862+ SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
863 else
864 AC_MSG_RESULT(no)
865- vi_cv_path_mzscheme_pfx=
866+ AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
867+ if test -f /usr/include/plt/scheme.h; then
868+ AC_MSG_RESULT(yes)
869+ SCHEME_INC=/usr/include/plt
870+ else
871+ AC_MSG_RESULT(no)
872+ AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/)
873+ if test -f /usr/include/racket/scheme.h; then
874+ AC_MSG_RESULT(yes)
875+ SCHEME_INC=/usr/include/racket
876+ else
877+ AC_MSG_RESULT(no)
878+ vi_cv_path_mzscheme_pfx=
879+ fi
880+ fi
881 fi
882 fi
883 fi
884@@ -586,13 +600,23 @@
885 elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
886 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
887 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
888- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
889+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then
890+ MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"
891+ MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
892+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.a"; then
893+ MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
894+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"; then
895 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
896 else
897 dnl Using shared objects
898 if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
899 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
900 MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
901+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.so"; then
902+ MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket3m"
903+ MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
904+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.so"; then
905+ MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket -lmzgc"
906 else
907 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
908 fi
909@@ -607,10 +631,20 @@
910 fi
911 if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
912 SCHEME_COLLECTS=lib/plt/
913+ else
914+ if test -d $vi_cv_path_mzscheme_pfx/lib/racket/collects; then
915+ SCHEME_COLLECTS=lib/racket/
916+ fi
917 fi
918 if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
919- dnl need to generate bytecode for MzScheme base
920 MZSCHEME_EXTRA="mzscheme_base.c"
921+ else
922+ if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
923+ MZSCHEME_EXTRA="mzscheme_base.c"
924+ fi
925+ fi
926+ if test "X$MZSCHEME_EXTRA" != "X" ; then
927+ dnl need to generate bytecode for MzScheme base
928 MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
929 MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
930 fi
931@@ -857,9 +891,9 @@
932
933 PYTHON_LIBS="${vi_cv_path_python_plibs}"
934 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
935- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
936+ PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
937 else
938- PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}"
939+ PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
940 fi
941 PYTHON_SRC="if_python.c"
942 dnl For Mac OSX 10.2 config.o is included in the Python library.
943@@ -871,7 +905,7 @@
944 if test "${vi_cv_var_python_version}" = "1.4"; then
945 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
946 fi
947- PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
948+ PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
949
950 dnl On FreeBSD linking with "-pthread" is required to use threads.
951 dnl _THREAD_SAFE must be used for compiling then.
952@@ -1029,9 +1063,9 @@
953
954 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
955 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
956- PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
957+ PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
958 else
959- PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}"
960+ PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
961 fi
962 PYTHON3_SRC="if_python3.c"
963 dnl For Mac OSX 10.2 config.o is included in the Python library.
964@@ -1109,9 +1143,9 @@
965 if test "$python_ok" = yes && test "$python3_ok" = yes; then
966 AC_DEFINE(DYNAMIC_PYTHON)
967 AC_DEFINE(DYNAMIC_PYTHON3)
968- AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL)
969+ AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
970 cflags_save=$CFLAGS
971- CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
972+ CFLAGS="$CFLAGS $PYTHON_CFLAGS"
973 ldflags_save=$LDFLAGS
974 LDFLAGS="$LDFLAGS -ldl"
975 AC_RUN_IFELSE([
976@@ -1122,15 +1156,17 @@
977 * Only the first pyhton version used will be switched on.
978 */
979
980- int no_rtl_global_needed_for(char *python_instsoname)
981+ int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
982 {
983 int needed = 0;
984 void* pylib = dlopen(python_instsoname, RTLD_LAZY);
985 if (pylib != 0)
986 {
987+ void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
988 void (*init)(void) = dlsym(pylib, "Py_Initialize");
989 int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
990 void (*final)(void) = dlsym(pylib, "Py_Finalize");
991+ (*pfx)(prefix);
992 (*init)();
993 needed = (*simple)("import termios") == -1;
994 (*final)();
995@@ -1142,13 +1178,60 @@
996 int main(int argc, char** argv)
997 {
998 int not_needed = 0;
999- if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0"))
1000+ if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}"))
1001 not_needed = 1;
1002 return !not_needed;
1003 }],
1004 [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
1005+
1006+ CFLAGS=$cflags_save
1007+ LDFLAGS=$ldflags_save
1008+
1009+ AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
1010+ cflags_save=$CFLAGS
1011+ CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1012+ ldflags_save=$LDFLAGS
1013+ LDFLAGS="$LDFLAGS -ldl"
1014+ AC_RUN_IFELSE([
1015+ #include <dlfcn.h>
1016+ #include <wchar.h>
1017+ /* If this program fails, then RTLD_GLOBAL is needed.
1018+ * RTLD_GLOBAL will be used and then it is not possible to
1019+ * have both python versions enabled in the same vim instance.
1020+ * Only the first pyhton version used will be switched on.
1021+ */
1022+
1023+ int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
1024+ {
1025+ int needed = 0;
1026+ void* pylib = dlopen(python_instsoname, RTLD_LAZY);
1027+ if (pylib != 0)
1028+ {
1029+ void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
1030+ void (*init)(void) = dlsym(pylib, "Py_Initialize");
1031+ int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1032+ void (*final)(void) = dlsym(pylib, "Py_Finalize");
1033+ (*pfx)(prefix);
1034+ (*init)();
1035+ needed = (*simple)("import termios") == -1;
1036+ (*final)();
1037+ dlclose(pylib);
1038+ }
1039+ return !needed;
1040+ }
1041+
1042+ int main(int argc, char** argv)
1043+ {
1044+ int not_needed = 0;
1045+ if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}"))
1046+ not_needed = 1;
1047+ return !not_needed;
1048+ }],
1049+ [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
1050+
1051 CFLAGS=$cflags_save
1052 LDFLAGS=$ldflags_save
1053+
1054 PYTHON_SRC="if_python.c"
1055 PYTHON_OBJ="objects/if_python.o"
1056 PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
1057@@ -1299,10 +1382,10 @@
1058
1059 AC_MSG_CHECKING(--enable-rubyinterp argument)
1060 AC_ARG_ENABLE(rubyinterp,
1061- [ --enable-rubyinterp Include Ruby interpreter.], ,
1062+ [ --enable-rubyinterp[=OPTS] Include Ruby interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
1063 [enable_rubyinterp="no"])
1064 AC_MSG_RESULT($enable_rubyinterp)
1065-if test "$enable_rubyinterp" = "yes"; then
1066+if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
1067 AC_MSG_CHECKING(--with-ruby-command argument)
1068 AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
1069 RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
1070@@ -1360,6 +1443,12 @@
1071 RUBY_OBJ="objects/if_ruby.o"
1072 RUBY_PRO="if_ruby.pro"
1073 AC_DEFINE(FEAT_RUBY)
1074+ if test "$enable_rubyinterp" = "dynamic"; then
1075+ libruby=`$vi_cv_path_ruby -r rbconfig -e 'printf "lib%s.%s\n", Config::CONFIG[["RUBY_SO_NAME"]], Config::CONFIG[["DLEXT"]]'`
1076+ AC_DEFINE(DYNAMIC_RUBY)
1077+ RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
1078+ RUBY_LIBS=
1079+ fi
1080 else
1081 AC_MSG_RESULT(not found; disabling Ruby)
1082 fi
1083@@ -3487,6 +3576,23 @@
1084 fi
1085 AC_SUBST(DEPEND_CFLAGS_FILTER)
1086
1087+dnl link.sh tries to avoid overlinking in a hackish way.
1088+dnl At least GNU ld supports --as-needed which provides the same functionality
1089+dnl at linker level. Let's use it.
1090+AC_MSG_CHECKING(linker --as-needed support)
1091+LINK_AS_NEEDED=
1092+# Check if linker supports --as-needed and --no-as-needed options
1093+if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
1094+ LDFLAGS="$LDFLAGS -Wl,--as-needed"
1095+ LINK_AS_NEEDED=yes
1096+fi
1097+if test "$LINK_AS_NEEDED" = yes; then
1098+ AC_MSG_RESULT(yes)
1099+else
1100+ AC_MSG_RESULT(no)
1101+fi
1102+AC_SUBST(LINK_AS_NEEDED)
1103+
1104 dnl write output files
1105 AC_OUTPUT(auto/config.mk:config.mk.in)
1106
1107diff -Naur vim73.orig/src/diff.c vim73/src/diff.c
1108--- vim73.orig/src/diff.c 2010-07-31 09:35:21.000000000 -0400
1109+++ vim73/src/diff.c 2011-01-08 20:59:40.994788713 -0500
1110@@ -1127,11 +1127,13 @@
1111 # endif
1112
1113 wp->w_p_diff = TRUE;
1114+ /* Use 'scrollbind' and 'cursorbind' when available */
1115+#ifdef FEAT_SCROLLBIND
1116+ wp->w_p_scb = TRUE;
1117+#endif
1118 #ifdef FEAT_CURSORBIND
1119- /* Use cursorbind if it's available */
1120 wp->w_p_crb = TRUE;
1121 #endif
1122- wp->w_p_scb = TRUE;
1123 wp->w_p_wrap = FALSE;
1124 # ifdef FEAT_FOLDING
1125 curwin = wp;
1126@@ -1177,10 +1179,7 @@
1127 {
1128 /* Set 'diff', 'scrollbind' off and 'wrap' on. */
1129 wp->w_p_diff = FALSE;
1130-#ifdef FEAT_CURSORBIND
1131- wp->w_p_crb = FALSE;
1132-#endif
1133- wp->w_p_scb = FALSE;
1134+ RESET_BINDING(wp);
1135 wp->w_p_wrap = TRUE;
1136 #ifdef FEAT_FOLDING
1137 curwin = wp;
1138diff -Naur vim73.orig/src/edit.c vim73/src/edit.c
1139--- vim73.orig/src/edit.c 2010-08-08 08:55:05.000000000 -0400
1140+++ vim73/src/edit.c 2011-01-08 21:01:19.146656810 -0500
1141@@ -58,6 +58,10 @@
1142 };
1143
1144 static char e_hitend[] = N_("Hit end of paragraph");
1145+#ifdef FEAT_COMPL_FUNC
1146+static char e_complwin[] = N_("E839: Completion function changed window");
1147+static char e_compldel[] = N_("E840: Completion function deleted text");
1148+#endif
1149
1150 /*
1151 * Structure used to store one match for insert completion.
1152@@ -2658,6 +2662,7 @@
1153 if (stop_arrow() == FAIL)
1154 return;
1155
1156+ compl_direction = FORWARD;
1157 if (startcol > curwin->w_cursor.col)
1158 startcol = curwin->w_cursor.col;
1159 compl_col = startcol;
1160@@ -3833,6 +3838,8 @@
1161 char_u *args[2];
1162 char_u *funcname;
1163 pos_T pos;
1164+ win_T *curwin_save;
1165+ buf_T *curbuf_save;
1166
1167 funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu;
1168 if (*funcname == NUL)
1169@@ -3843,13 +3850,27 @@
1170 args[1] = base;
1171
1172 pos = curwin->w_cursor;
1173+ curwin_save = curwin;
1174+ curbuf_save = curbuf;
1175 matchlist = call_func_retlist(funcname, 2, args, FALSE);
1176+ if (curwin_save != curwin || curbuf_save != curbuf)
1177+ {
1178+ EMSG(_(e_complwin));
1179+ goto theend;
1180+ }
1181 curwin->w_cursor = pos; /* restore the cursor position */
1182- if (matchlist == NULL)
1183- return;
1184+ check_cursor();
1185+ if (!equalpos(curwin->w_cursor, pos))
1186+ {
1187+ EMSG(_(e_compldel));
1188+ goto theend;
1189+ }
1190+ if (matchlist != NULL)
1191+ ins_compl_add_list(matchlist);
1192
1193- ins_compl_add_list(matchlist);
1194- list_unref(matchlist);
1195+theend:
1196+ if (matchlist != NULL)
1197+ list_unref(matchlist);
1198 }
1199 #endif /* FEAT_COMPL_FUNC */
1200
1201@@ -3889,6 +3910,7 @@
1202 char_u *word;
1203 int icase = FALSE;
1204 int adup = FALSE;
1205+ int aempty = FALSE;
1206 char_u *(cptext[CPT_COUNT]);
1207
1208 if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL)
1209@@ -3906,13 +3928,15 @@
1210 icase = get_dict_number(tv->vval.v_dict, (char_u *)"icase");
1211 if (get_dict_string(tv->vval.v_dict, (char_u *)"dup", FALSE) != NULL)
1212 adup = get_dict_number(tv->vval.v_dict, (char_u *)"dup");
1213+ if (get_dict_string(tv->vval.v_dict, (char_u *)"empty", FALSE) != NULL)
1214+ aempty = get_dict_number(tv->vval.v_dict, (char_u *)"empty");
1215 }
1216 else
1217 {
1218 word = get_tv_string_chk(tv);
1219 vim_memset(cptext, 0, sizeof(cptext));
1220 }
1221- if (word == NULL || *word == NUL)
1222+ if (word == NULL || (!aempty && *word == NUL))
1223 return FAIL;
1224 return ins_compl_add(word, -1, icase, NULL, cptext, dir, 0, adup);
1225 }
1226@@ -4994,6 +5018,8 @@
1227 int col;
1228 char_u *funcname;
1229 pos_T pos;
1230+ win_T *curwin_save;
1231+ buf_T *curbuf_save;
1232
1233 /* Call 'completefunc' or 'omnifunc' and get pattern length as a
1234 * string */
1235@@ -5009,8 +5035,21 @@
1236 args[0] = (char_u *)"1";
1237 args[1] = NULL;
1238 pos = curwin->w_cursor;
1239+ curwin_save = curwin;
1240+ curbuf_save = curbuf;
1241 col = call_func_retnr(funcname, 2, args, FALSE);
1242+ if (curwin_save != curwin || curbuf_save != curbuf)
1243+ {
1244+ EMSG(_(e_complwin));
1245+ return FAIL;
1246+ }
1247 curwin->w_cursor = pos; /* restore the cursor position */
1248+ check_cursor();
1249+ if (!equalpos(curwin->w_cursor, pos))
1250+ {
1251+ EMSG(_(e_compldel));
1252+ return FAIL;
1253+ }
1254
1255 if (col < 0)
1256 col = curs_col;
1257diff -Naur vim73.orig/src/eval.c vim73/src/eval.c
1258--- vim73.orig/src/eval.c 2010-08-09 16:12:14.000000000 -0400
1259+++ vim73/src/eval.c 2011-01-08 21:01:19.506657797 -0500
1260@@ -10,9 +10,6 @@
1261 /*
1262 * eval.c: Expression evaluation.
1263 */
1264-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
1265-# include "vimio.h" /* for mch_open(), must be before vim.h */
1266-#endif
1267
1268 #include "vim.h"
1269
1270@@ -362,6 +359,7 @@
1271 {VV_NAME("operator", VAR_STRING), VV_RO},
1272 {VV_NAME("searchforward", VAR_NUMBER), 0},
1273 {VV_NAME("oldfiles", VAR_LIST), 0},
1274+ {VV_NAME("windowid", VAR_NUMBER), VV_RO},
1275 };
1276
1277 /* shorthand */
1278@@ -433,9 +431,9 @@
1279 static void listitem_free __ARGS((listitem_T *item));
1280 static void listitem_remove __ARGS((list_T *l, listitem_T *item));
1281 static long list_len __ARGS((list_T *l));
1282-static int list_equal __ARGS((list_T *l1, list_T *l2, int ic));
1283-static int dict_equal __ARGS((dict_T *d1, dict_T *d2, int ic));
1284-static int tv_equal __ARGS((typval_T *tv1, typval_T *tv2, int ic));
1285+static int list_equal __ARGS((list_T *l1, list_T *l2, int ic, int recursive));
1286+static int dict_equal __ARGS((dict_T *d1, dict_T *d2, int ic, int recursive));
1287+static int tv_equal __ARGS((typval_T *tv1, typval_T *tv2, int ic, int recursive));
1288 static listitem_T *list_find __ARGS((list_T *l, long n));
1289 static long list_find_nr __ARGS((list_T *l, long idx, int *errorp));
1290 static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
1291@@ -2325,7 +2323,7 @@
1292 else if (endchars != NULL
1293 && vim_strchr(endchars, *skipwhite(arg)) == NULL)
1294 EMSG(_(e_letunexp));
1295- else
1296+ else if (!check_secure())
1297 {
1298 c1 = name[len];
1299 name[len] = NUL;
1300@@ -3337,6 +3335,15 @@
1301 int failed = FALSE;
1302 funcdict_T fudi;
1303
1304+ if (eap->skip)
1305+ {
1306+ /* trans_function_name() doesn't work well when skipping, use eval0()
1307+ * instead to skip to any following command, e.g. for:
1308+ * :if 0 | call dict.foo().bar() | endif */
1309+ eval0(eap->arg, &rettv, &eap->nextcmd, FALSE);
1310+ return;
1311+ }
1312+
1313 tofree = trans_function_name(&arg, eap->skip, TFN_INT, &fudi);
1314 if (fudi.fd_newkey != NULL)
1315 {
1316@@ -4349,7 +4356,8 @@
1317 else
1318 {
1319 /* Compare two Lists for being equal or unequal. */
1320- n1 = list_equal(rettv->vval.v_list, var2.vval.v_list, ic);
1321+ n1 = list_equal(rettv->vval.v_list, var2.vval.v_list,
1322+ ic, FALSE);
1323 if (type == TYPE_NEQUAL)
1324 n1 = !n1;
1325 }
1326@@ -4378,7 +4386,8 @@
1327 else
1328 {
1329 /* Compare two Dictionaries for being equal or unequal. */
1330- n1 = dict_equal(rettv->vval.v_dict, var2.vval.v_dict, ic);
1331+ n1 = dict_equal(rettv->vval.v_dict, var2.vval.v_dict,
1332+ ic, FALSE);
1333 if (type == TYPE_NEQUAL)
1334 n1 = !n1;
1335 }
1336@@ -5913,10 +5922,11 @@
1337 * Return TRUE when two lists have exactly the same values.
1338 */
1339 static int
1340-list_equal(l1, l2, ic)
1341+list_equal(l1, l2, ic, recursive)
1342 list_T *l1;
1343 list_T *l2;
1344 int ic; /* ignore case for strings */
1345+ int recursive; /* TRUE when used recursively */
1346 {
1347 listitem_T *item1, *item2;
1348
1349@@ -5930,7 +5940,7 @@
1350 for (item1 = l1->lv_first, item2 = l2->lv_first;
1351 item1 != NULL && item2 != NULL;
1352 item1 = item1->li_next, item2 = item2->li_next)
1353- if (!tv_equal(&item1->li_tv, &item2->li_tv, ic))
1354+ if (!tv_equal(&item1->li_tv, &item2->li_tv, ic, recursive))
1355 return FALSE;
1356 return item1 == NULL && item2 == NULL;
1357 }
1358@@ -5952,10 +5962,11 @@
1359 * Return TRUE when two dictionaries have exactly the same key/values.
1360 */
1361 static int
1362-dict_equal(d1, d2, ic)
1363+dict_equal(d1, d2, ic, recursive)
1364 dict_T *d1;
1365 dict_T *d2;
1366 int ic; /* ignore case for strings */
1367+ int recursive; /* TRUE when used recursively */
1368 {
1369 hashitem_T *hi;
1370 dictitem_T *item2;
1371@@ -5976,7 +5987,7 @@
1372 item2 = dict_find(d2, hi->hi_key, -1);
1373 if (item2 == NULL)
1374 return FALSE;
1375- if (!tv_equal(&HI2DI(hi)->di_tv, &item2->di_tv, ic))
1376+ if (!tv_equal(&HI2DI(hi)->di_tv, &item2->di_tv, ic, recursive))
1377 return FALSE;
1378 --todo;
1379 }
1380@@ -5984,41 +5995,54 @@
1381 return TRUE;
1382 }
1383
1384+static int tv_equal_recurse_limit;
1385+
1386 /*
1387 * Return TRUE if "tv1" and "tv2" have the same value.
1388 * Compares the items just like "==" would compare them, but strings and
1389 * numbers are different. Floats and numbers are also different.
1390 */
1391 static int
1392-tv_equal(tv1, tv2, ic)
1393+tv_equal(tv1, tv2, ic, recursive)
1394 typval_T *tv1;
1395 typval_T *tv2;
1396- int ic; /* ignore case */
1397+ int ic; /* ignore case */
1398+ int recursive; /* TRUE when used recursively */
1399 {
1400 char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN];
1401 char_u *s1, *s2;
1402- static int recursive = 0; /* cach recursive loops */
1403+ static int recursive_cnt = 0; /* catch recursive loops */
1404 int r;
1405
1406 if (tv1->v_type != tv2->v_type)
1407 return FALSE;
1408+
1409 /* Catch lists and dicts that have an endless loop by limiting
1410- * recursiveness to 1000. We guess they are equal then. */
1411- if (recursive >= 1000)
1412+ * recursiveness to a limit. We guess they are equal then.
1413+ * A fixed limit has the problem of still taking an awful long time.
1414+ * Reduce the limit every time running into it. That should work fine for
1415+ * deeply linked structures that are not recursively linked and catch
1416+ * recursiveness quickly. */
1417+ if (!recursive)
1418+ tv_equal_recurse_limit = 1000;
1419+ if (recursive_cnt >= tv_equal_recurse_limit)
1420+ {
1421+ --tv_equal_recurse_limit;
1422 return TRUE;
1423+ }
1424
1425 switch (tv1->v_type)
1426 {
1427 case VAR_LIST:
1428- ++recursive;
1429- r = list_equal(tv1->vval.v_list, tv2->vval.v_list, ic);
1430- --recursive;
1431+ ++recursive_cnt;
1432+ r = list_equal(tv1->vval.v_list, tv2->vval.v_list, ic, TRUE);
1433+ --recursive_cnt;
1434 return r;
1435
1436 case VAR_DICT:
1437- ++recursive;
1438- r = dict_equal(tv1->vval.v_dict, tv2->vval.v_dict, ic);
1439- --recursive;
1440+ ++recursive_cnt;
1441+ r = dict_equal(tv1->vval.v_dict, tv2->vval.v_dict, ic, TRUE);
1442+ --recursive_cnt;
1443 return r;
1444
1445 case VAR_FUNC:
1446@@ -7075,7 +7099,7 @@
1447 }
1448
1449 /*
1450- * Add a list entry to dictionary "d".
1451+ * Add a list entry to dictionary "d".
1452 * Returns FAIL when out of memory and when key already exists.
1453 */
1454 int
1455@@ -7097,6 +7121,7 @@
1456 dictitem_free(item);
1457 return FAIL;
1458 }
1459+ ++list->lv_refcount;
1460 return OK;
1461 }
1462
1463@@ -7802,7 +7827,7 @@
1464 {"log10", 1, 1, f_log10},
1465 #endif
1466 {"map", 2, 2, f_map},
1467- {"maparg", 1, 3, f_maparg},
1468+ {"maparg", 1, 4, f_maparg},
1469 {"mapcheck", 1, 3, f_mapcheck},
1470 {"match", 2, 4, f_match},
1471 {"matchadd", 2, 4, f_matchadd},
1472@@ -9389,7 +9414,7 @@
1473 }
1474
1475 for ( ; li != NULL; li = li->li_next)
1476- if (tv_equal(&li->li_tv, &argvars[1], ic))
1477+ if (tv_equal(&li->li_tv, &argvars[1], ic, FALSE))
1478 ++n;
1479 }
1480 }
1481@@ -9416,7 +9441,7 @@
1482 if (!HASHITEM_EMPTY(hi))
1483 {
1484 --todo;
1485- if (tv_equal(&HI2DI(hi)->di_tv, &argvars[1], ic))
1486+ if (tv_equal(&HI2DI(hi)->di_tv, &argvars[1], ic, FALSE))
1487 ++n;
1488 }
1489 }
1490@@ -9857,7 +9882,7 @@
1491 char_u *s;
1492 int len;
1493 char_u *errormsg;
1494- int flags = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND;
1495+ int options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND;
1496 expand_T xpc;
1497 int error = FALSE;
1498
1499@@ -9875,12 +9900,14 @@
1500 * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1501 if (argvars[1].v_type != VAR_UNKNOWN
1502 && get_tv_number_chk(&argvars[1], &error))
1503- flags |= WILD_KEEP_ALL;
1504+ options |= WILD_KEEP_ALL;
1505 if (!error)
1506 {
1507 ExpandInit(&xpc);
1508 xpc.xp_context = EXPAND_FILES;
1509- rettv->vval.v_string = ExpandOne(&xpc, s, NULL, flags, WILD_ALL);
1510+ if (p_wic)
1511+ options += WILD_ICASE;
1512+ rettv->vval.v_string = ExpandOne(&xpc, s, NULL, options, WILD_ALL);
1513 }
1514 else
1515 rettv->vval.v_string = NULL;
1516@@ -11653,7 +11680,7 @@
1517 typval_T *argvars;
1518 typval_T *rettv;
1519 {
1520- int flags = WILD_SILENT|WILD_USE_NL;
1521+ int options = WILD_SILENT|WILD_USE_NL;
1522 expand_T xpc;
1523 int error = FALSE;
1524
1525@@ -11661,14 +11688,16 @@
1526 * for 'wildignore' and don't put matches for 'suffixes' at the end. */
1527 if (argvars[1].v_type != VAR_UNKNOWN
1528 && get_tv_number_chk(&argvars[1], &error))
1529- flags |= WILD_KEEP_ALL;
1530+ options |= WILD_KEEP_ALL;
1531 rettv->v_type = VAR_STRING;
1532 if (!error)
1533 {
1534 ExpandInit(&xpc);
1535 xpc.xp_context = EXPAND_FILES;
1536+ if (p_wic)
1537+ options += WILD_ICASE;
1538 rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
1539- NULL, flags, WILD_ALL);
1540+ NULL, options, WILD_ALL);
1541 }
1542 else
1543 rettv->vval.v_string = NULL;
1544@@ -12116,6 +12145,9 @@
1545 #ifdef FEAT_TOOLBAR
1546 "toolbar",
1547 #endif
1548+#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
1549+ "unnamedplus",
1550+#endif
1551 #ifdef FEAT_USR_CMDS
1552 "user-commands", /* was accidentally included in 5.4 */
1553 "user_commands",
1554@@ -12572,7 +12604,7 @@
1555 }
1556
1557 for ( ; item != NULL; item = item->li_next, ++idx)
1558- if (tv_equal(&item->li_tv, &argvars[1], ic))
1559+ if (tv_equal(&item->li_tv, &argvars[1], ic, FALSE))
1560 {
1561 rettv->vval.v_number = idx;
1562 break;
1563@@ -13290,8 +13322,10 @@
1564 char_u *keys_buf = NULL;
1565 char_u *rhs;
1566 int mode;
1567- garray_T ga;
1568 int abbr = FALSE;
1569+ int get_dict = FALSE;
1570+ mapblock_T *mp;
1571+ int buffer_local;
1572
1573 /* return empty string for failure */
1574 rettv->v_type = VAR_STRING;
1575@@ -13305,7 +13339,11 @@
1576 {
1577 which = get_tv_string_buf_chk(&argvars[1], buf);
1578 if (argvars[2].v_type != VAR_UNKNOWN)
1579+ {
1580 abbr = get_tv_number(&argvars[2]);
1581+ if (argvars[3].v_type != VAR_UNKNOWN)
1582+ get_dict = get_tv_number(&argvars[3]);
1583+ }
1584 }
1585 else
1586 which = (char_u *)"";
1587@@ -13315,19 +13353,34 @@
1588 mode = get_map_mode(&which, 0);
1589
1590 keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE);
1591- rhs = check_map(keys, mode, exact, FALSE, abbr);
1592+ rhs = check_map(keys, mode, exact, FALSE, abbr, &mp, &buffer_local);
1593 vim_free(keys_buf);
1594- if (rhs != NULL)
1595- {
1596- ga_init(&ga);
1597- ga.ga_itemsize = 1;
1598- ga.ga_growsize = 40;
1599
1600- while (*rhs != NUL)
1601- ga_concat(&ga, str2special(&rhs, FALSE));
1602+ if (!get_dict)
1603+ {
1604+ /* Return a string. */
1605+ if (rhs != NULL)
1606+ rettv->vval.v_string = str2special_save(rhs, FALSE);
1607+
1608+ }
1609+ else if (rettv_dict_alloc(rettv) != FAIL && rhs != NULL)
1610+ {
1611+ /* Return a dictionary. */
1612+ char_u *lhs = str2special_save(mp->m_keys, TRUE);
1613+ char_u *mapmode = map_mode_to_chars(mp->m_mode);
1614+ dict_T *dict = rettv->vval.v_dict;
1615+
1616+ dict_add_nr_str(dict, "lhs", 0L, lhs);
1617+ dict_add_nr_str(dict, "rhs", 0L, mp->m_orig_str);
1618+ dict_add_nr_str(dict, "noremap", mp->m_noremap ? 1L : 0L , NULL);
1619+ dict_add_nr_str(dict, "expr", mp->m_expr ? 1L : 0L, NULL);
1620+ dict_add_nr_str(dict, "silent", mp->m_silent ? 1L : 0L, NULL);
1621+ dict_add_nr_str(dict, "sid", (long)mp->m_script_ID, NULL);
1622+ dict_add_nr_str(dict, "buffer", (long)buffer_local, NULL);
1623+ dict_add_nr_str(dict, "mode", 0L, mapmode);
1624
1625- ga_append(&ga, NUL);
1626- rettv->vval.v_string = (char_u *)ga.ga_data;
1627+ vim_free(lhs);
1628+ vim_free(mapmode);
1629 }
1630 }
1631
1632@@ -22519,18 +22572,21 @@
1633 if (tab != NULL)
1634 {
1635 *tab++ = '\0'; /* isolate the variable name */
1636- if (*tab == 'S') /* string var */
1637- type = VAR_STRING;
1638+ switch (*tab)
1639+ {
1640+ case 'S': type = VAR_STRING; break;
1641 #ifdef FEAT_FLOAT
1642- else if (*tab == 'F')
1643- type = VAR_FLOAT;
1644+ case 'F': type = VAR_FLOAT; break;
1645 #endif
1646+ case 'D': type = VAR_DICT; break;
1647+ case 'L': type = VAR_LIST; break;
1648+ }
1649
1650 tab = vim_strchr(tab, '\t');
1651 if (tab != NULL)
1652 {
1653 tv.v_type = type;
1654- if (type == VAR_STRING)
1655+ if (type == VAR_STRING || type == VAR_DICT || type == VAR_LIST)
1656 tv.vval.v_string = viminfo_readstring(virp,
1657 (int)(tab - virp->vir_line + 1), TRUE);
1658 #ifdef FEAT_FLOAT
1659@@ -22539,9 +22595,27 @@
1660 #endif
1661 else
1662 tv.vval.v_number = atol((char *)tab + 1);
1663+ if (type == VAR_DICT || type == VAR_LIST)
1664+ {
1665+ typval_T *etv = eval_expr(tv.vval.v_string, NULL);
1666+
1667+ if (etv == NULL)
1668+ /* Failed to parse back the dict or list, use it as a
1669+ * string. */
1670+ tv.v_type = VAR_STRING;
1671+ else
1672+ {
1673+ vim_free(tv.vval.v_string);
1674+ tv = *etv;
1675+ }
1676+ }
1677+
1678 set_var(virp->vir_line + 1, &tv, FALSE);
1679- if (type == VAR_STRING)
1680+
1681+ if (tv.v_type == VAR_STRING)
1682 vim_free(tv.vval.v_string);
1683+ else if (tv.v_type == VAR_DICT || tv.v_type == VAR_LIST)
1684+ clear_tv(&tv);
1685 }
1686 }
1687 }
1688@@ -22583,8 +22657,10 @@
1689 case VAR_STRING: s = "STR"; break;
1690 case VAR_NUMBER: s = "NUM"; break;
1691 #ifdef FEAT_FLOAT
1692- case VAR_FLOAT: s = "FLO"; break;
1693+ case VAR_FLOAT: s = "FLO"; break;
1694 #endif
1695+ case VAR_DICT: s = "DIC"; break;
1696+ case VAR_LIST: s = "LIS"; break;
1697 default: continue;
1698 }
1699 fprintf(fp, "!%s\t%s\t", this_var->di_key, s);
1700diff -Naur vim73.orig/src/ex_cmds.c vim73/src/ex_cmds.c
1701--- vim73.orig/src/ex_cmds.c 2010-08-13 05:14:35.000000000 -0400
1702+++ vim73/src/ex_cmds.c 2011-01-08 21:01:19.370657515 -0500
1703@@ -11,10 +11,6 @@
1704 * ex_cmds.c: some functions for command line commands
1705 */
1706
1707-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
1708-# include "vimio.h" /* for mch_open(), must be before vim.h */
1709-#endif
1710-
1711 #include "vim.h"
1712 #include "version.h"
1713
1714@@ -323,7 +319,8 @@
1715 /* When sorting numbers "start_col_nr" is the number, not the column
1716 * number. */
1717 if (sort_nr)
1718- result = l1.start_col_nr - l2.start_col_nr;
1719+ result = l1.start_col_nr == l2.start_col_nr ? 0
1720+ : l1.start_col_nr > l2.start_col_nr ? 1 : -1;
1721 else
1722 {
1723 /* We need to copy one line into "sortbuf1", because there is no
1724@@ -482,7 +479,7 @@
1725 * of the match, by temporarily terminating the string there */
1726 s2 = s + end_col;
1727 c = *s2;
1728- (*s2) = 0;
1729+ *s2 = NUL;
1730 /* Sorting on number: Store the number itself. */
1731 p = s + start_col;
1732 if (sort_hex)
1733@@ -491,9 +488,13 @@
1734 s = skiptodigit(p);
1735 if (s > p && s[-1] == '-')
1736 --s; /* include preceding negative sign */
1737- vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
1738- &nrs[lnum - eap->line1].start_col_nr, NULL);
1739- (*s2) = c;
1740+ if (*s == NUL)
1741+ /* empty line should sort before any number */
1742+ nrs[lnum - eap->line1].start_col_nr = -MAXLNUM;
1743+ else
1744+ vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
1745+ &nrs[lnum - eap->line1].start_col_nr, NULL);
1746+ *s2 = c;
1747 }
1748 else
1749 {
1750@@ -2700,6 +2701,10 @@
1751 TRUE);
1752 do_modelines(0);
1753 }
1754+
1755+ /* Autocommands may have changed buffer names, esp. when
1756+ * 'autochdir' is set. */
1757+ fname = curbuf->b_sfname;
1758 #endif
1759 }
1760
1761@@ -3498,9 +3503,7 @@
1762 curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */
1763 curwin->w_p_nu = 0; /* no line numbers */
1764 curwin->w_p_rnu = 0; /* no relative line numbers */
1765-#ifdef FEAT_SCROLLBIND
1766- curwin->w_p_scb = FALSE; /* no scroll binding */
1767-#endif
1768+ RESET_BINDING(curwin); /* no scroll or cursor binding */
1769 #ifdef FEAT_ARABIC
1770 curwin->w_p_arab = FALSE; /* no arabic mode */
1771 #endif
1772@@ -5471,9 +5474,8 @@
1773 return FALSE;
1774 curwin->w_p_pvw = TRUE;
1775 curwin->w_p_wfh = TRUE;
1776-# ifdef FEAT_SCROLLBIND
1777- curwin->w_p_scb = FALSE; /* don't take over 'scrollbind' */
1778-# endif
1779+ RESET_BINDING(curwin); /* don't take over 'scrollbind'
1780+ and 'cursorbind' */
1781 # ifdef FEAT_DIFF
1782 curwin->w_p_diff = FALSE; /* no 'diff' */
1783 # endif
1784@@ -6559,8 +6561,7 @@
1785 struct sign
1786 {
1787 sign_T *sn_next; /* next sign in list */
1788- int sn_typenr; /* type number of sign (negative if not equal
1789- to name) */
1790+ int sn_typenr; /* type number of sign */
1791 char_u *sn_name; /* name of sign */
1792 char_u *sn_icon; /* name of pixmap */
1793 #ifdef FEAT_SIGN_ICONS
1794@@ -6572,7 +6573,7 @@
1795 };
1796
1797 static sign_T *first_sign = NULL;
1798-static int last_sign_typenr = MAX_TYPENR; /* is decremented */
1799+static int next_sign_typenr = 1;
1800
1801 static int sign_cmd_idx __ARGS((char_u *begin_cmd, char_u *end_cmd));
1802 static void sign_list_defined __ARGS((sign_T *sp));
1803@@ -6654,9 +6655,14 @@
1804 EMSG(_("E156: Missing sign name"));
1805 else
1806 {
1807+ /* Isolate the sign name. If it's a number skip leading zeroes,
1808+ * so that "099" and "99" are the same sign. But keep "0". */
1809 p = skiptowhite(arg);
1810 if (*p != NUL)
1811 *p++ = NUL;
1812+ while (arg[0] == '0' && arg[1] != NUL)
1813+ ++arg;
1814+
1815 sp_prev = NULL;
1816 for (sp = first_sign; sp != NULL; sp = sp->sn_next)
1817 {
1818@@ -6669,46 +6675,52 @@
1819 /* ":sign define {name} ...": define a sign */
1820 if (sp == NULL)
1821 {
1822+ sign_T *lp;
1823+ int start = next_sign_typenr;
1824+
1825 /* Allocate a new sign. */
1826 sp = (sign_T *)alloc_clear((unsigned)sizeof(sign_T));
1827 if (sp == NULL)
1828 return;
1829- if (sp_prev == NULL)
1830- first_sign = sp;
1831- else
1832- sp_prev->sn_next = sp;
1833- sp->sn_name = vim_strnsave(arg, (int)(p - arg));
1834
1835- /* If the name is a number use that for the typenr,
1836- * otherwise use a negative number. */
1837- if (VIM_ISDIGIT(*arg))
1838- sp->sn_typenr = atoi((char *)arg);
1839- else
1840+ /* Check that next_sign_typenr is not already being used.
1841+ * This only happens after wrapping around. Hopefully
1842+ * another one got deleted and we can use its number. */
1843+ for (lp = first_sign; lp != NULL; )
1844 {
1845- sign_T *lp;
1846- int start = last_sign_typenr;
1847-
1848- for (lp = first_sign; lp != NULL; lp = lp->sn_next)
1849+ if (lp->sn_typenr == next_sign_typenr)
1850 {
1851- if (lp->sn_typenr == last_sign_typenr)
1852+ ++next_sign_typenr;
1853+ if (next_sign_typenr == MAX_TYPENR)
1854+ next_sign_typenr = 1;
1855+ if (next_sign_typenr == start)
1856 {
1857- --last_sign_typenr;
1858- if (last_sign_typenr == 0)
1859- last_sign_typenr = MAX_TYPENR;
1860- if (last_sign_typenr == start)
1861- {
1862- EMSG(_("E612: Too many signs defined"));
1863- return;
1864- }
1865- lp = first_sign;
1866- continue;
1867+ vim_free(sp);
1868+ EMSG(_("E612: Too many signs defined"));
1869+ return;
1870 }
1871+ lp = first_sign; /* start all over */
1872+ continue;
1873 }
1874+ lp = lp->sn_next;
1875+ }
1876+
1877+ sp->sn_typenr = next_sign_typenr;
1878+ if (++next_sign_typenr == MAX_TYPENR)
1879+ next_sign_typenr = 1; /* wrap around */
1880
1881- sp->sn_typenr = last_sign_typenr--;
1882- if (last_sign_typenr == 0)
1883- last_sign_typenr = MAX_TYPENR; /* wrap around */
1884+ sp->sn_name = vim_strsave(arg);
1885+ if (sp->sn_name == NULL) /* out of memory */
1886+ {
1887+ vim_free(sp);
1888+ return;
1889 }
1890+
1891+ /* add the new sign to the list of signs */
1892+ if (sp_prev == NULL)
1893+ first_sign = sp;
1894+ else
1895+ sp_prev->sn_next = sp;
1896 }
1897
1898 /* set values for a defined sign. */
1899@@ -6886,6 +6898,8 @@
1900 arg = skiptowhite(arg);
1901 if (*arg != NUL)
1902 *arg++ = NUL;
1903+ while (sign_name[0] == '0' && sign_name[1] != NUL)
1904+ ++sign_name;
1905 }
1906 else if (STRNCMP(arg, "file=", 5) == 0)
1907 {
1908diff -Naur vim73.orig/src/ex_cmds2.c vim73/src/ex_cmds2.c
1909--- vim73.orig/src/ex_cmds2.c 2010-07-27 15:43:38.000000000 -0400
1910+++ vim73/src/ex_cmds2.c 2011-01-08 21:01:19.374658068 -0500
1911@@ -11,10 +11,6 @@
1912 * ex_cmds2.c: some more functions for command line commands
1913 */
1914
1915-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
1916-# include "vimio.h" /* for mch_open(), must be before vim.h */
1917-#endif
1918-
1919 #include "vim.h"
1920 #include "version.h"
1921
1922@@ -2165,9 +2161,7 @@
1923 {
1924 if (win_split(0, 0) == FAIL)
1925 return;
1926-# ifdef FEAT_SCROLLBIND
1927- curwin->w_p_scb = FALSE;
1928-# endif
1929+ RESET_BINDING(curwin);
1930 }
1931 else
1932 #endif
1933diff -Naur vim73.orig/src/ex_docmd.c vim73/src/ex_docmd.c
1934--- vim73.orig/src/ex_docmd.c 2010-08-07 10:59:47.000000000 -0400
1935+++ vim73/src/ex_docmd.c 2011-01-08 21:01:19.234657608 -0500
1936@@ -733,7 +733,7 @@
1937 * do_cmdline(): execute one Ex command line
1938 *
1939 * 1. Execute "cmdline" when it is not NULL.
1940- * If "cmdline" is NULL, or more lines are needed, getline() is used.
1941+ * If "cmdline" is NULL, or more lines are needed, fgetline() is used.
1942 * 2. Split up in parts separated with '|'.
1943 *
1944 * This function can be called recursively!
1945@@ -741,7 +741,7 @@
1946 * flags:
1947 * DOCMD_VERBOSE - The command will be included in the error message.
1948 * DOCMD_NOWAIT - Don't call wait_return() and friends.
1949- * DOCMD_REPEAT - Repeat execution until getline() returns NULL.
1950+ * DOCMD_REPEAT - Repeat execution until fgetline() returns NULL.
1951 * DOCMD_KEYTYPED - Don't reset KeyTyped.
1952 * DOCMD_EXCRESET - Reset the exception environment (used for debugging).
1953 * DOCMD_KEEPLINE - Store first typed line (for repeating with ".").
1954@@ -749,15 +749,15 @@
1955 * return FAIL if cmdline could not be executed, OK otherwise
1956 */
1957 int
1958-do_cmdline(cmdline, getline, cookie, flags)
1959+do_cmdline(cmdline, fgetline, cookie, flags)
1960 char_u *cmdline;
1961- char_u *(*getline) __ARGS((int, void *, int));
1962- void *cookie; /* argument for getline() */
1963+ char_u *(*fgetline) __ARGS((int, void *, int));
1964+ void *cookie; /* argument for fgetline() */
1965 int flags;
1966 {
1967 char_u *next_cmdline; /* next cmd to execute */
1968 char_u *cmdline_copy = NULL; /* copy of cmd line */
1969- int used_getline = FALSE; /* used "getline" to obtain command */
1970+ int used_getline = FALSE; /* used "fgetline" to obtain command */
1971 static int recursive = 0; /* recursive depth */
1972 int msg_didout_before_start = 0;
1973 int count = 0; /* line number count */
1974@@ -775,14 +775,14 @@
1975 struct msglist **saved_msg_list = NULL;
1976 struct msglist *private_msg_list;
1977
1978- /* "getline" and "cookie" passed to do_one_cmd() */
1979+ /* "fgetline" and "cookie" passed to do_one_cmd() */
1980 char_u *(*cmd_getline) __ARGS((int, void *, int));
1981 void *cmd_cookie;
1982 struct loop_cookie cmd_loop_cookie;
1983 void *real_cookie;
1984 int getline_is_func;
1985 #else
1986-# define cmd_getline getline
1987+# define cmd_getline fgetline
1988 # define cmd_cookie cookie
1989 #endif
1990 static int call_depth = 0; /* recursiveness */
1991@@ -822,10 +822,10 @@
1992 cstack.cs_lflags = 0;
1993 ga_init2(&lines_ga, (int)sizeof(wcmd_T), 10);
1994
1995- real_cookie = getline_cookie(getline, cookie);
1996+ real_cookie = getline_cookie(fgetline, cookie);
1997
1998 /* Inside a function use a higher nesting level. */
1999- getline_is_func = getline_equal(getline, cookie, get_func_line);
2000+ getline_is_func = getline_equal(fgetline, cookie, get_func_line);
2001 if (getline_is_func && ex_nesting_level == func_level(real_cookie))
2002 ++ex_nesting_level;
2003
2004@@ -837,7 +837,7 @@
2005 breakpoint = func_breakpoint(real_cookie);
2006 dbg_tick = func_dbg_tick(real_cookie);
2007 }
2008- else if (getline_equal(getline, cookie, getsourceline))
2009+ else if (getline_equal(fgetline, cookie, getsourceline))
2010 {
2011 fname = sourcing_name;
2012 breakpoint = source_breakpoint(real_cookie);
2013@@ -881,7 +881,8 @@
2014 * KeyTyped is only set when calling vgetc(). Reset it here when not
2015 * calling vgetc() (sourced command lines).
2016 */
2017- if (!(flags & DOCMD_KEYTYPED) && !getline_equal(getline, cookie, getexline))
2018+ if (!(flags & DOCMD_KEYTYPED)
2019+ && !getline_equal(fgetline, cookie, getexline))
2020 KeyTyped = FALSE;
2021
2022 /*
2023@@ -894,7 +895,7 @@
2024 do
2025 {
2026 #ifdef FEAT_EVAL
2027- getline_is_func = getline_equal(getline, cookie, get_func_line);
2028+ getline_is_func = getline_equal(fgetline, cookie, get_func_line);
2029 #endif
2030
2031 /* stop skipping cmds for an error msg after all endif/while/for */
2032@@ -909,7 +910,7 @@
2033
2034 /*
2035 * 1. If repeating a line in a loop, get a line from lines_ga.
2036- * 2. If no line given: Get an allocated line with getline().
2037+ * 2. If no line given: Get an allocated line with fgetline().
2038 * 3. If a line is given: Make a copy, so we can mess with it.
2039 */
2040
2041@@ -938,12 +939,12 @@
2042 }
2043 #ifdef FEAT_PROFILE
2044 else if (do_profiling == PROF_YES
2045- && getline_equal(getline, cookie, getsourceline))
2046+ && getline_equal(fgetline, cookie, getsourceline))
2047 script_line_end();
2048 #endif
2049
2050 /* Check if a sourced file hit a ":finish" command. */
2051- if (source_finished(getline, cookie))
2052+ if (source_finished(fgetline, cookie))
2053 {
2054 retval = FAIL;
2055 break;
2056@@ -954,7 +955,7 @@
2057 && *dbg_tick != debug_tick)
2058 {
2059 *breakpoint = dbg_find_breakpoint(
2060- getline_equal(getline, cookie, getsourceline),
2061+ getline_equal(fgetline, cookie, getsourceline),
2062 fname, sourcing_lnum);
2063 *dbg_tick = debug_tick;
2064 }
2065@@ -969,7 +970,7 @@
2066 dbg_breakpoint(fname, sourcing_lnum);
2067 /* Find next breakpoint. */
2068 *breakpoint = dbg_find_breakpoint(
2069- getline_equal(getline, cookie, getsourceline),
2070+ getline_equal(fgetline, cookie, getsourceline),
2071 fname, sourcing_lnum);
2072 *dbg_tick = debug_tick;
2073 }
2074@@ -978,7 +979,7 @@
2075 {
2076 if (getline_is_func)
2077 func_line_start(real_cookie);
2078- else if (getline_equal(getline, cookie, getsourceline))
2079+ else if (getline_equal(fgetline, cookie, getsourceline))
2080 script_line_start();
2081 }
2082 # endif
2083@@ -987,7 +988,7 @@
2084 if (cstack.cs_looplevel > 0)
2085 {
2086 /* Inside a while/for loop we need to store the lines and use them
2087- * again. Pass a different "getline" function to do_one_cmd()
2088+ * again. Pass a different "fgetline" function to do_one_cmd()
2089 * below, so that it stores lines in or reads them from
2090 * "lines_ga". Makes it possible to define a function inside a
2091 * while/for loop. */
2092@@ -995,27 +996,27 @@
2093 cmd_cookie = (void *)&cmd_loop_cookie;
2094 cmd_loop_cookie.lines_gap = &lines_ga;
2095 cmd_loop_cookie.current_line = current_line;
2096- cmd_loop_cookie.getline = getline;
2097+ cmd_loop_cookie.getline = fgetline;
2098 cmd_loop_cookie.cookie = cookie;
2099 cmd_loop_cookie.repeating = (current_line < lines_ga.ga_len);
2100 }
2101 else
2102 {
2103- cmd_getline = getline;
2104+ cmd_getline = fgetline;
2105 cmd_cookie = cookie;
2106 }
2107 #endif
2108
2109- /* 2. If no line given, get an allocated line with getline(). */
2110+ /* 2. If no line given, get an allocated line with fgetline(). */
2111 if (next_cmdline == NULL)
2112 {
2113 /*
2114 * Need to set msg_didout for the first line after an ":if",
2115 * otherwise the ":if" will be overwritten.
2116 */
2117- if (count == 1 && getline_equal(getline, cookie, getexline))
2118+ if (count == 1 && getline_equal(fgetline, cookie, getexline))
2119 msg_didout = TRUE;
2120- if (getline == NULL || (next_cmdline = getline(':', cookie,
2121+ if (fgetline == NULL || (next_cmdline = fgetline(':', cookie,
2122 #ifdef FEAT_EVAL
2123 cstack.cs_idx < 0 ? 0 : (cstack.cs_idx + 1) * 2
2124 #else
2125@@ -1142,7 +1143,7 @@
2126 * If the command was typed, remember it for the ':' register.
2127 * Do this AFTER executing the command to make :@: work.
2128 */
2129- if (getline_equal(getline, cookie, getexline)
2130+ if (getline_equal(fgetline, cookie, getexline)
2131 && new_last_cmdline != NULL)
2132 {
2133 vim_free(last_cmdline);
2134@@ -1163,7 +1164,7 @@
2135 #ifdef FEAT_EVAL
2136 /* reset did_emsg for a function that is not aborted by an error */
2137 if (did_emsg && !force_abort
2138- && getline_equal(getline, cookie, get_func_line)
2139+ && getline_equal(fgetline, cookie, get_func_line)
2140 && !func_has_abort(real_cookie))
2141 did_emsg = FALSE;
2142
2143@@ -1202,7 +1203,7 @@
2144 if (breakpoint != NULL)
2145 {
2146 *breakpoint = dbg_find_breakpoint(
2147- getline_equal(getline, cookie, getsourceline),
2148+ getline_equal(fgetline, cookie, getsourceline),
2149 fname,
2150 ((wcmd_T *)lines_ga.ga_data)[current_line].lnum-1);
2151 *dbg_tick = debug_tick;
2152@@ -1296,8 +1297,8 @@
2153 #endif
2154 )
2155 && !(did_emsg && used_getline
2156- && (getline_equal(getline, cookie, getexmodeline)
2157- || getline_equal(getline, cookie, getexline)))
2158+ && (getline_equal(fgetline, cookie, getexmodeline)
2159+ || getline_equal(fgetline, cookie, getexline)))
2160 && (next_cmdline != NULL
2161 #ifdef FEAT_EVAL
2162 || cstack.cs_idx >= 0
2163@@ -1316,9 +1317,9 @@
2164 * unclosed conditional.
2165 */
2166 if (!got_int && !did_throw
2167- && ((getline_equal(getline, cookie, getsourceline)
2168- && !source_finished(getline, cookie))
2169- || (getline_equal(getline, cookie, get_func_line)
2170+ && ((getline_equal(fgetline, cookie, getsourceline)
2171+ && !source_finished(fgetline, cookie))
2172+ || (getline_equal(fgetline, cookie, get_func_line)
2173 && !func_has_ended(real_cookie))))
2174 {
2175 if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY)
2176@@ -1354,7 +1355,7 @@
2177 /* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
2178 * lack was reported above and the error message is to be converted to an
2179 * exception, do this now after rewinding the cstack. */
2180- do_errthrow(&cstack, getline_equal(getline, cookie, get_func_line)
2181+ do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line)
2182 ? (char_u *)"endfunction" : (char_u *)NULL);
2183
2184 if (trylevel == 0)
2185@@ -1449,9 +1450,9 @@
2186 */
2187 if (did_throw)
2188 need_rethrow = TRUE;
2189- if ((getline_equal(getline, cookie, getsourceline)
2190+ if ((getline_equal(fgetline, cookie, getsourceline)
2191 && ex_nesting_level > source_level(real_cookie))
2192- || (getline_equal(getline, cookie, get_func_line)
2193+ || (getline_equal(fgetline, cookie, get_func_line)
2194 && ex_nesting_level > func_level(real_cookie) + 1))
2195 {
2196 if (!did_throw)
2197@@ -1460,16 +1461,16 @@
2198 else
2199 {
2200 /* When leaving a function, reduce nesting level. */
2201- if (getline_equal(getline, cookie, get_func_line))
2202+ if (getline_equal(fgetline, cookie, get_func_line))
2203 --ex_nesting_level;
2204 /*
2205 * Go to debug mode when returning from a function in which we are
2206 * single-stepping.
2207 */
2208- if ((getline_equal(getline, cookie, getsourceline)
2209- || getline_equal(getline, cookie, get_func_line))
2210+ if ((getline_equal(fgetline, cookie, getsourceline)
2211+ || getline_equal(fgetline, cookie, get_func_line))
2212 && ex_nesting_level + 1 <= debug_break_level)
2213- do_debug(getline_equal(getline, cookie, getsourceline)
2214+ do_debug(getline_equal(fgetline, cookie, getsourceline)
2215 ? (char_u *)_("End of sourced file")
2216 : (char_u *)_("End of function"));
2217 }
2218@@ -2871,8 +2872,10 @@
2219 }
2220
2221 #ifdef FEAT_USR_CMDS
2222- /* Look for a user defined command as a last resort */
2223- if (eap->cmdidx == CMD_SIZE && *eap->cmd >= 'A' && *eap->cmd <= 'Z')
2224+ /* Look for a user defined command as a last resort. Let ":Print" be
2225+ * overruled by a user defined command. */
2226+ if ((eap->cmdidx == CMD_SIZE || eap->cmdidx == CMD_Print)
2227+ && *eap->cmd >= 'A' && *eap->cmd <= 'Z')
2228 {
2229 /* User defined commands may contain digits. */
2230 while (ASCII_ISALNUM(*p))
2231@@ -3465,7 +3468,8 @@
2232 case CMD_find:
2233 case CMD_sfind:
2234 case CMD_tabfind:
2235- xp->xp_context = EXPAND_FILES_IN_PATH;
2236+ if (xp->xp_context == EXPAND_FILES)
2237+ xp->xp_context = EXPAND_FILES_IN_PATH;
2238 break;
2239 case CMD_cd:
2240 case CMD_chdir:
2241@@ -4520,12 +4524,14 @@
2242 else /* n == 2 */
2243 {
2244 expand_T xpc;
2245+ int options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH;
2246
2247 ExpandInit(&xpc);
2248 xpc.xp_context = EXPAND_FILES;
2249+ if (p_wic)
2250+ options += WILD_ICASE;
2251 p = ExpandOne(&xpc, eap->arg, NULL,
2252- WILD_LIST_NOTFOUND|WILD_ADD_SLASH,
2253- WILD_EXPAND_FREE);
2254+ options, WILD_EXPAND_FREE);
2255 if (p == NULL)
2256 return FAIL;
2257 }
2258@@ -5587,6 +5593,7 @@
2259 int compl = EXPAND_NOTHING;
2260 char_u *compl_arg = NULL;
2261 int has_attr = (eap->arg[0] == '-');
2262+ int name_len;
2263
2264 p = eap->arg;
2265
2266@@ -5612,6 +5619,7 @@
2267 return;
2268 }
2269 end = p;
2270+ name_len = (int)(end - name);
2271
2272 /* If there is nothing after the name, and no attributes were specified,
2273 * we are listing commands
2274@@ -5626,6 +5634,13 @@
2275 EMSG(_("E183: User defined commands must start with an uppercase letter"));
2276 return;
2277 }
2278+ else if ((name_len == 1 && *name == 'X')
2279+ || (name_len <= 4
2280+ && STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0))
2281+ {
2282+ EMSG(_("E841: Reserved name, cannot be used for user defined command"));
2283+ return;
2284+ }
2285 else
2286 uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
2287 eap->forceit);
2288@@ -6897,9 +6912,7 @@
2289 # ifdef FEAT_WINDOWS
2290 if (win_split(0, 0) == FAIL)
2291 return;
2292-# ifdef FEAT_SCROLLBIND
2293- curwin->w_p_scb = FALSE;
2294-# endif
2295+ RESET_BINDING(curwin);
2296
2297 /* When splitting the window, create a new alist. Otherwise the
2298 * existing one is overwritten. */
2299@@ -7299,7 +7312,9 @@
2300 || cmdmod.browse
2301 # endif
2302 )
2303- curwin->w_p_scb = FALSE;
2304+ {
2305+ RESET_BINDING(curwin);
2306+ }
2307 else
2308 do_check_scrollbind(FALSE);
2309 # endif
2310@@ -9393,7 +9408,7 @@
2311 ex_ptag(eap)
2312 exarg_T *eap;
2313 {
2314- g_do_tagpreview = p_pvh;
2315+ g_do_tagpreview = p_pvh; /* will be reset to 0 in ex_tag_cmd() */
2316 ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
2317 }
2318
2319@@ -9525,17 +9540,23 @@
2320 #define SPEC_CFILE 4
2321 "<sfile>", /* ":so" file name */
2322 #define SPEC_SFILE 5
2323+ "<slnum>", /* ":so" file line number */
2324+#define SPEC_SLNUM 6
2325 #ifdef FEAT_AUTOCMD
2326 "<afile>", /* autocommand file name */
2327-# define SPEC_AFILE 6
2328+# define SPEC_AFILE 7
2329 "<abuf>", /* autocommand buffer number */
2330-# define SPEC_ABUF 7
2331+# define SPEC_ABUF 8
2332 "<amatch>", /* autocommand match name */
2333-# define SPEC_AMATCH 8
2334+# define SPEC_AMATCH 9
2335 #endif
2336 #ifdef FEAT_CLIENTSERVER
2337 "<client>"
2338-# define SPEC_CLIENT 9
2339+# ifdef FEAT_AUTOCMD
2340+# define SPEC_CLIENT 10
2341+# else
2342+# define SPEC_CLIENT 7
2343+# endif
2344 #endif
2345 };
2346
2347@@ -9560,6 +9581,7 @@
2348 * '<cWORD>' to WORD under the cursor
2349 * '<cfile>' to path name under the cursor
2350 * '<sfile>' to sourced file name
2351+ * '<slnum>' to sourced file line number
2352 * '<afile>' to file name for autocommand
2353 * '<abuf>' to buffer number for autocommand
2354 * '<amatch>' to matching name for autocommand
2355@@ -9591,10 +9613,7 @@
2356 #ifdef FEAT_MODIFY_FNAME
2357 int skip_mod = FALSE;
2358 #endif
2359-
2360-#if defined(FEAT_AUTOCMD) || defined(FEAT_CLIENTSERVER)
2361 char_u strbuf[30];
2362-#endif
2363
2364 *errormsg = NULL;
2365 if (escaped != NULL)
2366@@ -9783,6 +9802,15 @@
2367 return NULL;
2368 }
2369 break;
2370+ case SPEC_SLNUM: /* line in file for ":so" command */
2371+ if (sourcing_name == NULL || sourcing_lnum == 0)
2372+ {
2373+ *errormsg = (char_u *)_("E842: no line number to use for \"<slnum>\"");
2374+ return NULL;
2375+ }
2376+ sprintf((char *)strbuf, "%ld", (long)sourcing_lnum);
2377+ result = strbuf;
2378+ break;
2379 #if defined(FEAT_CLIENTSERVER)
2380 case SPEC_CLIENT: /* Source of last submitted input */
2381 sprintf((char *)strbuf, PRINTF_HEX_LONG_U,
2382@@ -10707,7 +10735,7 @@
2383 * Write a file name to the session file.
2384 * Takes care of the "slash" option in 'sessionoptions' and escapes special
2385 * characters.
2386- * Returns FAIL if writing fails.
2387+ * Returns FAIL if writing fails or out of memory.
2388 */
2389 static int
2390 ses_put_fname(fd, name, flagp)
2391@@ -10716,49 +10744,32 @@
2392 unsigned *flagp;
2393 {
2394 char_u *sname;
2395+ char_u *p;
2396 int retval = OK;
2397- int c;
2398
2399 sname = home_replace_save(NULL, name);
2400- if (sname != NULL)
2401- name = sname;
2402- while (*name != NUL)
2403- {
2404-#ifdef FEAT_MBYTE
2405- {
2406- int l;
2407+ if (sname == NULL)
2408+ return FAIL;
2409
2410- if (has_mbyte && (l = (*mb_ptr2len)(name)) > 1)
2411- {
2412- /* copy a multibyte char */
2413- while (--l >= 0)
2414- {
2415- if (putc(*name, fd) != *name)
2416- retval = FAIL;
2417- ++name;
2418- }
2419- continue;
2420- }
2421- }
2422-#endif
2423- c = *name++;
2424- if (c == '\\' && (*flagp & SSOP_SLASH))
2425- /* change a backslash to a forward slash */
2426- c = '/';
2427- else if ((vim_strchr(escape_chars, c) != NULL
2428-#ifdef BACKSLASH_IN_FILENAME
2429- && c != '\\'
2430-#endif
2431- ) || c == '#' || c == '%')
2432- {
2433- /* escape a special character with a backslash */
2434- if (putc('\\', fd) != '\\')
2435- retval = FAIL;
2436- }
2437- if (putc(c, fd) != c)
2438- retval = FAIL;
2439+ if (*flagp & SSOP_SLASH)
2440+ {
2441+ /* change all backslashes to forward slashes */
2442+ for (p = sname; *p != NUL; mb_ptr_adv(p))
2443+ if (*p == '\\')
2444+ *p = '/';
2445 }
2446+
2447+ /* escapse special characters */
2448+ p = vim_strsave_fnameescape(sname, FALSE);
2449 vim_free(sname);
2450+ if (p == NULL)
2451+ return FAIL;
2452+
2453+ /* write the result */
2454+ if (fputs((char *)p, fd) < 0)
2455+ retval = FAIL;
2456+
2457+ vim_free(p);
2458 return retval;
2459 }
2460
2461diff -Naur vim73.orig/src/ex_getln.c vim73/src/ex_getln.c
2462--- vim73.orig/src/ex_getln.c 2010-08-14 11:25:45.000000000 -0400
2463+++ vim73/src/ex_getln.c 2011-01-08 21:01:19.238657508 -0500
2464@@ -688,28 +688,35 @@
2465 p = get_expr_line();
2466 --textlock;
2467 restore_cmdline(&save_ccline);
2468- len = (int)STRLEN(p);
2469
2470- if (p != NULL && realloc_cmdbuff(len + 1) == OK)
2471+ if (p != NULL)
2472 {
2473- ccline.cmdlen = len;
2474- STRCPY(ccline.cmdbuff, p);
2475- vim_free(p);
2476-
2477- /* Restore the cursor or use the position set with
2478- * set_cmdline_pos(). */
2479- if (new_cmdpos > ccline.cmdlen)
2480- ccline.cmdpos = ccline.cmdlen;
2481- else
2482- ccline.cmdpos = new_cmdpos;
2483-
2484- KeyTyped = FALSE; /* Don't do p_wc completion. */
2485- redrawcmd();
2486- goto cmdline_changed;
2487+ len = (int)STRLEN(p);
2488+ if (realloc_cmdbuff(len + 1) == OK)
2489+ {
2490+ ccline.cmdlen = len;
2491+ STRCPY(ccline.cmdbuff, p);
2492+ vim_free(p);
2493+
2494+ /* Restore the cursor or use the position set with
2495+ * set_cmdline_pos(). */
2496+ if (new_cmdpos > ccline.cmdlen)
2497+ ccline.cmdpos = ccline.cmdlen;
2498+ else
2499+ ccline.cmdpos = new_cmdpos;
2500+
2501+ KeyTyped = FALSE; /* Don't do p_wc completion. */
2502+ redrawcmd();
2503+ goto cmdline_changed;
2504+ }
2505 }
2506 }
2507 beep_flush();
2508- c = ESC;
2509+ got_int = FALSE; /* don't abandon the command line */
2510+ did_emsg = FALSE;
2511+ emsg_on_display = FALSE;
2512+ redrawcmd();
2513+ goto cmdline_not_changed;
2514 }
2515 #endif
2516 else
2517@@ -2342,15 +2349,31 @@
2518 windgoto(msg_row, msg_col);
2519 pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
2520
2521- /* we are done when a NL is entered, but not when it comes after a
2522- * backslash */
2523- if (line_ga.ga_len > 0 && pend[-1] == '\n'
2524- && (line_ga.ga_len <= 1 || pend[-2] != '\\'))
2525- {
2526- --line_ga.ga_len;
2527- --pend;
2528- *pend = NUL;
2529- break;
2530+ /* We are done when a NL is entered, but not when it comes after an
2531+ * odd number of backslashes, that results in a NUL. */
2532+ if (line_ga.ga_len > 0 && pend[-1] == '\n')
2533+ {
2534+ int bcount = 0;
2535+
2536+ while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\')
2537+ ++bcount;
2538+
2539+ if (bcount > 0)
2540+ {
2541+ /* Halve the number of backslashes: "\NL" -> "NUL", "\\NL" ->
2542+ * "\NL", etc. */
2543+ line_ga.ga_len -= (bcount + 1) / 2;
2544+ pend -= (bcount + 1) / 2;
2545+ pend[-1] = '\n';
2546+ }
2547+
2548+ if ((bcount & 1) == 0)
2549+ {
2550+ --line_ga.ga_len;
2551+ --pend;
2552+ *pend = NUL;
2553+ break;
2554+ }
2555 }
2556 }
2557
2558@@ -3316,10 +3339,14 @@
2559 p2 = NULL;
2560 else
2561 {
2562+ int use_options = options |
2563+ WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE;
2564+
2565+ if (p_wic)
2566+ use_options += WILD_ICASE;
2567 p2 = ExpandOne(xp, p1,
2568 vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
2569- WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
2570- |options, type);
2571+ use_options, type);
2572 vim_free(p1);
2573 /* longest match: make sure it is not shorter, happens with :help */
2574 if (p2 != NULL && type == WILD_LONGEST)
2575@@ -3405,6 +3432,7 @@
2576 * options = WILD_KEEP_ALL: don't remove 'wildignore' entries
2577 * options = WILD_SILENT: don't print warning messages
2578 * options = WILD_ESCAPE: put backslash before special chars
2579+ * options = WILD_ICASE: ignore case for files
2580 *
2581 * The variables xp->xp_context and xp->xp_backslash must have been set!
2582 */
2583@@ -4338,6 +4366,7 @@
2584 char_u ***matches; /* return: array of pointers to matches */
2585 {
2586 char_u *file_str = NULL;
2587+ int options = WILD_ADD_SLASH|WILD_SILENT;
2588
2589 if (xp->xp_context == EXPAND_UNSUCCESSFUL)
2590 {
2591@@ -4356,9 +4385,11 @@
2592 if (file_str == NULL)
2593 return EXPAND_UNSUCCESSFUL;
2594
2595+ if (p_wic)
2596+ options += WILD_ICASE;
2597+
2598 /* find all files that match the description */
2599- if (ExpandFromContext(xp, file_str, matchcount, matches,
2600- WILD_ADD_SLASH|WILD_SILENT) == FAIL)
2601+ if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL)
2602 {
2603 *matchcount = 0;
2604 *matches = NULL;
2605@@ -4410,7 +4441,7 @@
2606 char_u *pat;
2607 int *num_file;
2608 char_u ***file;
2609- int options;
2610+ int options; /* EW_ flags */
2611 {
2612 #ifdef FEAT_CMDL_COMPL
2613 regmatch_T regmatch;
2614@@ -4464,6 +4495,9 @@
2615 flags |= (EW_FILE | EW_PATH);
2616 else
2617 flags = (flags | EW_DIR) & ~EW_FILE;
2618+ if (options & WILD_ICASE)
2619+ flags |= EW_ICASE;
2620+
2621 /* Expand wildcards, supporting %:h and the like. */
2622 ret = expand_wildcards_eval(&pat, num_file, file, flags);
2623 if (free_pat)
2624@@ -4728,7 +4762,11 @@
2625 || (pat[1] == '.' && vim_ispathsep(pat[2])))))
2626 path = (char_u *)".";
2627 else
2628+ {
2629 path = vim_getenv((char_u *)"PATH", &mustfree);
2630+ if (path == NULL)
2631+ path = (char_u *)"";
2632+ }
2633
2634 /*
2635 * Go over all directories in $PATH. Expand matches in that directory and
2636@@ -6147,9 +6185,7 @@
2637 curwin->w_p_rl = cmdmsg_rl;
2638 cmdmsg_rl = FALSE;
2639 # endif
2640-# ifdef FEAT_SCROLLBIND
2641- curwin->w_p_scb = FALSE;
2642-# endif
2643+ RESET_BINDING(curwin);
2644
2645 # ifdef FEAT_AUTOCMD
2646 /* Do execute autocommands for setting the filetype (load syntax). */
2647diff -Naur vim73.orig/src/fileio.c vim73/src/fileio.c
2648--- vim73.orig/src/fileio.c 2010-08-14 08:20:54.000000000 -0400
2649+++ vim73/src/fileio.c 2011-01-08 21:01:19.374658068 -0500
2650@@ -11,14 +11,6 @@
2651 * fileio.c: read from and write to a file
2652 */
2653
2654-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
2655-# include "vimio.h" /* for lseek(), must be before vim.h */
2656-#endif
2657-
2658-#if defined __EMX__
2659-# include "vimio.h" /* for mktemp(), CJW 1997-12-03 */
2660-#endif
2661-
2662 #include "vim.h"
2663
2664 #if defined(__TANDEM) || defined(__MINT__)
2665@@ -918,7 +910,7 @@
2666 {
2667 /* Read the first line (and a bit more). Immediately rewind to
2668 * the start of the file. If the read() fails "len" is -1. */
2669- len = vim_read(fd, firstline, 80);
2670+ len = read_eintr(fd, firstline, 80);
2671 lseek(fd, (off_t)0L, SEEK_SET);
2672 for (p = firstline; p < firstline + len; ++p)
2673 if (*p >= 0x80)
2674@@ -1373,7 +1365,7 @@
2675 /*
2676 * Read bytes from the file.
2677 */
2678- size = vim_read(fd, ptr, size);
2679+ size = read_eintr(fd, ptr, size);
2680 }
2681
2682 if (size <= 0)
2683@@ -4000,7 +3992,7 @@
2684 #ifdef HAS_BW_FLAGS
2685 write_info.bw_flags = FIO_NOCONVERT;
2686 #endif
2687- while ((write_info.bw_len = vim_read(fd, copybuf,
2688+ while ((write_info.bw_len = read_eintr(fd, copybuf,
2689 BUFSIZE)) > 0)
2690 {
2691 if (buf_write_bytes(&write_info) == FAIL)
2692@@ -4813,7 +4805,7 @@
2693 #ifdef HAS_BW_FLAGS
2694 write_info.bw_flags = FIO_NOCONVERT;
2695 #endif
2696- while ((write_info.bw_len = vim_read(fd, smallbuf,
2697+ while ((write_info.bw_len = read_eintr(fd, smallbuf,
2698 SMBUFSIZE)) > 0)
2699 if (buf_write_bytes(&write_info) == FAIL)
2700 break;
2701@@ -5330,7 +5322,7 @@
2702
2703 /*
2704 * Call write() to write a number of bytes to the file.
2705- * Also handles encryption and 'encoding' conversion.
2706+ * Handles encryption and 'encoding' conversion.
2707 *
2708 * Return FAIL for failure, OK otherwise.
2709 */
2710@@ -5702,16 +5694,8 @@
2711 crypt_encode(buf, len, buf);
2712 #endif
2713
2714- /* Repeat the write(), it may be interrupted by a signal. */
2715- while (len > 0)
2716- {
2717- wlen = vim_write(ip->bw_fd, buf, len);
2718- if (wlen <= 0) /* error! */
2719- return FAIL;
2720- len -= wlen;
2721- buf += wlen;
2722- }
2723- return OK;
2724+ wlen = write_eintr(ip->bw_fd, buf, len);
2725+ return (wlen < len) ? FAIL : OK;
2726 }
2727
2728 #ifdef FEAT_MBYTE
2729@@ -6662,8 +6646,8 @@
2730 return -1;
2731 }
2732
2733- while ((n = vim_read(fd_in, buffer, BUFSIZE)) > 0)
2734- if (vim_write(fd_out, buffer, n) != n)
2735+ while ((n = read_eintr(fd_in, buffer, BUFSIZE)) > 0)
2736+ if (write_eintr(fd_out, buffer, n) != n)
2737 {
2738 errmsg = _("E208: Error writing to \"%s\"");
2739 break;
2740@@ -10304,3 +10288,55 @@
2741 }
2742 return reg_pat;
2743 }
2744+
2745+#if defined(EINTR) || defined(PROTO)
2746+/*
2747+ * Version of read() that retries when interrupted by EINTR (possibly
2748+ * by a SIGWINCH).
2749+ */
2750+ long
2751+read_eintr(fd, buf, bufsize)
2752+ int fd;
2753+ void *buf;
2754+ size_t bufsize;
2755+{
2756+ long ret;
2757+
2758+ for (;;)
2759+ {
2760+ ret = vim_read(fd, buf, bufsize);
2761+ if (ret >= 0 || errno != EINTR)
2762+ break;
2763+ }
2764+ return ret;
2765+}
2766+
2767+/*
2768+ * Version of write() that retries when interrupted by EINTR (possibly
2769+ * by a SIGWINCH).
2770+ */
2771+ long
2772+write_eintr(fd, buf, bufsize)
2773+ int fd;
2774+ void *buf;
2775+ size_t bufsize;
2776+{
2777+ long ret = 0;
2778+ long wlen;
2779+
2780+ /* Repeat the write() so long it didn't fail, other than being interrupted
2781+ * by a signal. */
2782+ while (ret < (long)bufsize)
2783+ {
2784+ wlen = vim_write(fd, (char *)buf + ret, bufsize - ret);
2785+ if (wlen < 0)
2786+ {
2787+ if (errno != EINTR)
2788+ break;
2789+ }
2790+ else
2791+ ret += wlen;
2792+ }
2793+ return ret;
2794+}
2795+#endif
2796diff -Naur vim73.orig/src/getchar.c vim73/src/getchar.c
2797--- vim73.orig/src/getchar.c 2010-08-08 09:00:33.000000000 -0400
2798+++ vim73/src/getchar.c 2011-01-08 21:01:19.462656564 -0500
2799@@ -1506,9 +1506,6 @@
2800 }
2801 }
2802
2803-#define KL_PART_KEY -1 /* keylen value for incomplete key-code */
2804-#define KL_PART_MAP -2 /* keylen value for incomplete mapping */
2805-
2806 /*
2807 * Get the next input character.
2808 * Can return a special key or a multi-byte character.
2809@@ -2171,7 +2168,7 @@
2810 if (!timedout)
2811 {
2812 /* break at a partly match */
2813- keylen = KL_PART_MAP;
2814+ keylen = KEYLEN_PART_MAP;
2815 break;
2816 }
2817 }
2818@@ -2192,7 +2189,7 @@
2819
2820 /* If no partly match found, use the longest full
2821 * match. */
2822- if (keylen != KL_PART_MAP)
2823+ if (keylen != KEYLEN_PART_MAP)
2824 {
2825 mp = mp_match;
2826 keylen = mp_match_len;
2827@@ -2230,7 +2227,7 @@
2828 }
2829 /* Need more chars for partly match. */
2830 if (mlen == typebuf.tb_len)
2831- keylen = KL_PART_KEY;
2832+ keylen = KEYLEN_PART_KEY;
2833 else if (max_mlen < mlen)
2834 /* no match, may have to check for termcode at
2835 * next character */
2836@@ -2238,7 +2235,7 @@
2837 }
2838
2839 if ((mp == NULL || max_mlen >= mp_match_len)
2840- && keylen != KL_PART_MAP)
2841+ && keylen != KEYLEN_PART_MAP)
2842 {
2843 int save_keylen = keylen;
2844
2845@@ -2264,8 +2261,8 @@
2846 /* If no termcode matched but 'pastetoggle'
2847 * matched partially it's like an incomplete key
2848 * sequence. */
2849- if (keylen == 0 && save_keylen == KL_PART_KEY)
2850- keylen = KL_PART_KEY;
2851+ if (keylen == 0 && save_keylen == KEYLEN_PART_KEY)
2852+ keylen = KEYLEN_PART_KEY;
2853
2854 /*
2855 * When getting a partial match, but the last
2856@@ -2302,7 +2299,7 @@
2857 continue;
2858 }
2859 if (*s == NUL) /* need more characters */
2860- keylen = KL_PART_KEY;
2861+ keylen = KEYLEN_PART_KEY;
2862 }
2863 if (keylen >= 0)
2864 #endif
2865@@ -2339,7 +2336,8 @@
2866 if (keylen > 0) /* full matching terminal code */
2867 {
2868 #if defined(FEAT_GUI) && defined(FEAT_MENU)
2869- if (typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
2870+ if (typebuf.tb_len >= 2
2871+ && typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
2872 && typebuf.tb_buf[typebuf.tb_off + 1]
2873 == KS_MENU)
2874 {
2875@@ -2381,7 +2379,7 @@
2876 /* Partial match: get some more characters. When a
2877 * matching mapping was found use that one. */
2878 if (mp == NULL || keylen < 0)
2879- keylen = KL_PART_KEY;
2880+ keylen = KEYLEN_PART_KEY;
2881 else
2882 keylen = mp_match_len;
2883 }
2884@@ -2553,7 +2551,8 @@
2885 #endif
2886 && typebuf.tb_maplen == 0
2887 && (State & INSERT)
2888- && (p_timeout || (keylen == KL_PART_KEY && p_ttimeout))
2889+ && (p_timeout
2890+ || (keylen == KEYLEN_PART_KEY && p_ttimeout))
2891 && (c = inchar(typebuf.tb_buf + typebuf.tb_off
2892 + typebuf.tb_len, 3, 25L,
2893 typebuf.tb_change_cnt)) == 0)
2894@@ -2783,9 +2782,9 @@
2895 ? 0
2896 : ((typebuf.tb_len == 0
2897 || !(p_timeout || (p_ttimeout
2898- && keylen == KL_PART_KEY)))
2899+ && keylen == KEYLEN_PART_KEY)))
2900 ? -1L
2901- : ((keylen == KL_PART_KEY && p_ttm >= 0)
2902+ : ((keylen == KEYLEN_PART_KEY && p_ttm >= 0)
2903 ? p_ttm
2904 : p_tm)), typebuf.tb_change_cnt);
2905
2906@@ -3168,6 +3167,7 @@
2907 int expr = FALSE;
2908 #endif
2909 int noremap;
2910+ char_u *orig_rhs;
2911
2912 keys = arg;
2913 map_table = maphash;
2914@@ -3266,6 +3266,7 @@
2915 }
2916 if (*p != NUL)
2917 *p++ = NUL;
2918+
2919 p = skipwhite(p);
2920 rhs = p;
2921 hasarg = (*rhs != NUL);
2922@@ -3288,6 +3289,7 @@
2923 */
2924 if (haskey)
2925 keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, special);
2926+ orig_rhs = rhs;
2927 if (hasarg)
2928 {
2929 if (STRICMP(rhs, "<nop>") == 0) /* "<Nop>" means nothing */
2930@@ -3298,7 +3300,7 @@
2931
2932 #ifdef FEAT_FKMAP
2933 /*
2934- * when in right-to-left mode and alternate keymap option set,
2935+ * When in right-to-left mode and alternate keymap option set,
2936 * reverse the character flow in the rhs in Farsi.
2937 */
2938 if (p_altkeymap && curwin->w_p_rl)
2939@@ -3556,6 +3558,8 @@
2940 }
2941 vim_free(mp->m_str);
2942 mp->m_str = newstr;
2943+ vim_free(mp->m_orig_str);
2944+ mp->m_orig_str = vim_strsave(orig_rhs);
2945 mp->m_noremap = noremap;
2946 mp->m_silent = silent;
2947 mp->m_mode = mode;
2948@@ -3633,10 +3637,12 @@
2949
2950 mp->m_keys = vim_strsave(keys);
2951 mp->m_str = vim_strsave(rhs);
2952+ mp->m_orig_str = vim_strsave(orig_rhs);
2953 if (mp->m_keys == NULL || mp->m_str == NULL)
2954 {
2955 vim_free(mp->m_keys);
2956 vim_free(mp->m_str);
2957+ vim_free(mp->m_orig_str);
2958 vim_free(mp);
2959 retval = 4; /* no mem */
2960 goto theend;
2961@@ -3682,6 +3688,7 @@
2962 mp = *mpp;
2963 vim_free(mp->m_keys);
2964 vim_free(mp->m_str);
2965+ vim_free(mp->m_orig_str);
2966 *mpp = mp->m_next;
2967 vim_free(mp);
2968 }
2969@@ -3851,12 +3858,57 @@
2970 }
2971 }
2972
2973+/*
2974+ * Return characters to represent the map mode in an allocated string.
2975+ * Returns NULL when out of memory.
2976+ */
2977+ char_u *
2978+map_mode_to_chars(mode)
2979+ int mode;
2980+{
2981+ garray_T mapmode;
2982+
2983+ ga_init2(&mapmode, 1, 7);
2984+
2985+ if ((mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
2986+ ga_append(&mapmode, '!'); /* :map! */
2987+ else if (mode & INSERT)
2988+ ga_append(&mapmode, 'i'); /* :imap */
2989+ else if (mode & LANGMAP)
2990+ ga_append(&mapmode, 'l'); /* :lmap */
2991+ else if (mode & CMDLINE)
2992+ ga_append(&mapmode, 'c'); /* :cmap */
2993+ else if ((mode & (NORMAL + VISUAL + SELECTMODE + OP_PENDING))
2994+ == NORMAL + VISUAL + SELECTMODE + OP_PENDING)
2995+ ga_append(&mapmode, ' '); /* :map */
2996+ else
2997+ {
2998+ if (mode & NORMAL)
2999+ ga_append(&mapmode, 'n'); /* :nmap */
3000+ if (mode & OP_PENDING)
3001+ ga_append(&mapmode, 'o'); /* :omap */
3002+ if ((mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE)
3003+ ga_append(&mapmode, 'v'); /* :vmap */
3004+ else
3005+ {
3006+ if (mode & VISUAL)
3007+ ga_append(&mapmode, 'x'); /* :xmap */
3008+ if (mode & SELECTMODE)
3009+ ga_append(&mapmode, 's'); /* :smap */
3010+ }
3011+ }
3012+
3013+ ga_append(&mapmode, NUL);
3014+ return (char_u *)mapmode.ga_data;
3015+}
3016+
3017 static void
3018 showmap(mp, local)
3019 mapblock_T *mp;
3020 int local; /* TRUE for buffer-local map */
3021 {
3022- int len = 1;
3023+ int len = 1;
3024+ char_u *mapchars;
3025
3026 if (msg_didout || msg_silent != 0)
3027 {
3028@@ -3864,49 +3916,15 @@
3029 if (got_int) /* 'q' typed at MORE prompt */
3030 return;
3031 }
3032- if ((mp->m_mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
3033- msg_putchar('!'); /* :map! */
3034- else if (mp->m_mode & INSERT)
3035- msg_putchar('i'); /* :imap */
3036- else if (mp->m_mode & LANGMAP)
3037- msg_putchar('l'); /* :lmap */
3038- else if (mp->m_mode & CMDLINE)
3039- msg_putchar('c'); /* :cmap */
3040- else if ((mp->m_mode & (NORMAL + VISUAL + SELECTMODE + OP_PENDING))
3041- == NORMAL + VISUAL + SELECTMODE + OP_PENDING)
3042- msg_putchar(' '); /* :map */
3043- else
3044+
3045+ mapchars = map_mode_to_chars(mp->m_mode);
3046+ if (mapchars != NULL)
3047 {
3048- len = 0;
3049- if (mp->m_mode & NORMAL)
3050- {
3051- msg_putchar('n'); /* :nmap */
3052- ++len;
3053- }
3054- if (mp->m_mode & OP_PENDING)
3055- {
3056- msg_putchar('o'); /* :omap */
3057- ++len;
3058- }
3059- if ((mp->m_mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE)
3060- {
3061- msg_putchar('v'); /* :vmap */
3062- ++len;
3063- }
3064- else
3065- {
3066- if (mp->m_mode & VISUAL)
3067- {
3068- msg_putchar('x'); /* :xmap */
3069- ++len;
3070- }
3071- if (mp->m_mode & SELECTMODE)
3072- {
3073- msg_putchar('s'); /* :smap */
3074- ++len;
3075- }
3076- }
3077+ msg_puts(mapchars);
3078+ len = (int)STRLEN(mapchars);
3079+ vim_free(mapchars);
3080 }
3081+
3082 while (++len <= 3)
3083 msg_putchar(' ');
3084
3085@@ -3931,8 +3949,7 @@
3086 msg_putchar(' ');
3087
3088 /* Use FALSE below if we only want things like <Up> to show up as such on
3089- * the rhs, and not M-x etc, TRUE gets both -- webb
3090- */
3091+ * the rhs, and not M-x etc, TRUE gets both -- webb */
3092 if (*mp->m_str == NUL)
3093 msg_puts_attr((char_u *)"<Nop>", hl_attr(HLF_8));
3094 else
3095@@ -4995,19 +5012,21 @@
3096 sourcing_name = save_name;
3097 }
3098
3099-#ifdef FEAT_EVAL
3100+#if defined(FEAT_EVAL) || defined(PROTO)
3101 /*
3102- * Check the string "keys" against the lhs of all mappings
3103- * Return pointer to rhs of mapping (mapblock->m_str)
3104- * NULL otherwise
3105+ * Check the string "keys" against the lhs of all mappings.
3106+ * Return pointer to rhs of mapping (mapblock->m_str).
3107+ * NULL when no mapping found.
3108 */
3109 char_u *
3110-check_map(keys, mode, exact, ign_mod, abbr)
3111+check_map(keys, mode, exact, ign_mod, abbr, mp_ptr, local_ptr)
3112 char_u *keys;
3113 int mode;
3114 int exact; /* require exact match */
3115 int ign_mod; /* ignore preceding modifier */
3116 int abbr; /* do abbreviations */
3117+ mapblock_T **mp_ptr; /* return: pointer to mapblock or NULL */
3118+ int *local_ptr; /* return: buffer-local mapping or NULL */
3119 {
3120 int hash;
3121 int len, minlen;
3122@@ -5062,7 +5081,17 @@
3123 minlen = mp->m_keylen - 3;
3124 }
3125 if (STRNCMP(s, keys, minlen) == 0)
3126+ {
3127+ if (mp_ptr != NULL)
3128+ *mp_ptr = mp;
3129+ if (local_ptr != NULL)
3130+#ifdef FEAT_LOCALMAP
3131+ *local_ptr = local;
3132+#else
3133+ *local_ptr = 0;
3134+#endif
3135 return mp->m_str;
3136+ }
3137 }
3138 }
3139 }
3140diff -Naur vim73.orig/src/globals.h vim73/src/globals.h
3141--- vim73.orig/src/globals.h 2010-07-23 15:20:45.000000000 -0400
3142+++ vim73/src/globals.h 2011-01-08 21:01:19.278656842 -0500
3143@@ -510,8 +510,13 @@
3144 EXTERN VimClipboard clip_plus; /* CLIPBOARD selection in X11 */
3145 # else
3146 # define clip_plus clip_star /* there is only one clipboard */
3147+# define ONE_CLIPBOARD
3148 # endif
3149-EXTERN int clip_unnamed INIT(= FALSE);
3150+
3151+#define CLIP_UNNAMED 1
3152+#define CLIP_UNNAMED_PLUS 2
3153+EXTERN int clip_unnamed INIT(= 0); /* above two values or'ed */
3154+
3155 EXTERN int clip_autoselect INIT(= FALSE);
3156 EXTERN int clip_autoselectml INIT(= FALSE);
3157 EXTERN int clip_html INIT(= FALSE);
3158diff -Naur vim73.orig/src/gui.c vim73/src/gui.c
3159--- vim73.orig/src/gui.c 2010-08-08 09:01:18.000000000 -0400
3160+++ vim73/src/gui.c 2011-01-08 21:01:18.886656411 -0500
3161@@ -105,8 +105,18 @@
3162
3163 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
3164 if (gui.in_use)
3165+ {
3166+# ifdef FEAT_EVAL
3167+ Window x11_window;
3168+ Display *x11_display;
3169+
3170+ if (gui_get_x11_windis(&x11_window, &x11_display) == OK)
3171+ set_vim_var_nr(VV_WINDOWID, (long)x11_window);
3172+# endif
3173+
3174 /* Display error messages in a dialog now. */
3175 display_errors();
3176+ }
3177 #endif
3178
3179 #if defined(MAY_FORK) && !defined(__QNXNTO__)
3180@@ -2352,7 +2362,7 @@
3181 if (draw_sign)
3182 /* Draw the sign on top of the spaces. */
3183 gui_mch_drawsign(gui.row, col, gui.highlight_mask);
3184-# if defined(FEAT_NETBEANS_INTG) && (defined(FEAT_GUI_MOTIF) \
3185+# if defined(FEAT_NETBEANS_INTG) && (defined(FEAT_GUI_X11) \
3186 || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32))
3187 if (multi_sign)
3188 netbeans_draw_multisign_indicator(gui.row);
3189diff -Naur vim73.orig/src/gui_gtk.c vim73/src/gui_gtk.c
3190--- vim73.orig/src/gui_gtk.c 2010-07-20 07:15:22.000000000 -0400
3191+++ vim73/src/gui_gtk.c 2011-01-08 21:01:19.298658878 -0500
3192@@ -1287,6 +1287,9 @@
3193 entry = gtk_entry_new();
3194 gtk_widget_show(entry);
3195
3196+ /* Make Enter work like pressing OK. */
3197+ gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
3198+
3199 text = CONVERT_TO_UTF8(textfield);
3200 gtk_entry_set_text(GTK_ENTRY(entry), (const char *)text);
3201 CONVERT_TO_UTF8_FREE(text);
3202@@ -1795,7 +1798,6 @@
3203 char_u *repl_text;
3204 gboolean direction_down;
3205 SharedFindReplace *sfr;
3206- int rc;
3207
3208 flags = (int)(long)data; /* avoid a lint warning here */
3209
3210@@ -1821,7 +1823,7 @@
3211
3212 repl_text = CONVERT_FROM_UTF8(repl_text);
3213 find_text = CONVERT_FROM_UTF8(find_text);
3214- rc = gui_do_findrepl(flags, find_text, repl_text, direction_down);
3215+ gui_do_findrepl(flags, find_text, repl_text, direction_down);
3216 CONVERT_FROM_UTF8_FREE(repl_text);
3217 CONVERT_FROM_UTF8_FREE(find_text);
3218 }
3219diff -Naur vim73.orig/src/gui_mac.c vim73/src/gui_mac.c
3220--- vim73.orig/src/gui_mac.c 2010-08-14 15:39:54.000000000 -0400
3221+++ vim73/src/gui_mac.c 2011-01-08 21:01:18.766656221 -0500
3222@@ -1480,7 +1480,7 @@
3223 *
3224 * Returns the index inside the menu wher
3225 */
3226- short /* Shoulde we return MenuItemIndex? */
3227+ short /* Should we return MenuItemIndex? */
3228 gui_mac_get_menu_item_index(vimmenu_T *pMenu)
3229 {
3230 short index;
3231@@ -1823,7 +1823,7 @@
3232 p.h += gui.scrollbar_width;
3233 if (gui.which_scrollbars[SBAR_RIGHT])
3234 p.h += gui.scrollbar_width;
3235- /* ideal height is as heigh as we can get */
3236+ /* ideal height is as high as we can get */
3237 p.v = 15 * 1024;
3238
3239 thePart = IsWindowInStandardState(whichWindow, &p, &r)
3240@@ -4481,7 +4481,7 @@
3241 * event arrives. No need to check for input_buf_full because we are
3242 * returning as soon as it contains a single char.
3243 */
3244- /* TODO: reduce wtime accordinly??? */
3245+ /* TODO: reduce wtime accordingly??? */
3246 if (wtime > -1)
3247 sleeppyTick = 60 * wtime / 1000;
3248 else
3249@@ -5723,13 +5723,13 @@
3250 iconDITL = GetResource('DITL', 131);
3251 switch (type)
3252 {
3253- case VIM_GENERIC: useIcon = kNoteIcon;
3254- case VIM_ERROR: useIcon = kStopIcon;
3255- case VIM_WARNING: useIcon = kCautionIcon;
3256- case VIM_INFO: useIcon = kNoteIcon;
3257- case VIM_QUESTION: useIcon = kNoteIcon;
3258- default: useIcon = kStopIcon;
3259- };
3260+ case VIM_GENERIC:
3261+ case VIM_INFO:
3262+ case VIM_QUESTION: useIcon = kNoteIcon; break;
3263+ case VIM_WARNING: useIcon = kCautionIcon; break;
3264+ case VIM_ERROR: useIcon = kStopIcon; break;
3265+ default: useIcon = kStopIcon;
3266+ }
3267 AppendDITL(theDialog, iconDITL, overlayDITL);
3268 ReleaseResource(iconDITL);
3269 GetDialogItem(theDialog, iconItm.idx, &itemType, &itemHandle, &box);
3270@@ -5892,7 +5892,7 @@
3271
3272 return itemHit;
3273 /*
3274- * Usefull thing which could be used
3275+ * Useful thing which could be used
3276 * SetDialogTimeout(): Auto click a button after timeout
3277 * SetDialogTracksCursor() : Get the I-beam cursor over input box
3278 * MoveDialogItem(): Probably better than SetDialogItem
3279@@ -6100,7 +6100,7 @@
3280 #endif
3281
3282 /*
3283- * Transfered from os_mac.c for MacOS X using os_unix.c prep work
3284+ * Transferred from os_mac.c for MacOS X using os_unix.c prep work
3285 */
3286
3287 int
3288@@ -6543,7 +6543,7 @@
3289 static ControlRef dataBrowser = NULL;
3290
3291 // when the tabline is hidden, vim doesn't call update_tabline(). When
3292-// the tabline is shown again, show_tabline() is called before upate_tabline(),
3293+// the tabline is shown again, show_tabline() is called before update_tabline(),
3294 // and because of this, the tab labels and vims internal tabs are out of sync
3295 // for a very short time. to prevent inconsistent state, we store the labels
3296 // of the tabs, not pointers to the tabs (which are invalid for a short time).
3297diff -Naur vim73.orig/src/gui_w32.c vim73/src/gui_w32.c
3298--- vim73.orig/src/gui_w32.c 2010-08-08 09:05:26.000000000 -0400
3299+++ vim73/src/gui_w32.c 2011-01-08 21:01:18.990656516 -0500
3300@@ -289,13 +289,13 @@
3301
3302 #ifdef FEAT_MENU
3303 static UINT s_menu_id = 100;
3304+#endif
3305
3306 /*
3307 * Use the system font for dialogs and tear-off menus. Remove this line to
3308 * use DLG_FONT_NAME.
3309 */
3310-# define USE_SYSMENU_FONT
3311-#endif
3312+#define USE_SYSMENU_FONT
3313
3314 #define VIM_NAME "vim"
3315 #define VIM_CLASS "Vim"
3316@@ -1260,7 +1260,7 @@
3317
3318 /* try and load the user32.dll library and get the entry points for
3319 * multi-monitor-support. */
3320- if ((user32_lib = LoadLibrary("User32.dll")) != NULL)
3321+ if ((user32_lib = vimLoadLib("User32.dll")) != NULL)
3322 {
3323 pMonitorFromWindow = (TMonitorFromWindow)GetProcAddress(user32_lib,
3324 "MonitorFromWindow");
3325@@ -1573,6 +1573,11 @@
3326 # endif
3327 #endif
3328
3329+#ifdef FEAT_EVAL
3330+ /* set the v:windowid variable */
3331+ set_vim_var_nr(VV_WINDOWID, (long)s_hwnd);
3332+#endif
3333+
3334 theend:
3335 /* Display any pending error messages */
3336 display_errors();
3337@@ -4188,7 +4193,7 @@
3338 static void
3339 dyn_imm_load(void)
3340 {
3341- hLibImm = LoadLibrary("imm32.dll");
3342+ hLibImm = vimLoadLib("imm32.dll");
3343 if (hLibImm == NULL)
3344 return;
3345
3346diff -Naur vim73.orig/src/gui_w48.c vim73/src/gui_w48.c
3347--- vim73.orig/src/gui_w48.c 2010-07-27 15:46:04.000000000 -0400
3348+++ vim73/src/gui_w48.c 2011-01-08 21:01:18.918658776 -0500
3349@@ -1810,7 +1810,8 @@
3350 * mapped we want to use the mapping instead. */
3351 if (vk == VK_F10
3352 && gui.menu_is_active
3353- && check_map(k10, State, FALSE, TRUE, FALSE) == NULL)
3354+ && check_map(k10, State, FALSE, TRUE, FALSE,
3355+ NULL, NULL) == NULL)
3356 break;
3357 #endif
3358 if (GetKeyState(VK_SHIFT) & 0x8000)
3359@@ -1924,7 +1925,8 @@
3360 /* Check for <F10>: Default effect is to select the menu. When <F10> is
3361 * mapped we need to stop it here to avoid strange effects (e.g., for the
3362 * key-up event) */
3363- if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE) == NULL)
3364+ if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE,
3365+ NULL, NULL) == NULL)
3366 #endif
3367 DispatchMessage(&msg);
3368 }
3369diff -Naur vim73.orig/src/gui_x11.c vim73/src/gui_x11.c
3370--- vim73.orig/src/gui_x11.c 2010-08-08 09:05:45.000000000 -0400
3371+++ vim73/src/gui_x11.c 2011-01-08 21:01:19.178657868 -0500
3372@@ -2895,6 +2895,11 @@
3373 focus = gui.in_focus;
3374 }
3375
3376+#if defined(FEAT_NETBEANS_INTG)
3377+ /* Process any queued netbeans messages. */
3378+ netbeans_parse_messages();
3379+#endif
3380+
3381 /*
3382 * Don't use gui_mch_update() because then we will spin-lock until a
3383 * char arrives, instead we use XtAppProcessEvent() to hang until an
3384diff -Naur vim73.orig/src/if_cscope.c vim73/src/if_cscope.c
3385--- vim73.orig/src/if_cscope.c 2010-07-25 10:32:31.000000000 -0400
3386+++ vim73/src/if_cscope.c 2011-01-08 21:01:19.458660505 -0500
3387@@ -13,16 +13,11 @@
3388
3389 #if defined(FEAT_CSCOPE) || defined(PROTO)
3390
3391-#include <string.h>
3392-#include <errno.h>
3393 #include <assert.h>
3394 #include <sys/types.h>
3395 #include <sys/stat.h>
3396 #if defined(UNIX)
3397 # include <sys/wait.h>
3398-#else
3399- /* not UNIX, must be WIN32 */
3400-# include "vimio.h"
3401 #endif
3402 #include "if_cscope.h"
3403
3404@@ -1274,9 +1269,7 @@
3405 {
3406 win_split(postponed_split > 0 ? postponed_split : 0,
3407 postponed_split_flags);
3408-# ifdef FEAT_SCROLLBIND
3409- curwin->w_p_scb = FALSE;
3410-# endif
3411+ RESET_BINDING(curwin);
3412 postponed_split = 0;
3413 }
3414 # endif
3415@@ -1353,7 +1346,7 @@
3416 " g: Find this definition\n"
3417 " i: Find files #including this file\n"
3418 " s: Find this C symbol\n"
3419- " t: Find assignments to\n"));
3420+ " t: Find this text string\n"));
3421
3422 cmdp++;
3423 }
3424@@ -1664,7 +1657,7 @@
3425 /*
3426 * PRIVATE: cs_make_vim_style_matches
3427 *
3428- * convert the cscope output into into a ctags style entry (as might be found
3429+ * convert the cscope output into a ctags style entry (as might be found
3430 * in a ctags tags file). there's one catch though: cscope doesn't tell you
3431 * the type of the tag you are looking for. for example, in Darren Hiebert's
3432 * ctags (the one that comes with vim), #define's use a line number to find the
3433diff -Naur vim73.orig/src/if_lua.c vim73/src/if_lua.c
3434--- vim73.orig/src/if_lua.c 2010-08-12 16:12:04.000000000 -0400
3435+++ vim73/src/if_lua.c 2011-01-08 21:01:18.922656581 -0500
3436@@ -49,7 +49,7 @@
3437 # define symbol_from_dll dlsym
3438 # define close_dll dlclose
3439 #else
3440-# define load_dll LoadLibrary
3441+# define load_dll vimLoadLib
3442 # define symbol_from_dll GetProcAddress
3443 # define close_dll FreeLibrary
3444 #endif
3445diff -Naur vim73.orig/src/if_mzsch.c vim73/src/if_mzsch.c
3446--- vim73.orig/src/if_mzsch.c 2010-06-25 23:56:17.000000000 -0400
3447+++ vim73/src/if_mzsch.c 2011-01-08 21:01:19.114655467 -0500
3448@@ -556,8 +556,8 @@
3449
3450 if (hMzGC && hMzSch)
3451 return OK;
3452- hMzSch = LoadLibrary(sch_dll);
3453- hMzGC = LoadLibrary(gc_dll);
3454+ hMzSch = vimLoadLib(sch_dll);
3455+ hMzGC = vimLoadLib(gc_dll);
3456
3457 if (!hMzSch)
3458 {
3459@@ -794,9 +794,16 @@
3460 #endif
3461 }
3462
3463+#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) && defined(USE_THREAD_LOCAL)
3464+static __declspec(thread) void *tls_space;
3465+#endif
3466+
3467 void
3468 mzscheme_main(void)
3469 {
3470+#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) && defined(USE_THREAD_LOCAL)
3471+ scheme_register_tls_space(&tls_space, 0);
3472+#endif
3473 #if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400
3474 /* use trampoline for precise GC in MzScheme >= 4.x */
3475 scheme_main_setup(TRUE, mzscheme_env_main, 0, NULL);
3476diff -Naur vim73.orig/src/if_perl.xs vim73/src/if_perl.xs
3477--- vim73.orig/src/if_perl.xs 2010-07-22 05:33:37.000000000 -0400
3478+++ vim73/src/if_perl.xs 2011-01-08 21:01:18.926655661 -0500
3479@@ -106,7 +106,7 @@
3480 #define close_dll dlclose
3481 #else
3482 #define PERL_PROC FARPROC
3483-#define load_dll LoadLibrary
3484+#define load_dll vimLoadLib
3485 #define symbol_from_dll GetProcAddress
3486 #define close_dll FreeLibrary
3487 #endif
3488diff -Naur vim73.orig/src/if_py_both.h vim73/src/if_py_both.h
3489--- vim73.orig/src/if_py_both.h 2010-08-08 07:06:29.000000000 -0400
3490+++ vim73/src/if_py_both.h 2011-01-08 21:01:18.982656784 -0500
3491@@ -34,6 +34,7 @@
3492 static PyObject *OutputWrite(PyObject *, PyObject *);
3493 static PyObject *OutputWritelines(PyObject *, PyObject *);
3494
3495+/* Function to write a line, points to either msg() or emsg(). */
3496 typedef void (*writefn)(char_u *);
3497 static void writer(writefn fn, char_u *str, PyInt n);
3498
3499@@ -122,52 +123,19 @@
3500 return Py_None;
3501 }
3502
3503-static char_u *buffer = NULL;
3504-static PyInt buffer_len = 0;
3505-static PyInt buffer_size = 0;
3506-
3507+/* Buffer IO, we write one whole line at a time. */
3508+static garray_T io_ga = {0, 0, 1, 80, NULL};
3509 static writefn old_fn = NULL;
3510
3511 static void
3512-buffer_ensure(PyInt n)
3513-{
3514- PyInt new_size;
3515- char_u *new_buffer;
3516-
3517- if (n < buffer_size)
3518- return;
3519-
3520- new_size = buffer_size;
3521- while (new_size < n)
3522- new_size += 80;
3523-
3524- if (new_size != buffer_size)
3525- {
3526- new_buffer = alloc((unsigned)new_size);
3527- if (new_buffer == NULL)
3528- return;
3529-
3530- if (buffer)
3531- {
3532- memcpy(new_buffer, buffer, buffer_len);
3533- vim_free(buffer);
3534- }
3535-
3536- buffer = new_buffer;
3537- buffer_size = new_size;
3538- }
3539-}
3540-
3541- static void
3542 PythonIO_Flush(void)
3543 {
3544- if (old_fn && buffer_len)
3545+ if (old_fn != NULL && io_ga.ga_len > 0)
3546 {
3547- buffer[buffer_len] = 0;
3548- old_fn(buffer);
3549+ ((char_u *)io_ga.ga_data)[io_ga.ga_len] = NUL;
3550+ old_fn((char_u *)io_ga.ga_data);
3551 }
3552-
3553- buffer_len = 0;
3554+ io_ga.ga_len = 0;
3555 }
3556
3557 static void
3558@@ -175,30 +143,34 @@
3559 {
3560 char_u *ptr;
3561
3562- if (fn != old_fn && old_fn != NULL)
3563+ /* Flush when switching output function. */
3564+ if (fn != old_fn)
3565 PythonIO_Flush();
3566-
3567 old_fn = fn;
3568
3569+ /* Write each NL separated line. Text after the last NL is kept for
3570+ * writing later. */
3571 while (n > 0 && (ptr = memchr(str, '\n', n)) != NULL)
3572 {
3573 PyInt len = ptr - str;
3574
3575- buffer_ensure(buffer_len + len + 1);
3576+ if (ga_grow(&io_ga, (int)(len + 1)) == FAIL)
3577+ break;
3578
3579- memcpy(buffer + buffer_len, str, len);
3580- buffer_len += len;
3581- buffer[buffer_len] = 0;
3582- fn(buffer);
3583+ mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)len);
3584+ ((char *)io_ga.ga_data)[io_ga.ga_len + len] = NUL;
3585+ fn((char_u *)io_ga.ga_data);
3586 str = ptr + 1;
3587 n -= len + 1;
3588- buffer_len = 0;
3589+ io_ga.ga_len = 0;
3590 }
3591
3592- /* Put the remaining text into the buffer for later printing */
3593- buffer_ensure(buffer_len + n + 1);
3594- memcpy(buffer + buffer_len, str, n);
3595- buffer_len += n;
3596+ /* Put the remaining text into io_ga for later printing. */
3597+ if (n > 0 && ga_grow(&io_ga, (int)(n + 1)) == OK)
3598+ {
3599+ mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)n);
3600+ io_ga.ga_len += (int)n;
3601+ }
3602 }
3603
3604 /***************/
3605diff -Naur vim73.orig/src/if_python.c vim73/src/if_python.c
3606--- vim73.orig/src/if_python.c 2010-08-13 09:59:41.000000000 -0400
3607+++ vim73/src/if_python.c 2011-01-08 21:01:19.190656939 -0500
3608@@ -102,7 +102,7 @@
3609 # include <dlfcn.h>
3610 # define FARPROC void*
3611 # define HINSTANCE void*
3612-# ifdef PY_NO_RTLD_GLOBAL
3613+# if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)
3614 # define load_dll(n) dlopen((n), RTLD_LAZY)
3615 # else
3616 # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
3617@@ -110,7 +110,7 @@
3618 # define close_dll dlclose
3619 # define symbol_from_dll dlsym
3620 # else
3621-# define load_dll LoadLibrary
3622+# define load_dll vimLoadLib
3623 # define close_dll FreeLibrary
3624 # define symbol_from_dll GetProcAddress
3625 # endif
3626@@ -168,6 +168,7 @@
3627 # define Py_BuildValue dll_Py_BuildValue
3628 # define Py_FindMethod dll_Py_FindMethod
3629 # define Py_InitModule4 dll_Py_InitModule4
3630+# define Py_SetPythonHome dll_Py_SetPythonHome
3631 # define Py_Initialize dll_Py_Initialize
3632 # define Py_Finalize dll_Py_Finalize
3633 # define Py_IsInitialized dll_Py_IsInitialized
3634@@ -226,6 +227,7 @@
3635 static PyObject*(*dll_Py_BuildValue)(char *, ...);
3636 static PyObject*(*dll_Py_FindMethod)(struct PyMethodDef[], PyObject *, char *);
3637 static PyObject*(*dll_Py_InitModule4)(char *, struct PyMethodDef *, char *, PyObject *, int);
3638+static void(*dll_Py_SetPythonHome)(char *home);
3639 static void(*dll_Py_Initialize)(void);
3640 static void(*dll_Py_Finalize)(void);
3641 static int(*dll_Py_IsInitialized)(void);
3642@@ -310,6 +312,7 @@
3643 # else
3644 {"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
3645 # endif
3646+ {"Py_SetPythonHome", (PYTHON_PROC*)&dll_Py_SetPythonHome},
3647 {"Py_Initialize", (PYTHON_PROC*)&dll_Py_Initialize},
3648 {"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize},
3649 {"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized},
3650@@ -349,7 +352,7 @@
3651 {
3652 int i;
3653
3654-#if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON3)
3655+#if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3)
3656 /* Can't have Python and Python3 loaded at the same time.
3657 * It cause a crash, because RTLD_GLOBAL is needed for
3658 * standard C extension libraries of one or both python versions. */
3659@@ -543,6 +546,10 @@
3660 }
3661 #endif
3662
3663+#ifdef PYTHON_HOME
3664+ Py_SetPythonHome(PYTHON_HOME);
3665+#endif
3666+
3667 init_structs();
3668
3669 #if !defined(MACOS) || defined(MACOS_X_UNIX)
3670diff -Naur vim73.orig/src/if_python3.c vim73/src/if_python3.c
3671--- vim73.orig/src/if_python3.c 2010-08-13 09:59:40.000000000 -0400
3672+++ vim73/src/if_python3.c 2011-01-08 21:01:19.190656939 -0500
3673@@ -80,7 +80,7 @@
3674 # include <dlfcn.h>
3675 # define FARPROC void*
3676 # define HINSTANCE void*
3677-# ifdef PY_NO_RTLD_GLOBAL
3678+# if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)
3679 # define load_dll(n) dlopen((n), RTLD_LAZY)
3680 # else
3681 # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
3682@@ -88,7 +88,7 @@
3683 # define close_dll dlclose
3684 # define symbol_from_dll dlsym
3685 # else
3686-# define load_dll LoadLibrary
3687+# define load_dll vimLoadLib
3688 # define close_dll FreeLibrary
3689 # define symbol_from_dll GetProcAddress
3690 # endif
3691@@ -132,6 +132,7 @@
3692 # define PyType_Ready py3_PyType_Ready
3693 #undef Py_BuildValue
3694 # define Py_BuildValue py3_Py_BuildValue
3695+# define Py_SetPythonHome py3_Py_SetPythonHome
3696 # define Py_Initialize py3_Py_Initialize
3697 # define Py_Finalize py3_Py_Finalize
3698 # define Py_IsInitialized py3_Py_IsInitialized
3699@@ -170,6 +171,7 @@
3700 * Pointers for dynamic link
3701 */
3702 static int (*py3_PySys_SetArgv)(int, wchar_t **);
3703+static void (*py3_Py_SetPythonHome)(wchar_t *home);
3704 static void (*py3_Py_Initialize)(void);
3705 static PyObject* (*py3_PyList_New)(Py_ssize_t size);
3706 static PyGILState_STATE (*py3_PyGILState_Ensure)(void);
3707@@ -254,6 +256,7 @@
3708 } py3_funcname_table[] =
3709 {
3710 {"PySys_SetArgv", (PYTHON_PROC*)&py3_PySys_SetArgv},
3711+ {"Py_SetPythonHome", (PYTHON_PROC*)&py3_Py_SetPythonHome},
3712 {"Py_Initialize", (PYTHON_PROC*)&py3_Py_Initialize},
3713 {"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
3714 {"PyList_New", (PYTHON_PROC*)&py3_PyList_New},
3715@@ -336,7 +339,7 @@
3716 int i;
3717 void *ucs_from_string, *ucs_from_string_and_size;
3718
3719-# if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON)
3720+# if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON)
3721 /* Can't have Python and Python3 loaded at the same time.
3722 * It cause a crash, because RTLD_GLOBAL is needed for
3723 * standard C extension libraries of one or both python versions. */
3724@@ -539,6 +542,11 @@
3725
3726 init_structs();
3727
3728+
3729+#ifdef PYTHON3_HOME
3730+ Py_SetPythonHome(PYTHON3_HOME);
3731+#endif
3732+
3733 /* initialise threads */
3734 PyEval_InitThreads();
3735
3736diff -Naur vim73.orig/src/if_ruby.c vim73/src/if_ruby.c
3737--- vim73.orig/src/if_ruby.c 2010-06-30 15:33:12.000000000 -0400
3738+++ vim73/src/if_ruby.c 2011-01-08 21:01:19.442657935 -0500
3739@@ -4,6 +4,7 @@
3740 *
3741 * Ruby interface by Shugo Maeda
3742 * with improvements by SegPhault (Ryan Paul)
3743+ * with improvements by Jon Maken
3744 *
3745 * Do ":help uganda" in Vim to read copying and usage conditions.
3746 * Do ":help credits" in Vim to see a list of people who contributed.
3747@@ -13,6 +14,10 @@
3748 #include <stdio.h>
3749 #include <string.h>
3750
3751+#ifdef HAVE_CONFIG_H
3752+# include "auto/config.h"
3753+#endif
3754+
3755 #ifdef _WIN32
3756 # if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18)
3757 # define NT
3758@@ -26,12 +31,12 @@
3759 # define RUBYEXTERN extern
3760 #endif
3761
3762+#ifdef DYNAMIC_RUBY
3763 /*
3764 * This is tricky. In ruby.h there is (inline) function rb_class_of()
3765 * definition. This function use these variables. But we want function to
3766 * use dll_* variables.
3767 */
3768-#ifdef DYNAMIC_RUBY
3769 # define rb_cFalseClass (*dll_rb_cFalseClass)
3770 # define rb_cFixnum (*dll_rb_cFixnum)
3771 # define rb_cNilClass (*dll_rb_cNilClass)
3772@@ -46,8 +51,23 @@
3773 */
3774 # define RUBY_EXPORT
3775 # endif
3776+
3777+#if !(defined(WIN32) || defined(_WIN64))
3778+# include <dlfcn.h>
3779+# define HINSTANCE void*
3780+# define RUBY_PROC void*
3781+# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
3782+# define symbol_from_dll dlsym
3783+# define close_dll dlclose
3784+#else
3785+# define RUBY_PROC FARPROC
3786+# define load_dll vimLoadLib
3787+# define symbol_from_dll GetProcAddress
3788+# define close_dll FreeLibrary
3789 #endif
3790
3791+#endif /* ifdef DYNAMIC_RUBY */
3792+
3793 /* suggested by Ariya Mizutani */
3794 #if (_MSC_VER == 1200)
3795 # undef _WIN32_WINNT
3796@@ -70,6 +90,7 @@
3797 # include <ruby/encoding.h>
3798 #endif
3799
3800+#undef off_t /* ruby defines off_t as _int64, Mingw uses long */
3801 #undef EXTERN
3802 #undef _
3803
3804@@ -160,28 +181,35 @@
3805 #define rb_lastline_get dll_rb_lastline_get
3806 #define rb_lastline_set dll_rb_lastline_set
3807 #define rb_load_protect dll_rb_load_protect
3808+#ifndef RUBY19_OR_LATER
3809 #define rb_num2long dll_rb_num2long
3810+#endif
3811 #define rb_num2ulong dll_rb_num2ulong
3812 #define rb_obj_alloc dll_rb_obj_alloc
3813 #define rb_obj_as_string dll_rb_obj_as_string
3814 #define rb_obj_id dll_rb_obj_id
3815 #define rb_raise dll_rb_raise
3816-#define rb_str2cstr dll_rb_str2cstr
3817 #define rb_str_cat dll_rb_str_cat
3818 #define rb_str_concat dll_rb_str_concat
3819 #define rb_str_new dll_rb_str_new
3820 #ifdef rb_str_new2
3821 /* Ruby may #define rb_str_new2 to use rb_str_new_cstr. */
3822 # define need_rb_str_new_cstr 1
3823+/* Ruby's headers #define rb_str_new_cstr to make use of GCC's
3824+ * __builtin_constant_p extension. */
3825+# undef rb_str_new_cstr
3826 # define rb_str_new_cstr dll_rb_str_new_cstr
3827 #else
3828 # define rb_str_new2 dll_rb_str_new2
3829 #endif
3830 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3831+# define rb_string_value dll_rb_string_value
3832 # define rb_string_value_ptr dll_rb_string_value_ptr
3833 # define rb_float_new dll_rb_float_new
3834 # define rb_ary_new dll_rb_ary_new
3835 # define rb_ary_push dll_rb_ary_push
3836+#else
3837+# define rb_str2cstr dll_rb_str2cstr
3838 #endif
3839 #ifdef RUBY19_OR_LATER
3840 # define rb_errinfo dll_rb_errinfo
3841@@ -190,9 +218,11 @@
3842 #endif
3843 #define ruby_init dll_ruby_init
3844 #define ruby_init_loadpath dll_ruby_init_loadpath
3845-#define NtInitialize dll_NtInitialize
3846-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3847-# define rb_w32_snprintf dll_rb_w32_snprintf
3848+#ifdef WIN3264
3849+# define NtInitialize dll_NtInitialize
3850+# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3851+# define rb_w32_snprintf dll_rb_w32_snprintf
3852+# endif
3853 #endif
3854
3855 #ifdef RUBY19_OR_LATER
3856@@ -201,7 +231,9 @@
3857 # define rb_enc_find dll_rb_enc_find
3858 # define rb_enc_str_new dll_rb_enc_str_new
3859 # define rb_sprintf dll_rb_sprintf
3860+# define rb_require dll_rb_require
3861 # define ruby_init_stack dll_ruby_init_stack
3862+# define ruby_process_options dll_ruby_process_options
3863 #endif
3864
3865 /*
3866@@ -246,7 +278,11 @@
3867 static VALUE (*dll_rb_obj_as_string) (VALUE);
3868 static VALUE (*dll_rb_obj_id) (VALUE);
3869 static void (*dll_rb_raise) (VALUE, const char*, ...);
3870+#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3871+static VALUE (*dll_rb_string_value) (volatile VALUE*);
3872+#else
3873 static char *(*dll_rb_str2cstr) (VALUE,int*);
3874+#endif
3875 static VALUE (*dll_rb_str_cat) (VALUE, const char*, long);
3876 static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
3877 static VALUE (*dll_rb_str_new) (const char*, long);
3878@@ -263,7 +299,12 @@
3879 #endif
3880 static void (*dll_ruby_init) (void);
3881 static void (*dll_ruby_init_loadpath) (void);
3882+#ifdef WIN3264
3883 static void (*dll_NtInitialize) (int*, char***);
3884+# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3885+static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
3886+# endif
3887+#endif
3888 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3889 static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
3890 static VALUE (*dll_rb_float_new) (double);
3891@@ -273,9 +314,6 @@
3892 #ifdef RUBY19_OR_LATER
3893 static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
3894 #endif
3895-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3896-static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
3897-#endif
3898
3899 #ifdef RUBY19_OR_LATER
3900 static void (*dll_ruby_script) (const char*);
3901@@ -283,7 +321,9 @@
3902 static rb_encoding* (*dll_rb_enc_find) (const char*);
3903 static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
3904 static VALUE (*dll_rb_sprintf) (const char*, ...);
3905+static VALUE (*dll_rb_require) (const char*);
3906 static void (*ruby_init_stack)(VALUE*);
3907+static void* (*ruby_process_options)(int, char**);
3908 #endif
3909
3910 #ifdef RUBY19_OR_LATER
3911@@ -297,12 +337,11 @@
3912 }
3913 #endif
3914
3915-static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
3916+static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */
3917
3918 /*
3919 * Table of name to function pointer of ruby.
3920 */
3921-#define RUBY_PROC FARPROC
3922 static struct
3923 {
3924 char *name;
3925@@ -347,7 +386,11 @@
3926 {"rb_obj_as_string", (RUBY_PROC*)&dll_rb_obj_as_string},
3927 {"rb_obj_id", (RUBY_PROC*)&dll_rb_obj_id},
3928 {"rb_raise", (RUBY_PROC*)&dll_rb_raise},
3929+#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3930+ {"rb_string_value", (RUBY_PROC*)&dll_rb_string_value},
3931+#else
3932 {"rb_str2cstr", (RUBY_PROC*)&dll_rb_str2cstr},
3933+#endif
3934 {"rb_str_cat", (RUBY_PROC*)&dll_rb_str_cat},
3935 {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
3936 {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
3937@@ -363,15 +406,17 @@
3938 #endif
3939 {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
3940 {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
3941+#ifdef WIN3264
3942 {
3943-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
3944+# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
3945 "NtInitialize",
3946-#else
3947+# else
3948 "ruby_sysinit",
3949-#endif
3950+# endif
3951 (RUBY_PROC*)&dll_NtInitialize},
3952-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3953+# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3954 {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
3955+# endif
3956 #endif
3957 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
3958 {"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
3959@@ -386,7 +431,9 @@
3960 {"rb_enc_find", (RUBY_PROC*)&dll_rb_enc_find},
3961 {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new},
3962 {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
3963+ {"rb_require", (RUBY_PROC*)&dll_rb_require},
3964 {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
3965+ {"ruby_process_options", (RUBY_PROC*)&dll_ruby_process_options},
3966 #endif
3967 {"", NULL},
3968 };
3969@@ -399,8 +446,8 @@
3970 {
3971 if (hinstRuby)
3972 {
3973- FreeLibrary(hinstRuby);
3974- hinstRuby = 0;
3975+ close_dll(hinstRuby);
3976+ hinstRuby = NULL;
3977 }
3978 }
3979
3980@@ -416,7 +463,7 @@
3981
3982 if (hinstRuby)
3983 return OK;
3984- hinstRuby = LoadLibrary(libname);
3985+ hinstRuby = load_dll(libname);
3986 if (!hinstRuby)
3987 {
3988 if (verbose)
3989@@ -426,11 +473,11 @@
3990
3991 for (i = 0; ruby_funcname_table[i].ptr; ++i)
3992 {
3993- if (!(*ruby_funcname_table[i].ptr = GetProcAddress(hinstRuby,
3994+ if (!(*ruby_funcname_table[i].ptr = symbol_from_dll(hinstRuby,
3995 ruby_funcname_table[i].name)))
3996 {
3997- FreeLibrary(hinstRuby);
3998- hinstRuby = 0;
3999+ close_dll(hinstRuby);
4000+ hinstRuby = NULL;
4001 if (verbose)
4002 EMSG2(_(e_loadfunc), ruby_funcname_table[i].name);
4003 return FAIL;
4004@@ -539,9 +586,9 @@
4005 if (u_save(eap->line1 - 1, eap->line2 + 1) != OK)
4006 return;
4007 for (i = eap->line1; i <= eap->line2; i++) {
4008- VALUE line, oldline;
4009+ VALUE line;
4010
4011- line = oldline = vim_str2rb_enc_str((char *)ml_get(i));
4012+ line = vim_str2rb_enc_str((char *)ml_get(i));
4013 rb_lastline_set(line);
4014 eval_enc_string_protect((char *) eap->arg, &state);
4015 if (state) {
4016@@ -616,13 +663,16 @@
4017 ruby_init();
4018 }
4019 #ifdef RUBY19_OR_LATER
4020+ {
4021+ int dummy_argc = 2;
4022+ char *dummy_argv[] = {"vim-ruby", "-e0"};
4023+ ruby_process_options(dummy_argc, dummy_argv);
4024+ }
4025 ruby_script("vim-ruby");
4026-#endif
4027+#else
4028 ruby_init_loadpath();
4029- ruby_io_init();
4030-#ifdef RUBY19_OR_LATER
4031- rb_enc_find_index("encdb");
4032 #endif
4033+ ruby_io_init();
4034 ruby_vim_init();
4035 ruby_initialized = 1;
4036 #ifdef DYNAMIC_RUBY
4037@@ -906,15 +956,9 @@
4038
4039 static VALUE get_buffer_line(buf_T *buf, linenr_T n)
4040 {
4041- if (n > 0 && n <= buf->b_ml.ml_line_count)
4042- {
4043- char *line = (char *)ml_get_buf(buf, n, FALSE);
4044- return line ? vim_str2rb_enc_str(line) : Qnil;
4045- }
4046- rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
4047-#ifndef __GNUC__
4048- return Qnil; /* For stop warning */
4049-#endif
4050+ if (n <= 0 || n > buf->b_ml.ml_line_count)
4051+ rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
4052+ return vim_str2rb_enc_str((char *)ml_get_buf(buf, n, FALSE));
4053 }
4054
4055 static VALUE buffer_aref(VALUE self, VALUE num)
4056@@ -953,9 +997,6 @@
4057 else
4058 {
4059 rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
4060-#ifndef __GNUC__
4061- return Qnil; /* For stop warning */
4062-#endif
4063 }
4064 return str;
4065 }
4066@@ -1010,7 +1051,8 @@
4067 long n = NUM2LONG(num);
4068 aco_save_T aco;
4069
4070- if (line == NULL) {
4071+ if (line == NULL)
4072+ {
4073 rb_raise(rb_eIndexError, "NULL line");
4074 }
4075 else if (n >= 0 && n <= buf->b_ml.ml_line_count)
4076@@ -1034,7 +1076,8 @@
4077
4078 update_curbuf(NOT_VALID);
4079 }
4080- else {
4081+ else
4082+ {
4083 rb_raise(rb_eIndexError, "line number %ld out of range", n);
4084 }
4085 return str;
4086diff -Naur vim73.orig/src/if_sniff.c vim73/src/if_sniff.c
4087--- vim73.orig/src/if_sniff.c 2010-05-15 07:04:06.000000000 -0400
4088+++ vim73/src/if_sniff.c 2011-01-08 21:01:19.378657342 -0500
4089@@ -9,7 +9,6 @@
4090
4091 #ifdef WIN32
4092 # include <stdio.h>
4093-# include "vimio.h"
4094 # include <process.h>
4095 # include <string.h>
4096 # include <assert.h>
4097diff -Naur vim73.orig/src/if_tcl.c vim73/src/if_tcl.c
4098--- vim73.orig/src/if_tcl.c 2010-08-08 09:07:25.000000000 -0400
4099+++ vim73/src/if_tcl.c 2011-01-08 21:01:19.434656677 -0500
4100@@ -74,7 +74,6 @@
4101 #endif
4102
4103 #include <tcl.h>
4104-#include <errno.h>
4105 #include <string.h>
4106
4107 typedef struct
4108diff -Naur vim73.orig/src/integration.c vim73/src/integration.c
4109--- vim73.orig/src/integration.c 2010-08-08 09:09:21.000000000 -0400
4110+++ vim73/src/integration.c 2011-01-08 21:01:19.434656677 -0500
4111@@ -33,7 +33,6 @@
4112 #include <sys/un.h>
4113 #endif
4114
4115-#include <errno.h>
4116 #include <sys/types.h>
4117 #include <sys/socket.h>
4118 #include <sys/param.h>
4119diff -Naur vim73.orig/src/link.sh vim73/src/link.sh
4120--- vim73.orig/src/link.sh 2010-07-21 15:43:29.000000000 -0400
4121+++ vim73/src/link.sh 2011-01-08 21:01:19.122658259 -0500
4122@@ -5,7 +5,7 @@
4123 # libraries when they exist, but this doesn't mean they are needed for Vim.
4124 #
4125 # Author: Bram Moolenaar
4126-# Last change: 2006 Sep 26
4127+# Last change: 2010 Nov 03
4128 # License: Public domain
4129 #
4130 # Warning: This fails miserably if the linker doesn't return an error code!
4131@@ -16,11 +16,23 @@
4132 echo "$LINK " >link.cmd
4133 exit_value=0
4134
4135+if test "$LINK_AS_NEEDED" = yes; then
4136+ echo "link.sh: \$LINK_AS_NEEDED set to 'yes': invoking linker directly."
4137+ cat link.cmd
4138+ if sh link.cmd; then
4139+ exit_value=0
4140+ echo "link.sh: Linked fine"
4141+ else
4142+ exit_value=$?
4143+ echo "link.sh: Linking failed"
4144+ fi
4145+else
4146+ if test -f auto/link.sed; then
4147+
4148 #
4149 # If auto/link.sed already exists, use it. We assume a previous run of
4150 # link.sh has found the correct set of libraries.
4151 #
4152-if test -f auto/link.sed; then
4153 echo "link.sh: The file 'auto/link.sed' exists, which is going to be used now."
4154 echo "link.sh: If linking fails, try deleting the auto/link.sed file."
4155 echo "link.sh: If this fails too, try creating an empty auto/link.sed file."
4156@@ -124,6 +136,8 @@
4157 fi
4158 fi
4159
4160+fi
4161+
4162 #
4163 # cleanup
4164 #
4165diff -Naur vim73.orig/src/macros.h vim73/src/macros.h
4166--- vim73.orig/src/macros.h 2010-07-17 15:41:21.000000000 -0400
4167+++ vim73/src/macros.h 2011-01-08 20:59:41.002656834 -0500
4168@@ -285,3 +285,17 @@
4169 #else
4170 # define DO_AUTOCHDIR
4171 #endif
4172+
4173+#if defined(FEAT_SCROLLBIND) && defined(FEAT_CURSORBIND)
4174+# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
4175+#else
4176+# if defined(FEAT_SCROLLBIND)
4177+# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE
4178+# else
4179+# if defined(FEAT_CURSORBIND)
4180+# define RESET_BINDING(wp) (wp)->w_p_crb = FALSE
4181+# else
4182+# define RESET_BINDING(wp)
4183+# endif
4184+# endif
4185+#endif
4186diff -Naur vim73.orig/src/main.c vim73/src/main.c
4187--- vim73.orig/src/main.c 2010-08-08 09:09:55.000000000 -0400
4188+++ vim73/src/main.c 2011-01-08 21:01:19.378657342 -0500
4189@@ -7,10 +7,6 @@
4190 * See README.txt for an overview of the Vim source code.
4191 */
4192
4193-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
4194-# include "vimio.h" /* for close() and dup() */
4195-#endif
4196-
4197 #define EXTERN
4198 #include "vim.h"
4199
4200@@ -940,7 +936,7 @@
4201 if (netbeansArg != NULL && strncmp("-nb", netbeansArg, 3) == 0)
4202 {
4203 # ifdef FEAT_GUI
4204-# if !defined(FEAT_GUI_MOTIF) && !defined(FEAT_GUI_GTK) \
4205+# if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) \
4206 && !defined(FEAT_GUI_W32)
4207 if (gui.in_use)
4208 {
4209@@ -3817,6 +3813,8 @@
4210 /* Check if we have at least one argument. */
4211 if (filec <= 0)
4212 mainerr_arg_missing((char_u *)filev[-1]);
4213+
4214+ /* Temporarily cd to the current directory to handle relative file names. */
4215 if (mch_dirname(cwd, MAXPATHL) != OK)
4216 return NULL;
4217 if ((p = vim_strsave_escaped_ext(cwd,
4218@@ -3858,13 +3856,20 @@
4219 ga_concat(&ga, p);
4220 vim_free(p);
4221 }
4222+ ga_concat(&ga, (char_u *)"|if exists('*inputrestore')|call inputrestore()|endif<CR>");
4223+
4224 /* The :drop commands goes to Insert mode when 'insertmode' is set, use
4225 * CTRL-\ CTRL-N again. */
4226- ga_concat(&ga, (char_u *)"|if exists('*inputrestore')|call inputrestore()|endif<CR>");
4227- ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd -");
4228+ ga_concat(&ga, (char_u *)"<C-\\><C-N>");
4229+
4230+ /* Switch back to the correct current directory (prior to temporary path
4231+ * switch) unless 'autochdir' is set, in which case it will already be
4232+ * correct after the :drop command. */
4233+ ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|cd -|endif<CR>");
4234+
4235 if (sendReply)
4236- ga_concat(&ga, (char_u *)"<CR>:call SetupRemoteReplies()");
4237- ga_concat(&ga, (char_u *)"<CR>:");
4238+ ga_concat(&ga, (char_u *)":call SetupRemoteReplies()<CR>");
4239+ ga_concat(&ga, (char_u *)":");
4240 if (inicmd != NULL)
4241 {
4242 /* Can't use <CR> after "inicmd", because an "startinsert" would cause
4243diff -Naur vim73.orig/src/mbyte.c vim73/src/mbyte.c
4244--- vim73.orig/src/mbyte.c 2010-07-18 09:05:44.000000000 -0400
4245+++ vim73/src/mbyte.c 2011-01-08 21:01:19.006657043 -0500
4246@@ -3124,6 +3124,9 @@
4247 /* If one of the two characters is incomplete return -1. */
4248 if (incomplete || i + utf_byte2len(s2[i]) > n)
4249 return -1;
4250+ /* Don't case-fold illegal bytes or truncated characters. */
4251+ if (utf_ptr2len(s1 + i) < l || utf_ptr2len(s2 + i) < l)
4252+ return -1;
4253 cdiff = utf_fold(utf_ptr2char(s1 + i))
4254 - utf_fold(utf_ptr2char(s2 + i));
4255 if (cdiff != 0)
4256@@ -4159,11 +4162,11 @@
4257 {
4258 if (hIconvDLL != 0 && hMsvcrtDLL != 0)
4259 return TRUE;
4260- hIconvDLL = LoadLibrary(DYNAMIC_ICONV_DLL);
4261+ hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL);
4262 if (hIconvDLL == 0) /* sometimes it's called libiconv.dll */
4263- hIconvDLL = LoadLibrary(DYNAMIC_ICONV_DLL_ALT);
4264+ hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT);
4265 if (hIconvDLL != 0)
4266- hMsvcrtDLL = LoadLibrary(DYNAMIC_MSVCRT_DLL);
4267+ hMsvcrtDLL = vimLoadLib(DYNAMIC_MSVCRT_DLL);
4268 if (hIconvDLL == 0 || hMsvcrtDLL == 0)
4269 {
4270 /* Only give the message when 'verbose' is set, otherwise it might be
4271@@ -5167,16 +5170,16 @@
4272 void
4273 xim_set_preedit()
4274 {
4275- if (xic == NULL)
4276- return;
4277-
4278- xim_set_focus(TRUE);
4279-
4280 XVaNestedList attr_list;
4281 XRectangle spot_area;
4282 XPoint over_spot;
4283 int line_space;
4284
4285+ if (xic == NULL)
4286+ return;
4287+
4288+ xim_set_focus(TRUE);
4289+
4290 if (!xim_has_focus)
4291 {
4292 /* hide XIM cursor */
4293@@ -5554,12 +5557,12 @@
4294 void
4295 xim_set_status_area()
4296 {
4297- if (xic == NULL)
4298- return;
4299-
4300 XVaNestedList preedit_list = 0, status_list = 0, list = 0;
4301 XRectangle pre_area, status_area;
4302
4303+ if (xic == NULL)
4304+ return;
4305+
4306 if (input_style & XIMStatusArea)
4307 {
4308 if (input_style & XIMPreeditArea)
4309diff -Naur vim73.orig/src/memfile.c vim73/src/memfile.c
4310--- vim73.orig/src/memfile.c 2010-06-20 22:59:57.000000000 -0400
4311+++ vim73/src/memfile.c 2011-01-08 21:01:19.378657342 -0500
4312@@ -32,10 +32,6 @@
4313 * file is opened.
4314 */
4315
4316-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
4317-# include "vimio.h" /* for lseek(), must be before vim.h */
4318-#endif
4319-
4320 #include "vim.h"
4321
4322 /*
4323@@ -1049,7 +1045,7 @@
4324 PERROR(_("E294: Seek error in swap file read"));
4325 return FAIL;
4326 }
4327- if ((unsigned)vim_read(mfp->mf_fd, hp->bh_data, size) != size)
4328+ if ((unsigned)read_eintr(mfp->mf_fd, hp->bh_data, size) != size)
4329 {
4330 PERROR(_("E295: Read error in swap file"));
4331 return FAIL;
4332@@ -1168,7 +1164,7 @@
4333 }
4334 #endif
4335
4336- if ((unsigned)vim_write(mfp->mf_fd, data, size) != size)
4337+ if ((unsigned)write_eintr(mfp->mf_fd, data, size) != size)
4338 result = FAIL;
4339
4340 #ifdef FEAT_CRYPT
4341diff -Naur vim73.orig/src/memline.c vim73/src/memline.c
4342--- vim73.orig/src/memline.c 2010-08-08 09:11:46.000000000 -0400
4343+++ vim73/src/memline.c 2011-01-08 21:01:19.434656677 -0500
4344@@ -42,10 +42,6 @@
4345 * mf_get().
4346 */
4347
4348-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
4349-# include "vimio.h" /* for mch_open(), must be before vim.h */
4350-#endif
4351-
4352 #include "vim.h"
4353
4354 #ifndef UNIX /* it's in os_unix.h for Unix */
4355@@ -56,10 +52,6 @@
4356 # include <proto/dos.h> /* for Open() and Close() */
4357 #endif
4358
4359-#ifdef HAVE_ERRNO_H
4360-# include <errno.h>
4361-#endif
4362-
4363 typedef struct block0 ZERO_BL; /* contents of the first block */
4364 typedef struct pointer_block PTR_BL; /* contents of a pointer block */
4365 typedef struct data_block DATA_BL; /* contents of a data block */
4366@@ -582,6 +574,9 @@
4367 idx = ip->ip_index + 1; /* go to next index */
4368 page_count = 1;
4369 }
4370+
4371+ if (error > 0)
4372+ EMSG(_("E843: Error while updating swap file crypt"));
4373 }
4374
4375 mfp->mf_old_key = NULL;
4376@@ -2059,7 +2054,7 @@
4377 fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0);
4378 if (fd >= 0)
4379 {
4380- if (read(fd, (char *)&b0, sizeof(b0)) == sizeof(b0))
4381+ if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0))
4382 {
4383 if (STRNCMP(b0.b0_version, "VIM 3.0", 7) == 0)
4384 {
4385@@ -2384,7 +2379,7 @@
4386 * Make a copy of the line if necessary.
4387 */
4388 /*
4389- * get a pointer to a (read-only copy of a) line
4390+ * Return a pointer to a (read-only copy of a) line.
4391 *
4392 * On failure an error message is given and IObuff is returned (to avoid
4393 * having to check for error everywhere).
4394@@ -2397,7 +2392,7 @@
4395 }
4396
4397 /*
4398- * ml_get_pos: get pointer to position 'pos'
4399+ * Return pointer to position "pos".
4400 */
4401 char_u *
4402 ml_get_pos(pos)
4403@@ -2407,7 +2402,7 @@
4404 }
4405
4406 /*
4407- * ml_get_curline: get pointer to cursor line.
4408+ * Return pointer to cursor line.
4409 */
4410 char_u *
4411 ml_get_curline()
4412@@ -2416,7 +2411,7 @@
4413 }
4414
4415 /*
4416- * ml_get_cursor: get pointer to cursor position
4417+ * Return pointer to cursor position.
4418 */
4419 char_u *
4420 ml_get_cursor()
4421@@ -2426,7 +2421,7 @@
4422 }
4423
4424 /*
4425- * get a pointer to a line in a specific buffer
4426+ * Return a pointer to a line in a specific buffer
4427 *
4428 * "will_change": if TRUE mark the buffer dirty (chars in the line will be
4429 * changed)
4430@@ -4389,7 +4384,7 @@
4431 fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0);
4432 if (fd >= 0)
4433 {
4434- if (read(fd, (char *)&b0, sizeof(b0)) == sizeof(b0))
4435+ if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0))
4436 {
4437 /*
4438 * If the swapfile has the same directory as the
4439diff -Naur vim73.orig/src/menu.c vim73/src/menu.c
4440--- vim73.orig/src/menu.c 2010-07-14 10:49:01.000000000 -0400
4441+++ vim73/src/menu.c 2011-01-08 21:01:19.494656637 -0500
4442@@ -1512,8 +1512,8 @@
4443 {
4444 #ifdef FEAT_MULTI_LANG
4445 if (menu->en_name != NULL
4446- && (menu_namecmp(name,menu->en_name)
4447- || menu_namecmp(name,menu->en_dname)))
4448+ && (menu_namecmp(name, menu->en_name)
4449+ || menu_namecmp(name, menu->en_dname)))
4450 return TRUE;
4451 #endif
4452 return menu_namecmp(name, menu->name) || menu_namecmp(name, menu->dname);
4453@@ -2342,7 +2342,7 @@
4454
4455 while (menu != NULL)
4456 {
4457- if (STRCMP(name, menu->name) == 0 || STRCMP(name, menu->dname) == 0)
4458+ if (menu_name_equal(name, menu))
4459 {
4460 if (menu->children == NULL)
4461 {
4462diff -Naur vim73.orig/src/message.c vim73/src/message.c
4463--- vim73.orig/src/message.c 2010-08-04 14:10:02.000000000 -0400
4464+++ vim73/src/message.c 2011-01-08 21:01:19.510657932 -0500
4465@@ -569,6 +569,10 @@
4466 int severe;
4467 #endif
4468
4469+ /* Skip this if not giving error messages at the moment. */
4470+ if (emsg_not_now())
4471+ return TRUE;
4472+
4473 called_emsg = TRUE;
4474 ex_exitval = 1;
4475
4476@@ -581,10 +585,6 @@
4477 emsg_severe = FALSE;
4478 #endif
4479
4480- /* Skip this if not giving error messages at the moment. */
4481- if (emsg_not_now())
4482- return TRUE;
4483-
4484 if (!emsg_off || vim_strchr(p_debug, 't') != NULL)
4485 {
4486 #ifdef FEAT_EVAL
4487@@ -1477,6 +1477,27 @@
4488 return retval;
4489 }
4490
4491+#if defined(FEAT_EVAL) || defined(PROTO)
4492+/*
4493+ * Return the lhs or rhs of a mapping, with the key codes turned into printable
4494+ * strings, in an allocated string.
4495+ */
4496+ char_u *
4497+str2special_save(str, is_lhs)
4498+ char_u *str;
4499+ int is_lhs; /* TRUE for lhs, FALSE for rhs */
4500+{
4501+ garray_T ga;
4502+ char_u *p = str;
4503+
4504+ ga_init2(&ga, 1, 40);
4505+ while (*p != NUL)
4506+ ga_concat(&ga, str2special(&p, is_lhs));
4507+ ga_append(&ga, NUL);
4508+ return (char_u *)ga.ga_data;
4509+}
4510+#endif
4511+
4512 /*
4513 * Return the printable string for the key codes at "*sp".
4514 * Used for translating the lhs or rhs of a mapping to printable chars.
4515diff -Naur vim73.orig/src/misc1.c vim73/src/misc1.c
4516--- vim73.orig/src/misc1.c 2010-08-15 07:24:05.000000000 -0400
4517+++ vim73/src/misc1.c 2011-01-08 21:01:19.466658112 -0500
4518@@ -3114,10 +3114,11 @@
4519 && (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm)))
4520 continue;
4521
4522- /* found a termcode: adjust length */
4523- if (n > 0)
4524+ if (n == KEYLEN_REMOVED) /* key code removed */
4525+ continue;
4526+ if (n > 0) /* found a termcode: adjust length */
4527 len = n;
4528- if (len == 0) /* nothing typed yet */
4529+ if (len == 0) /* nothing typed yet */
4530 continue;
4531
4532 /* Handle modifier and/or special key code. */
4533@@ -9161,7 +9162,10 @@
4534 #ifdef CASE_INSENSITIVE_FILENAME
4535 regmatch.rm_ic = TRUE; /* Behave like Terminal.app */
4536 #else
4537- regmatch.rm_ic = FALSE; /* Don't ever ignore case */
4538+ if (flags & EW_ICASE)
4539+ regmatch.rm_ic = TRUE; /* 'wildignorecase' set */
4540+ else
4541+ regmatch.rm_ic = FALSE; /* Don't ignore case */
4542 #endif
4543 regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
4544 vim_free(pat);
4545@@ -9317,7 +9321,8 @@
4546 continue; /* it's different when it's shorter */
4547
4548 rival = other_paths[j] + other_path_len - candidate_len;
4549- if (fnamecmp(maybe_unique, rival) == 0)
4550+ if (fnamecmp(maybe_unique, rival) == 0
4551+ && (rival == other_paths[j] || vim_ispathsep(*(rival - 1))))
4552 return FALSE; /* match */
4553 }
4554
4555@@ -9642,7 +9647,7 @@
4556 if (paths == NULL)
4557 return 0;
4558
4559- files = globpath(paths, pattern, 0);
4560+ files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
4561 vim_free(paths);
4562 if (files == NULL)
4563 return 0;
4564diff -Naur vim73.orig/src/misc2.c vim73/src/misc2.c
4565--- vim73.orig/src/misc2.c 2010-08-13 05:14:35.000000000 -0400
4566+++ vim73/src/misc2.c 2011-01-08 21:01:19.302660568 -0500
4567@@ -200,7 +200,6 @@
4568 }
4569 #endif
4570
4571- idx = -1;
4572 ptr = line;
4573 while (col <= wcol && *ptr != NUL)
4574 {
4575@@ -1223,7 +1222,7 @@
4576 #endif
4577
4578 /*
4579- * copy a string into newly allocated memory
4580+ * Copy "string" into newly allocated memory.
4581 */
4582 char_u *
4583 vim_strsave(string)
4584@@ -1239,6 +1238,12 @@
4585 return p;
4586 }
4587
4588+/*
4589+ * Copy up to "len" bytes of "string" into newly allocated memory and
4590+ * terminate with a NUL.
4591+ * The allocated memory always has size "len + 1", also when "string" is
4592+ * shorter.
4593+ */
4594 char_u *
4595 vim_strnsave(string, len)
4596 char_u *string;
4597diff -Naur vim73.orig/src/netbeans.c vim73/src/netbeans.c
4598--- vim73.orig/src/netbeans.c 2010-08-09 16:48:09.000000000 -0400
4599+++ vim73/src/netbeans.c 2011-01-08 21:01:19.498658408 -0500
4600@@ -16,10 +16,6 @@
4601 * See ":help netbeans-protocol" for explanation.
4602 */
4603
4604-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
4605-# include "vimio.h" /* for mch_open(), must be before vim.h */
4606-#endif
4607-
4608 #include "vim.h"
4609
4610 #if defined(FEAT_NETBEANS_INTG) || defined(PROTO)
4611@@ -87,7 +83,7 @@
4612 static void nb_init_graphics __ARGS((void));
4613 static void coloncmd __ARGS((char *cmd, ...));
4614 static void nb_set_curbuf __ARGS((buf_T *buf));
4615-#ifdef FEAT_GUI_MOTIF
4616+#ifdef FEAT_GUI_X11
4617 static void messageFromNetbeans __ARGS((XtPointer, int *, XtInputId *));
4618 #endif
4619 #ifdef FEAT_GUI_GTK
4620@@ -112,7 +108,7 @@
4621 static NBSOCK nbsock = -1; /* socket fd for Netbeans connection */
4622 #define NETBEANS_OPEN (nbsock != -1)
4623
4624-#ifdef FEAT_GUI_MOTIF
4625+#ifdef FEAT_GUI_X11
4626 static XtInputId inputHandler = (XtInputId)NULL; /* Cookie for input */
4627 #endif
4628 #ifdef FEAT_GUI_GTK
4629@@ -135,15 +131,13 @@
4630 static int needupdate = 0;
4631 static int inAtomic = 0;
4632
4633+/*
4634+ * Close the socket and remove the input handlers.
4635+ */
4636 static void
4637-netbeans_close(void)
4638+nb_close_socket(void)
4639 {
4640- if (!NETBEANS_OPEN)
4641- return;
4642-
4643- netbeans_send_disconnect();
4644-
4645-#ifdef FEAT_GUI_MOTIF
4646+#ifdef FEAT_GUI_X11
4647 if (inputHandler != (XtInputId)NULL)
4648 {
4649 XtRemoveInput(inputHandler);
4650@@ -167,13 +161,27 @@
4651 # endif
4652 #endif
4653
4654+ sock_close(nbsock);
4655+ nbsock = -1;
4656+}
4657+
4658+/*
4659+ * Close the connection and cleanup.
4660+ * May be called when nb_close_socket() was called earlier.
4661+ */
4662+ static void
4663+netbeans_close(void)
4664+{
4665+ if (NETBEANS_OPEN)
4666+ {
4667+ netbeans_send_disconnect();
4668+ nb_close_socket();
4669+ }
4670+
4671 #ifdef FEAT_BEVAL
4672 bevalServers &= ~BEVAL_NETBEANS;
4673 #endif
4674
4675- sock_close(nbsock);
4676- nbsock = -1;
4677-
4678 needupdate = 0;
4679 inAtomic = 0;
4680 nb_free();
4681@@ -311,14 +319,9 @@
4682 server.sin_port = htons(port);
4683 if ((host = gethostbyname(hostname)) == NULL)
4684 {
4685- if (mch_access(hostname, R_OK) >= 0)
4686- {
4687- /* DEBUG: input file */
4688- sd = mch_open(hostname, O_RDONLY, 0);
4689- goto theend;
4690- }
4691 nbdebug(("error in gethostbyname() in netbeans_connect()\n"));
4692 PERROR("gethostbyname() in netbeans_connect()");
4693+ sock_close(sd);
4694 goto theend;
4695 }
4696 memcpy((char *)&server.sin_addr, host->h_addr, host->h_length);
4697@@ -368,15 +371,12 @@
4698 || (errno == EINTR)))
4699 {
4700 nbdebug(("retrying...\n"));
4701- sleep(5);
4702- if (!doabort)
4703+ mch_delay(3000L, TRUE);
4704+ ui_breakcheck();
4705+ if (got_int)
4706 {
4707- ui_breakcheck();
4708- if (got_int)
4709- {
4710- errno = EINTR;
4711- break;
4712- }
4713+ errno = EINTR;
4714+ break;
4715 }
4716 if (connect(sd, (struct sockaddr *)&server,
4717 sizeof(server)) == 0)
4718@@ -391,6 +391,7 @@
4719 /* Get here when the server can't be found. */
4720 nbdebug(("Cannot connect to Netbeans #2\n"));
4721 PERROR(_("Cannot connect to Netbeans #2"));
4722+ sock_close(sd);
4723 if (doabort)
4724 getout(1);
4725 goto theend;
4726@@ -401,6 +402,7 @@
4727 {
4728 nbdebug(("Cannot connect to Netbeans\n"));
4729 PERROR(_("Cannot connect to Netbeans"));
4730+ sock_close(sd);
4731 if (doabort)
4732 getout(1);
4733 goto theend;
4734@@ -631,9 +633,7 @@
4735 {
4736 char_u *p;
4737 queue_T *node;
4738-
4739- if (!NETBEANS_OPEN)
4740- return;
4741+ int own_node;
4742
4743 while (head.next != NULL && head.next != &head)
4744 {
4745@@ -672,20 +672,25 @@
4746 *p++ = NUL;
4747 if (*p == NUL)
4748 {
4749+ own_node = TRUE;
4750 head.next = node->next;
4751 node->next->prev = node->prev;
4752 }
4753+ else
4754+ own_node = FALSE;
4755
4756 /* now, parse and execute the commands */
4757 nb_parse_cmd(node->buffer);
4758
4759- if (*p == NUL)
4760+ if (own_node)
4761 {
4762 /* buffer finished, dispose of the node and buffer */
4763 vim_free(node->buffer);
4764 vim_free(node);
4765 }
4766- else
4767+ /* Check that "head" wasn't changed under our fingers, e.g. when a
4768+ * DETACH command was handled. */
4769+ else if (head.next == node)
4770 {
4771 /* more follows, move to the start */
4772 STRMOVE(node->buffer, p);
4773@@ -700,7 +705,7 @@
4774 /*
4775 * Read a command from netbeans.
4776 */
4777-#ifdef FEAT_GUI_MOTIF
4778+#ifdef FEAT_GUI_X11
4779 static void
4780 messageFromNetbeans(XtPointer clientData UNUSED,
4781 int *unused1 UNUSED,
4782@@ -720,15 +725,14 @@
4783 }
4784 #endif
4785
4786+#define DETACH_MSG "DETACH\n"
4787+
4788 void
4789 netbeans_read()
4790 {
4791 static char_u *buf = NULL;
4792 int len = 0;
4793 int readlen = 0;
4794-#if defined(NB_HAS_GUI) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)
4795- static int level = 0;
4796-#endif
4797 #ifdef HAVE_SELECT
4798 struct timeval tval;
4799 fd_set rfds;
4800@@ -744,13 +748,6 @@
4801 return;
4802 }
4803
4804-#if defined(NB_HAS_GUI) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)
4805- /* recursion guard; this will be called from the X event loop at unknown
4806- * moments */
4807- if (NB_HAS_GUI)
4808- ++level;
4809-#endif
4810-
4811 /* Allocate a buffer to read into. */
4812 if (buf == NULL)
4813 {
4814@@ -790,34 +787,32 @@
4815 break; /* did read everything that's available */
4816 }
4817
4818+ /* Reading a socket disconnection (readlen == 0), or a socket error. */
4819 if (readlen <= 0)
4820 {
4821- /* read error or didn't read anything */
4822- netbeans_close();
4823- nbdebug(("messageFromNetbeans: Error in read() from socket\n"));
4824+ /* Queue a "DETACH" netbeans message in the command queue in order to
4825+ * terminate the netbeans session later. Do not end the session here
4826+ * directly as we may be running in the context of a call to
4827+ * netbeans_parse_messages():
4828+ * netbeans_parse_messages
4829+ * -> autocmd triggered while processing the netbeans cmd
4830+ * -> ui_breakcheck
4831+ * -> gui event loop or select loop
4832+ * -> netbeans_read()
4833+ */
4834+ save((char_u *)DETACH_MSG, (int)strlen(DETACH_MSG));
4835+ nb_close_socket();
4836+
4837 if (len < 0)
4838 {
4839 nbdebug(("read from Netbeans socket\n"));
4840 PERROR(_("read from Netbeans socket"));
4841 }
4842- return; /* don't try to parse it */
4843 }
4844
4845-#if defined(NB_HAS_GUI) && !defined(FEAT_GUI_W32)
4846- /* Let the main loop handle messages. */
4847- if (NB_HAS_GUI)
4848- {
4849-# ifdef FEAT_GUI_GTK
4850- if (gtk_main_level() > 0)
4851- gtk_main_quit();
4852-# else
4853- /* Parse the messages now, but avoid recursion. */
4854- if (level == 1)
4855- netbeans_parse_messages();
4856-
4857- --level;
4858-# endif
4859- }
4860+#if defined(NB_HAS_GUI) && defined(FEAT_GUI_GTK)
4861+ if (NB_HAS_GUI && gtk_main_level() > 0)
4862+ gtk_main_quit();
4863 #endif
4864 }
4865
4866@@ -955,7 +950,6 @@
4867 keyQ_T *key_node = keyHead.next;
4868 queue_T *cmd_node = head.next;
4869 nbbuf_T buf;
4870- buf_T *bufp;
4871 int i;
4872
4873 /* free the netbeans buffer list */
4874@@ -964,7 +958,7 @@
4875 buf = buf_list[i];
4876 vim_free(buf.displayname);
4877 vim_free(buf.signmap);
4878- if ((bufp=buf.bufp) != NULL)
4879+ if (buf.bufp != NULL)
4880 {
4881 buf.bufp->b_netbeans_file = FALSE;
4882 buf.bufp->b_was_netbeans_file = FALSE;
4883@@ -1186,6 +1180,10 @@
4884
4885 nbdebug(("REP %d: <none>\n", cmdno));
4886
4887+ /* Avoid printing an annoying error message. */
4888+ if (!NETBEANS_OPEN)
4889+ return;
4890+
4891 sprintf(reply, "%d\n", cmdno);
4892 nb_send(reply, "nb_reply_nil");
4893 }
4894@@ -2773,6 +2771,16 @@
4895 ex_nbstart(eap)
4896 exarg_T *eap;
4897 {
4898+#ifdef FEAT_GUI
4899+# if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) \
4900+ && !defined(FEAT_GUI_W32)
4901+ if (gui.in_use)
4902+ {
4903+ EMSG(_("E838: netbeans is not supported with this GUI"));
4904+ return;
4905+ }
4906+# endif
4907+#endif
4908 netbeans_open((char *)eap->arg, FALSE);
4909 }
4910
4911@@ -2937,7 +2945,7 @@
4912 if (!NB_HAS_GUI || !NETBEANS_OPEN)
4913 return;
4914
4915-# ifdef FEAT_GUI_MOTIF
4916+# ifdef FEAT_GUI_X11
4917 /* tell notifier we are interested in being called
4918 * when there is input on the editor connection socket
4919 */
4920@@ -3027,7 +3035,7 @@
4921 }
4922 }
4923
4924-#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_W32) || defined(PROTO)
4925+#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_W32) || defined(PROTO)
4926 /*
4927 * Tell netbeans that the window was moved or resized.
4928 */
4929@@ -3458,7 +3466,7 @@
4930 return FALSE;
4931 }
4932
4933-#if defined(FEAT_GUI_MOTIF) || defined(PROTO)
4934+#if defined(FEAT_GUI_X11) || defined(PROTO)
4935 /*
4936 * We have multiple signs to draw at the same location. Draw the
4937 * multi-sign indicator instead. This is the Motif version.
4938@@ -3487,7 +3495,7 @@
4939 XDrawPoint(gui.dpy, gui.wid, gui.text_gc, x+3, y++);
4940 XDrawPoint(gui.dpy, gui.wid, gui.text_gc, x+2, y);
4941 }
4942-#endif /* FEAT_GUI_MOTIF */
4943+#endif /* FEAT_GUI_X11 */
4944
4945 #if defined(FEAT_GUI_GTK) && !defined(PROTO)
4946 /*
4947diff -Naur vim73.orig/src/normal.c vim73/src/normal.c
4948--- vim73.orig/src/normal.c 2010-07-31 09:25:19.000000000 -0400
4949+++ vim73/src/normal.c 2011-01-08 21:01:19.390656741 -0500
4950@@ -25,6 +25,9 @@
4951 static int restart_VIsual_select = 0;
4952 #endif
4953
4954+#ifdef FEAT_EVAL
4955+static void set_vcount_ca __ARGS((cmdarg_T *cap, int *set_prevcount));
4956+#endif
4957 static int
4958 # ifdef __BORLANDC__
4959 _RTLENTRYF
4960@@ -648,6 +651,14 @@
4961 dont_scroll = FALSE; /* allow scrolling here */
4962 #endif
4963
4964+#ifdef FEAT_EVAL
4965+ /* Set v:count here, when called from main() and not a stuffed
4966+ * command, so that v:count can be used in an expression mapping
4967+ * when there is no count. */
4968+ if (toplevel && stuff_empty())
4969+ set_vcount_ca(&ca, &set_prevcount);
4970+#endif
4971+
4972 /*
4973 * Get the command character from the user.
4974 */
4975@@ -725,15 +736,7 @@
4976 * command, so that v:count can be used in an expression mapping
4977 * right after the count. */
4978 if (toplevel && stuff_empty())
4979- {
4980- long count = ca.count0;
4981-
4982- /* multiply with ca.opcount the same way as below */
4983- if (ca.opcount != 0)
4984- count = ca.opcount * (count == 0 ? 1 : count);
4985- set_vcount(count, count == 0 ? 1 : count, set_prevcount);
4986- set_prevcount = FALSE; /* only set v:prevcount once */
4987- }
4988+ set_vcount_ca(&ca, &set_prevcount);
4989 #endif
4990 if (ctrl_w)
4991 {
4992@@ -1386,6 +1389,26 @@
4993 opcount = ca.opcount;
4994 }
4995
4996+#ifdef FEAT_EVAL
4997+/*
4998+ * Set v:count and v:count1 according to "cap".
4999+ * Set v:prevcount only when "set_prevcount" is TRUE.
5000+ */
5001+ static void
5002+set_vcount_ca(cap, set_prevcount)
5003+ cmdarg_T *cap;
5004+ int *set_prevcount;
5005+{
5006+ long count = cap->count0;
5007+
5008+ /* multiply with cap->opcount the same way as above */
5009+ if (cap->opcount != 0)
5010+ count = cap->opcount * (count == 0 ? 1 : count);
5011+ set_vcount(count, count == 0 ? 1 : count, *set_prevcount);
5012+ *set_prevcount = FALSE; /* only set v:prevcount once */
5013+}
5014+#endif
5015+
5016 /*
5017 * Handle an operator after visual mode or when the movement is finished
5018 */
5019@@ -5666,8 +5689,13 @@
5020 else if (cmdchar == '#')
5021 aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
5022 else if (tag_cmd)
5023- /* Don't escape spaces and Tabs in a tag with a backslash */
5024- aux_ptr = (char_u *)"\\|\"\n[";
5025+ {
5026+ if (curbuf->b_help)
5027+ /* ":help" handles unescaped argument */
5028+ aux_ptr = (char_u *)"";
5029+ else
5030+ aux_ptr = (char_u *)"\\|\"\n[";
5031+ }
5032 else
5033 aux_ptr = (char_u *)"\\|\"\n*?[";
5034
5035@@ -8524,7 +8552,7 @@
5036 else
5037 curwin->w_curswant = 0;
5038 /* keep curswant at the column where we wanted to go, not where
5039- we ended; differs if line is too short */
5040+ * we ended; differs if line is too short */
5041 curwin->w_set_curswant = FALSE;
5042 }
5043
5044diff -Naur vim73.orig/src/ops.c vim73/src/ops.c
5045--- vim73.orig/src/ops.c 2010-08-01 08:16:08.000000000 -0400
5046+++ vim73/src/ops.c 2011-01-08 21:01:19.314657721 -0500
5047@@ -1584,9 +1584,11 @@
5048 adjust_clip_reg(rp)
5049 int *rp;
5050 {
5051- /* If no reg. specified, and "unnamed" is in 'clipboard', use '*' reg. */
5052- if (*rp == 0 && clip_unnamed)
5053- *rp = '*';
5054+ /* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard',
5055+ * use '*' or '+' reg, respectively. "unnamedplus" prevails. */
5056+ if (*rp == 0 && clip_unnamed != 0)
5057+ *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
5058+ ? '+' : '*';
5059 if (!clip_star.available && *rp == '*')
5060 *rp = 0;
5061 if (!clip_plus.available && *rp == '+')
5062@@ -2842,6 +2844,9 @@
5063 char_u *p;
5064 char_u *pnew;
5065 struct block_def bd;
5066+#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
5067+ int did_star = FALSE;
5068+#endif
5069
5070 /* check for read-only register */
5071 if (oap->regname != 0 && !valid_yank_reg(oap->regname, TRUE))
5072@@ -3115,7 +3120,8 @@
5073 */
5074 if (clip_star.available
5075 && (curr == &(y_regs[STAR_REGISTER])
5076- || (!deleting && oap->regname == 0 && clip_unnamed)))
5077+ || (!deleting && oap->regname == 0
5078+ && (clip_unnamed & CLIP_UNNAMED))))
5079 {
5080 if (curr != &(y_regs[STAR_REGISTER]))
5081 /* Copy the text from register 0 to the clipboard register. */
5082@@ -3123,6 +3129,9 @@
5083
5084 clip_own_selection(&clip_star);
5085 clip_gen_set_selection(&clip_star);
5086+# ifdef FEAT_X11
5087+ did_star = TRUE;
5088+# endif
5089 }
5090
5091 # ifdef FEAT_X11
5092@@ -3130,12 +3139,19 @@
5093 * If we were yanking to the '+' register, send result to selection.
5094 * Also copy to the '*' register, in case auto-select is off.
5095 */
5096- else if (clip_plus.available && curr == &(y_regs[PLUS_REGISTER]))
5097+ if (clip_plus.available
5098+ && (curr == &(y_regs[PLUS_REGISTER])
5099+ || (!deleting && oap->regname == 0
5100+ && (clip_unnamed & CLIP_UNNAMED_PLUS))))
5101 {
5102+ if (curr != &(y_regs[PLUS_REGISTER]))
5103+ /* Copy the text from register 0 to the clipboard register. */
5104+ copy_yank_reg(&(y_regs[PLUS_REGISTER]));
5105+
5106 /* No need to copy to * register upon 'unnamed' now - see below */
5107 clip_own_selection(&clip_plus);
5108 clip_gen_set_selection(&clip_plus);
5109- if (!clip_isautosel())
5110+ if (!clip_isautosel() && !did_star)
5111 {
5112 copy_yank_reg(&(y_regs[STAR_REGISTER]));
5113 clip_own_selection(&clip_star);
5114@@ -3979,7 +3995,12 @@
5115 for (i = -1; i < NUM_REGISTERS && !got_int; ++i)
5116 {
5117 name = get_register_name(i);
5118- if (arg != NULL && vim_strchr(arg, name) == NULL)
5119+ if (arg != NULL && vim_strchr(arg, name) == NULL
5120+#ifdef ONE_CLIPBOARD
5121+ /* Star register and plus register contain the same thing. */
5122+ && (name != '*' || vim_strchr(arg, '+') == NULL)
5123+#endif
5124+ )
5125 continue; /* did not ask for this register */
5126
5127 #ifdef FEAT_CLIPBOARD
5128@@ -4153,9 +4174,10 @@
5129 int save_undo;
5130 {
5131 char_u *curr = NULL;
5132+ char_u *curr_start = NULL;
5133 char_u *cend;
5134 char_u *newp;
5135- char_u *spaces; /* number of spaces inserte before a line */
5136+ char_u *spaces; /* number of spaces inserted before a line */
5137 int endcurr1 = NUL;
5138 int endcurr2 = NUL;
5139 int currsize = 0; /* size of the current line */
5140@@ -4181,7 +4203,7 @@
5141 */
5142 for (t = 0; t < count; ++t)
5143 {
5144- curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
5145+ curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
5146 if (insert_space && t > 0)
5147 {
5148 curr = skipwhite(curr);
5149@@ -4265,10 +4287,10 @@
5150 copy_spaces(cend, (size_t)(spaces[t]));
5151 }
5152 mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t,
5153- (long)(cend - newp + spaces[t]));
5154+ (long)(cend - newp + spaces[t] - (curr - curr_start)));
5155 if (t == 0)
5156 break;
5157- curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1));
5158+ curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1));
5159 if (insert_space && t > 1)
5160 curr = skipwhite(curr);
5161 currsize = (int)STRLEN(curr);
5162diff -Naur vim73.orig/src/option.c vim73/src/option.c
5163--- vim73.orig/src/option.c 2010-08-04 14:49:18.000000000 -0400
5164+++ vim73/src/option.c 2011-01-08 21:01:19.282656400 -0500
5165@@ -2740,7 +2740,7 @@
5166 (char_u *)&p_wc, PV_NONE,
5167 {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
5168 SCRIPTID_INIT},
5169- {"wildcharm", "wcm", P_NUM|P_VI_DEF,
5170+ {"wildcharm", "wcm", P_NUM|P_VI_DEF,
5171 (char_u *)&p_wcm, PV_NONE,
5172 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
5173 {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
5174@@ -2750,6 +2750,9 @@
5175 (char_u *)NULL, PV_NONE,
5176 #endif
5177 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
5178+ {"wildignorecase", "wic", P_BOOL|P_VI_DEF,
5179+ (char_u *)&p_wic, PV_NONE,
5180+ {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
5181 {"wildmenu", "wmnu", P_BOOL|P_VI_DEF,
5182 #ifdef FEAT_WILDMENU
5183 (char_u *)&p_wmnu, PV_NONE,
5184@@ -7304,7 +7307,7 @@
5185 static char_u *
5186 check_clipboard_option()
5187 {
5188- int new_unnamed = FALSE;
5189+ int new_unnamed = 0;
5190 int new_autoselect = FALSE;
5191 int new_autoselectml = FALSE;
5192 int new_html = FALSE;
5193@@ -7316,9 +7319,15 @@
5194 {
5195 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
5196 {
5197- new_unnamed = TRUE;
5198+ new_unnamed |= CLIP_UNNAMED;
5199 p += 7;
5200 }
5201+ else if (STRNCMP(p, "unnamedplus", 11) == 0
5202+ && (p[11] == ',' || p[11] == NUL))
5203+ {
5204+ new_unnamed |= CLIP_UNNAMED_PLUS;
5205+ p += 11;
5206+ }
5207 else if (STRNCMP(p, "autoselect", 10) == 0
5208 && (p[10] == ',' || p[10] == NUL))
5209 {
5210@@ -9756,6 +9765,9 @@
5211 #ifdef FEAT_SCROLLBIND
5212 to->wo_scb = from->wo_scb;
5213 #endif
5214+#ifdef FEAT_CURSORBIND
5215+ to->wo_crb = from->wo_crb;
5216+#endif
5217 #ifdef FEAT_SPELL
5218 to->wo_spell = from->wo_spell;
5219 #endif
5220@@ -10011,7 +10023,7 @@
5221 buf->b_p_smc = p_smc;
5222 #endif
5223 #ifdef FEAT_SPELL
5224- buf->b_s.b_p_spc = vim_strsave(p_spf);
5225+ buf->b_s.b_p_spc = vim_strsave(p_spc);
5226 (void)compile_cap_prog(&buf->b_s);
5227 buf->b_s.b_p_spf = vim_strsave(p_spf);
5228 buf->b_s.b_p_spl = vim_strsave(p_spl);
5229diff -Naur vim73.orig/src/option.h vim73/src/option.h
5230--- vim73.orig/src/option.h 2010-07-25 10:15:02.000000000 -0400
5231+++ vim73/src/option.h 2011-01-08 21:01:19.246657477 -0500
5232@@ -872,6 +872,7 @@
5233 EXTERN char_u *p_ww; /* 'whichwrap' */
5234 EXTERN long p_wc; /* 'wildchar' */
5235 EXTERN long p_wcm; /* 'wildcharm' */
5236+EXTERN long p_wic; /* 'wildignorecase' */
5237 EXTERN char_u *p_wim; /* 'wildmode' */
5238 #ifdef FEAT_WILDMENU
5239 EXTERN int p_wmnu; /* 'wildmenu' */
5240diff -Naur vim73.orig/src/os_macosx.m vim73/src/os_macosx.m
5241--- vim73.orig/src/os_macosx.m 2010-08-15 06:56:50.000000000 -0400
5242+++ vim73/src/os_macosx.m 2011-01-08 21:01:18.806655841 -0500
5243@@ -15,6 +15,10 @@
5244 Error: MACOS 9 is no longer supported in Vim 7
5245 #endif
5246
5247+/* Avoid a conflict for the definition of Boolean between Mac header files and
5248+ * X11 header files. */
5249+#define NO_X11_INCLUDES
5250+
5251 #include "vim.h"
5252 #import <Cocoa/Cocoa.h>
5253
5254diff -Naur vim73.orig/src/os_msdos.c vim73/src/os_msdos.c
5255--- vim73.orig/src/os_msdos.c 2010-05-15 07:04:07.000000000 -0400
5256+++ vim73/src/os_msdos.c 2011-01-08 21:01:19.382657751 -0500
5257@@ -21,7 +21,6 @@
5258 * Some functions are also used for Win16 (MS-Windows 3.1).
5259 */
5260
5261-#include "vimio.h"
5262 #include "vim.h"
5263
5264 #include <conio.h>
5265diff -Naur vim73.orig/src/os_mswin.c vim73/src/os_mswin.c
5266--- vim73.orig/src/os_mswin.c 2010-07-27 15:39:05.000000000 -0400
5267+++ vim73/src/os_mswin.c 2011-01-08 21:01:19.434656677 -0500
5268@@ -22,7 +22,6 @@
5269 # endif
5270 #endif
5271
5272-#include "vimio.h"
5273 #include "vim.h"
5274
5275 #ifdef WIN16
5276@@ -31,7 +30,6 @@
5277 # include <string.h>
5278 #endif
5279 #include <sys/types.h>
5280-#include <errno.h>
5281 #include <signal.h>
5282 #include <limits.h>
5283 #include <process.h>
5284@@ -817,7 +815,11 @@
5285 BOOL fRunTimeLinkSuccess = FALSE;
5286
5287 // Get a handle to the DLL module.
5288+# ifdef WIN16
5289 hinstLib = LoadLibrary(libname);
5290+# else
5291+ hinstLib = vimLoadLib(libname);
5292+# endif
5293
5294 // If the handle is valid, try to get the function address.
5295 if (hinstLib != NULL)
5296diff -Naur vim73.orig/src/os_unix.c vim73/src/os_unix.c
5297--- vim73.orig/src/os_unix.c 2010-08-08 09:14:04.000000000 -0400
5298+++ vim73/src/os_unix.c 2011-01-08 21:01:19.358658475 -0500
5299@@ -1123,6 +1123,30 @@
5300 }
5301 #endif
5302
5303+# if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
5304+static void loose_clipboard __ARGS((void));
5305+
5306+/*
5307+ * Called when Vim is going to sleep or execute a shell command.
5308+ * We can't respond to requests for the X selections. Lose them, otherwise
5309+ * other applications will hang. But first copy the text to cut buffer 0.
5310+ */
5311+ static void
5312+loose_clipboard()
5313+{
5314+ if (clip_star.owned || clip_plus.owned)
5315+ {
5316+ x11_export_final_selection();
5317+ if (clip_star.owned)
5318+ clip_lose_selection(&clip_star);
5319+ if (clip_plus.owned)
5320+ clip_lose_selection(&clip_plus);
5321+ if (x11_display != NULL)
5322+ XFlush(x11_display);
5323+ }
5324+}
5325+#endif
5326+
5327 /*
5328 * If the machine has job control, use it to suspend the program,
5329 * otherwise fake it by starting a new shell.
5330@@ -1137,19 +1161,7 @@
5331 out_flush(); /* needed to disable mouse on some systems */
5332
5333 # if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
5334- /* Since we are going to sleep, we can't respond to requests for the X
5335- * selections. Lose them, otherwise other applications will hang. But
5336- * first copy the text to cut buffer 0. */
5337- if (clip_star.owned || clip_plus.owned)
5338- {
5339- x11_export_final_selection();
5340- if (clip_star.owned)
5341- clip_lose_selection(&clip_star);
5342- if (clip_plus.owned)
5343- clip_lose_selection(&clip_plus);
5344- if (x11_display != NULL)
5345- XFlush(x11_display);
5346- }
5347+ loose_clipboard();
5348 # endif
5349
5350 # if defined(_REENTRANT) && defined(SIGCONT)
5351@@ -1726,6 +1738,11 @@
5352 }
5353 if (x11_window == 0 || x11_display == NULL)
5354 return (result = FAIL);
5355+
5356+# ifdef FEAT_EVAL
5357+ set_vim_var_nr(VV_WINDOWID, (long)x11_window);
5358+# endif
5359+
5360 return (result = OK);
5361 }
5362
5363@@ -3706,6 +3723,10 @@
5364 if (options & SHELL_COOKED)
5365 settmode(TMODE_COOK); /* set to normal mode */
5366
5367+# if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
5368+ loose_clipboard();
5369+# endif
5370+
5371 # ifdef __EMX__
5372 if (cmd == NULL)
5373 x = system(""); /* this starts an interactive shell in emx */
5374@@ -3814,13 +3835,17 @@
5375 # endif
5376 int did_settmode = FALSE; /* settmode(TMODE_RAW) called */
5377
5378+ newcmd = vim_strsave(p_sh);
5379+ if (newcmd == NULL) /* out of memory */
5380+ goto error;
5381+
5382 out_flush();
5383 if (options & SHELL_COOKED)
5384 settmode(TMODE_COOK); /* set to normal mode */
5385
5386- newcmd = vim_strsave(p_sh);
5387- if (newcmd == NULL) /* out of memory */
5388- goto error;
5389+# if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
5390+ loose_clipboard();
5391+# endif
5392
5393 /*
5394 * Do this loop twice:
5395@@ -4148,7 +4173,6 @@
5396 # ifdef FEAT_GUI
5397 if (pty_master_fd >= 0)
5398 {
5399- close(pty_slave_fd); /* close slave side of pty */
5400 fromshell_fd = pty_master_fd;
5401 toshell_fd = dup(pty_master_fd);
5402 }
5403@@ -4430,7 +4454,7 @@
5404 ++noread_cnt;
5405 while (RealWaitForChar(fromshell_fd, 10L, NULL))
5406 {
5407- len = read(fromshell_fd, (char *)buffer
5408+ len = read_eintr(fromshell_fd, buffer
5409 # ifdef FEAT_MBYTE
5410 + buffer_off, (size_t)(BUFLEN - buffer_off)
5411 # else
5412@@ -4617,6 +4641,14 @@
5413 break;
5414 }
5415
5416+# ifdef FEAT_GUI
5417+ /* Close slave side of pty. Only do this after the child has
5418+ * exited, otherwise the child may hang when it tries to write on
5419+ * the pty. */
5420+ if (pty_master_fd >= 0)
5421+ close(pty_slave_fd);
5422+# endif
5423+
5424 /* Make sure the child that writes to the external program is
5425 * dead. */
5426 if (wpid > 0)
5427diff -Naur vim73.orig/src/os_win16.c vim73/src/os_win16.c
5428--- vim73.orig/src/os_win16.c 2010-06-26 00:03:31.000000000 -0400
5429+++ vim73/src/os_win16.c 2011-01-08 21:01:19.434656677 -0500
5430@@ -20,13 +20,11 @@
5431 # pragma warn -obs
5432 #endif
5433
5434-#include "vimio.h"
5435 #include "vim.h"
5436
5437 #include <dos.h>
5438 #include <string.h>
5439 #include <sys/types.h>
5440-#include <errno.h>
5441 #include <signal.h>
5442 #include <limits.h>
5443 #include <process.h>
5444diff -Naur vim73.orig/src/os_win32.c vim73/src/os_win32.c
5445--- vim73.orig/src/os_win32.c 2010-07-14 10:49:36.000000000 -0400
5446+++ vim73/src/os_win32.c 2011-01-08 21:01:19.438656953 -0500
5447@@ -20,7 +20,6 @@
5448 * Roger Knobbe <rogerk@wonderware.com> did the initial port of Vim 3.0.
5449 */
5450
5451-#include "vimio.h"
5452 #include "vim.h"
5453
5454 #ifdef FEAT_MZSCHEME
5455@@ -28,7 +27,6 @@
5456 #endif
5457
5458 #include <sys/types.h>
5459-#include <errno.h>
5460 #include <signal.h>
5461 #include <limits.h>
5462 #include <process.h>
5463@@ -206,42 +204,73 @@
5464 static int suppress_winsize = 1; /* don't fiddle with console */
5465 #endif
5466
5467+static char_u *exe_path = NULL;
5468+
5469 static void
5470 get_exe_name(void)
5471 {
5472- char temp[256];
5473- static int did_set_PATH = FALSE;
5474+ /* Maximum length of $PATH is more than MAXPATHL. 8191 is often mentioned
5475+ * as the maximum length that works (plus a NUL byte). */
5476+#define MAX_ENV_PATH_LEN 8192
5477+ char temp[MAX_ENV_PATH_LEN];
5478+ char_u *p;
5479
5480 if (exe_name == NULL)
5481 {
5482 /* store the name of the executable, may be used for $VIM */
5483- GetModuleFileName(NULL, temp, 255);
5484+ GetModuleFileName(NULL, temp, MAX_ENV_PATH_LEN - 1);
5485 if (*temp != NUL)
5486 exe_name = FullName_save((char_u *)temp, FALSE);
5487 }
5488
5489- if (!did_set_PATH && exe_name != NULL)
5490+ if (exe_path == NULL && exe_name != NULL)
5491 {
5492- char_u *p;
5493- char_u *newpath;
5494-
5495- /* Append our starting directory to $PATH, so that when doing "!xxd"
5496- * it's found in our starting directory. Needed because SearchPath()
5497- * also looks there. */
5498- p = mch_getenv("PATH");
5499- newpath = alloc((unsigned)(STRLEN(p) + STRLEN(exe_name) + 2));
5500- if (newpath != NULL)
5501- {
5502- STRCPY(newpath, p);
5503- STRCAT(newpath, ";");
5504- vim_strncpy(newpath + STRLEN(newpath), exe_name,
5505- gettail_sep(exe_name) - exe_name);
5506- vim_setenv((char_u *)"PATH", newpath);
5507- vim_free(newpath);
5508+ exe_path = vim_strnsave(exe_name,
5509+ (int)(gettail_sep(exe_name) - exe_name));
5510+ if (exe_path != NULL)
5511+ {
5512+ /* Append our starting directory to $PATH, so that when doing
5513+ * "!xxd" it's found in our starting directory. Needed because
5514+ * SearchPath() also looks there. */
5515+ p = mch_getenv("PATH");
5516+ if (p == NULL
5517+ || STRLEN(p) + STRLEN(exe_path) + 2 < MAX_ENV_PATH_LEN)
5518+ {
5519+ if (p == NULL || *p == NUL)
5520+ temp[0] = NUL;
5521+ else
5522+ {
5523+ STRCPY(temp, p);
5524+ STRCAT(temp, ";");
5525+ }
5526+ STRCAT(temp, exe_path);
5527+ vim_setenv((char_u *)"PATH", temp);
5528+ }
5529 }
5530+ }
5531+}
5532+
5533+/*
5534+ * Load library "name".
5535+ */
5536+ HINSTANCE
5537+vimLoadLib(char *name)
5538+{
5539+ HINSTANCE dll = NULL;
5540+ char old_dir[MAXPATHL];
5541
5542- did_set_PATH = TRUE;
5543+ if (exe_path == NULL)
5544+ get_exe_name();
5545+ if (exe_path != NULL && mch_dirname(old_dir, MAXPATHL) == OK)
5546+ {
5547+ /* Change directory to where the executable is, both to make sure we
5548+ * find a .dll there and to avoid looking for a .dll in the current
5549+ * directory. */
5550+ mch_chdir(exe_path);
5551+ dll = LoadLibrary(name);
5552+ mch_chdir(old_dir);
5553 }
5554+ return dll;
5555 }
5556
5557 #if defined(DYNAMIC_GETTEXT) || defined(PROTO)
5558@@ -254,7 +283,7 @@
5559 static char *null_libintl_bindtextdomain(const char *, const char *);
5560 static char *null_libintl_bind_textdomain_codeset(const char *, const char *);
5561
5562-static HINSTANCE hLibintlDLL = 0;
5563+static HINSTANCE hLibintlDLL = NULL;
5564 char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
5565 char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain;
5566 char *(*dyn_libintl_bindtextdomain)(const char *, const char *)
5567@@ -282,26 +311,16 @@
5568 if (hLibintlDLL)
5569 return 1;
5570 /* Load gettext library (libintl.dll) */
5571- hLibintlDLL = LoadLibrary(libname != NULL ? libname : GETTEXT_DLL);
5572+ hLibintlDLL = vimLoadLib(libname != NULL ? libname : GETTEXT_DLL);
5573 if (!hLibintlDLL)
5574 {
5575- char_u dirname[_MAX_PATH];
5576-
5577- /* Try using the path from gvim.exe to find the .dll there. */
5578- get_exe_name();
5579- STRCPY(dirname, exe_name);
5580- STRCPY(gettail(dirname), GETTEXT_DLL);
5581- hLibintlDLL = LoadLibrary((char *)dirname);
5582- if (!hLibintlDLL)
5583+ if (p_verbose > 0)
5584 {
5585- if (p_verbose > 0)
5586- {
5587- verbose_enter();
5588- EMSG2(_(e_loadlib), GETTEXT_DLL);
5589- verbose_leave();
5590- }
5591- return 0;
5592+ verbose_enter();
5593+ EMSG2(_(e_loadlib), GETTEXT_DLL);
5594+ verbose_leave();
5595 }
5596+ return 0;
5597 }
5598 for (i = 0; libintl_entry[i].name != NULL
5599 && libintl_entry[i].ptr != NULL; ++i)
5600@@ -430,7 +449,7 @@
5601 * Seems like a lot of overhead to load/unload ADVAPI32.DLL each
5602 * time we verify security...
5603 */
5604- advapi_lib = LoadLibrary("ADVAPI32.DLL");
5605+ advapi_lib = vimLoadLib("ADVAPI32.DLL");
5606 if (advapi_lib != NULL)
5607 {
5608 pSetNamedSecurityInfo = (PSNSECINFO)GetProcAddress(advapi_lib,
5609@@ -1615,6 +1634,35 @@
5610 return TRUE;
5611 }
5612
5613+#if ((defined(__MINGW32__) || defined (__CYGWIN32__)) && \
5614+ __MSVCRT_VERSION__ >= 0x800) || (defined(_MSC_VER) && _MSC_VER >= 1400)
5615+/*
5616+ * Bad parameter handler.
5617+ *
5618+ * Certain MS CRT functions will intentionally crash when passed invalid
5619+ * parameters to highlight possible security holes. Setting this function as
5620+ * the bad parameter handler will prevent the crash.
5621+ *
5622+ * In debug builds the parameters contain CRT information that might help track
5623+ * down the source of a problem, but in non-debug builds the arguments are all
5624+ * NULL/0. Debug builds will also produce assert dialogs from the CRT, it is
5625+ * worth allowing these to make debugging of issues easier.
5626+ */
5627+ static void
5628+bad_param_handler(const wchar_t *expression,
5629+ const wchar_t *function,
5630+ const wchar_t *file,
5631+ unsigned int line,
5632+ uintptr_t pReserved)
5633+{
5634+}
5635+
5636+# define SET_INVALID_PARAM_HANDLER \
5637+ ((void)_set_invalid_parameter_handler(bad_param_handler))
5638+#else
5639+# define SET_INVALID_PARAM_HANDLER
5640+#endif
5641+
5642 #ifdef FEAT_GUI_W32
5643
5644 /*
5645@@ -1627,6 +1675,9 @@
5646 extern int _fmode;
5647 #endif
5648
5649+ /* Silently handle invalid parameters to CRT functions */
5650+ SET_INVALID_PARAM_HANDLER;
5651+
5652 /* Let critical errors result in a failure, not in a dialog box. Required
5653 * for the timestamp test to work on removed floppies. */
5654 SetErrorMode(SEM_FAILCRITICALERRORS);
5655@@ -2103,6 +2154,9 @@
5656 extern int _fmode;
5657 #endif
5658
5659+ /* Silently handle invalid parameters to CRT functions */
5660+ SET_INVALID_PARAM_HANDLER;
5661+
5662 /* Let critical errors result in a failure, not in a dialog box. Required
5663 * for the timestamp test to work on removed floppies. */
5664 SetErrorMode(SEM_FAILCRITICALERRORS);
5665@@ -2273,12 +2327,14 @@
5666 int len)
5667 {
5668 char szTrueName[_MAX_PATH + 2];
5669+ char szTrueNameTemp[_MAX_PATH + 2];
5670 char *ptrue, *ptruePrev;
5671 char *porig, *porigPrev;
5672 int flen;
5673 WIN32_FIND_DATA fb;
5674 HANDLE hFind;
5675 int c;
5676+ int slen;
5677
5678 flen = (int)STRLEN(name);
5679 if (flen == 0 || flen > _MAX_PATH)
5680@@ -2323,12 +2379,19 @@
5681 }
5682 *ptrue = NUL;
5683
5684+ /* To avoid a slow failure append "\*" when searching a directory,
5685+ * server or network share. */
5686+ STRCPY(szTrueNameTemp, szTrueName);
5687+ slen = (int)strlen(szTrueNameTemp);
5688+ if (*porig == psepc && slen + 2 < _MAX_PATH)
5689+ STRCPY(szTrueNameTemp + slen, "\\*");
5690+
5691 /* Skip "", "." and "..". */
5692 if (ptrue > ptruePrev
5693 && (ptruePrev[0] != '.'
5694 || (ptruePrev[1] != NUL
5695 && (ptruePrev[1] != '.' || ptruePrev[2] != NUL)))
5696- && (hFind = FindFirstFile(szTrueName, &fb))
5697+ && (hFind = FindFirstFile(szTrueNameTemp, &fb))
5698 != INVALID_HANDLE_VALUE)
5699 {
5700 c = *porig;
5701@@ -3120,9 +3183,10 @@
5702 * It's nicer to run a filter command in a minimized window, but in
5703 * Windows 95 this makes the command MUCH slower. We can't do it under
5704 * Win32s either as it stops the synchronous spawn workaround working.
5705+ * Don't activate the window to keep focus on Vim.
5706 */
5707 if ((options & SHELL_DOOUT) && !mch_windows95() && !gui_is_win32s())
5708- si.wShowWindow = SW_SHOWMINIMIZED;
5709+ si.wShowWindow = SW_SHOWMINNOACTIVE;
5710 else
5711 si.wShowWindow = SW_SHOWNORMAL;
5712 si.cbReserved2 = 0;
5713diff -Naur vim73.orig/src/popupmnu.c vim73/src/popupmnu.c
5714--- vim73.orig/src/popupmnu.c 2010-08-08 09:14:58.000000000 -0400
5715+++ vim73/src/popupmnu.c 2011-01-08 21:01:19.046656594 -0500
5716@@ -558,8 +558,11 @@
5717 win_T *curwin_save = curwin;
5718 int res = OK;
5719
5720- /* Open a preview window. 3 lines by default. */
5721+ /* Open a preview window. 3 lines by default. Prefer
5722+ * 'previewheight' if set and smaller. */
5723 g_do_tagpreview = 3;
5724+ if (p_pvh > 0 && p_pvh < g_do_tagpreview)
5725+ g_do_tagpreview = p_pvh;
5726 resized = prepare_tagpreview(FALSE);
5727 g_do_tagpreview = 0;
5728
5729diff -Naur vim73.orig/src/proto/fileio.pro vim73/src/proto/fileio.pro
5730--- vim73.orig/src/proto/fileio.pro 2010-08-15 08:30:28.000000000 -0400
5731+++ vim73/src/proto/fileio.pro 2011-01-08 21:01:19.354659886 -0500
5732@@ -54,4 +54,6 @@
5733 int match_file_pat __ARGS((char_u *pattern, regprog_T *prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs));
5734 int match_file_list __ARGS((char_u *list, char_u *sfname, char_u *ffname));
5735 char_u *file_pat_to_reg_pat __ARGS((char_u *pat, char_u *pat_end, char *allow_dirs, int no_bslash));
5736+long read_eintr __ARGS((int fd, void *buf, size_t bufsize));
5737+long write_eintr __ARGS((int fd, void *buf, size_t bufsize));
5738 /* vim: set ft=c : */
5739diff -Naur vim73.orig/src/proto/getchar.pro vim73/src/proto/getchar.pro
5740--- vim73.orig/src/proto/getchar.pro 2010-08-15 08:30:29.000000000 -0400
5741+++ vim73/src/proto/getchar.pro 2011-01-08 21:01:18.918658776 -0500
5742@@ -51,6 +51,7 @@
5743 int get_map_mode __ARGS((char_u **cmdp, int forceit));
5744 void map_clear __ARGS((char_u *cmdp, char_u *arg, int forceit, int abbr));
5745 void map_clear_int __ARGS((buf_T *buf, int mode, int local, int abbr));
5746+char_u *map_mode_to_chars __ARGS((int mode));
5747 int map_to_exists __ARGS((char_u *str, char_u *modechars, int abbr));
5748 int map_to_exists_mode __ARGS((char_u *rhs, int mode, int abbr));
5749 char_u *set_context_in_map_cmd __ARGS((expand_T *xp, char_u *cmd, char_u *arg, int forceit, int isabbrev, int isunmap, cmdidx_T cmdidx));
5750@@ -61,7 +62,7 @@
5751 int makemap __ARGS((FILE *fd, buf_T *buf));
5752 int put_escstr __ARGS((FILE *fd, char_u *strstart, int what));
5753 void check_map_keycodes __ARGS((void));
5754-char_u *check_map __ARGS((char_u *keys, int mode, int exact, int ign_mod, int abbr));
5755+char_u *check_map __ARGS((char_u *keys, int mode, int exact, int ign_mod, int abbr, mapblock_T **mp_ptr, int *local_ptr));
5756 void init_mappings __ARGS((void));
5757 void add_map __ARGS((char_u *map, int mode));
5758 /* vim: set ft=c : */
5759diff -Naur vim73.orig/src/proto/message.pro vim73/src/proto/message.pro
5760--- vim73.orig/src/proto/message.pro 2010-08-15 08:30:41.000000000 -0400
5761+++ vim73/src/proto/message.pro 2011-01-08 21:01:18.918658776 -0500
5762@@ -33,6 +33,7 @@
5763 int msg_outtrans_len_attr __ARGS((char_u *msgstr, int len, int attr));
5764 void msg_make __ARGS((char_u *arg));
5765 int msg_outtrans_special __ARGS((char_u *strstart, int from));
5766+char_u *str2special_save __ARGS((char_u *str, int is_lhs));
5767 char_u *str2special __ARGS((char_u **sp, int from));
5768 void str2specialbuf __ARGS((char_u *sp, char_u *buf, int len));
5769 void msg_prt_line __ARGS((char_u *s, int list));
5770diff -Naur vim73.orig/src/proto/os_win32.pro vim73/src/proto/os_win32.pro
5771--- vim73.orig/src/proto/os_win32.pro 2010-08-15 08:31:14.000000000 -0400
5772+++ vim73/src/proto/os_win32.pro 2011-01-08 21:01:18.926655661 -0500
5773@@ -1,4 +1,5 @@
5774 /* os_win32.c */
5775+HINSTANCE vimLoadLib __ARGS((char *name));
5776 int dyn_libintl_init __ARGS((char *libname));
5777 void dyn_libintl_end __ARGS((void));
5778 void PlatformId __ARGS((void));
5779diff -Naur vim73.orig/src/quickfix.c vim73/src/quickfix.c
5780--- vim73.orig/src/quickfix.c 2010-08-09 16:12:14.000000000 -0400
5781+++ vim73/src/quickfix.c 2011-01-08 21:01:19.226656888 -0500
5782@@ -1656,9 +1656,7 @@
5783 opened_window = TRUE; /* close it when fail */
5784 p_swb = empty_option; /* don't split again */
5785 swb_flags = 0;
5786-# ifdef FEAT_SCROLLBIND
5787- curwin->w_p_scb = FALSE;
5788-# endif
5789+ RESET_BINDING(curwin);
5790 if (ll_ref != NULL)
5791 {
5792 /* The new window should use the location list from the
5793@@ -2125,6 +2123,7 @@
5794 --qi->qf_lists[idx].qf_count;
5795 }
5796 vim_free(qi->qf_lists[idx].qf_title);
5797+ qi->qf_lists[idx].qf_title = NULL;
5798 }
5799
5800 /*
5801@@ -2333,9 +2332,7 @@
5802 win_goto(lastwin);
5803 if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
5804 return; /* not enough room for window */
5805-#ifdef FEAT_SCROLLBIND
5806- curwin->w_p_scb = FALSE;
5807-#endif
5808+ RESET_BINDING(curwin);
5809
5810 if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
5811 {
5812@@ -2362,6 +2359,7 @@
5813 set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
5814 OPT_LOCAL);
5815 set_option_value((char_u *)"bh", 0L, (char_u *)"wipe", OPT_LOCAL);
5816+ RESET_BINDING(curwin);
5817 #ifdef FEAT_DIFF
5818 curwin->w_p_diff = FALSE;
5819 #endif
5820@@ -3435,6 +3433,7 @@
5821 char_u *fname;
5822 {
5823 buf_T *newbuf;
5824+ buf_T *newbuf_to_wipe = NULL;
5825 int failed = TRUE;
5826 aco_save_T aco;
5827
5828@@ -3471,15 +3470,19 @@
5829 failed = FALSE;
5830 if (curbuf != newbuf)
5831 {
5832- /* Bloody autocommands changed the buffer! */
5833- if (buf_valid(newbuf))
5834- wipe_buffer(newbuf, FALSE);
5835+ /* Bloody autocommands changed the buffer! Can happen when
5836+ * using netrw and editing a remote file. Use the current
5837+ * buffer instead, delete the dummy one after restoring the
5838+ * window stuff. */
5839+ newbuf_to_wipe = newbuf;
5840 newbuf = curbuf;
5841 }
5842 }
5843
5844 /* restore curwin/curbuf and a few other things */
5845 aucmd_restbuf(&aco);
5846+ if (newbuf_to_wipe != NULL && buf_valid(newbuf_to_wipe))
5847+ wipe_buffer(newbuf_to_wipe, FALSE);
5848 }
5849
5850 if (!buf_valid(newbuf))
5851diff -Naur vim73.orig/src/regexp.c vim73/src/regexp.c
5852--- vim73.orig/src/regexp.c 2010-07-12 16:41:48.000000000 -0400
5853+++ vim73/src/regexp.c 2011-01-08 20:59:37.790766680 -0500
5854@@ -3538,6 +3538,7 @@
5855
5856 regline = line;
5857 reglnum = 0;
5858+ reg_toolong = FALSE;
5859
5860 /* Simplest case: Anchored match need be tried only once. */
5861 if (prog->reganch)
5862diff -Naur vim73.orig/src/screen.c vim73/src/screen.c
5863--- vim73.orig/src/screen.c 2010-08-13 09:21:27.000000000 -0400
5864+++ vim73/src/screen.c 2011-01-08 21:01:19.494656637 -0500
5865@@ -2317,7 +2317,7 @@
5866 num = (long)lnum;
5867 else
5868 /* 'relativenumber', don't use negative numbers */
5869- num = (long)abs((int)get_cursor_rel_lnum(wp, lnum));
5870+ num = labs((long)get_cursor_rel_lnum(wp, lnum));
5871
5872 sprintf((char *)buf, "%*ld ", w, num);
5873 #ifdef FEAT_RIGHTLEFT
5874@@ -3405,9 +3405,9 @@
5875 # endif
5876 )
5877 {
5878- int_u text_sign;
5879+ int text_sign;
5880 # ifdef FEAT_SIGN_ICONS
5881- int_u icon_sign;
5882+ int icon_sign;
5883 # endif
5884
5885 /* Draw two cells with the sign value or blank. */
5886@@ -3475,8 +3475,7 @@
5887 num = (long)lnum;
5888 else
5889 /* 'relativenumber', don't use negative numbers */
5890- num = (long)abs((int)get_cursor_rel_lnum(wp,
5891- lnum));
5892+ num = labs((long)get_cursor_rel_lnum(wp, lnum));
5893
5894 sprintf((char *)extra, "%*ld ",
5895 number_width(wp), num);
5896@@ -6522,8 +6521,17 @@
5897 stl, use_sandbox,
5898 fillchar, maxwidth, hltab, tabtab);
5899 vim_free(stl);
5900- len = (int)STRLEN(buf);
5901
5902+ /* Make all characters printable. */
5903+ p = transstr(buf);
5904+ if (p != NULL)
5905+ {
5906+ vim_strncpy(buf, p, sizeof(buf) - 1);
5907+ vim_free(p);
5908+ }
5909+
5910+ /* fill up with "fillchar" */
5911+ len = (int)STRLEN(buf);
5912 while (width < maxwidth && len < (int)sizeof(buf) - 1)
5913 {
5914 #ifdef FEAT_MBYTE
5915diff -Naur vim73.orig/src/search.c vim73/src/search.c
5916--- vim73.orig/src/search.c 2010-07-14 10:49:41.000000000 -0400
5917+++ vim73/src/search.c 2011-01-08 20:59:41.002656834 -0500
5918@@ -5075,9 +5075,7 @@
5919 if (win_split(0, 0) == FAIL)
5920 #endif
5921 break;
5922-#ifdef FEAT_SCROLLBIND
5923- curwin->w_p_scb = FALSE;
5924-#endif
5925+ RESET_BINDING(curwin);
5926 }
5927 if (depth == -1)
5928 {
5929diff -Naur vim73.orig/src/spell.c vim73/src/spell.c
5930--- vim73.orig/src/spell.c 2010-08-01 09:43:01.000000000 -0400
5931+++ vim73/src/spell.c 2011-01-08 21:01:19.386656778 -0500
5932@@ -303,10 +303,6 @@
5933 * few bytes as possible, see offset2bytes())
5934 */
5935
5936-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
5937-# include "vimio.h" /* for lseek(), must be before vim.h */
5938-#endif
5939-
5940 #include "vim.h"
5941
5942 #if defined(FEAT_SPELL) || defined(PROTO)
5943@@ -327,6 +323,16 @@
5944 typedef long idx_T;
5945 #endif
5946
5947+#ifdef VMS
5948+# define SPL_FNAME_TMPL "%s_%s.spl"
5949+# define SPL_FNAME_ADD "_add."
5950+# define SPL_FNAME_ASCII "_ascii."
5951+#else
5952+# define SPL_FNAME_TMPL "%s.%s.spl"
5953+# define SPL_FNAME_ADD ".add."
5954+# define SPL_FNAME_ASCII ".ascii."
5955+#endif
5956+
5957 /* Flags used for a word. Only the lowest byte can be used, the region byte
5958 * comes above it. */
5959 #define WF_REGION 0x01 /* region byte follows */
5960@@ -2471,14 +2477,24 @@
5961 * Find the first spell file for "lang" in 'runtimepath' and load it.
5962 */
5963 vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
5964- "spell/%s.%s.spl", lang, spell_enc());
5965+#ifdef VMS
5966+ "spell/%s_%s.spl",
5967+#else
5968+ "spell/%s.%s.spl",
5969+#endif
5970+ lang, spell_enc());
5971 r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
5972
5973 if (r == FAIL && *sl.sl_lang != NUL)
5974 {
5975 /* Try loading the ASCII version. */
5976 vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
5977- "spell/%s.ascii.spl", lang);
5978+#ifdef VMS
5979+ "spell/%s_ascii.spl",
5980+#else
5981+ "spell/%s.ascii.spl",
5982+#endif
5983+ lang);
5984 r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
5985
5986 #ifdef FEAT_AUTOCMD
5987@@ -2496,7 +2512,12 @@
5988
5989 if (r == FAIL)
5990 {
5991- smsg((char_u *)_("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""),
5992+ smsg((char_u *)
5993+#ifdef VMS
5994+ _("Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\""),
5995+#else
5996+ _("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""),
5997+#endif
5998 lang, spell_enc(), lang);
5999 }
6000 else if (sl.sl_slang != NULL)
6001@@ -2530,7 +2551,7 @@
6002 int_wordlist_spl(fname)
6003 char_u *fname;
6004 {
6005- vim_snprintf((char *)fname, MAXPATHL, "%s.%s.spl",
6006+ vim_snprintf((char *)fname, MAXPATHL, SPL_FNAME_TMPL,
6007 int_wordlist, spell_enc());
6008 }
6009
6010@@ -2785,8 +2806,8 @@
6011 if (lp->sl_fname == NULL)
6012 goto endFAIL;
6013
6014- /* Check for .add.spl. */
6015- lp->sl_add = strstr((char *)gettail(fname), ".add.") != NULL;
6016+ /* Check for .add.spl (_add.spl for VMS). */
6017+ lp->sl_add = strstr((char *)gettail(fname), SPL_FNAME_ADD) != NULL;
6018 }
6019 else
6020 lp = old_lp;
6021@@ -4679,7 +4700,7 @@
6022 buf_T *buf;
6023 char_u fname[MAXPATHL];
6024
6025- /* Go through all buffers and handle 'spelllang'. */ //<VN>
6026+ /* Go through all buffers and handle 'spelllang'. <VN> */
6027 for (buf = firstbuf; buf != NULL; buf = buf->b_next)
6028 ga_clear(&buf->b_s.b_langp);
6029
6030@@ -4951,7 +4972,7 @@
6031 char_u *si_info; /* info text chars or NULL */
6032 int si_region_count; /* number of regions supported (1 when there
6033 are no regions) */
6034- char_u si_region_name[16]; /* region names; used only if
6035+ char_u si_region_name[17]; /* region names; used only if
6036 * si_region_count > 1) */
6037
6038 garray_T si_rep; /* list of fromto_T entries from REP lines */
6039@@ -9109,8 +9130,8 @@
6040 /* For ":mkspell path/vim" output file is "path/vim.latin1.spl". */
6041 innames = &fnames[0];
6042 incount = 1;
6043- vim_snprintf((char *)wfname, sizeof(wfname), "%s.%s.spl", fnames[0],
6044- spin.si_ascii ? (char_u *)"ascii" : spell_enc());
6045+ vim_snprintf((char *)wfname, sizeof(wfname), SPL_FNAME_TMPL,
6046+ fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc());
6047 }
6048 else if (len > 4 && STRCMP(fnames[0] + len - 4, ".spl") == 0)
6049 {
6050@@ -9119,15 +9140,15 @@
6051 }
6052 else
6053 /* Name should be language, make the file name from it. */
6054- vim_snprintf((char *)wfname, sizeof(wfname), "%s.%s.spl", fnames[0],
6055- spin.si_ascii ? (char_u *)"ascii" : spell_enc());
6056+ vim_snprintf((char *)wfname, sizeof(wfname), SPL_FNAME_TMPL,
6057+ fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc());
6058
6059 /* Check for .ascii.spl. */
6060- if (strstr((char *)gettail(wfname), ".ascii.") != NULL)
6061+ if (strstr((char *)gettail(wfname), SPL_FNAME_ASCII) != NULL)
6062 spin.si_ascii = TRUE;
6063
6064 /* Check for .add.spl. */
6065- if (strstr((char *)gettail(wfname), ".add.") != NULL)
6066+ if (strstr((char *)gettail(wfname), SPL_FNAME_ADD) != NULL)
6067 spin.si_add = TRUE;
6068 }
6069
6070@@ -9530,7 +9551,8 @@
6071 if (aspath)
6072 /* Use directory of an entry with path, e.g., for
6073 * "/dir/lg.utf-8.spl" use "/dir". */
6074- vim_strncpy(buf, curbuf->b_s.b_p_spl, lstart - curbuf->b_s.b_p_spl - 1);
6075+ vim_strncpy(buf, curbuf->b_s.b_p_spl,
6076+ lstart - curbuf->b_s.b_p_spl - 1);
6077 else
6078 /* Copy the path from 'runtimepath' to buf[]. */
6079 copy_option_part(&rtp, buf, MAXPATHL, ",");
6080@@ -9539,13 +9561,14 @@
6081 /* Use the first language name from 'spelllang' and the
6082 * encoding used in the first loaded .spl file. */
6083 if (aspath)
6084- vim_strncpy(buf, curbuf->b_s.b_p_spl, lend - curbuf->b_s.b_p_spl);
6085+ vim_strncpy(buf, curbuf->b_s.b_p_spl,
6086+ lend - curbuf->b_s.b_p_spl);
6087 else
6088 {
6089 /* Create the "spell" directory if it doesn't exist yet. */
6090 l = (int)STRLEN(buf);
6091 vim_snprintf((char *)buf + l, MAXPATHL - l, "/spell");
6092- if (!filewritable(buf) != 2)
6093+ if (filewritable(buf) != 2)
6094 vim_mkdir(buf, 0755);
6095
6096 l = (int)STRLEN(buf);
6097@@ -9837,10 +9860,7 @@
6098 {
6099 /* be quick for ASCII */
6100 if (wp->w_s->b_spell_ismw[*p])
6101- {
6102 s = p + 1; /* skip a mid-word character */
6103- l = MB_BYTE2LEN(*s);
6104- }
6105 }
6106 else
6107 {
6108@@ -9848,10 +9868,7 @@
6109 if (c < 256 ? wp->w_s->b_spell_ismw[c]
6110 : (wp->w_s->b_spell_ismw_mb != NULL
6111 && vim_strchr(wp->w_s->b_spell_ismw_mb, c) != NULL))
6112- {
6113 s = p + l;
6114- l = MB_BYTE2LEN(*s);
6115- }
6116 }
6117
6118 c = mb_ptr2char(s);
6119@@ -13811,11 +13828,8 @@
6120 su->su_sfmaxscore = cleanup_suggestions(gap,
6121 su->su_sfmaxscore, SUG_CLEAN_COUNT(su));
6122 else
6123- {
6124- i = su->su_maxscore;
6125 su->su_maxscore = cleanup_suggestions(gap,
6126 su->su_maxscore, SUG_CLEAN_COUNT(su));
6127- }
6128 }
6129 }
6130 }
6131diff -Naur vim73.orig/src/structs.h vim73/src/structs.h
6132--- vim73.orig/src/structs.h 2010-08-07 10:59:27.000000000 -0400
6133+++ vim73/src/structs.h 2011-01-08 21:01:18.918658776 -0500
6134@@ -979,9 +979,10 @@
6135 struct mapblock
6136 {
6137 mapblock_T *m_next; /* next mapblock in list */
6138- char_u *m_keys; /* mapped from */
6139+ char_u *m_keys; /* mapped from, lhs */
6140 int m_keylen; /* strlen(m_keys) */
6141- char_u *m_str; /* mapped to */
6142+ char_u *m_str; /* mapped to, rhs */
6143+ char_u *m_orig_str; /* rhs as entered by the user */
6144 int m_mode; /* valid mode */
6145 int m_noremap; /* if non-zero no re-mapping for m_str */
6146 char m_silent; /* <silent> used, don't echo commands */
6147diff -Naur vim73.orig/src/syntax.c vim73/src/syntax.c
6148--- vim73.orig/src/syntax.c 2010-08-08 09:17:03.000000000 -0400
6149+++ vim73/src/syntax.c 2011-01-08 21:01:18.790655926 -0500
6150@@ -7600,10 +7600,10 @@
6151 /*
6152 * Copy characters from arg[] to buf[], translating <> codes.
6153 */
6154- for (p = arg, off = 0; off < 100 && *p; )
6155+ for (p = arg, off = 0; off < 100 - 6 && *p; )
6156 {
6157 len = trans_special(&p, buf + off, FALSE);
6158- if (len) /* recognized special char */
6159+ if (len > 0) /* recognized special char */
6160 off += len;
6161 else /* copy as normal char */
6162 buf[off++] = *p++;
6163diff -Naur vim73.orig/src/tag.c vim73/src/tag.c
6164--- vim73.orig/src/tag.c 2010-08-10 03:25:22.000000000 -0400
6165+++ vim73/src/tag.c 2011-01-08 21:01:19.386656778 -0500
6166@@ -11,10 +11,6 @@
6167 * Code to handle tags and the tag stack
6168 */
6169
6170-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
6171-# include "vimio.h" /* for lseek(), must be before vim.h */
6172-#endif
6173-
6174 #include "vim.h"
6175
6176 /*
6177@@ -3143,9 +3139,7 @@
6178 {
6179 win_split(postponed_split > 0 ? postponed_split : 0,
6180 postponed_split_flags);
6181-# ifdef FEAT_SCROLLBIND
6182- curwin->w_p_scb = FALSE;
6183-# endif
6184+ RESET_BINDING(curwin);
6185 }
6186 #endif
6187
6188diff -Naur vim73.orig/src/term.c vim73/src/term.c
6189--- vim73.orig/src/term.c 2010-07-25 09:30:31.000000000 -0400
6190+++ vim73/src/term.c 2011-01-08 21:01:19.486656758 -0500
6191@@ -3053,10 +3053,13 @@
6192 int old_Rows = Rows;
6193 int old_Columns = Columns;
6194
6195- (void)ui_get_shellsize();
6196- check_shellsize();
6197- if (old_Rows != Rows || old_Columns != Columns)
6198- shell_resized();
6199+ if (!exiting)
6200+ {
6201+ (void)ui_get_shellsize();
6202+ check_shellsize();
6203+ if (old_Rows != Rows || old_Columns != Columns)
6204+ shell_resized();
6205+ }
6206 }
6207
6208 /*
6209@@ -3828,6 +3831,7 @@
6210 * Check from typebuf.tb_buf[typebuf.tb_off] to typebuf.tb_buf[typebuf.tb_off
6211 * + max_offset].
6212 * Return 0 for no match, -1 for partial match, > 0 for full match.
6213+ * Return KEYLEN_REMOVED when a key code was deleted.
6214 * With a match, the match is removed, the replacement code is inserted in
6215 * typebuf.tb_buf[] and the number of characters in typebuf.tb_buf[] is
6216 * returned.
6217@@ -3845,6 +3849,7 @@
6218 int slen = 0; /* init for GCC */
6219 int modslen;
6220 int len;
6221+ int retval = 0;
6222 int offset;
6223 char_u key_name[2];
6224 int modifiers;
6225@@ -4940,6 +4945,13 @@
6226 #endif
6227 string[new_slen++] = key_name[1];
6228 }
6229+ else if (new_slen == 0 && key_name[0] == KS_EXTRA
6230+ && key_name[1] == KE_IGNORE)
6231+ {
6232+ /* Do not put K_IGNORE into the buffer, do return KEYLEN_REMOVED
6233+ * to indicate what happened. */
6234+ retval = KEYLEN_REMOVED;
6235+ }
6236 else
6237 {
6238 string[new_slen++] = K_SPECIAL;
6239@@ -4976,7 +4988,7 @@
6240 (size_t)(buflen - offset));
6241 mch_memmove(buf + offset, string, (size_t)new_slen);
6242 }
6243- return (len + extra + offset);
6244+ return retval == 0 ? (len + extra + offset) : retval;
6245 }
6246
6247 return 0; /* no match found */
6248diff -Naur vim73.orig/src/testdir/Make_amiga.mak vim73/src/testdir/Make_amiga.mak
6249--- vim73.orig/src/testdir/Make_amiga.mak 2010-08-04 10:34:34.000000000 -0400
6250+++ vim73/src/testdir/Make_amiga.mak 2011-01-08 21:01:19.138657005 -0500
6251@@ -27,7 +27,8 @@
6252 test56.out test57.out test58.out test59.out test60.out \
6253 test61.out test62.out test63.out test64.out test65.out \
6254 test66.out test67.out test68.out test69.out test70.out \
6255- test71.out test72.out test73.out
6256+ test71.out test72.out test73.out test74.out test75.out \
6257+ test76.out
6258
6259 .SUFFIXES: .in .out
6260
6261@@ -120,3 +121,6 @@
6262 test71.out: test71.in
6263 test72.out: test72.in
6264 test73.out: test73.in
6265+test74.out: test74.in
6266+test75.out: test75.in
6267+test76.out: test76.in
6268diff -Naur vim73.orig/src/testdir/Make_dos.mak vim73/src/testdir/Make_dos.mak
6269--- vim73.orig/src/testdir/Make_dos.mak 2010-08-13 12:27:19.000000000 -0400
6270+++ vim73/src/testdir/Make_dos.mak 2011-01-08 21:01:19.138657005 -0500
6271@@ -27,7 +27,8 @@
6272 test30.out test31.out test32.out test33.out test34.out \
6273 test37.out test38.out test39.out test40.out test41.out \
6274 test42.out test52.out test65.out test66.out test67.out \
6275- test68.out test69.out test71.out test72.out test73.out
6276+ test68.out test69.out test71.out test72.out test73.out \
6277+ test74.out test75.out test76.out
6278
6279 SCRIPTS32 = test50.out test70.out
6280
6281diff -Naur vim73.orig/src/testdir/Make_ming.mak vim73/src/testdir/Make_ming.mak
6282--- vim73.orig/src/testdir/Make_ming.mak 2010-08-04 10:34:47.000000000 -0400
6283+++ vim73/src/testdir/Make_ming.mak 2011-01-08 21:01:19.138657005 -0500
6284@@ -47,7 +47,8 @@
6285 test30.out test31.out test32.out test33.out test34.out \
6286 test37.out test38.out test39.out test40.out test41.out \
6287 test42.out test52.out test65.out test66.out test67.out \
6288- test68.out test69.out test71.out test72.out test72.out
6289+ test68.out test69.out test71.out test72.out test73.out \
6290+ test74.out test75.out test76.out
6291
6292 SCRIPTS32 = test50.out test70.out
6293
6294diff -Naur vim73.orig/src/testdir/Make_os2.mak vim73/src/testdir/Make_os2.mak
6295--- vim73.orig/src/testdir/Make_os2.mak 2010-08-04 10:34:55.000000000 -0400
6296+++ vim73/src/testdir/Make_os2.mak 2011-01-08 21:01:19.138657005 -0500
6297@@ -27,7 +27,8 @@
6298 test56.out test57.out test58.out test59.out test60.out \
6299 test61.out test62.out test63.out test64.out test65.out \
6300 test66.out test67.out test68.out test69.out test70.out \
6301- test71.out test72.out test73.out
6302+ test71.out test72.out test73.out test74.out test75.out \
6303+ test76.out
6304
6305 .SUFFIXES: .in .out
6306
6307diff -Naur vim73.orig/src/testdir/Make_vms.mms vim73/src/testdir/Make_vms.mms
6308--- vim73.orig/src/testdir/Make_vms.mms 2010-08-04 10:35:46.000000000 -0400
6309+++ vim73/src/testdir/Make_vms.mms 2011-01-08 21:01:19.138657005 -0500
6310@@ -4,7 +4,7 @@
6311 # Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
6312 # Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
6313 #
6314-# Last change: 2010 Aug 04
6315+# Last change: 2010 Nov 10
6316 #
6317 # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
6318 # Edit the lines in the Configuration section below to select.
6319@@ -74,7 +74,7 @@
6320 test56.out test57.out test60.out \
6321 test61.out test62.out test63.out test64.out test65.out \
6322 test66.out test67.out test68.out test69.out \
6323- test71.out test72.out
6324+ test71.out test72.out test74.out test75.out test76.out
6325
6326 # Known problems:
6327 # Test 30: a problem around mac format - unknown reason
6328diff -Naur vim73.orig/src/testdir/Makefile vim73/src/testdir/Makefile
6329--- vim73.orig/src/testdir/Makefile 2010-08-15 08:56:30.000000000 -0400
6330+++ vim73/src/testdir/Makefile 2011-01-08 21:01:19.138657005 -0500
6331@@ -10,6 +10,7 @@
6332 # This will make testing about 10 times as slow.
6333 # VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.$*
6334
6335+
6336 SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
6337 test7.out test8.out test9.out test10.out test11.out \
6338 test12.out test13.out test14.out test15.out test17.out \
6339@@ -23,7 +24,8 @@
6340 test54.out test55.out test56.out test57.out test58.out \
6341 test59.out test60.out test61.out test62.out test63.out \
6342 test64.out test65.out test66.out test67.out test68.out \
6343- test69.out test70.out test71.out test72.out test73.out
6344+ test69.out test70.out test71.out test72.out test73.out \
6345+ test74.out test75.out test76.out
6346
6347 SCRIPTS_GUI = test16.out
6348
6349@@ -44,7 +46,7 @@
6350 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
6351
6352 clean:
6353- -rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim mzscheme.vim test.ok X* valgrind.pid* viminfo
6354+ -rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim mzscheme.vim test.ok X* valgrind.* viminfo
6355
6356 test1.out: test1.in
6357 -rm -f $*.failed tiny.vim small.vim mbyte.vim mzscheme.vim test.ok X* viminfo
6358diff -Naur vim73.orig/src/testdir/main.aap vim73/src/testdir/main.aap
6359--- vim73.orig/src/testdir/main.aap 2010-07-30 16:03:23.000000000 -0400
6360+++ vim73/src/testdir/main.aap 2011-01-08 21:01:18.878656504 -0500
6361@@ -13,7 +13,7 @@
6362 test33.out test34.out test35.out test36.out test37.out
6363 test38.out test39.out test40.out test41.out test42.out
6364 test43.out test44.out test45.out test46.out test47.out
6365- test48.out test49.out
6366+ test48.out test49.out test74.out
6367
6368 ScriptsGUI = test16.out
6369
6370diff -Naur vim73.orig/src/testdir/test49.vim vim73/src/testdir/test49.vim
6371--- vim73.orig/src/testdir/test49.vim 2010-05-15 07:04:10.000000000 -0400
6372+++ vim73/src/testdir/test49.vim 2011-01-08 21:01:18.782656702 -0500
6373@@ -1,6 +1,6 @@
6374 " Vim script language tests
6375 " Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
6376-" Last Change: 2006 Apr 28
6377+" Last Change: 2010 Sep 29
6378
6379 "-------------------------------------------------------------------------------
6380 " Test environment {{{1
6381@@ -8711,7 +8711,7 @@
6382 endif
6383 else
6384 if cmd == "let"
6385- let match = MATCH(0, thrmsg, 'E106', "Unknown variable")
6386+ let match = MATCH(0, thrmsg, 'E121', "Undefined variable")
6387 elseif cmd == "unlet"
6388 let match = MATCH(0, thrmsg, 'E108', "No such variable")
6389 endif
6390diff -Naur vim73.orig/src/testdir/test55.in vim73/src/testdir/test55.in
6391--- vim73.orig/src/testdir/test55.in 2010-05-15 07:04:10.000000000 -0400
6392+++ vim73/src/testdir/test55.in 2011-01-08 21:01:19.158657647 -0500
6393@@ -342,7 +342,18 @@
6394 :$put =(d == d)
6395 :$put =(l != deepcopy(l))
6396 :$put =(d != deepcopy(d))
6397+:"
6398+:" compare complex recursively linked list and dict
6399+:let l = []
6400+:call add(l, l)
6401+:let dict4 = {"l": l}
6402+:call add(dict4.l, dict4)
6403+:let lcopy = deepcopy(l)
6404+:let dict4copy = deepcopy(dict4)
6405+:$put =(l == lcopy)
6406+:$put =(dict4 == dict4copy)
6407 :endfun
6408+:"
6409 :call Test(1, 2, [3, 4], {5: 6}) " This may take a while
6410 :"
6411 :delfunc Test
6412diff -Naur vim73.orig/src/testdir/test55.ok vim73/src/testdir/test55.ok
6413--- vim73.orig/src/testdir/test55.ok 2010-05-15 07:04:10.000000000 -0400
6414+++ vim73/src/testdir/test55.ok 2011-01-08 21:01:19.158657647 -0500
6415@@ -109,3 +109,5 @@
6416 1
6417 0
6418 0
6419+1
6420+1
6421diff -Naur vim73.orig/src/testdir/test57.in vim73/src/testdir/test57.in
6422--- vim73.orig/src/testdir/test57.in 2010-05-15 07:04:10.000000000 -0400
6423+++ vim73/src/testdir/test57.in 2011-01-08 21:01:18.866656341 -0500
6424@@ -53,15 +53,19 @@
6425 t02: numeric
6426 abc
6427 ab
6428-a
6429 a321
6430 a123
6431 a122
6432+a
6433+x-22
6434 b321
6435 b123
6436+
6437 c123d
6438+-24
6439 123b
6440 c321d
6441+0
6442 b322b
6443 b321
6444 b321b
6445diff -Naur vim73.orig/src/testdir/test57.ok vim73/src/testdir/test57.ok
6446--- vim73.orig/src/testdir/test57.ok 2010-05-15 07:04:10.000000000 -0400
6447+++ vim73/src/testdir/test57.ok 2011-01-08 21:01:18.866656341 -0500
6448@@ -21,6 +21,10 @@
6449 a
6450
6451
6452+
6453+-24
6454+x-22
6455+0
6456 a122
6457 a123
6458 b123
6459diff -Naur vim73.orig/src/testdir/test61.in vim73/src/testdir/test61.in
6460--- vim73.orig/src/testdir/test61.in 2010-06-26 23:07:58.000000000 -0400
6461+++ vim73/src/testdir/test61.in 2011-01-08 20:59:38.610657137 -0500
6462@@ -4,6 +4,10 @@
6463 Also tests :earlier and :later.
6464
6465 STARTTEST
6466+:echo undotree().entries
6467+ENDTEST
6468+
6469+STARTTEST
6470 :" Delete three characters and undo
6471 Gx:set ul=100
6472 x:set ul=100
6473diff -Naur vim73.orig/src/testdir/test68.in vim73/src/testdir/test68.in
6474--- vim73.orig/src/testdir/test68.in 2010-05-15 07:04:10.000000000 -0400
6475+++ vim73/src/testdir/test68.in 2011-01-08 21:01:18.806655841 -0500
6476@@ -51,6 +51,17 @@
6477 }
6478
6479 STARTTEST
6480+/^{/+2
6481+:set tw& fo=a
6482+I^^
6483+ENDTEST
6484+
6485+{
6486+ 1aa
6487+ 2bb
6488+}
6489+
6490+STARTTEST
6491 :g/^STARTTEST/.,/^ENDTEST/d
6492 :1;/^Results/,$wq! test.out
6493 ENDTEST
6494diff -Naur vim73.orig/src/testdir/test68.ok vim73/src/testdir/test68.ok
6495--- vim73.orig/src/testdir/test68.ok 2010-05-15 07:04:10.000000000 -0400
6496+++ vim73/src/testdir/test68.ok 2011-01-08 21:01:18.806655841 -0500
6497@@ -33,3 +33,6 @@
6498 #a b
6499 }
6500
6501+
6502+{ 1aa ^^2bb }
6503+
6504diff -Naur vim73.orig/src/testdir/test74.in vim73/src/testdir/test74.in
6505--- vim73.orig/src/testdir/test74.in 1969-12-31 19:00:00.000000000 -0500
6506+++ vim73/src/testdir/test74.in 2011-01-08 21:01:18.878656504 -0500
6507@@ -0,0 +1,36 @@
6508+" Tests for storing global variables in the .viminfo file vim: set ft=vim:
6509+
6510+STARTTEST
6511+:so small.vim
6512+:" Do all test in a separate window to avoid E211 when we recursively
6513+:" delete the Xfind directory during cleanup
6514+:"
6515+:" This will cause a few errors, do it silently.
6516+:set visualbell
6517+:set nocp viminfo+=!,nviminfo
6518+:let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}
6519+:" store a really long list, so line wrapping will occur in viminfo file
6520+:let MY_GLOBAL_LIST=range(1,100)
6521+:wv! Xviminfo
6522+:unlet MY_GLOBAL_DICT
6523+:unlet MY_GLOBAL_LIST
6524+:rv! Xviminfo
6525+:call delete('Xviminfo')
6526+:if exists("MY_GLOBAL_DICT")
6527+:redir >> test.out
6528+:echo MY_GLOBAL_DICT
6529+:redir end
6530+:endif
6531+:if exists("MY_GLOBAL_LIST")
6532+:redir >> test.out
6533+:echo MY_GLOBAL_LIST
6534+:redir end
6535+:endif
6536+:redir >> test.out
6537+:echo "foobar"
6538+:redir end
6539+:endif
6540+:qa!
6541+ENDTEST
6542+
6543+eof
6544diff -Naur vim73.orig/src/testdir/test74.ok vim73/src/testdir/test74.ok
6545--- vim73.orig/src/testdir/test74.ok 1969-12-31 19:00:00.000000000 -0500
6546+++ vim73/src/testdir/test74.ok 2011-01-08 21:01:18.878656504 -0500
6547@@ -0,0 +1,5 @@
6548+
6549+{'foo': 1, 'longvarible': 1000, 'bar': 0}
6550+[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
6551+
6552+foobar
6553diff -Naur vim73.orig/src/testdir/test75.in vim73/src/testdir/test75.in
6554--- vim73.orig/src/testdir/test75.in 1969-12-31 19:00:00.000000000 -0500
6555+++ vim73/src/testdir/test75.in 2011-01-08 21:01:18.918658776 -0500
6556@@ -0,0 +1,16 @@
6557+" Tests for functions.
6558+
6559+STARTTEST
6560+:so small.vim
6561+:" Test maparg() with a string result
6562+:map foo<C-V> is<F4>foo
6563+:vnoremap <script> <buffer> <expr> <silent> bar isbar
6564+:call append('$', maparg('foo<C-V>'))
6565+:call append('$', string(maparg('foo<C-V>', '', 0, 1)))
6566+:call append('$', string(maparg('bar', '', 0, 1)))
6567+:"
6568+:/^eof/+1,$w! test.out
6569+:qa!
6570+ENDTEST
6571+
6572+eof
6573diff -Naur vim73.orig/src/testdir/test75.ok vim73/src/testdir/test75.ok
6574--- vim73.orig/src/testdir/test75.ok 1969-12-31 19:00:00.000000000 -0500
6575+++ vim73/src/testdir/test75.ok 2011-01-08 21:01:18.918658776 -0500
6576@@ -0,0 +1,3 @@
6577+is<F4>foo
6578+{'silent': 0, 'noremap': 0, 'lhs': 'foo<C-V>', 'mode': ' ', 'expr': 0, 'sid': 0, 'rhs': 'is<F4>foo', 'buffer': 0}
6579+{'silent': 1, 'noremap': 1, 'lhs': 'bar', 'mode': 'v', 'expr': 1, 'sid': 0, 'rhs': 'isbar', 'buffer': 1}
6580diff -Naur vim73.orig/src/testdir/test76.in vim73/src/testdir/test76.in
6581--- vim73.orig/src/testdir/test76.in 1969-12-31 19:00:00.000000000 -0500
6582+++ vim73/src/testdir/test76.in 2011-01-08 21:01:19.138657005 -0500
6583@@ -0,0 +1,46 @@
6584+Tests for completefunc/omnifunc. vim: set ft=vim :
6585+
6586+STARTTEST
6587+:"Test that nothing happens if the 'completefunc' opens
6588+:"a new window (no completion, no crash)
6589+:so small.vim
6590+:function! DummyCompleteOne(findstart, base)
6591+: if a:findstart
6592+: return 0
6593+: else
6594+: wincmd n
6595+: return ['onedef', 'oneDEF']
6596+: endif
6597+:endfunction
6598+:setlocal completefunc=DummyCompleteOne
6599+/^one
6600+A:q!
6601+:function! DummyCompleteTwo(findstart, base)
6602+: if a:findstart
6603+: wincmd n
6604+: return 0
6605+: else
6606+: return ['twodef', 'twoDEF']
6607+: endif
6608+:endfunction
6609+:setlocal completefunc=DummyCompleteTwo
6610+/^two
6611+A:q!
6612+:"Test that 'completefunc' works when it's OK.
6613+:function! DummyCompleteThree(findstart, base)
6614+: if a:findstart
6615+: return 0
6616+: else
6617+: return ['threedef', 'threeDEF']
6618+: endif
6619+:endfunction
6620+:setlocal completefunc=DummyCompleteThree
6621+/^three
6622+A:/^+++/,/^three/w! test.out
6623+:qa!
6624+ENDTEST
6625+
6626++++
6627+one
6628+two
6629+three
6630diff -Naur vim73.orig/src/testdir/test76.ok vim73/src/testdir/test76.ok
6631--- vim73.orig/src/testdir/test76.ok 1969-12-31 19:00:00.000000000 -0500
6632+++ vim73/src/testdir/test76.ok 2011-01-08 21:01:19.142655736 -0500
6633@@ -0,0 +1,4 @@
6634++++
6635+
6636+two
6637+threeDEF
6638diff -Naur vim73.orig/src/ui.c vim73/src/ui.c
6639--- vim73.orig/src/ui.c 2010-08-08 09:17:30.000000000 -0400
6640+++ vim73/src/ui.c 2011-01-08 21:01:18.766656221 -0500
6641@@ -469,7 +469,7 @@
6642 */
6643 #ifdef FEAT_X11
6644 /* Always own the selection, we might have lost it without being
6645- * notified. */
6646+ * notified, e.g. during a ":sh" command. */
6647 if (cbd->available)
6648 {
6649 int was_owned = cbd->owned;
6650@@ -1944,10 +1944,9 @@
6651 */
6652
6653 static Boolean clip_x11_convert_selection_cb __ARGS((Widget, Atom *, Atom *, Atom *, XtPointer *, long_u *, int *));
6654-
6655 static void clip_x11_lose_ownership_cb __ARGS((Widget, Atom *));
6656-
6657 static void clip_x11_timestamp_cb __ARGS((Widget w, XtPointer n, XEvent *event, Boolean *cont));
6658+static void clip_x11_request_selection_cb __ARGS((Widget, XtPointer, Atom *, Atom *, XtPointer, long_u *, int *));
6659
6660 /*
6661 * Property callback to get a timestamp for XtOwnSelection.
6662@@ -1985,8 +1984,17 @@
6663 return;
6664
6665 /* Get the selection, using the event timestamp. */
6666- XtOwnSelection(w, xproperty->atom, xproperty->time,
6667- clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb, NULL);
6668+ if (XtOwnSelection(w, xproperty->atom, xproperty->time,
6669+ clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb,
6670+ NULL) == OK)
6671+ {
6672+ /* Set the "owned" flag now, there may have been a call to
6673+ * lose_ownership_cb in between. */
6674+ if (xproperty->atom == clip_plus.sel_atom)
6675+ clip_plus.owned = TRUE;
6676+ else
6677+ clip_star.owned = TRUE;
6678+ }
6679 }
6680
6681 void
6682@@ -1997,8 +2005,6 @@
6683 /*(XtEventHandler)*/clip_x11_timestamp_cb, (XtPointer)NULL);
6684 }
6685
6686-static void clip_x11_request_selection_cb __ARGS((Widget, XtPointer, Atom *, Atom *, XtPointer, long_u *, int *));
6687-
6688 static void
6689 clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
6690 format)
6691@@ -2336,7 +2342,7 @@
6692
6693 void
6694 clip_x11_lose_selection(myShell, cbd)
6695- Widget myShell;
6696+ Widget myShell;
6697 VimClipboard *cbd;
6698 {
6699 XtDisownSelection(myShell, cbd->sel_atom, CurrentTime);
6700@@ -2344,14 +2350,29 @@
6701
6702 int
6703 clip_x11_own_selection(myShell, cbd)
6704- Widget myShell;
6705+ Widget myShell;
6706 VimClipboard *cbd;
6707 {
6708- /* Get the time by a zero-length append, clip_x11_timestamp_cb will be
6709- * called with the current timestamp. */
6710- if (!XChangeProperty(XtDisplay(myShell), XtWindow(myShell), cbd->sel_atom,
6711- timestamp_atom, 32, PropModeAppend, NULL, 0))
6712+ /* When using the GUI we have proper timestamps, use the one of the last
6713+ * event. When in the console we don't get events (the terminal gets
6714+ * them), Get the time by a zero-length append, clip_x11_timestamp_cb will
6715+ * be called with the current timestamp. */
6716+#ifdef FEAT_GUI
6717+ if (gui.in_use)
6718+ {
6719+ if (XtOwnSelection(myShell, cbd->sel_atom,
6720+ XtLastTimestampProcessed(XtDisplay(myShell)),
6721+ clip_x11_convert_selection_cb, clip_x11_lose_ownership_cb,
6722+ NULL) == False)
6723 return FAIL;
6724+ }
6725+ else
6726+#endif
6727+ {
6728+ if (!XChangeProperty(XtDisplay(myShell), XtWindow(myShell),
6729+ cbd->sel_atom, timestamp_atom, 32, PropModeAppend, NULL, 0))
6730+ return FAIL;
6731+ }
6732 /* Flush is required in a terminal as nothing else is doing it. */
6733 XFlush(XtDisplay(myShell));
6734 return OK;
6735diff -Naur vim73.orig/src/undo.c vim73/src/undo.c
6736--- vim73.orig/src/undo.c 2010-08-07 06:48:15.000000000 -0400
6737+++ vim73/src/undo.c 2011-01-08 21:01:19.386656778 -0500
6738@@ -81,10 +81,6 @@
6739 #define UH_MAGIC 0x18dade /* value for uh_magic when in use */
6740 #define UE_MAGIC 0xabc123 /* value for ue_magic when in use */
6741
6742-#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
6743-# include "vimio.h" /* for vim_read(), must be before vim.h */
6744-#endif
6745-
6746 #include "vim.h"
6747
6748 static void u_unch_branch __ARGS((u_header_T *uhp));
6749@@ -1386,7 +1382,7 @@
6750 char_u mbuf[UF_START_MAGIC_LEN];
6751 int len;
6752
6753- len = vim_read(fd, mbuf, UF_START_MAGIC_LEN);
6754+ len = read_eintr(fd, mbuf, UF_START_MAGIC_LEN);
6755 close(fd);
6756 if (len < UF_START_MAGIC_LEN
6757 || memcmp(mbuf, UF_START_MAGIC, UF_START_MAGIC_LEN) != 0)
6758@@ -1861,6 +1857,7 @@
6759 curbuf->b_u_seq_cur = seq_cur;
6760 curbuf->b_u_time_cur = seq_time;
6761 curbuf->b_u_save_nr_last = last_save_nr;
6762+ curbuf->b_u_save_nr_cur = last_save_nr;
6763
6764 curbuf->b_u_synced = TRUE;
6765 vim_free(uhp_table);
6766@@ -2794,7 +2791,7 @@
6767 uhp->uh_time);
6768 if (uhp->uh_save_nr > 0)
6769 {
6770- while (STRLEN(IObuff) < 32)
6771+ while (STRLEN(IObuff) < 33)
6772 STRCAT(IObuff, " ");
6773 vim_snprintf_add((char *)IObuff, IOSIZE,
6774 " %3ld", uhp->uh_save_nr);
6775@@ -2849,7 +2846,7 @@
6776 sort_strings((char_u **)ga.ga_data, ga.ga_len);
6777
6778 msg_start();
6779- msg_puts_attr((char_u *)_("number changes time saved"),
6780+ msg_puts_attr((char_u *)_("number changes when saved"),
6781 hl_attr(HLF_T));
6782 for (i = 0; i < ga.ga_len && !got_int; ++i)
6783 {
6784@@ -2879,7 +2876,15 @@
6785 if (time(NULL) - tt >= 100)
6786 {
6787 curtime = localtime(&tt);
6788- (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime);
6789+ if (time(NULL) - tt < (60L * 60L * 12L))
6790+ /* within 12 hours */
6791+ (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime);
6792+ else if (time(NULL) - tt < (60L * 60L * 24L * 180L))
6793+ /* within 6 months */
6794+ (void)strftime((char *)buf, buflen, "%m/%d %H:%M:%S", curtime);
6795+ else
6796+ /* long ago */
6797+ (void)strftime((char *)buf, buflen, "%y/%m/%d %H:%M:%S", curtime);
6798 }
6799 else
6800 #endif
6801diff -Naur vim73.orig/src/version.c vim73/src/version.c
6802--- vim73.orig/src/version.c 2010-08-01 09:45:48.000000000 -0400
6803+++ vim73/src/version.c 2011-01-08 21:01:19.514657428 -0500
6804@@ -715,6 +715,204 @@
6805 static int included_patches[] =
6806 { /* Add new patch number below this line */
6807 /**/
6808+ 99,
6809+/**/
6810+ 98,
6811+/**/
6812+ 97,
6813+/**/
6814+ 96,
6815+/**/
6816+ 95,
6817+/**/
6818+ 94,
6819+/**/
6820+ 93,
6821+/**/
6822+ 92,
6823+/**/
6824+ 91,
6825+/**/
6826+ 90,
6827+/**/
6828+ 89,
6829+/**/
6830+ 88,
6831+/**/
6832+ 87,
6833+/**/
6834+ 86,
6835+/**/
6836+ 85,
6837+/**/
6838+ 84,
6839+/**/
6840+ 83,
6841+/**/
6842+ 82,
6843+/**/
6844+ 81,
6845+/**/
6846+ 80,
6847+/**/
6848+ 79,
6849+/**/
6850+ 78,
6851+/**/
6852+ 77,
6853+/**/
6854+ 76,
6855+/**/
6856+ 75,
6857+/**/
6858+ 74,
6859+/**/
6860+ 73,
6861+/**/
6862+ 72,
6863+/**/
6864+ 71,
6865+/**/
6866+ 70,
6867+/**/
6868+ 69,
6869+/**/
6870+ 68,
6871+/**/
6872+ 67,
6873+/**/
6874+ 66,
6875+/**/
6876+ 65,
6877+/**/
6878+ 64,
6879+/**/
6880+ 63,
6881+/**/
6882+ 62,
6883+/**/
6884+ 61,
6885+/**/
6886+ 60,
6887+/**/
6888+ 59,
6889+/**/
6890+ 58,
6891+/**/
6892+ 57,
6893+/**/
6894+ 56,
6895+/**/
6896+ 55,
6897+/**/
6898+ 54,
6899+/**/
6900+ 53,
6901+/**/
6902+ 52,
6903+/**/
6904+ 51,
6905+/**/
6906+ 50,
6907+/**/
6908+ 49,
6909+/**/
6910+ 48,
6911+/**/
6912+ 47,
6913+/**/
6914+ 46,
6915+/**/
6916+ 45,
6917+/**/
6918+ 44,
6919+/**/
6920+ 43,
6921+/**/
6922+ 42,
6923+/**/
6924+ 41,
6925+/**/
6926+ 40,
6927+/**/
6928+ 39,
6929+/**/
6930+ 38,
6931+/**/
6932+ 37,
6933+/**/
6934+ 36,
6935+/**/
6936+ 35,
6937+/**/
6938+ 34,
6939+/**/
6940+ 33,
6941+/**/
6942+ 32,
6943+/**/
6944+ 31,
6945+/**/
6946+ 30,
6947+/**/
6948+ 29,
6949+/**/
6950+ 28,
6951+/**/
6952+ 27,
6953+/**/
6954+ 26,
6955+/**/
6956+ 25,
6957+/**/
6958+ 24,
6959+/**/
6960+ 23,
6961+/**/
6962+ 22,
6963+/**/
6964+ 21,
6965+/**/
6966+ 20,
6967+/**/
6968+ 19,
6969+/**/
6970+ 18,
6971+/**/
6972+ 17,
6973+/**/
6974+ 16,
6975+/**/
6976+ 15,
6977+/**/
6978+ 14,
6979+/**/
6980+ 13,
6981+/**/
6982+ 12,
6983+/**/
6984+ 11,
6985+/**/
6986+ 10,
6987+/**/
6988+ 9,
6989+/**/
6990+ 8,
6991+/**/
6992+ 7,
6993+/**/
6994+ 6,
6995+/**/
6996+ 5,
6997+/**/
6998+ 4,
6999+/**/
7000+ 3,
7001+/**/
7002+ 2,
7003+/**/
7004+ 1,
7005+/**/
7006 0
7007 };
7008
7009@@ -1262,9 +1460,9 @@
7010 if (highest_patch())
7011 {
7012 /* Check for 9.9x or 9.9xx, alpha/beta version */
7013- if (isalpha((int)mediumVersion[3]))
7014+ if (isalpha((int)vers[3]))
7015 {
7016- if (isalpha((int)mediumVersion[4]))
7017+ if (isalpha((int)vers[4]))
7018 sprintf((char *)vers + 5, ".%d%s", highest_patch(),
7019 mediumVersion + 5);
7020 else
7021diff -Naur vim73.orig/src/vim.h vim73/src/vim.h
7022--- vim73.orig/src/vim.h 2010-07-29 14:46:39.000000000 -0400
7023+++ vim73/src/vim.h 2011-01-08 21:01:19.466658112 -0500
7024@@ -27,6 +27,11 @@
7025 # endif
7026 #endif
7027
7028+#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64) \
7029+ || defined(__EMX__)
7030+# include "vimio.h"
7031+#endif
7032+
7033 /* ============ the header file puzzle (ca. 50-100 pieces) ========= */
7034
7035 #ifdef HAVE_CONFIG_H /* GNU autoconf (or something else) was here */
7036@@ -192,8 +197,8 @@
7037 #endif
7038
7039 #ifdef NO_X11_INCLUDES
7040- /* In os_mac_conv.c NO_X11_INCLUDES is defined to avoid X11 headers.
7041- * Disable all X11 related things to avoid conflicts. */
7042+ /* In os_mac_conv.c and os_macosx.m NO_X11_INCLUDES is defined to avoid
7043+ * X11 headers. Disable all X11 related things to avoid conflicts. */
7044 # ifdef FEAT_X11
7045 # undef FEAT_X11
7046 # endif
7047@@ -475,6 +480,11 @@
7048 # include <sys/stat.h>
7049 #endif
7050
7051+#if defined(HAVE_ERRNO_H) || defined(DJGPP) || defined(WIN16) \
7052+ || defined(WIN32) || defined(_WIN64) || defined(__EMX__)
7053+# include <errno.h>
7054+#endif
7055+
7056 /*
7057 * Allow other (non-unix) systems to configure themselves now
7058 * These are also in os_unix.h, because osdef.sh needs them there.
7059@@ -798,6 +808,7 @@
7060 #define WILD_KEEP_ALL 32
7061 #define WILD_SILENT 64
7062 #define WILD_ESCAPE 128
7063+#define WILD_ICASE 256
7064
7065 /* Flags for expand_wildcards() */
7066 #define EW_DIR 0x01 /* include directory names */
7067@@ -808,6 +819,7 @@
7068 #define EW_SILENT 0x20 /* don't print "1 returned" from shell */
7069 #define EW_EXEC 0x40 /* executable files */
7070 #define EW_PATH 0x80 /* search in 'path' too */
7071+#define EW_ICASE 0x100 /* ignore case */
7072 /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
7073 * is used when executing commands and EW_SILENT for interactive expanding. */
7074
7075@@ -1640,6 +1652,11 @@
7076 # define USE_INPUT_BUF
7077 #endif
7078
7079+#ifndef EINTR
7080+# define read_eintr(fd, buf, count) vim_read((fd), (buf), (count))
7081+# define write_eintr(fd, buf, count) vim_write((fd), (buf), (count))
7082+#endif
7083+
7084 #ifdef MSWIN
7085 /* On MS-Windows the third argument isn't size_t. This matters for Win64,
7086 * where sizeof(size_t)==8, not 4 */
7087@@ -1842,7 +1859,8 @@
7088 #define VV_OP 52
7089 #define VV_SEARCHFORWARD 53
7090 #define VV_OLDFILES 54
7091-#define VV_LEN 55 /* number of v: vars */
7092+#define VV_WINDOWID 55
7093+#define VV_LEN 56 /* number of v: vars */
7094
7095 #ifdef FEAT_CLIPBOARD
7096
7097@@ -2193,4 +2211,8 @@
7098 #define MSCR_LEFT -1
7099 #define MSCR_RIGHT -2
7100
7101+#define KEYLEN_PART_KEY -1 /* keylen value for incomplete key-code */
7102+#define KEYLEN_PART_MAP -2 /* keylen value for incomplete mapping */
7103+#define KEYLEN_REMOVED 9999 /* keylen value for removed sequence */
7104+
7105 #endif /* VIM__H */
7106diff -Naur vim73.orig/src/window.c vim73/src/window.c
7107--- vim73.orig/src/window.c 2010-07-20 16:23:49.000000000 -0400
7108+++ vim73/src/window.c 2011-01-08 21:01:19.514657428 -0500
7109@@ -70,7 +70,8 @@
7110 #endif /* FEAT_WINDOWS */
7111
7112 static win_T *win_alloc __ARGS((win_T *after, int hidden));
7113-static void win_new_height __ARGS((win_T *, int));
7114+static void set_fraction __ARGS((win_T *wp));
7115+static void win_new_height __ARGS((win_T *wp, int height));
7116
7117 #define URL_SLASH 1 /* path_is_url() has found "://" */
7118 #define URL_BACKSLASH 2 /* path_is_url() has found ":\\" */
7119@@ -525,9 +526,7 @@
7120 setpcmark();
7121 if (win_split(0, 0) == OK)
7122 {
7123-# ifdef FEAT_SCROLLBIND
7124- curwin->w_p_scb = FALSE;
7125-# endif
7126+ RESET_BINDING(curwin);
7127 (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,
7128 ECMD_HIDE, NULL);
7129 if (nchar == 'F' && lnum >= 0)
7130@@ -985,10 +984,17 @@
7131 else
7132 frame_append(curfrp, frp);
7133
7134+ /* Set w_fraction now so that the cursor keeps the same relative
7135+ * vertical position. */
7136+ if (oldwin->w_height > 0)
7137+ set_fraction(oldwin);
7138+ wp->w_fraction = oldwin->w_fraction;
7139+
7140 #ifdef FEAT_VERTSPLIT
7141 if (flags & WSP_VERT)
7142 {
7143 wp->w_p_scr = curwin->w_p_scr;
7144+
7145 if (need_status)
7146 {
7147 win_new_height(oldwin, oldwin->w_height - 1);
7148@@ -3277,9 +3283,7 @@
7149 if (aucmd_win != NULL)
7150 {
7151 win_init_some(aucmd_win, curwin);
7152-# ifdef FEAT_SCROLLBIND
7153- aucmd_win->w_p_scb = FALSE;
7154-# endif
7155+ RESET_BINDING(aucmd_win);
7156 new_frame(aucmd_win);
7157 }
7158 }
7159@@ -3320,10 +3324,8 @@
7160 /* First window in new tab page, initialize it from "oldwin". */
7161 win_init(curwin, oldwin, 0);
7162
7163-# ifdef FEAT_SCROLLBIND
7164- /* We don't want scroll-binding in the first window. */
7165- curwin->w_p_scb = FALSE;
7166-# endif
7167+ /* We don't want cursor- and scroll-binding in the first window. */
7168+ RESET_BINDING(curwin);
7169 }
7170 #endif
7171
7172@@ -5459,6 +5461,19 @@
7173
7174 #endif /* FEAT_WINDOWS */
7175
7176+#define FRACTION_MULT 16384L
7177+
7178+/*
7179+ * Set wp->w_fraction for the current w_wrow and w_height.
7180+ */
7181+ static void
7182+set_fraction(wp)
7183+ win_T *wp;
7184+{
7185+ wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT
7186+ + FRACTION_MULT / 2) / (long)wp->w_height;
7187+}
7188+
7189 /*
7190 * Set the height of a window.
7191 * This takes care of the things inside the window, not what happens to the
7192@@ -5471,7 +5486,6 @@
7193 {
7194 linenr_T lnum;
7195 int sline, line_size;
7196-#define FRACTION_MULT 16384L
7197
7198 /* Don't want a negative height. Happens when splitting a tiny window.
7199 * Will equalize heights soon to fix it. */
7200@@ -5481,8 +5495,7 @@
7201 return; /* nothing to do */
7202
7203 if (wp->w_wrow != wp->w_prev_fraction_row && wp->w_height > 0)
7204- wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT
7205- + FRACTION_MULT / 2) / (long)wp->w_height;
7206+ set_fraction(wp);
7207
7208 wp->w_height = height;
7209 wp->w_skipcol = 0;
7210diff -Naur vim73.orig/src/workshop.c vim73/src/workshop.c
7211--- vim73.orig/src/workshop.c 2010-08-08 09:18:24.000000000 -0400
7212+++ vim73/src/workshop.c 2011-01-08 21:01:19.438656953 -0500
7213@@ -16,7 +16,6 @@
7214 #include <sys/types.h>
7215 #include <netdb.h>
7216 #include <netinet/in.h>
7217-#include <errno.h>
7218 #include <sys/socket.h>
7219 #ifdef HAVE_LIBGEN_H
7220 # include <libgen.h>
Note: See TracBrowser for help on using the repository browser.