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

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 6c5a343 was 6c5a343, checked in by Joe Ciccone <jciccone@…>, 12 years ago

Update Vim to 7.3.

  • Property mode set to 100644
File size: 216.7 KB
  • runtime/doc/eval.txt

    Submitted By: Joe Ciccone <jciccone@gmail.com>
    Date: 01-08-2010
    Initial Package Version: 7.3
    Origin: Upstream
    Upstream Status: From Upstream
    Description: Contains all upstream patches between 7.3.001 and 7.3.099
    
    diff -Naur vim73.orig/runtime/doc/eval.txt vim73/runtime/doc/eval.txt
    old new  
    16571657                                        *v:warningmsg* *warningmsg-variable*
    16581658v:warningmsg    Last given warning message.  It's allowed to set this variable.
    16591659
     1660                                        *v:windowid* *windowid-variable*
     1661v:windowid      When any X11 based GUI is running or when running in a
     1662                terminal and Vim connects to the X server (|-X|) this will be
     1663                set to the window ID.
     1664                When an MS-Windows GUI is running this will be set to the
     1665                window handle.
     1666                Otherwise the value is zero.
     1667                Note: for windows inside Vim use |winnr()|.
     1668
    16601669==============================================================================
    166116704. Builtin Functions                                    *functions*
    16621671
     
    18221831log( {expr})                    Float   natural logarithm (base e) of {expr}
    18231832log10( {expr})                  Float   logarithm of Float {expr} to base 10
    18241833map( {expr}, {string})          List/Dict  change each item in {expr} to {expr}
    1825 maparg( {name}[, {mode} [, {abbr}]])
     1834maparg( {name}[, {mode} [, {abbr} [, {dict}]]])
    18261835                                String  rhs of mapping {name} in mode {mode}
    18271836mapcheck( {name}[, {mode} [, {abbr}]])
    18281837                                String  check for mappings matching {name}
     
    39663975                further items in {expr} are processed.
    39673976
    39683977
    3969 maparg({name}[, {mode} [, {abbr}]])                     *maparg()*
    3970                 Return the rhs of mapping {name} in mode {mode}.  When there
    3971                 is no mapping for {name}, an empty String is returned.
     3978maparg({name}[, {mode} [, {abbr} [, {dict}]]])                  *maparg()*
     3979                When {dict} is omitted or zero: Return the rhs of mapping
     3980                {name} in mode {mode}.  The returned String has special
     3981                characters translated like in the output of the ":map" command
     3982                listing.
     3983               
     3984                When there is no mapping for {name}, an empty String is
     3985                returned.
     3986
     3987                The {name} can have special key names, like in the ":map"
     3988                command.
     3989
    39723990                {mode} can be one of these strings:
    39733991                        "n"     Normal
    3974                         "v"     Visual
     3992                        "v"     Visual (including Select)
    39753993                        "o"     Operator-pending
    39763994                        "i"     Insert
    39773995                        "c"     Cmd-line
     3996                        "s"     Select
     3997                        "x"     Visual
    39783998                        "l"     langmap |language-mapping|
    39793999                        ""      Normal, Visual and Operator-pending
    39804000                When {mode} is omitted, the modes for "" are used.
     4001
    39814002                When {abbr} is there and it is non-zero use abbreviations
    39824003                instead of mappings.
    3983                 The {name} can have special key names, like in the ":map"
    3984                 command.  The returned String has special characters
    3985                 translated like in the output of the ":map" command listing.
     4004
     4005                When {dict} is there and it is non-zero return a dictionary
     4006                containing all the information of the mapping with the
     4007                following items:
     4008                  "lhs"      The {lhs} of the mapping.
     4009                  "rhs"      The {rhs} of the mapping as typed.
     4010                  "silent"   1 for a |:map-silent| mapping, else 0.
     4011                  "noremap"  1 if the {rhs} of the mapping is remappable.
     4012                  "expr"     1 for an expression mapping (|:map-<expr>|).
     4013                  "buffer"   1 for a buffer local mapping (|:map-local|).
     4014                  "mode"     Modes for which the mapping is defined. In
     4015                             addition to the modes mentioned above, these
     4016                             characters will be used:
     4017                             " "     Normal, Visual and Operator-pending
     4018                             "!"     Insert and Commandline mode
     4019                                     (|mapmpde-ic|)
     4020                  "sid"      the Script local ID, used for <sid> mappings
     4021                             (|<SID>|)
     4022
    39864023                The mappings local to the current buffer are checked first,
    39874024                then the global mappings.
    39884025                This function can be used to map a key even when it's already
  • runtime/doc/netbeans.txt

    diff -Naur vim73.orig/runtime/doc/netbeans.txt vim73/runtime/doc/netbeans.txt
    old new  
    1 *netbeans.txt*  For Vim version 7.3.  Last change: 2010 Jul 20
     1*netbeans.txt*  For Vim version 7.3.  Last change: 2010 Aug 20
    22
    33
    44                  VIM REFERENCE MANUAL    by Gordon Prieur et al.
     
    118118uncommenting a line with "--disable-netbeans" in the Makefile.
    119119
    120120Currently the NetBeans interface is supported by Vim running in a terminal and
    121 by GVim when it is run with one of the following GUIs: GTK, GNOME, and Motif.
     121by GVim when it is run with one of the following GUIs: GTK, GNOME, Windows,
     122Athena and Motif.
    122123
    123124If Motif support is required the user must supply XPM libraries.  See
    124125|workshop-xpm| for details on obtaining the latest version of XPM.
  • runtime/doc/options.txt

    diff -Naur vim73.orig/runtime/doc/options.txt vim73/runtime/doc/options.txt
    old new  
    14341434                        explicitly accessed using the "* notation.  Also see
    14351435                        |gui-clipboard|.
    14361436
     1437        unnamedplus     A variant of "unnamed" flag which uses the clipboard
     1438                        register '+' (|quoteplus|) instead of register '*' for
     1439                        all operations except yank.  Yank shall copy the text
     1440                        into register '+' and also into '*' when "unnamed" is
     1441                        included.
     1442                        Only available with the |+x11| feature.
     1443                        Availability can be checked with: >
     1444                                if has('unnamedplus')
     1445<
    14371446        autoselect      Works like the 'a' flag in 'guioptions': If present,
    14381447                        then whenever Visual mode is started, or the Visual
    14391448                        area extended, Vim tries to become the owner of the
     
    75307539        !       When included, save and restore global variables that start
    75317540                with an uppercase letter, and don't contain a lowercase
    75327541                letter.  Thus "KEEPTHIS and "K_L_M" are stored, but "KeepThis"
    7533                 and "_K_L_M" are not.  Only String and Number types are
    7534                 stored.
     7542                and "_K_L_M" are not.  Nested List and Dict items may not be
     7543                read back correctly, you end up with a string representation
     7544                instead.
    75357545        "       Maximum number of lines saved for each register.  Old name of
    75367546                the '<' item, with the disadvantage that you need to put a
    75377547                backslash before the ", otherwise it will be recognized as the
     
    77477757        a pattern from the list.  This avoids problems when a future version
    77487758        uses another default.
    77497759
     7760
     7761                        *'wildignorecase* *'wic'* *'nowildignorecase* *'nowic'*
     7762'wildignorecase' 'wic'  boolean (default off)
     7763                        global
     7764                        {not in Vi}
     7765        When set case is ignored when completing file names and directories.
     7766        Has no effect on systems where file name case is generally ignored.
     7767        Does not apply when the shell is used to expand wildcards, which
     7768        happens when there are special characters.
     7769
     7770
    77507771                                *'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
    77517772'wildmenu' 'wmnu'       boolean (default off)
    77527773                        global
  • src/GvimExt/Make_ming.mak

    diff -Naur vim73.orig/src/GvimExt/Make_ming.mak vim73/src/GvimExt/Make_ming.mak
    old new  
    1717# check also the executables
    1818MINGWOLD = no
    1919
     20# Link against the shared versions of libgcc/libstdc++ by default.  Set
     21# STATIC_STDCPLUS to "yes" to link against static versions instead.
     22STATIC_STDCPLUS=no
     23#STATIC_STDCPLUS=yes
     24
     25# Note: -static-libstdc++ is not available until gcc 4.5.x.
     26LDFLAGS += -shared
     27ifeq (yes, $(STATIC_STDCPLUS))
     28LDFLAGS += -static-libgcc -static-libstdc++
     29endif
     30
    2031ifeq ($(CROSS),yes)
    2132DEL = rm
    2233ifeq ($(MINGWOLD),yes)
     
    3445endif
    3546CXX := $(CROSS_COMPILE)g++
    3647WINDRES := $(CROSS_COMPILE)windres
     48WINDRES_CXX = $(CXX)
     49WINDRES_FLAGS = --preprocessor="$(WINDRES_CXX) -E -xc" -DRC_INVOKED
    3750LIBS :=  -luuid
    3851RES  := gvimext.res
    3952DEFFILE = gvimext_ming.def
     
    4659all: all-before $(DLL) all-after
    4760
    4861$(DLL): $(OBJ) $(RES) $(DEFFILE)
    49         $(CXX) -shared $(CXXFLAGS) -s -o $@ \
     62        $(CXX) $(LDFLAGS) $(CXXFLAGS) -s -o $@ \
    5063                -Wl,--enable-auto-image-base \
    5164                -Wl,--enable-auto-import \
    5265                -Wl,--whole-archive \
     
    5871        $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@
    5972
    6073$(RES): gvimext_ming.rc
    61         $(WINDRES) --input-format=rc --output-format=coff -DMING $? -o $@
     74        $(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@
    6275
    6376clean: clean-custom
    6477        -$(DEL)  $(OBJ) $(RES) $(DLL)
  • src/Make_cyg.mak

    diff -Naur vim73.orig/src/Make_cyg.mak vim73/src/Make_cyg.mak
    old new  
    11#
    22# Makefile for VIM on Win32, using Cygnus gcc
    3 # Last updated by Dan Sharp.  Last Change: 2010 Feb 24
     3# Last updated by Dan Sharp.  Last Change: 2010 Nov 03
    44#
    55# Also read INSTALLpc.txt!
    66#
     
    2727#   MZSCHEME_VER      define to version of MzScheme being used (209_000)
    2828#   DYNAMIC_MZSCHEME  no or yes: use yes to load the MzScheme DLLs dynamically (yes)
    2929#   MZSCHEME_DLLS     path to MzScheme DLLs (libmzgc and libmzsch), for "static" build.
     30#   MZSCHEME_USE_RACKET  define to use "racket" instead of "mzsch".
    3031# LUA   define to path to Lua dir to get Lua support (not defined)
    3132#   LUA_VER         define to version of Lua being used (51)
    3233#   DYNAMIC_LUA  no or yes: use yes to load the Lua DLL dynamically (yes)
     
    254255MZSCHEME_GENERATE_BASE=no
    255256endif
    256257
     258ifndef MZSCHEME_USE_RACKET
     259MZSCHEME_MAIN_LIB=mzsch
     260else
     261MZSCHEME_MAIN_LIB=racket
     262endif
     263
    257264ifeq (yes, $(DYNAMIC_MZSCHEME))
    258 DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
     265DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
    259266else
    260267ifndef MZSCHEME_DLLS
    261268MZSCHEME_DLLS = $(MZSCHEME)
    262269endif
    263270ifeq (yes,$(MZSCHEME_PRECISE_GC))
    264 MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
     271MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
    265272else
    266 MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
     273MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
    267274endif
    268275EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB)
    269276endif
  • src/Make_ming.mak

    diff -Naur vim73.orig/src/Make_ming.mak vim73/src/Make_ming.mak
    old new  
    5656NETBEANS=$(GUI)
    5757
    5858
     59# Link against the shared version of libstdc++ by default.  Set
     60# STATIC_STDCPLUS to "yes" to link against static version instead.
     61ifndef STATIC_STDCPLUS
     62STATIC_STDCPLUS=no
     63endif
     64
    5965# If the user doesn't want gettext, undefine it.
    6066ifeq (no, $(GETTEXT))
    6167GETTEXT=
     
    141147MZSCHEME_GENERATE_BASE=no
    142148endif
    143149
     150ifndef MZSCHEME_USE_RACKET
     151MZSCHEME_MAIN_LIB=mzsch
     152else
     153MZSCHEME_MAIN_LIB=racket
     154endif
     155
    144156ifeq (no,$(DYNAMIC_MZSCHEME))
    145157ifeq (yes,$(MZSCHEME_PRECISE_GC))
    146 MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
     158MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
    147159else
    148 MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
     160MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
    149161endif
    150162# the modern MinGW can dynamically link to dlls directly.
    151163# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
     
    304316endif
    305317CC := $(CROSS_COMPILE)gcc
    306318WINDRES := $(CROSS_COMPILE)windres
     319WINDRES_CC = $(CC)
    307320
    308321#>>>>> end of choices
    309322###########################################################################
    310323
    311324CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall
     325WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
    312326
    313327ifdef GETTEXT
    314328DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
     
    343357ifdef MZSCHEME
    344358CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
    345359ifeq (yes, $(DYNAMIC_MZSCHEME))
    346 CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
     360CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
    347361endif
    348362endif
    349363
     
    571585endif
    572586
    573587ifeq (yes, $(OLE))
    574 LIB += -loleaut32 -lstdc++
     588LIB += -loleaut32
    575589OBJ += $(OUTDIR)/if_ole.o
     590ifeq (yes, $(STATIC_STDCPLUS))
     591LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
     592else
     593LIB += -lstdc++
     594endif
    576595endif
    577596
    578597ifeq (yes, $(MBYTE))
     
    650669        $(CC) -c $(CFLAGS) $< -o $@
    651670
    652671$(OUTDIR)/vimres.res: vim.rc version.h gui_w32_rc.h
    653         $(WINDRES) $(DEFINES) vim.rc $(OUTDIR)/vimres.res
     672        $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) vim.rc $(OUTDIR)/vimres.res
    654673
    655674$(OUTDIR)/vimrc.o: $(OUTDIR)/vimres.res
    656         $(WINDRES) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.o
     675        $(WINDRES) $(WINDRES_FLAGS) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.o
    657676
    658677$(OUTDIR):
    659678        $(MKDIR) $(OUTDIR)
  • src/Make_mvc.mak

    diff -Naur vim73.orig/src/Make_mvc.mak vim73/src/Make_mvc.mak
    old new  
    380380!if "$(_NMAKE_VER)" == "10.00.30319.01"
    381381MSVCVER = 10.0
    382382!endif
    383 !if "$(_NMAKE_VER)" == "9.00.30729.01"
    384 MSVCVER = 9.0
    385 !endif
    386383!endif
    387384
    388385# Abort bulding VIM if version of VC is unrecognised.
     
    705702MZSCHEME_VER = 205_000
    706703!endif
    707704CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
    708 !if EXIST("$(MZSCHEME)\collects\scheme\base.ss")
    709 # for MzScheme 4.x we need to include byte code for basic Scheme stuff
     705!if EXIST("$(MZSCHEME)\collects\scheme\base.ss") \
     706        || EXIST("$(MZSCHEME)\collects\scheme\base.rkt")
     707# for MzScheme >= 4 we need to include byte code for basic Scheme stuff
    710708MZSCHEME_EXTRA_DEP = mzscheme_base.c
    711709CFLAGS = $(CFLAGS) -DINCLUDE_MZSCHEME_BASE
    712710!endif
    713 !if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib") \
     711!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib")
     712MZSCHEME_MAIN_LIB=mzsch
     713!else
     714MZSCHEME_MAIN_LIB=racket
     715!endif
     716!if EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \
    714717        && !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib")
    715718!message Building with Precise GC
    716719MZSCHEME_PRECISE_GC = yes
     
    722725!endif
    723726!message MzScheme DLLs will be loaded dynamically
    724727CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME \
    725                 -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" \
     728                -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \
    726729                -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
    727730!else
    728731!if "$(MZSCHEME_DEBUG)" == "yes"
     
    730733!endif
    731734!if "$(MZSCHEME_PRECISE_GC)" == "yes"
    732735# Precise GC does not use separate dll
    733 MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
     736MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
    734737!else
    735738MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \
    736                 $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
     739                $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib
    737740!endif
    738741!endif
    739742MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
  • src/Makefile

    diff -Naur vim73.orig/src/Makefile vim73/src/Makefile
    old new  
    414414# However, this may still cause problems, such as "import termios" failing.
    415415# Build two separate versions of Vim in that case.
    416416#CONF_OPT_PYTHON = --enable-pythoninterp
     417#CONF_OPT_PYTHON = --enable-pythoninterp=dynamic
    417418#CONF_OPT_PYTHON3 = --enable-python3interp
     419#CONF_OPT_PYTHON3 = --enable-python3interp=dynamic
    418420
    419421# RUBY
    420422# Uncomment this when you want to include the Ruby interface.
     423# First one for static linking, second one for loading when used.
    421424# Note: you need the development package (e.g., ruby1.9.1-dev on Ubuntu).
    422425#CONF_OPT_RUBY = --enable-rubyinterp
     426#CONF_OPT_RUBY = --enable-rubyinterp=dynamic
    423427#CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1
    424428
    425429# TCL
     
    10471051INSTALL_DATA    = cp
    10481052INSTALL_DATA_R  = cp -r
    10491053
    1050 ### Program to run on installed binary
     1054### Program to run on installed binary.  Use the second one to disable strip.
    10511055#STRIP = strip
     1056#STRIP = /bin/true
    10521057
    10531058### Permissions for binaries  {{{1
    10541059BINMOD = 755
     
    13211326.SUFFIXES: .c .o .pro
    13221327
    13231328PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
    1324 POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS)
     1329POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(EXTRA_DEFS)
    13251330
    13261331ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS)
    13271332
     
    13291334# with "-E".
    13301335OSDEF_CFLAGS = $(PRE_DEFS) $(POST_DEFS)
    13311336
    1332 LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
     1337LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(RUBY_CFLAGS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
    13331338
    13341339LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)="
    13351340
     
    16951700        $(CCC) version.c -o objects/version.o
    16961701        @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \
    16971702                -o $(VIMTARGET) $(OBJ) objects/version.o $(ALL_LIBS)" \
    1698                 MAKE="$(MAKE)" sh $(srcdir)/link.sh
     1703                MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \
     1704                sh $(srcdir)/link.sh
    16991705
    17001706xxd/xxd$(EXEEXT): xxd/xxd.c
    17011707        cd xxd; CC="$(CC)" CFLAGS="$(CPPFLAGS) $(CFLAGS)" \
     
    25322538        $(CCC) $(PYTHON3_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) -o $@ if_python3.c
    25332539
    25342540objects/if_ruby.o: if_ruby.c
    2535         $(CCC) -o $@ if_ruby.c
     2541        $(CCC) $(RUBY_CFLAGS) -o $@ if_ruby.c
    25362542
    25372543objects/if_sniff.o: if_sniff.c
    25382544        $(CCC) -o $@ if_sniff.c
  • src/auto/configure

    diff -Naur vim73.orig/src/auto/configure vim73/src/auto/configure
    old new  
    593593
    594594ac_subst_vars='LTLIBOBJS
    595595LIBOBJS
     596LINK_AS_NEEDED
    596597DEPEND_CFLAGS_FILTER
    597598MAKEMO
    598599MSGFMT
     
    14271428  --enable-pythoninterp=OPTS   Include Python interpreter. default=no OPTS=no/yes/dynamic
    14281429  --enable-python3interp=OPTS   Include Python3 interpreter. default=no OPTS=no/yes/dynamic
    14291430  --enable-tclinterp      Include Tcl interpreter.
    1430   --enable-rubyinterp     Include Ruby interpreter.
     1431  --enable-rubyinterp=OPTS     Include Ruby interpreter.  default=no OPTS=no/yes/dynamic
    14311432  --enable-cscope         Include cscope interface.
    14321433  --enable-workshop       Include Sun Visual Workshop support.
    14331434  --disable-netbeans      Disable NetBeans integration support.
     
    48624863      else
    48634864        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
    48644865$as_echo "no" >&6; }
    4865         { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/plt/" >&5
    4866 $as_echo_n "checking if scheme.h can be found in /usr/include/plt/... " >&6; }
    4867         if test -f /usr/include/plt/scheme.h; then
     4866        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket" >&5
     4867$as_echo_n "checking if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket... " >&6; }
     4868        if test -f $vi_cv_path_mzscheme_pfx/include/racket/scheme.h; then
    48684869          { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
    48694870$as_echo "yes" >&6; }
    4870           SCHEME_INC=/usr/include/plt
     4871          SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
    48714872        else
    48724873          { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
    48734874$as_echo "no" >&6; }
    4874           vi_cv_path_mzscheme_pfx=
     4875          { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/plt/" >&5
     4876$as_echo_n "checking if scheme.h can be found in /usr/include/plt/... " >&6; }
     4877          if test -f /usr/include/plt/scheme.h; then
     4878            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
     4879$as_echo "yes" >&6; }
     4880            SCHEME_INC=/usr/include/plt
     4881          else
     4882            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     4883$as_echo "no" >&6; }
     4884            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if scheme.h can be found in /usr/include/racket/" >&5
     4885$as_echo_n "checking if scheme.h can be found in /usr/include/racket/... " >&6; }
     4886            if test -f /usr/include/racket/scheme.h; then
     4887              { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
     4888$as_echo "yes" >&6; }
     4889              SCHEME_INC=/usr/include/racket
     4890            else
     4891              { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     4892$as_echo "no" >&6; }
     4893              vi_cv_path_mzscheme_pfx=
     4894            fi
     4895          fi
    48754896        fi
    48764897      fi
    48774898    fi
     
    48834904    elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
    48844905      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
    48854906      MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
    4886     elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
     4907    elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then
     4908      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"
     4909      MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
     4910    elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.a"; then
     4911      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
     4912    elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"; then
    48874913      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
    48884914    else
    48894915            if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
    48904916        MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
    48914917        MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
     4918      elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.so"; then
     4919        MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket3m"
     4920        MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
     4921      elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.so"; then
     4922        MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket -lmzgc"
    48924923      else
    48934924        MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
    48944925      fi
     
    49014932    fi
    49024933    if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
    49034934      SCHEME_COLLECTS=lib/plt/
     4935    else
     4936      if test -d $vi_cv_path_mzscheme_pfx/lib/racket/collects; then
     4937        SCHEME_COLLECTS=lib/racket/
     4938      fi
    49044939    fi
    49054940    if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
    4906             MZSCHEME_EXTRA="mzscheme_base.c"
    4907       MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
     4941      MZSCHEME_EXTRA="mzscheme_base.c"
     4942    else
     4943      if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
     4944        MZSCHEME_EXTRA="mzscheme_base.c"
     4945      fi
     4946    fi
     4947    if test "X$MZSCHEME_EXTRA" != "X" ; then
     4948            MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
    49084949      MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
    49094950    fi
    49104951    MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
     
    52855326
    52865327        PYTHON_LIBS="${vi_cv_path_python_plibs}"
    52875328        if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
    5288           PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
     5329          PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
    52895330        else
    5290           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}"
     5331          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}\\\""
    52915332        fi
    52925333        PYTHON_SRC="if_python.c"
    52935334                if test "x$MACOSX" = "xyes"; then
     
    52985339        if test "${vi_cv_var_python_version}" = "1.4"; then
    52995340           PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
    53005341        fi
    5301         PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
     5342    PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
    53025343
    53035344                                                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5
    53045345$as_echo_n "checking if -pthread should be used... " >&6; }
     
    55605601
    55615602      PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
    55625603      if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
    5563         PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
     5604        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
    55645605      else
    5565         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}"
     5606        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}\\\""
    55665607      fi
    55675608      PYTHON3_SRC="if_python3.c"
    55685609            if test "x$MACOSX" = "xyes"; then
     
    56675708
    56685709  $as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h
    56695710
    5670   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL" >&5
    5671 $as_echo_n "checking whether we can do without RTLD_GLOBAL... " >&6; }
     5711  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python" >&5
     5712$as_echo_n "checking whether we can do without RTLD_GLOBAL for Python... " >&6; }
    56725713  cflags_save=$CFLAGS
    5673   CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
     5714  CFLAGS="$CFLAGS $PYTHON_CFLAGS"
    56745715  ldflags_save=$LDFLAGS
    56755716  LDFLAGS="$LDFLAGS -ldl"
    56765717  if test "$cross_compiling" = yes; then :
     
    56895730     * Only the first pyhton version used will be switched on.
    56905731     */
    56915732
    5692     int no_rtl_global_needed_for(char *python_instsoname)
     5733    int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
    56935734    {
    56945735      int needed = 0;
    56955736      void* pylib = dlopen(python_instsoname, RTLD_LAZY);
    56965737      if (pylib != 0)
    56975738      {
     5739          void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
    56985740          void (*init)(void) = dlsym(pylib, "Py_Initialize");
    56995741          int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
    57005742          void (*final)(void) = dlsym(pylib, "Py_Finalize");
     5743          (*pfx)(prefix);
    57015744          (*init)();
    57025745          needed = (*simple)("import termios") == -1;
    57035746          (*final)();
     
    57095752    int main(int argc, char** argv)
    57105753    {
    57115754      int not_needed = 0;
    5712       if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0"))
     5755      if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}"))
    57135756            not_needed = 1;
    57145757      return !not_needed;
    57155758    }
     
    57265769  conftest.$ac_objext conftest.beam conftest.$ac_ext
    57275770fi
    57285771
     5772
    57295773  CFLAGS=$cflags_save
    57305774  LDFLAGS=$ldflags_save
     5775
     5776  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python3" >&5
     5777$as_echo_n "checking whether we can do without RTLD_GLOBAL for Python3... " >&6; }
     5778  cflags_save=$CFLAGS
     5779  CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
     5780  ldflags_save=$LDFLAGS
     5781  LDFLAGS="$LDFLAGS -ldl"
     5782  if test "$cross_compiling" = yes; then :
     5783  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
     5784$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
     5785as_fn_error "cannot run test program while cross compiling
     5786See \`config.log' for more details." "$LINENO" 5; }
     5787else
     5788  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     5789/* end confdefs.h.  */
     5790
     5791    #include <dlfcn.h>
     5792    #include <wchar.h>
     5793    /* If this program fails, then RTLD_GLOBAL is needed.
     5794     * RTLD_GLOBAL will be used and then it is not possible to
     5795     * have both python versions enabled in the same vim instance.
     5796     * Only the first pyhton version used will be switched on.
     5797     */
     5798
     5799    int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
     5800    {
     5801      int needed = 0;
     5802      void* pylib = dlopen(python_instsoname, RTLD_LAZY);
     5803      if (pylib != 0)
     5804      {
     5805          void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
     5806          void (*init)(void) = dlsym(pylib, "Py_Initialize");
     5807          int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
     5808          void (*final)(void) = dlsym(pylib, "Py_Finalize");
     5809          (*pfx)(prefix);
     5810          (*init)();
     5811          needed = (*simple)("import termios") == -1;
     5812          (*final)();
     5813          dlclose(pylib);
     5814      }
     5815      return !needed;
     5816    }
     5817
     5818    int main(int argc, char** argv)
     5819    {
     5820      int not_needed = 0;
     5821      if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}"))
     5822            not_needed = 1;
     5823      return !not_needed;
     5824    }
     5825_ACEOF
     5826if ac_fn_c_try_run "$LINENO"; then :
     5827  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
     5828$as_echo "yes" >&6; };$as_echo "#define PY3_NO_RTLD_GLOBAL 1" >>confdefs.h
     5829
     5830else
     5831  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     5832$as_echo "no" >&6; }
     5833fi
     5834rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
     5835  conftest.$ac_objext conftest.beam conftest.$ac_ext
     5836fi
     5837
     5838
     5839  CFLAGS=$cflags_save
     5840  LDFLAGS=$ldflags_save
     5841
    57315842  PYTHON_SRC="if_python.c"
    57325843  PYTHON_OBJ="objects/if_python.o"
    57335844  PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
     
    61036214
    61046215{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rubyinterp" >&5
    61056216$as_echo "$enable_rubyinterp" >&6; }
    6106 if test "$enable_rubyinterp" = "yes"; then
     6217if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
    61076218  { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-ruby-command argument" >&5
    61086219$as_echo_n "checking --with-ruby-command argument... " >&6; }
    61096220
     
    62096320        RUBY_PRO="if_ruby.pro"
    62106321        $as_echo "#define FEAT_RUBY 1" >>confdefs.h
    62116322
     6323        if test "$enable_rubyinterp" = "dynamic"; then
     6324          libruby=`$vi_cv_path_ruby -r rbconfig -e 'printf "lib%s.%s\n", Config::CONFIG["RUBY_SO_NAME"], Config::CONFIG["DLEXT"]'`
     6325          $as_echo "#define DYNAMIC_RUBY 1" >>confdefs.h
     6326
     6327          RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
     6328          RUBY_LIBS=
     6329        fi
    62126330      else
    62136331        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found; disabling Ruby" >&5
    62146332$as_echo "not found; disabling Ruby" >&6; }
     
    1235712475fi
    1235812476
    1235912477
     12478{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5
     12479$as_echo_n "checking linker --as-needed support... " >&6; }
     12480LINK_AS_NEEDED=
     12481# Check if linker supports --as-needed and --no-as-needed options
     12482if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
     12483  LDFLAGS="$LDFLAGS -Wl,--as-needed"
     12484  LINK_AS_NEEDED=yes
     12485fi
     12486if test "$LINK_AS_NEEDED" = yes; then
     12487  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
     12488$as_echo "yes" >&6; }
     12489else
     12490  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
     12491$as_echo "no" >&6; }
     12492fi
     12493
     12494
    1236012495ac_config_files="$ac_config_files auto/config.mk:config.mk.in"
    1236112496
    1236212497cat >confcache <<\_ACEOF
  • src/buffer.c

    diff -Naur vim73.orig/src/buffer.c vim73/src/buffer.c
    old new  
    639639    {
    640640        clear_wininfo(buf);             /* including window-local options */
    641641        free_buf_options(buf, TRUE);
     642#ifdef FEAT_SPELL
     643        ga_clear(&buf->b_s.b_langp);
     644#endif
    642645    }
    643646#ifdef FEAT_EVAL
    644647    vars_clear(&buf->b_vars.dv_hashtab); /* free all internal variables */
     
    661664    vim_free(buf->b_start_fenc);
    662665    buf->b_start_fenc = NULL;
    663666#endif
    664 #ifdef FEAT_SPELL
    665     ga_clear(&buf->b_s.b_langp);
    666 #endif
    667667}
    668668
    669669/*
     
    12881288    /* Go to the other buffer. */
    12891289    set_curbuf(buf, action);
    12901290
    1291 #if defined(FEAT_LISTCMDS) && defined(FEAT_SCROLLBIND)
     1291#if defined(FEAT_LISTCMDS) \
     1292        && (defined(FEAT_SCROLLBIND) || defined(FEAT_CURSORBIND))
    12921293    if (action == DOBUF_SPLIT)
    1293         curwin->w_p_scb = FALSE;        /* reset 'scrollbind' */
     1294    {
     1295        RESET_BINDING(curwin);  /* reset 'scrollbind' and 'cursorbind' */
     1296    }
    12941297#endif
    12951298
    12961299#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
     
    19171920                tabpage_new();
    19181921            else if (win_split(0, 0) == FAIL)   /* Open in a new window */
    19191922                return FAIL;
    1920 # ifdef FEAT_SCROLLBIND
    1921             curwin->w_p_scb = FALSE;
    1922 # endif
     1923            RESET_BINDING(curwin);
    19231924        }
    19241925    }
    19251926#endif
  • src/config.h.in

    diff -Naur vim73.orig/src/config.h.in vim73/src/config.h.in
    old new  
    349349/* Define if you want to include the Ruby interpreter. */
    350350#undef FEAT_RUBY
    351351
     352/* Define for linking via dlopen() or LoadLibrary() */
     353#undef DYNAMIC_RUBY
     354
    352355/* Define if you want to include the Tcl interpreter. */
    353356#undef FEAT_TCL
    354357
  • src/config.mk.in

    diff -Naur vim73.orig/src/config.mk.in vim73/src/config.mk.in
    old new  
    3030CPP             = @CPP@
    3131CPP_MM          = @CPP_MM@
    3232DEPEND_CFLAGS_FILTER = @DEPEND_CFLAGS_FILTER@
     33LINK_AS_NEEDED  = @LINK_AS_NEEDED@
    3334X_CFLAGS        = @X_CFLAGS@
    3435X_LIBS_DIR      = @X_LIBS@
    3536X_PRE_LIBS      = @X_PRE_LIBS@
  • src/configure.in

    diff -Naur vim73.orig/src/configure.in vim73/src/configure.in
    old new  
    568568        SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
    569569      else
    570570        AC_MSG_RESULT(no)
    571         AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
    572         if test -f /usr/include/plt/scheme.h; then
     571        AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket)
     572        if test -f $vi_cv_path_mzscheme_pfx/include/racket/scheme.h; then
    573573          AC_MSG_RESULT(yes)
    574           SCHEME_INC=/usr/include/plt
     574          SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
    575575        else
    576576          AC_MSG_RESULT(no)
    577           vi_cv_path_mzscheme_pfx=
     577          AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
     578          if test -f /usr/include/plt/scheme.h; then
     579            AC_MSG_RESULT(yes)
     580            SCHEME_INC=/usr/include/plt
     581          else
     582            AC_MSG_RESULT(no)
     583            AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/)
     584            if test -f /usr/include/racket/scheme.h; then
     585              AC_MSG_RESULT(yes)
     586              SCHEME_INC=/usr/include/racket
     587            else
     588              AC_MSG_RESULT(no)
     589              vi_cv_path_mzscheme_pfx=
     590            fi
     591          fi
    578592        fi
    579593      fi
    580594    fi
     
    586600    elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
    587601      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
    588602      MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
    589     elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
     603    elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then
     604      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"
     605      MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
     606    elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.a"; then
     607      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libracket.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
     608    elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a"; then
    590609      MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
    591610    else
    592611      dnl Using shared objects
    593612      if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
    594613        MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
    595614        MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
     615      elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.so"; then
     616        MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket3m"
     617        MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
     618      elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket.so"; then
     619        MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lracket -lmzgc"
    596620      else
    597621        MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
    598622      fi
     
    607631    fi
    608632    if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
    609633      SCHEME_COLLECTS=lib/plt/
     634    else
     635      if test -d $vi_cv_path_mzscheme_pfx/lib/racket/collects; then
     636        SCHEME_COLLECTS=lib/racket/
     637      fi
    610638    fi
    611639    if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
    612       dnl need to generate bytecode for MzScheme base
    613640      MZSCHEME_EXTRA="mzscheme_base.c"
     641    else
     642      if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
     643        MZSCHEME_EXTRA="mzscheme_base.c"
     644      fi
     645    fi
     646    if test "X$MZSCHEME_EXTRA" != "X" ; then
     647      dnl need to generate bytecode for MzScheme base
    614648      MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
    615649      MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
    616650    fi
     
    857891
    858892        PYTHON_LIBS="${vi_cv_path_python_plibs}"
    859893        if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
    860           PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
     894          PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\""
    861895        else
    862           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}"
     896          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}\\\""
    863897        fi
    864898        PYTHON_SRC="if_python.c"
    865899        dnl For Mac OSX 10.2 config.o is included in the Python library.
     
    871905        if test "${vi_cv_var_python_version}" = "1.4"; then
    872906           PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
    873907        fi
    874         PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
     908    PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
    875909
    876910        dnl On FreeBSD linking with "-pthread" is required to use threads.
    877911        dnl _THREAD_SAFE must be used for compiling then.
     
    10291063
    10301064      PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
    10311065      if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
    1032         PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}"
     1066        PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
    10331067      else
    1034         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}"
     1068        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}\\\""
    10351069      fi
    10361070      PYTHON3_SRC="if_python3.c"
    10371071      dnl For Mac OSX 10.2 config.o is included in the Python library.
     
    11091143if test "$python_ok" = yes && test "$python3_ok" = yes; then
    11101144  AC_DEFINE(DYNAMIC_PYTHON)
    11111145  AC_DEFINE(DYNAMIC_PYTHON3)
    1112   AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL)
     1146  AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
    11131147  cflags_save=$CFLAGS
    1114   CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
     1148  CFLAGS="$CFLAGS $PYTHON_CFLAGS"
    11151149  ldflags_save=$LDFLAGS
    11161150  LDFLAGS="$LDFLAGS -ldl"
    11171151  AC_RUN_IFELSE([
     
    11221156     * Only the first pyhton version used will be switched on.
    11231157     */
    11241158
    1125     int no_rtl_global_needed_for(char *python_instsoname)
     1159    int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
    11261160    {
    11271161      int needed = 0;
    11281162      void* pylib = dlopen(python_instsoname, RTLD_LAZY);
    11291163      if (pylib != 0)
    11301164      {
     1165          void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
    11311166          void (*init)(void) = dlsym(pylib, "Py_Initialize");
    11321167          int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
    11331168          void (*final)(void) = dlsym(pylib, "Py_Finalize");
     1169          (*pfx)(prefix);
    11341170          (*init)();
    11351171          needed = (*simple)("import termios") == -1;
    11361172          (*final)();
     
    11421178    int main(int argc, char** argv)
    11431179    {
    11441180      int not_needed = 0;
    1145       if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0"))
     1181      if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}"))
    11461182            not_needed = 1;
    11471183      return !not_needed;
    11481184    }],
    11491185    [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
     1186
     1187  CFLAGS=$cflags_save
     1188  LDFLAGS=$ldflags_save
     1189
     1190  AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
     1191  cflags_save=$CFLAGS
     1192  CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
     1193  ldflags_save=$LDFLAGS
     1194  LDFLAGS="$LDFLAGS -ldl"
     1195  AC_RUN_IFELSE([
     1196    #include <dlfcn.h>
     1197    #include <wchar.h>
     1198    /* If this program fails, then RTLD_GLOBAL is needed.
     1199     * RTLD_GLOBAL will be used and then it is not possible to
     1200     * have both python versions enabled in the same vim instance.
     1201     * Only the first pyhton version used will be switched on.
     1202     */
     1203
     1204    int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
     1205    {
     1206      int needed = 0;
     1207      void* pylib = dlopen(python_instsoname, RTLD_LAZY);
     1208      if (pylib != 0)
     1209      {
     1210          void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
     1211          void (*init)(void) = dlsym(pylib, "Py_Initialize");
     1212          int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
     1213          void (*final)(void) = dlsym(pylib, "Py_Finalize");
     1214          (*pfx)(prefix);
     1215          (*init)();
     1216          needed = (*simple)("import termios") == -1;
     1217          (*final)();
     1218          dlclose(pylib);
     1219      }
     1220      return !needed;
     1221    }
     1222
     1223    int main(int argc, char** argv)
     1224    {
     1225      int not_needed = 0;
     1226      if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}"))
     1227            not_needed = 1;
     1228      return !not_needed;
     1229    }],
     1230    [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
     1231
    11501232  CFLAGS=$cflags_save
    11511233  LDFLAGS=$ldflags_save
     1234
    11521235  PYTHON_SRC="if_python.c"
    11531236  PYTHON_OBJ="objects/if_python.o"
    11541237  PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
     
    12991382
    13001383AC_MSG_CHECKING(--enable-rubyinterp argument)
    13011384AC_ARG_ENABLE(rubyinterp,
    1302         [  --enable-rubyinterp     Include Ruby interpreter.], ,
     1385        [  --enable-rubyinterp[=OPTS]     Include Ruby interpreter.  [default=no] [OPTS=no/yes/dynamic]], ,
    13031386        [enable_rubyinterp="no"])
    13041387AC_MSG_RESULT($enable_rubyinterp)
    1305 if test "$enable_rubyinterp" = "yes"; then
     1388if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
    13061389  AC_MSG_CHECKING(--with-ruby-command argument)
    13071390  AC_ARG_WITH(ruby-command, [  --with-ruby-command=RUBY  name of the Ruby command (default: ruby)],
    13081391        RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
     
    13601443        RUBY_OBJ="objects/if_ruby.o"
    13611444        RUBY_PRO="if_ruby.pro"
    13621445        AC_DEFINE(FEAT_RUBY)
     1446        if test "$enable_rubyinterp" = "dynamic"; then
     1447          libruby=`$vi_cv_path_ruby -r rbconfig -e 'printf "lib%s.%s\n", Config::CONFIG[["RUBY_SO_NAME"]], Config::CONFIG[["DLEXT"]]'`
     1448          AC_DEFINE(DYNAMIC_RUBY)
     1449          RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
     1450          RUBY_LIBS=
     1451        fi
    13631452      else
    13641453        AC_MSG_RESULT(not found; disabling Ruby)
    13651454      fi
     
    34873576fi
    34883577AC_SUBST(DEPEND_CFLAGS_FILTER)
    34893578
     3579dnl link.sh tries to avoid overlinking in a hackish way.
     3580dnl At least GNU ld supports --as-needed which provides the same functionality
     3581dnl at linker level. Let's use it.
     3582AC_MSG_CHECKING(linker --as-needed support)
     3583LINK_AS_NEEDED=
     3584# Check if linker supports --as-needed and --no-as-needed options
     3585if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
     3586  LDFLAGS="$LDFLAGS -Wl,--as-needed"
     3587  LINK_AS_NEEDED=yes
     3588fi
     3589if test "$LINK_AS_NEEDED" = yes; then
     3590  AC_MSG_RESULT(yes)
     3591else
     3592  AC_MSG_RESULT(no)
     3593fi
     3594AC_SUBST(LINK_AS_NEEDED)
     3595
    34903596dnl write output files
    34913597AC_OUTPUT(auto/config.mk:config.mk.in)
    34923598
  • src/diff.c

    diff -Naur vim73.orig/src/diff.c vim73/src/diff.c
    old new  
    11271127# endif
    11281128
    11291129    wp->w_p_diff = TRUE;
     1130    /* Use 'scrollbind' and 'cursorbind' when available */
     1131#ifdef FEAT_SCROLLBIND
     1132    wp->w_p_scb = TRUE;
     1133#endif
    11301134#ifdef FEAT_CURSORBIND
    1131     /* Use cursorbind if it's available */
    11321135    wp->w_p_crb = TRUE;
    11331136#endif
    1134     wp->w_p_scb = TRUE;
    11351137    wp->w_p_wrap = FALSE;
    11361138# ifdef FEAT_FOLDING
    11371139    curwin = wp;
     
    11771179        {
    11781180            /* Set 'diff', 'scrollbind' off and 'wrap' on. */
    11791181            wp->w_p_diff = FALSE;
    1180 #ifdef FEAT_CURSORBIND
    1181             wp->w_p_crb = FALSE;
    1182 #endif
    1183             wp->w_p_scb = FALSE;
     1182            RESET_BINDING(wp);
    11841183            wp->w_p_wrap = TRUE;
    11851184#ifdef FEAT_FOLDING
    11861185            curwin = wp;
  • src/edit.c

    diff -Naur vim73.orig/src/edit.c vim73/src/edit.c
    old new  
    5858};
    5959
    6060static char e_hitend[] = N_("Hit end of paragraph");
     61#ifdef FEAT_COMPL_FUNC
     62static char e_complwin[] = N_("E839: Completion function changed window");
     63static char e_compldel[] = N_("E840: Completion function deleted text");
     64#endif
    6165
    6266/*
    6367 * Structure used to store one match for insert completion.
     
    26582662    if (stop_arrow() == FAIL)
    26592663        return;
    26602664
     2665    compl_direction = FORWARD;
    26612666    if (startcol > curwin->w_cursor.col)
    26622667        startcol = curwin->w_cursor.col;
    26632668    compl_col = startcol;
     
    38333838    char_u      *args[2];
    38343839    char_u      *funcname;
    38353840    pos_T       pos;
     3841    win_T       *curwin_save;
     3842    buf_T       *curbuf_save;
    38363843
    38373844    funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu;
    38383845    if (*funcname == NUL)
     
    38433850    args[1] = base;
    38443851
    38453852    pos = curwin->w_cursor;
     3853    curwin_save = curwin;
     3854    curbuf_save = curbuf;
    38463855    matchlist = call_func_retlist(funcname, 2, args, FALSE);
     3856    if (curwin_save != curwin || curbuf_save != curbuf)
     3857    {
     3858        EMSG(_(e_complwin));
     3859        goto theend;
     3860    }
    38473861    curwin->w_cursor = pos;     /* restore the cursor position */
    3848     if (matchlist == NULL)
    3849         return;
     3862    check_cursor();
     3863    if (!equalpos(curwin->w_cursor, pos))
     3864    {
     3865        EMSG(_(e_compldel));
     3866        goto theend;
     3867    }
     3868    if (matchlist != NULL)
     3869        ins_compl_add_list(matchlist);
    38503870
    3851     ins_compl_add_list(matchlist);
    3852     list_unref(matchlist);
     3871theend:
     3872    if (matchlist != NULL)
     3873        list_unref(matchlist);
    38533874}
    38543875#endif /* FEAT_COMPL_FUNC */
    38553876
     
    38893910    char_u      *word;
    38903911    int         icase = FALSE;
    38913912    int         adup = FALSE;
     3913    int         aempty = FALSE;
    38923914    char_u      *(cptext[CPT_COUNT]);
    38933915
    38943916    if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL)
     
    39063928            icase = get_dict_number(tv->vval.v_dict, (char_u *)"icase");
    39073929        if (get_dict_string(tv->vval.v_dict, (char_u *)"dup", FALSE) != NULL)
    39083930            adup = get_dict_number(tv->vval.v_dict, (char_u *)"dup");
     3931        if (get_dict_string(tv->vval.v_dict, (char_u *)"empty", FALSE) != NULL)
     3932            aempty = get_dict_number(tv->vval.v_dict, (char_u *)"empty");
    39093933    }
    39103934    else
    39113935    {
    39123936        word = get_tv_string_chk(tv);
    39133937        vim_memset(cptext, 0, sizeof(cptext));
    39143938    }
    3915     if (word == NULL || *word == NUL)
     3939    if (word == NULL || (!aempty && *word == NUL))
    39163940        return FAIL;
    39173941    return ins_compl_add(word, -1, icase, NULL, cptext, dir, 0, adup);
    39183942}
     
    49945018            int         col;
    49955019            char_u      *funcname;
    49965020            pos_T       pos;
     5021            win_T       *curwin_save;
     5022            buf_T       *curbuf_save;
    49975023
    49985024            /* Call 'completefunc' or 'omnifunc' and get pattern length as a
    49995025             * string */
     
    50095035            args[0] = (char_u *)"1";
    50105036            args[1] = NULL;
    50115037            pos = curwin->w_cursor;
     5038            curwin_save = curwin;
     5039            curbuf_save = curbuf;
    50125040            col = call_func_retnr(funcname, 2, args, FALSE);
     5041            if (curwin_save != curwin || curbuf_save != curbuf)
     5042            {
     5043                EMSG(_(e_complwin));
     5044                return FAIL;
     5045            }
    50135046            curwin->w_cursor = pos;     /* restore the cursor position */
     5047            check_cursor();
     5048            if (!equalpos(curwin->w_cursor, pos))
     5049            {
     5050                EMSG(_(e_compldel));
     5051                return FAIL;
     5052            }
    50145053
    50155054            if (col < 0)
    50165055                col = curs_col;
  • src/eval.c

    diff -Naur vim73.orig/src/eval.c vim73/src/eval.c
    old new  
    1010/*
    1111 * eval.c: Expression evaluation.
    1212 */
    13 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
    14 # include "vimio.h"     /* for mch_open(), must be before vim.h */
    15 #endif
    1613
    1714#include "vim.h"
    1815
     
    362359    {VV_NAME("operator",         VAR_STRING), VV_RO},
    363360    {VV_NAME("searchforward",    VAR_NUMBER), 0},
    364361    {VV_NAME("oldfiles",         VAR_LIST), 0},
     362    {VV_NAME("windowid",         VAR_NUMBER), VV_RO},
    365363};
    366364
    367365/* shorthand */
     
    433431static void listitem_free __ARGS((listitem_T *item));
    434432static void listitem_remove __ARGS((list_T *l, listitem_T *item));
    435433static long list_len __ARGS((list_T *l));
    436 static int list_equal __ARGS((list_T *l1, list_T *l2, int ic));
    437 static int dict_equal __ARGS((dict_T *d1, dict_T *d2, int ic));
    438 static int tv_equal __ARGS((typval_T *tv1, typval_T *tv2, int ic));
     434static int list_equal __ARGS((list_T *l1, list_T *l2, int ic, int recursive));
     435static int dict_equal __ARGS((dict_T *d1, dict_T *d2, int ic, int recursive));
     436static int tv_equal __ARGS((typval_T *tv1, typval_T *tv2, int ic, int recursive));
    439437static listitem_T *list_find __ARGS((list_T *l, long n));
    440438static long list_find_nr __ARGS((list_T *l, long idx, int *errorp));
    441439static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
     
    23252323            else if (endchars != NULL
    23262324                             && vim_strchr(endchars, *skipwhite(arg)) == NULL)
    23272325                EMSG(_(e_letunexp));
    2328             else
     2326            else if (!check_secure())
    23292327            {
    23302328                c1 = name[len];
    23312329                name[len] = NUL;
     
    33373335    int         failed = FALSE;
    33383336    funcdict_T  fudi;
    33393337
     3338    if (eap->skip)
     3339    {
     3340        /* trans_function_name() doesn't work well when skipping, use eval0()
     3341         * instead to skip to any following command, e.g. for:
     3342         *   :if 0 | call dict.foo().bar() | endif  */
     3343        eval0(eap->arg, &rettv, &eap->nextcmd, FALSE);
     3344        return;
     3345    }
     3346
    33403347    tofree = trans_function_name(&arg, eap->skip, TFN_INT, &fudi);
    33413348    if (fudi.fd_newkey != NULL)
    33423349    {
     
    43494356                else
    43504357                {
    43514358                    /* Compare two Lists for being equal or unequal. */
    4352                     n1 = list_equal(rettv->vval.v_list, var2.vval.v_list, ic);
     4359                    n1 = list_equal(rettv->vval.v_list, var2.vval.v_list,
     4360                                                                   ic, FALSE);
    43534361                    if (type == TYPE_NEQUAL)
    43544362                        n1 = !n1;
    43554363                }
     
    43784386                else
    43794387                {
    43804388                    /* Compare two Dictionaries for being equal or unequal. */
    4381                     n1 = dict_equal(rettv->vval.v_dict, var2.vval.v_dict, ic);
     4389                    n1 = dict_equal(rettv->vval.v_dict, var2.vval.v_dict,
     4390                                                                   ic, FALSE);
    43824391                    if (type == TYPE_NEQUAL)
    43834392                        n1 = !n1;
    43844393                }
     
    59135922 * Return TRUE when two lists have exactly the same values.
    59145923 */
    59155924    static int
    5916 list_equal(l1, l2, ic)
     5925list_equal(l1, l2, ic, recursive)
    59175926    list_T      *l1;
    59185927    list_T      *l2;
    59195928    int         ic;     /* ignore case for strings */
     5929    int         recursive;  /* TRUE when used recursively */
    59205930{
    59215931    listitem_T  *item1, *item2;
    59225932
     
    59305940    for (item1 = l1->lv_first, item2 = l2->lv_first;
    59315941            item1 != NULL && item2 != NULL;
    59325942                               item1 = item1->li_next, item2 = item2->li_next)
    5933         if (!tv_equal(&item1->li_tv, &item2->li_tv, ic))
     5943        if (!tv_equal(&item1->li_tv, &item2->li_tv, ic, recursive))
    59345944            return FALSE;
    59355945    return item1 == NULL && item2 == NULL;
    59365946}
     
    59525962 * Return TRUE when two dictionaries have exactly the same key/values.
    59535963 */
    59545964    static int
    5955 dict_equal(d1, d2, ic)
     5965dict_equal(d1, d2, ic, recursive)
    59565966    dict_T      *d1;
    59575967    dict_T      *d2;
    59585968    int         ic;     /* ignore case for strings */
     5969    int         recursive; /* TRUE when used recursively */
    59595970{
    59605971    hashitem_T  *hi;
    59615972    dictitem_T  *item2;
     
    59765987            item2 = dict_find(d2, hi->hi_key, -1);
    59775988            if (item2 == NULL)
    59785989                return FALSE;
    5979             if (!tv_equal(&HI2DI(hi)->di_tv, &item2->di_tv, ic))
     5990            if (!tv_equal(&HI2DI(hi)->di_tv, &item2->di_tv, ic, recursive))
    59805991                return FALSE;
    59815992            --todo;
    59825993        }
     
    59845995    return TRUE;
    59855996}
    59865997
     5998static int tv_equal_recurse_limit;
     5999
    59876000/*
    59886001 * Return TRUE if "tv1" and "tv2" have the same value.
    59896002 * Compares the items just like "==" would compare them, but strings and
    59906003 * numbers are different.  Floats and numbers are also different.
    59916004 */
    59926005    static int
    5993 tv_equal(tv1, tv2, ic)
     6006tv_equal(tv1, tv2, ic, recursive)
    59946007    typval_T *tv1;
    59956008    typval_T *tv2;
    5996     int     ic;     /* ignore case */
     6009    int      ic;            /* ignore case */
     6010    int      recursive;     /* TRUE when used recursively */
    59976011{
    59986012    char_u      buf1[NUMBUFLEN], buf2[NUMBUFLEN];
    59996013    char_u      *s1, *s2;
    6000     static int  recursive = 0;      /* cach recursive loops */
     6014    static int  recursive_cnt = 0;          /* catch recursive loops */
    60016015    int         r;
    60026016
    60036017    if (tv1->v_type != tv2->v_type)
    60046018        return FALSE;
     6019
    60056020    /* Catch lists and dicts that have an endless loop by limiting
    6006      * recursiveness to 1000.  We guess they are equal then. */
    6007     if (recursive >= 1000)
     6021     * recursiveness to a limit.  We guess they are equal then.
     6022     * A fixed limit has the problem of still taking an awful long time.
     6023     * Reduce the limit every time running into it. That should work fine for
     6024     * deeply linked structures that are not recursively linked and catch
     6025     * recursiveness quickly. */
     6026    if (!recursive)
     6027        tv_equal_recurse_limit = 1000;
     6028    if (recursive_cnt >= tv_equal_recurse_limit)
     6029    {
     6030        --tv_equal_recurse_limit;
    60086031        return TRUE;
     6032    }
    60096033
    60106034    switch (tv1->v_type)
    60116035    {
    60126036        case VAR_LIST:
    6013             ++recursive;
    6014             r = list_equal(tv1->vval.v_list, tv2->vval.v_list, ic);
    6015             --recursive;
     6037            ++recursive_cnt;
     6038            r = list_equal(tv1->vval.v_list, tv2->vval.v_list, ic, TRUE);
     6039            --recursive_cnt;
    60166040            return r;
    60176041
    60186042        case VAR_DICT:
    6019             ++recursive;
    6020             r = dict_equal(tv1->vval.v_dict, tv2->vval.v_dict, ic);
    6021             --recursive;
     6043            ++recursive_cnt;
     6044            r = dict_equal(tv1->vval.v_dict, tv2->vval.v_dict, ic, TRUE);
     6045            --recursive_cnt;
    60226046            return r;
    60236047
    60246048        case VAR_FUNC:
     
    70757099}
    70767100
    70777101/*
    7078  * Add a list  entry to dictionary "d".
     7102 * Add a list entry to dictionary "d".
    70797103 * Returns FAIL when out of memory and when key already exists.
    70807104 */
    70817105    int
     
    70977121        dictitem_free(item);
    70987122        return FAIL;
    70997123    }
     7124    ++list->lv_refcount;
    71007125    return OK;
    71017126}
    71027127
     
    78027827    {"log10",           1, 1, f_log10},
    78037828#endif
    78047829    {"map",             2, 2, f_map},
    7805     {"maparg",          1, 3, f_maparg},
     7830    {"maparg",          1, 4, f_maparg},
    78067831    {"mapcheck",        1, 3, f_mapcheck},
    78077832    {"match",           2, 4, f_match},
    78087833    {"matchadd",        2, 4, f_matchadd},
     
    93899414            }
    93909415
    93919416            for ( ; li != NULL; li = li->li_next)
    9392                 if (tv_equal(&li->li_tv, &argvars[1], ic))
     9417                if (tv_equal(&li->li_tv, &argvars[1], ic, FALSE))
    93939418                    ++n;
    93949419        }
    93959420    }
     
    94169441                if (!HASHITEM_EMPTY(hi))
    94179442                {
    94189443                    --todo;
    9419                     if (tv_equal(&HI2DI(hi)->di_tv, &argvars[1], ic))
     9444                    if (tv_equal(&HI2DI(hi)->di_tv, &argvars[1], ic, FALSE))
    94209445                        ++n;
    94219446                }
    94229447            }
     
    98579882    char_u      *s;
    98589883    int         len;
    98599884    char_u      *errormsg;
    9860     int         flags = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND;
     9885    int         options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND;
    98619886    expand_T    xpc;
    98629887    int         error = FALSE;
    98639888
     
    98759900         * for 'wildignore' and don't put matches for 'suffixes' at the end. */
    98769901        if (argvars[1].v_type != VAR_UNKNOWN
    98779902                                    && get_tv_number_chk(&argvars[1], &error))
    9878             flags |= WILD_KEEP_ALL;
     9903            options |= WILD_KEEP_ALL;
    98799904        if (!error)
    98809905        {
    98819906            ExpandInit(&xpc);
    98829907            xpc.xp_context = EXPAND_FILES;
    9883             rettv->vval.v_string = ExpandOne(&xpc, s, NULL, flags, WILD_ALL);
     9908            if (p_wic)
     9909                options += WILD_ICASE;
     9910            rettv->vval.v_string = ExpandOne(&xpc, s, NULL, options, WILD_ALL);
    98849911        }
    98859912        else
    98869913            rettv->vval.v_string = NULL;
     
    1165311680    typval_T    *argvars;
    1165411681    typval_T    *rettv;
    1165511682{
    11656     int         flags = WILD_SILENT|WILD_USE_NL;
     11683    int         options = WILD_SILENT|WILD_USE_NL;
    1165711684    expand_T    xpc;
    1165811685    int         error = FALSE;
    1165911686
     
    1166111688    * for 'wildignore' and don't put matches for 'suffixes' at the end. */
    1166211689    if (argvars[1].v_type != VAR_UNKNOWN
    1166311690                                && get_tv_number_chk(&argvars[1], &error))
    11664         flags |= WILD_KEEP_ALL;
     11691        options |= WILD_KEEP_ALL;
    1166511692    rettv->v_type = VAR_STRING;
    1166611693    if (!error)
    1166711694    {
    1166811695        ExpandInit(&xpc);
    1166911696        xpc.xp_context = EXPAND_FILES;
     11697        if (p_wic)
     11698            options += WILD_ICASE;
    1167011699        rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
    11671                                                        NULL, flags, WILD_ALL);
     11700                                                     NULL, options, WILD_ALL);
    1167211701    }
    1167311702    else
    1167411703        rettv->vval.v_string = NULL;
     
    1211612145#ifdef FEAT_TOOLBAR
    1211712146        "toolbar",
    1211812147#endif
     12148#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
     12149        "unnamedplus",
     12150#endif
    1211912151#ifdef FEAT_USR_CMDS
    1212012152        "user-commands",    /* was accidentally included in 5.4 */
    1212112153        "user_commands",
     
    1257212604        }
    1257312605
    1257412606        for ( ; item != NULL; item = item->li_next, ++idx)
    12575             if (tv_equal(&item->li_tv, &argvars[1], ic))
     12607            if (tv_equal(&item->li_tv, &argvars[1], ic, FALSE))
    1257612608            {
    1257712609                rettv->vval.v_number = idx;
    1257812610                break;
     
    1329013322    char_u      *keys_buf = NULL;
    1329113323    char_u      *rhs;
    1329213324    int         mode;
    13293     garray_T    ga;
    1329413325    int         abbr = FALSE;
     13326    int         get_dict = FALSE;
     13327    mapblock_T  *mp;
     13328    int         buffer_local;
    1329513329
    1329613330    /* return empty string for failure */
    1329713331    rettv->v_type = VAR_STRING;
     
    1330513339    {
    1330613340        which = get_tv_string_buf_chk(&argvars[1], buf);
    1330713341        if (argvars[2].v_type != VAR_UNKNOWN)
     13342        {
    1330813343            abbr = get_tv_number(&argvars[2]);
     13344            if (argvars[3].v_type != VAR_UNKNOWN)
     13345                get_dict = get_tv_number(&argvars[3]);
     13346        }
    1330913347    }
    1331013348    else
    1331113349        which = (char_u *)"";
     
    1331513353    mode = get_map_mode(&which, 0);
    1331613354
    1331713355    keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE);
    13318     rhs = check_map(keys, mode, exact, FALSE, abbr);
     13356    rhs = check_map(keys, mode, exact, FALSE, abbr, &mp, &buffer_local);
    1331913357    vim_free(keys_buf);
    13320     if (rhs != NULL)
    13321     {
    13322         ga_init(&ga);
    13323         ga.ga_itemsize = 1;
    13324         ga.ga_growsize = 40;
    1332513358
    13326         while (*rhs != NUL)
    13327             ga_concat(&ga, str2special(&rhs, FALSE));
     13359    if (!get_dict)
     13360    {
     13361        /* Return a string. */
     13362        if (rhs != NULL)
     13363            rettv->vval.v_string = str2special_save(rhs, FALSE);
     13364
     13365    }
     13366    else if (rettv_dict_alloc(rettv) != FAIL && rhs != NULL)
     13367    {
     13368        /* Return a dictionary. */
     13369        char_u      *lhs = str2special_save(mp->m_keys, TRUE);
     13370        char_u      *mapmode = map_mode_to_chars(mp->m_mode);
     13371        dict_T      *dict = rettv->vval.v_dict;
     13372
     13373        dict_add_nr_str(dict, "lhs",     0L, lhs);
     13374        dict_add_nr_str(dict, "rhs",     0L, mp->m_orig_str);
     13375        dict_add_nr_str(dict, "noremap", mp->m_noremap ? 1L : 0L , NULL);
     13376        dict_add_nr_str(dict, "expr",    mp->m_expr    ? 1L : 0L, NULL);
     13377        dict_add_nr_str(dict, "silent",  mp->m_silent  ? 1L : 0L, NULL);
     13378        dict_add_nr_str(dict, "sid",     (long)mp->m_script_ID, NULL);
     13379        dict_add_nr_str(dict, "buffer",  (long)buffer_local, NULL);
     13380        dict_add_nr_str(dict, "mode",    0L, mapmode);
    1332813381
    13329         ga_append(&ga, NUL);
    13330         rettv->vval.v_string = (char_u *)ga.ga_data;
     13382        vim_free(lhs);
     13383        vim_free(mapmode);
    1333113384    }
    1333213385}
    1333313386
     
    2251922572        if (tab != NULL)
    2252022573        {
    2252122574            *tab++ = '\0';      /* isolate the variable name */
    22522             if (*tab == 'S')    /* string var */
    22523                 type = VAR_STRING;
     22575            switch (*tab)
     22576            {
     22577                case 'S': type = VAR_STRING; break;
    2252422578#ifdef FEAT_FLOAT
    22525             else if (*tab == 'F')
    22526                 type = VAR_FLOAT;
     22579                case 'F': type = VAR_FLOAT; break;
    2252722580#endif
     22581                case 'D': type = VAR_DICT; break;
     22582                case 'L': type = VAR_LIST; break;
     22583            }
    2252822584
    2252922585            tab = vim_strchr(tab, '\t');
    2253022586            if (tab != NULL)
    2253122587            {
    2253222588                tv.v_type = type;
    22533                 if (type == VAR_STRING)
     22589                if (type == VAR_STRING || type == VAR_DICT || type == VAR_LIST)
    2253422590                    tv.vval.v_string = viminfo_readstring(virp,
    2253522591                                       (int)(tab - virp->vir_line + 1), TRUE);
    2253622592#ifdef FEAT_FLOAT
     
    2253922595#endif
    2254022596                else
    2254122597                    tv.vval.v_number = atol((char *)tab + 1);
     22598                if (type == VAR_DICT || type == VAR_LIST)
     22599                {
     22600                    typval_T *etv = eval_expr(tv.vval.v_string, NULL);
     22601
     22602                    if (etv == NULL)
     22603                        /* Failed to parse back the dict or list, use it as a
     22604                         * string. */
     22605                        tv.v_type = VAR_STRING;
     22606                    else
     22607                    {
     22608                        vim_free(tv.vval.v_string);
     22609                        tv = *etv;
     22610                    }
     22611                }
     22612
    2254222613                set_var(virp->vir_line + 1, &tv, FALSE);
    22543                 if (type == VAR_STRING)
     22614
     22615                if (tv.v_type == VAR_STRING)
    2254422616                    vim_free(tv.vval.v_string);
     22617                else if (tv.v_type == VAR_DICT || tv.v_type == VAR_LIST)
     22618                    clear_tv(&tv);
    2254522619            }
    2254622620        }
    2254722621    }
     
    2258322657                    case VAR_STRING: s = "STR"; break;
    2258422658                    case VAR_NUMBER: s = "NUM"; break;
    2258522659#ifdef FEAT_FLOAT
    22586                     case VAR_FLOAT: s = "FLO"; break;
     22660                    case VAR_FLOAT:  s = "FLO"; break;
    2258722661#endif
     22662                    case VAR_DICT:   s = "DIC"; break;
     22663                    case VAR_LIST:   s = "LIS"; break;
    2258822664                    default: continue;
    2258922665                }
    2259022666                fprintf(fp, "!%s\t%s\t", this_var->di_key, s);
  • src/ex_cmds.c

    diff -Naur vim73.orig/src/ex_cmds.c vim73/src/ex_cmds.c
    old new  
    1111 * ex_cmds.c: some functions for command line commands
    1212 */
    1313
    14 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
    15 # include "vimio.h"     /* for mch_open(), must be before vim.h */
    16 #endif
    17 
    1814#include "vim.h"
    1915#include "version.h"
    2016
     
    323319    /* When sorting numbers "start_col_nr" is the number, not the column
    324320     * number. */
    325321    if (sort_nr)
    326         result = l1.start_col_nr - l2.start_col_nr;
     322        result = l1.start_col_nr == l2.start_col_nr ? 0
     323                                 : l1.start_col_nr > l2.start_col_nr ? 1 : -1;
    327324    else
    328325    {
    329326        /* We need to copy one line into "sortbuf1", because there is no
     
    482479             * of the match, by temporarily terminating the string there */
    483480            s2 = s + end_col;
    484481            c = *s2;
    485             (*s2) = 0;
     482            *s2 = NUL;
    486483            /* Sorting on number: Store the number itself. */
    487484            p = s + start_col;
    488485            if (sort_hex)
     
    491488                s = skiptodigit(p);
    492489            if (s > p && s[-1] == '-')
    493490                --s;  /* include preceding negative sign */
    494             vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
    495                                         &nrs[lnum - eap->line1].start_col_nr, NULL);
    496             (*s2) = c;
     491            if (*s == NUL)
     492                /* empty line should sort before any number */
     493                nrs[lnum - eap->line1].start_col_nr = -MAXLNUM;
     494            else
     495                vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
     496                                  &nrs[lnum - eap->line1].start_col_nr, NULL);
     497            *s2 = c;
    497498        }
    498499        else
    499500        {
     
    27002701                                                                        TRUE);
    27012702                do_modelines(0);
    27022703            }
     2704
     2705            /* Autocommands may have changed buffer names, esp. when
     2706             * 'autochdir' is set. */
     2707            fname = curbuf->b_sfname;
    27032708#endif
    27042709        }
    27052710
     
    34983503        curbuf->b_p_bin = FALSE;        /* reset 'bin' before reading file */
    34993504        curwin->w_p_nu = 0;             /* no line numbers */
    35003505        curwin->w_p_rnu = 0;            /* no relative line numbers */
    3501 #ifdef FEAT_SCROLLBIND
    3502         curwin->w_p_scb = FALSE;        /* no scroll binding */
    3503 #endif
     3506        RESET_BINDING(curwin);          /* no scroll or cursor binding */
    35043507#ifdef FEAT_ARABIC
    35053508        curwin->w_p_arab = FALSE;       /* no arabic mode */
    35063509#endif
     
    54715474                return FALSE;
    54725475            curwin->w_p_pvw = TRUE;
    54735476            curwin->w_p_wfh = TRUE;
    5474 # ifdef FEAT_SCROLLBIND
    5475             curwin->w_p_scb = FALSE;        /* don't take over 'scrollbind' */
    5476 # endif
     5477            RESET_BINDING(curwin);          /* don't take over 'scrollbind'
     5478                                               and 'cursorbind' */
    54775479# ifdef FEAT_DIFF
    54785480            curwin->w_p_diff = FALSE;       /* no 'diff' */
    54795481# endif
     
    65596561struct sign
    65606562{
    65616563    sign_T      *sn_next;       /* next sign in list */
    6562     int         sn_typenr;      /* type number of sign (negative if not equal
    6563                                    to name) */
     6564    int         sn_typenr;      /* type number of sign */
    65646565    char_u      *sn_name;       /* name of sign */
    65656566    char_u      *sn_icon;       /* name of pixmap */
    65666567#ifdef FEAT_SIGN_ICONS
     
    65726573};
    65736574
    65746575static sign_T   *first_sign = NULL;
    6575 static int      last_sign_typenr = MAX_TYPENR;  /* is decremented */
     6576static int      next_sign_typenr = 1;
    65766577
    65776578static int sign_cmd_idx __ARGS((char_u *begin_cmd, char_u *end_cmd));
    65786579static void sign_list_defined __ARGS((sign_T *sp));
     
    66546655            EMSG(_("E156: Missing sign name"));
    66556656        else
    66566657        {
     6658            /* Isolate the sign name.  If it's a number skip leading zeroes,
     6659             * so that "099" and "99" are the same sign.  But keep "0". */
    66576660            p = skiptowhite(arg);
    66586661            if (*p != NUL)
    66596662                *p++ = NUL;
     6663            while (arg[0] == '0' && arg[1] != NUL)
     6664                ++arg;
     6665
    66606666            sp_prev = NULL;
    66616667            for (sp = first_sign; sp != NULL; sp = sp->sn_next)
    66626668            {
     
    66696675                /* ":sign define {name} ...": define a sign */
    66706676                if (sp == NULL)
    66716677                {
     6678                    sign_T      *lp;
     6679                    int         start = next_sign_typenr;
     6680
    66726681                    /* Allocate a new sign. */
    66736682                    sp = (sign_T *)alloc_clear((unsigned)sizeof(sign_T));
    66746683                    if (sp == NULL)
    66756684                        return;
    6676                     if (sp_prev == NULL)
    6677                         first_sign = sp;
    6678                     else
    6679                         sp_prev->sn_next = sp;
    6680                     sp->sn_name = vim_strnsave(arg, (int)(p - arg));
    66816685
    6682                     /* If the name is a number use that for the typenr,
    6683                      * otherwise use a negative number. */
    6684                     if (VIM_ISDIGIT(*arg))
    6685                         sp->sn_typenr = atoi((char *)arg);
    6686                     else
     6686                    /* Check that next_sign_typenr is not already being used.
     6687                     * This only happens after wrapping around.  Hopefully
     6688                     * another one got deleted and we can use its number. */
     6689                    for (lp = first_sign; lp != NULL; )
    66876690                    {
    6688                         sign_T  *lp;
    6689                         int     start = last_sign_typenr;
    6690 
    6691                         for (lp = first_sign; lp != NULL; lp = lp->sn_next)
     6691                        if (lp->sn_typenr == next_sign_typenr)
    66926692                        {
    6693                             if (lp->sn_typenr == last_sign_typenr)
     6693                            ++next_sign_typenr;
     6694                            if (next_sign_typenr == MAX_TYPENR)
     6695                                next_sign_typenr = 1;
     6696                            if (next_sign_typenr == start)
    66946697                            {
    6695                                 --last_sign_typenr;
    6696                                 if (last_sign_typenr == 0)
    6697                                     last_sign_typenr = MAX_TYPENR;
    6698                                 if (last_sign_typenr == start)
    6699                                 {
    6700                                     EMSG(_("E612: Too many signs defined"));
    6701                                     return;
    6702                                 }
    6703                                 lp = first_sign;
    6704                                 continue;
     6698                                vim_free(sp);
     6699                                EMSG(_("E612: Too many signs defined"));
     6700                                return;
    67056701                            }
     6702                            lp = first_sign;  /* start all over */
     6703                            continue;
    67066704                        }
     6705                        lp = lp->sn_next;
     6706                    }
     6707
     6708                    sp->sn_typenr = next_sign_typenr;
     6709                    if (++next_sign_typenr == MAX_TYPENR)
     6710                        next_sign_typenr = 1; /* wrap around */
    67076711
    6708                         sp->sn_typenr = last_sign_typenr--;
    6709                         if (last_sign_typenr == 0)
    6710                             last_sign_typenr = MAX_TYPENR; /* wrap around */
     6712                    sp->sn_name = vim_strsave(arg);
     6713                    if (sp->sn_name == NULL)  /* out of memory */
     6714                    {
     6715                        vim_free(sp);
     6716                        return;
    67116717                    }
     6718
     6719                    /* add the new sign to the list of signs */
     6720                    if (sp_prev == NULL)
     6721                        first_sign = sp;
     6722                    else
     6723                        sp_prev->sn_next = sp;
    67126724                }
    67136725
    67146726                /* set values for a defined sign. */
     
    68866898                arg = skiptowhite(arg);
    68876899                if (*arg != NUL)
    68886900                    *arg++ = NUL;
     6901                while (sign_name[0] == '0' && sign_name[1] != NUL)
     6902                    ++sign_name;
    68896903            }
    68906904            else if (STRNCMP(arg, "file=", 5) == 0)
    68916905            {
  • src/ex_cmds2.c

    diff -Naur vim73.orig/src/ex_cmds2.c vim73/src/ex_cmds2.c
    old new  
    1111 * ex_cmds2.c: some more functions for command line commands
    1212 */
    1313
    14 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
    15 # include "vimio.h"     /* for mch_open(), must be before vim.h */
    16 #endif
    17 
    1814#include "vim.h"
    1915#include "version.h"
    2016
     
    21652161        {
    21662162            if (win_split(0, 0) == FAIL)
    21672163                return;
    2168 # ifdef FEAT_SCROLLBIND
    2169             curwin->w_p_scb = FALSE;
    2170 # endif
     2164            RESET_BINDING(curwin);
    21712165        }
    21722166        else
    21732167#endif
  • src/ex_docmd.c

    diff -Naur vim73.orig/src/ex_docmd.c vim73/src/ex_docmd.c
    old new  
    733733 * do_cmdline(): execute one Ex command line
    734734 *
    735735 * 1. Execute "cmdline" when it is not NULL.
    736  *    If "cmdline" is NULL, or more lines are needed, getline() is used.
     736 *    If "cmdline" is NULL, or more lines are needed, fgetline() is used.
    737737 * 2. Split up in parts separated with '|'.
    738738 *
    739739 * This function can be called recursively!
     
    741741 * flags:
    742742 * DOCMD_VERBOSE  - The command will be included in the error message.
    743743 * DOCMD_NOWAIT   - Don't call wait_return() and friends.
    744  * DOCMD_REPEAT   - Repeat execution until getline() returns NULL.
     744 * DOCMD_REPEAT   - Repeat execution until fgetline() returns NULL.
    745745 * DOCMD_KEYTYPED - Don't reset KeyTyped.
    746746 * DOCMD_EXCRESET - Reset the exception environment (used for debugging).
    747747 * DOCMD_KEEPLINE - Store first typed line (for repeating with ".").
     
    749749 * return FAIL if cmdline could not be executed, OK otherwise
    750750 */
    751751    int
    752 do_cmdline(cmdline, getline, cookie, flags)
     752do_cmdline(cmdline, fgetline, cookie, flags)
    753753    char_u      *cmdline;
    754     char_u      *(*getline) __ARGS((int, void *, int));
    755     void        *cookie;                /* argument for getline() */
     754    char_u      *(*fgetline) __ARGS((int, void *, int));
     755    void        *cookie;                /* argument for fgetline() */
    756756    int         flags;
    757757{
    758758    char_u      *next_cmdline;          /* next cmd to execute */
    759759    char_u      *cmdline_copy = NULL;   /* copy of cmd line */
    760     int         used_getline = FALSE;   /* used "getline" to obtain command */
     760    int         used_getline = FALSE;   /* used "fgetline" to obtain command */
    761761    static int  recursive = 0;          /* recursive depth */
    762762    int         msg_didout_before_start = 0;
    763763    int         count = 0;              /* line number count */
     
    775775    struct msglist      **saved_msg_list = NULL;
    776776    struct msglist      *private_msg_list;
    777777
    778     /* "getline" and "cookie" passed to do_one_cmd() */
     778    /* "fgetline" and "cookie" passed to do_one_cmd() */
    779779    char_u      *(*cmd_getline) __ARGS((int, void *, int));
    780780    void        *cmd_cookie;
    781781    struct loop_cookie cmd_loop_cookie;
    782782    void        *real_cookie;
    783783    int         getline_is_func;
    784784#else
    785 # define cmd_getline getline
     785# define cmd_getline fgetline
    786786# define cmd_cookie cookie
    787787#endif
    788788    static int  call_depth = 0;         /* recursiveness */
     
    822822    cstack.cs_lflags = 0;
    823823    ga_init2(&lines_ga, (int)sizeof(wcmd_T), 10);
    824824
    825     real_cookie = getline_cookie(getline, cookie);
     825    real_cookie = getline_cookie(fgetline, cookie);
    826826
    827827    /* Inside a function use a higher nesting level. */
    828     getline_is_func = getline_equal(getline, cookie, get_func_line);
     828    getline_is_func = getline_equal(fgetline, cookie, get_func_line);
    829829    if (getline_is_func && ex_nesting_level == func_level(real_cookie))
    830830        ++ex_nesting_level;
    831831
     
    837837        breakpoint = func_breakpoint(real_cookie);
    838838        dbg_tick = func_dbg_tick(real_cookie);
    839839    }
    840     else if (getline_equal(getline, cookie, getsourceline))
     840    else if (getline_equal(fgetline, cookie, getsourceline))
    841841    {
    842842        fname = sourcing_name;
    843843        breakpoint = source_breakpoint(real_cookie);
     
    881881     * KeyTyped is only set when calling vgetc().  Reset it here when not
    882882     * calling vgetc() (sourced command lines).
    883883     */
    884     if (!(flags & DOCMD_KEYTYPED) && !getline_equal(getline, cookie, getexline))
     884    if (!(flags & DOCMD_KEYTYPED)
     885                               && !getline_equal(fgetline, cookie, getexline))
    885886        KeyTyped = FALSE;
    886887
    887888    /*
     
    894895    do
    895896    {
    896897#ifdef FEAT_EVAL
    897         getline_is_func = getline_equal(getline, cookie, get_func_line);
     898        getline_is_func = getline_equal(fgetline, cookie, get_func_line);
    898899#endif
    899900
    900901        /* stop skipping cmds for an error msg after all endif/while/for */
     
    909910
    910911        /*
    911912         * 1. If repeating a line in a loop, get a line from lines_ga.
    912          * 2. If no line given: Get an allocated line with getline().
     913         * 2. If no line given: Get an allocated line with fgetline().
    913914         * 3. If a line is given: Make a copy, so we can mess with it.
    914915         */
    915916
     
    938939            }
    939940#ifdef FEAT_PROFILE
    940941            else if (do_profiling == PROF_YES
    941                              && getline_equal(getline, cookie, getsourceline))
     942                            && getline_equal(fgetline, cookie, getsourceline))
    942943                script_line_end();
    943944#endif
    944945
    945946            /* Check if a sourced file hit a ":finish" command. */
    946             if (source_finished(getline, cookie))
     947            if (source_finished(fgetline, cookie))
    947948            {
    948949                retval = FAIL;
    949950                break;
     
    954955                                                   && *dbg_tick != debug_tick)
    955956            {
    956957                *breakpoint = dbg_find_breakpoint(
    957                                 getline_equal(getline, cookie, getsourceline),
     958                                getline_equal(fgetline, cookie, getsourceline),
    958959                                                        fname, sourcing_lnum);
    959960                *dbg_tick = debug_tick;
    960961            }
     
    969970                dbg_breakpoint(fname, sourcing_lnum);
    970971                /* Find next breakpoint. */
    971972                *breakpoint = dbg_find_breakpoint(
    972                                 getline_equal(getline, cookie, getsourceline),
     973                               getline_equal(fgetline, cookie, getsourceline),
    973974                                                        fname, sourcing_lnum);
    974975                *dbg_tick = debug_tick;
    975976            }
     
    978979            {
    979980                if (getline_is_func)
    980981                    func_line_start(real_cookie);
    981                 else if (getline_equal(getline, cookie, getsourceline))
     982                else if (getline_equal(fgetline, cookie, getsourceline))
    982983                    script_line_start();
    983984            }
    984985# endif
     
    987988        if (cstack.cs_looplevel > 0)
    988989        {
    989990            /* Inside a while/for loop we need to store the lines and use them
    990              * again.  Pass a different "getline" function to do_one_cmd()
     991             * again.  Pass a different "fgetline" function to do_one_cmd()
    991992             * below, so that it stores lines in or reads them from
    992993             * "lines_ga".  Makes it possible to define a function inside a
    993994             * while/for loop. */
     
    995996            cmd_cookie = (void *)&cmd_loop_cookie;
    996997            cmd_loop_cookie.lines_gap = &lines_ga;
    997998            cmd_loop_cookie.current_line = current_line;
    998             cmd_loop_cookie.getline = getline;
     999            cmd_loop_cookie.getline = fgetline;
    9991000            cmd_loop_cookie.cookie = cookie;
    10001001            cmd_loop_cookie.repeating = (current_line < lines_ga.ga_len);
    10011002        }
    10021003        else
    10031004        {
    1004             cmd_getline = getline;
     1005            cmd_getline = fgetline;
    10051006            cmd_cookie = cookie;
    10061007        }
    10071008#endif
    10081009
    1009         /* 2. If no line given, get an allocated line with getline(). */
     1010        /* 2. If no line given, get an allocated line with fgetline(). */
    10101011        if (next_cmdline == NULL)
    10111012        {
    10121013            /*
    10131014             * Need to set msg_didout for the first line after an ":if",
    10141015             * otherwise the ":if" will be overwritten.
    10151016             */
    1016             if (count == 1 && getline_equal(getline, cookie, getexline))
     1017            if (count == 1 && getline_equal(fgetline, cookie, getexline))
    10171018                msg_didout = TRUE;
    1018             if (getline == NULL || (next_cmdline = getline(':', cookie,
     1019            if (fgetline == NULL || (next_cmdline = fgetline(':', cookie,
    10191020#ifdef FEAT_EVAL
    10201021                    cstack.cs_idx < 0 ? 0 : (cstack.cs_idx + 1) * 2
    10211022#else
     
    11421143             * If the command was typed, remember it for the ':' register.
    11431144             * Do this AFTER executing the command to make :@: work.
    11441145             */
    1145             if (getline_equal(getline, cookie, getexline)
     1146            if (getline_equal(fgetline, cookie, getexline)
    11461147                                                  && new_last_cmdline != NULL)
    11471148            {
    11481149                vim_free(last_cmdline);
     
    11631164#ifdef FEAT_EVAL
    11641165        /* reset did_emsg for a function that is not aborted by an error */
    11651166        if (did_emsg && !force_abort
    1166                 && getline_equal(getline, cookie, get_func_line)
     1167                && getline_equal(fgetline, cookie, get_func_line)
    11671168                                              && !func_has_abort(real_cookie))
    11681169            did_emsg = FALSE;
    11691170
     
    12021203                    if (breakpoint != NULL)
    12031204                    {
    12041205                        *breakpoint = dbg_find_breakpoint(
    1205                                 getline_equal(getline, cookie, getsourceline),
     1206                               getline_equal(fgetline, cookie, getsourceline),
    12061207                                                                        fname,
    12071208                           ((wcmd_T *)lines_ga.ga_data)[current_line].lnum-1);
    12081209                        *dbg_tick = debug_tick;
     
    12961297#endif
    12971298            )
    12981299            && !(did_emsg && used_getline
    1299                           && (getline_equal(getline, cookie, getexmodeline)
    1300                                 || getline_equal(getline, cookie, getexline)))
     1300                            && (getline_equal(fgetline, cookie, getexmodeline)
     1301                               || getline_equal(fgetline, cookie, getexline)))
    13011302            && (next_cmdline != NULL
    13021303#ifdef FEAT_EVAL
    13031304                        || cstack.cs_idx >= 0
     
    13161317         * unclosed conditional.
    13171318         */
    13181319        if (!got_int && !did_throw
    1319                 && ((getline_equal(getline, cookie, getsourceline)
    1320                         && !source_finished(getline, cookie))
    1321                     || (getline_equal(getline, cookie, get_func_line)
     1320                && ((getline_equal(fgetline, cookie, getsourceline)
     1321                        && !source_finished(fgetline, cookie))
     1322                    || (getline_equal(fgetline, cookie, get_func_line)
    13221323                                            && !func_has_ended(real_cookie))))
    13231324        {
    13241325            if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY)
     
    13541355    /* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
    13551356     * lack was reported above and the error message is to be converted to an
    13561357     * exception, do this now after rewinding the cstack. */
    1357     do_errthrow(&cstack, getline_equal(getline, cookie, get_func_line)
     1358    do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line)
    13581359                                  ? (char_u *)"endfunction" : (char_u *)NULL);
    13591360
    13601361    if (trylevel == 0)
     
    14491450     */
    14501451    if (did_throw)
    14511452        need_rethrow = TRUE;
    1452     if ((getline_equal(getline, cookie, getsourceline)
     1453    if ((getline_equal(fgetline, cookie, getsourceline)
    14531454                && ex_nesting_level > source_level(real_cookie))
    1454             || (getline_equal(getline, cookie, get_func_line)
     1455            || (getline_equal(fgetline, cookie, get_func_line)
    14551456                && ex_nesting_level > func_level(real_cookie) + 1))
    14561457    {
    14571458        if (!did_throw)
     
    14601461    else
    14611462    {
    14621463        /* When leaving a function, reduce nesting level. */
    1463         if (getline_equal(getline, cookie, get_func_line))
     1464        if (getline_equal(fgetline, cookie, get_func_line))
    14641465            --ex_nesting_level;
    14651466        /*
    14661467         * Go to debug mode when returning from a function in which we are
    14671468         * single-stepping.
    14681469         */
    1469         if ((getline_equal(getline, cookie, getsourceline)
    1470                     || getline_equal(getline, cookie, get_func_line))
     1470        if ((getline_equal(fgetline, cookie, getsourceline)
     1471                    || getline_equal(fgetline, cookie, get_func_line))
    14711472                && ex_nesting_level + 1 <= debug_break_level)
    1472             do_debug(getline_equal(getline, cookie, getsourceline)
     1473            do_debug(getline_equal(fgetline, cookie, getsourceline)
    14731474                    ? (char_u *)_("End of sourced file")
    14741475                    : (char_u *)_("End of function"));
    14751476    }
     
    28712872            }
    28722873
    28732874#ifdef FEAT_USR_CMDS
    2874         /* Look for a user defined command as a last resort */
    2875         if (eap->cmdidx == CMD_SIZE && *eap->cmd >= 'A' && *eap->cmd <= 'Z')
     2875        /* Look for a user defined command as a last resort.  Let ":Print" be
     2876         * overruled by a user defined command. */
     2877        if ((eap->cmdidx == CMD_SIZE || eap->cmdidx == CMD_Print)
     2878                && *eap->cmd >= 'A' && *eap->cmd <= 'Z')
    28762879        {
    28772880            /* User defined commands may contain digits. */
    28782881            while (ASCII_ISALNUM(*p))
     
    34653468        case CMD_find:
    34663469        case CMD_sfind:
    34673470        case CMD_tabfind:
    3468             xp->xp_context = EXPAND_FILES_IN_PATH;
     3471            if (xp->xp_context == EXPAND_FILES)
     3472                xp->xp_context = EXPAND_FILES_IN_PATH;
    34693473            break;
    34703474        case CMD_cd:
    34713475        case CMD_chdir:
     
    45204524                else /* n == 2 */
    45214525                {
    45224526                    expand_T    xpc;
     4527                    int         options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH;
    45234528
    45244529                    ExpandInit(&xpc);
    45254530                    xpc.xp_context = EXPAND_FILES;
     4531                    if (p_wic)
     4532                        options += WILD_ICASE;
    45264533                    p = ExpandOne(&xpc, eap->arg, NULL,
    4527                                             WILD_LIST_NOTFOUND|WILD_ADD_SLASH,
    4528                                                    WILD_EXPAND_FREE);
     4534                                                   options, WILD_EXPAND_FREE);
    45294535                    if (p == NULL)
    45304536                        return FAIL;
    45314537                }
     
    55875593    int     compl = EXPAND_NOTHING;
    55885594    char_u  *compl_arg = NULL;
    55895595    int     has_attr = (eap->arg[0] == '-');
     5596    int     name_len;
    55905597
    55915598    p = eap->arg;
    55925599
     
    56125619        return;
    56135620    }
    56145621    end = p;
     5622    name_len = (int)(end - name);
    56155623
    56165624    /* If there is nothing after the name, and no attributes were specified,
    56175625     * we are listing commands
     
    56265634        EMSG(_("E183: User defined commands must start with an uppercase letter"));
    56275635        return;
    56285636    }
     5637    else if ((name_len == 1 && *name == 'X')
     5638          || (name_len <= 4
     5639                  && STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0))
     5640    {
     5641        EMSG(_("E841: Reserved name, cannot be used for user defined command"));
     5642        return;
     5643    }
    56295644    else
    56305645        uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
    56315646                                                                eap->forceit);
     
    68976912# ifdef FEAT_WINDOWS
    68986913        if (win_split(0, 0) == FAIL)
    68996914            return;
    6900 #  ifdef FEAT_SCROLLBIND
    6901         curwin->w_p_scb = FALSE;
    6902 #  endif
     6915        RESET_BINDING(curwin);
    69036916
    69046917        /* When splitting the window, create a new alist.  Otherwise the
    69056918         * existing one is overwritten. */
     
    72997312                || cmdmod.browse
    73007313#  endif
    73017314           )
    7302             curwin->w_p_scb = FALSE;
     7315        {
     7316            RESET_BINDING(curwin);
     7317        }
    73037318        else
    73047319            do_check_scrollbind(FALSE);
    73057320# endif
     
    93939408ex_ptag(eap)
    93949409    exarg_T     *eap;
    93959410{
    9396     g_do_tagpreview = p_pvh;
     9411    g_do_tagpreview = p_pvh;  /* will be reset to 0 in ex_tag_cmd() */
    93979412    ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
    93989413}
    93999414
     
    95259540#define SPEC_CFILE  4
    95269541                    "<sfile>",          /* ":so" file name */
    95279542#define SPEC_SFILE  5
     9543                    "<slnum>",          /* ":so" file line number */
     9544#define SPEC_SLNUM  6
    95289545#ifdef FEAT_AUTOCMD
    95299546                    "<afile>",          /* autocommand file name */
    9530 # define SPEC_AFILE 6
     9547# define SPEC_AFILE 7
    95319548                    "<abuf>",           /* autocommand buffer number */
    9532 # define SPEC_ABUF  7
     9549# define SPEC_ABUF  8
    95339550                    "<amatch>",         /* autocommand match name */
    9534 # define SPEC_AMATCH 8
     9551# define SPEC_AMATCH 9
    95359552#endif
    95369553#ifdef FEAT_CLIENTSERVER
    95379554                    "<client>"
    9538 # define SPEC_CLIENT 9
     9555# ifdef FEAT_AUTOCMD
     9556#  define SPEC_CLIENT 10
     9557# else
     9558#  define SPEC_CLIENT 7
     9559# endif
    95399560#endif
    95409561    };
    95419562
     
    95609581 *        '<cWORD>' to WORD under the cursor
    95619582 *        '<cfile>' to path name under the cursor
    95629583 *        '<sfile>' to sourced file name
     9584 *        '<slnum>' to sourced file line number
    95639585 *        '<afile>' to file name for autocommand
    95649586 *        '<abuf>'  to buffer number for autocommand
    95659587 *        '<amatch>' to matching name for autocommand
     
    95919613#ifdef FEAT_MODIFY_FNAME
    95929614    int         skip_mod = FALSE;
    95939615#endif
    9594 
    9595 #if defined(FEAT_AUTOCMD) || defined(FEAT_CLIENTSERVER)
    95969616    char_u      strbuf[30];
    9597 #endif
    95989617
    95999618    *errormsg = NULL;
    96009619    if (escaped != NULL)
     
    97839802                    return NULL;
    97849803                }
    97859804                break;
     9805        case SPEC_SLNUM:        /* line in file for ":so" command */
     9806                if (sourcing_name == NULL || sourcing_lnum == 0)
     9807                {
     9808                    *errormsg = (char_u *)_("E842: no line number to use for \"<slnum>\"");
     9809                    return NULL;
     9810                }
     9811                sprintf((char *)strbuf, "%ld", (long)sourcing_lnum);
     9812                result = strbuf;
     9813                break;
    97869814#if defined(FEAT_CLIENTSERVER)
    97879815        case SPEC_CLIENT:       /* Source of last submitted input */
    97889816                sprintf((char *)strbuf, PRINTF_HEX_LONG_U,
     
    1070710735 * Write a file name to the session file.
    1070810736 * Takes care of the "slash" option in 'sessionoptions' and escapes special
    1070910737 * characters.
    10710  * Returns FAIL if writing fails.
     10738 * Returns FAIL if writing fails or out of memory.
    1071110739 */
    1071210740    static int
    1071310741ses_put_fname(fd, name, flagp)
     
    1071610744    unsigned    *flagp;
    1071710745{
    1071810746    char_u      *sname;
     10747    char_u      *p;
    1071910748    int         retval = OK;
    10720     int         c;
    1072110749
    1072210750    sname = home_replace_save(NULL, name);
    10723     if (sname != NULL)
    10724         name = sname;
    10725     while (*name != NUL)
    10726     {
    10727 #ifdef FEAT_MBYTE
    10728         {
    10729             int l;
     10751    if (sname == NULL)
     10752        return FAIL;
    1073010753
    10731             if (has_mbyte && (l = (*mb_ptr2len)(name)) > 1)
    10732             {
    10733                 /* copy a multibyte char */
    10734                 while (--l >= 0)
    10735                 {
    10736                     if (putc(*name, fd) != *name)
    10737                         retval = FAIL;
    10738                     ++name;
    10739                 }
    10740                 continue;
    10741             }
    10742         }
    10743 #endif
    10744         c = *name++;
    10745         if (c == '\\' && (*flagp & SSOP_SLASH))
    10746             /* change a backslash to a forward slash */
    10747             c = '/';
    10748         else if ((vim_strchr(escape_chars, c) != NULL
    10749 #ifdef BACKSLASH_IN_FILENAME
    10750                     && c != '\\'
    10751 #endif
    10752                  ) || c == '#' || c == '%')
    10753         {
    10754             /* escape a special character with a backslash */
    10755             if (putc('\\', fd) != '\\')
    10756                 retval = FAIL;
    10757         }
    10758         if (putc(c, fd) != c)
    10759             retval = FAIL;
     10754    if (*flagp & SSOP_SLASH)
     10755    {
     10756        /* change all backslashes to forward slashes */
     10757        for (p = sname; *p != NUL; mb_ptr_adv(p))
     10758            if (*p == '\\')
     10759                *p = '/';
    1076010760    }
     10761
     10762    /* escapse special characters */
     10763    p = vim_strsave_fnameescape(sname, FALSE);
    1076110764    vim_free(sname);
     10765    if (p == NULL)
     10766        return FAIL;
     10767
     10768    /* write the result */
     10769    if (fputs((char *)p, fd) < 0)
     10770        retval = FAIL;
     10771
     10772    vim_free(p);
    1076210773    return retval;
    1076310774}
    1076410775
  • src/ex_getln.c

    diff -Naur vim73.orig/src/ex_getln.c vim73/src/ex_getln.c
    old new  
    688688                    p = get_expr_line();
    689689                    --textlock;
    690690                    restore_cmdline(&save_ccline);
    691                     len = (int)STRLEN(p);
    692691
    693                     if (p != NULL && realloc_cmdbuff(len + 1) == OK)
     692                    if (p != NULL)
    694693                    {
    695                         ccline.cmdlen = len;
    696                         STRCPY(ccline.cmdbuff, p);
    697                         vim_free(p);
    698 
    699                         /* Restore the cursor or use the position set with
    700                          * set_cmdline_pos(). */
    701                         if (new_cmdpos > ccline.cmdlen)
    702                             ccline.cmdpos = ccline.cmdlen;
    703                         else
    704                             ccline.cmdpos = new_cmdpos;
    705 
    706                         KeyTyped = FALSE;       /* Don't do p_wc completion. */
    707                         redrawcmd();
    708                         goto cmdline_changed;
     694                        len = (int)STRLEN(p);
     695                        if (realloc_cmdbuff(len + 1) == OK)
     696                        {
     697                            ccline.cmdlen = len;
     698                            STRCPY(ccline.cmdbuff, p);
     699                            vim_free(p);
     700
     701                            /* Restore the cursor or use the position set with
     702                             * set_cmdline_pos(). */
     703                            if (new_cmdpos > ccline.cmdlen)
     704                                ccline.cmdpos = ccline.cmdlen;
     705                            else
     706                                ccline.cmdpos = new_cmdpos;
     707
     708                            KeyTyped = FALSE;   /* Don't do p_wc completion. */
     709                            redrawcmd();
     710                            goto cmdline_changed;
     711                        }
    709712                    }
    710713                }
    711714                beep_flush();
    712                 c = ESC;
     715                got_int = FALSE;        /* don't abandon the command line */
     716                did_emsg = FALSE;
     717                emsg_on_display = FALSE;
     718                redrawcmd();
     719                goto cmdline_not_changed;
    713720            }
    714721#endif
    715722            else
     
    23422349        windgoto(msg_row, msg_col);
    23432350        pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
    23442351
    2345         /* we are done when a NL is entered, but not when it comes after a
    2346          * backslash */
    2347         if (line_ga.ga_len > 0 && pend[-1] == '\n'
    2348                 && (line_ga.ga_len <= 1 || pend[-2] != '\\'))
    2349         {
    2350             --line_ga.ga_len;
    2351             --pend;
    2352             *pend = NUL;
    2353             break;
     2352        /* We are done when a NL is entered, but not when it comes after an
     2353         * odd number of backslashes, that results in a NUL. */
     2354        if (line_ga.ga_len > 0 && pend[-1] == '\n')
     2355        {
     2356            int bcount = 0;
     2357
     2358            while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\')
     2359                ++bcount;
     2360
     2361            if (bcount > 0)
     2362            {
     2363                /* Halve the number of backslashes: "\NL" -> "NUL", "\\NL" ->
     2364                 * "\NL", etc. */
     2365                line_ga.ga_len -= (bcount + 1) / 2;
     2366                pend -= (bcount + 1) / 2;
     2367                pend[-1] = '\n';
     2368            }
     2369
     2370            if ((bcount & 1) == 0)
     2371            {
     2372                --line_ga.ga_len;
     2373                --pend;
     2374                *pend = NUL;
     2375                break;
     2376            }
    23542377        }
    23552378    }
    23562379
     
    33163339            p2 = NULL;
    33173340        else
    33183341        {
     3342            int use_options = options |
     3343                    WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE;
     3344
     3345            if (p_wic)
     3346                use_options += WILD_ICASE;
    33193347            p2 = ExpandOne(xp, p1,
    33203348                         vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
    3321                     WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
    3322                                                               |options, type);
     3349                                                           use_options, type);
    33233350            vim_free(p1);
    33243351            /* longest match: make sure it is not shorter, happens with :help */
    33253352            if (p2 != NULL && type == WILD_LONGEST)
     
    34053432 * options = WILD_KEEP_ALL:         don't remove 'wildignore' entries
    34063433 * options = WILD_SILENT:           don't print warning messages
    34073434 * options = WILD_ESCAPE:           put backslash before special chars
     3435 * options = WILD_ICASE:            ignore case for files
    34083436 *
    34093437 * The variables xp->xp_context and xp->xp_backslash must have been set!
    34103438 */
     
    43384366    char_u      ***matches;     /* return: array of pointers to matches */
    43394367{
    43404368    char_u      *file_str = NULL;
     4369    int         options = WILD_ADD_SLASH|WILD_SILENT;
    43414370
    43424371    if (xp->xp_context == EXPAND_UNSUCCESSFUL)
    43434372    {
     
    43564385    if (file_str == NULL)
    43574386        return EXPAND_UNSUCCESSFUL;
    43584387
     4388    if (p_wic)
     4389        options += WILD_ICASE;
     4390
    43594391    /* find all files that match the description */
    4360     if (ExpandFromContext(xp, file_str, matchcount, matches,
    4361                                           WILD_ADD_SLASH|WILD_SILENT) == FAIL)
     4392    if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL)
    43624393    {
    43634394        *matchcount = 0;
    43644395        *matches = NULL;
     
    44104441    char_u      *pat;
    44114442    int         *num_file;
    44124443    char_u      ***file;
    4413     int         options;
     4444    int         options;  /* EW_ flags */
    44144445{
    44154446#ifdef FEAT_CMDL_COMPL
    44164447    regmatch_T  regmatch;
     
    44644495            flags |= (EW_FILE | EW_PATH);
    44654496        else
    44664497            flags = (flags | EW_DIR) & ~EW_FILE;
     4498        if (options & WILD_ICASE)
     4499            flags |= EW_ICASE;
     4500
    44674501        /* Expand wildcards, supporting %:h and the like. */
    44684502        ret = expand_wildcards_eval(&pat, num_file, file, flags);
    44694503        if (free_pat)
     
    47284762                            || (pat[1] == '.' && vim_ispathsep(pat[2])))))
    47294763        path = (char_u *)".";
    47304764    else
     4765    {
    47314766        path = vim_getenv((char_u *)"PATH", &mustfree);
     4767        if (path == NULL)
     4768            path = (char_u *)"";
     4769    }
    47324770
    47334771    /*
    47344772     * Go over all directories in $PATH.  Expand matches in that directory and
     
    61476185    curwin->w_p_rl = cmdmsg_rl;
    61486186    cmdmsg_rl = FALSE;
    61496187# endif
    6150 # ifdef FEAT_SCROLLBIND
    6151     curwin->w_p_scb = FALSE;
    6152 # endif
     6188    RESET_BINDING(curwin);
    61536189
    61546190# ifdef FEAT_AUTOCMD
    61556191    /* Do execute autocommands for setting the filetype (load syntax). */
  • src/fileio.c

    diff -Naur vim73.orig/src/fileio.c vim73/src/fileio.c
    old new  
    1111 * fileio.c: read from and write to a file
    1212 */
    1313
    14 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
    15 # include "vimio.h"     /* for lseek(), must be before vim.h */
    16 #endif
    17 
    18 #if defined __EMX__
    19 # include "vimio.h"     /* for mktemp(), CJW 1997-12-03 */
    20 #endif
    21 
    2214#include "vim.h"
    2315
    2416#if defined(__TANDEM) || defined(__MINT__)
     
    918910            {
    919911                /* Read the first line (and a bit more).  Immediately rewind to
    920912                 * the start of the file.  If the read() fails "len" is -1. */
    921                 len = vim_read(fd, firstline, 80);
     913                len = read_eintr(fd, firstline, 80);
    922914                lseek(fd, (off_t)0L, SEEK_SET);
    923915                for (p = firstline; p < firstline + len; ++p)
    924916                    if (*p >= 0x80)
     
    13731365                    /*
    13741366                     * Read bytes from the file.
    13751367                     */
    1376                     size = vim_read(fd, ptr, size);
     1368                    size = read_eintr(fd, ptr, size);
    13771369                }
    13781370
    13791371                if (size <= 0)
     
    40003992#ifdef HAS_BW_FLAGS
    40013993                        write_info.bw_flags = FIO_NOCONVERT;
    40023994#endif
    4003                         while ((write_info.bw_len = vim_read(fd, copybuf,
     3995                        while ((write_info.bw_len = read_eintr(fd, copybuf,
    40043996                                                                BUFSIZE)) > 0)
    40053997                        {
    40063998                            if (buf_write_bytes(&write_info) == FAIL)
     
    48134805#ifdef HAS_BW_FLAGS
    48144806                        write_info.bw_flags = FIO_NOCONVERT;
    48154807#endif
    4816                         while ((write_info.bw_len = vim_read(fd, smallbuf,
     4808                        while ((write_info.bw_len = read_eintr(fd, smallbuf,
    48174809                                                      SMBUFSIZE)) > 0)
    48184810                            if (buf_write_bytes(&write_info) == FAIL)
    48194811                                break;
     
    53305322
    53315323/*
    53325324 * Call write() to write a number of bytes to the file.
    5333  * Also handles encryption and 'encoding' conversion.
     5325 * Handles encryption and 'encoding' conversion.
    53345326 *
    53355327 * Return FAIL for failure, OK otherwise.
    53365328 */
     
    57025694        crypt_encode(buf, len, buf);
    57035695#endif
    57045696
    5705     /* Repeat the write(), it may be interrupted by a signal. */
    5706     while (len > 0)
    5707     {
    5708         wlen = vim_write(ip->bw_fd, buf, len);
    5709         if (wlen <= 0)              /* error! */
    5710             return FAIL;
    5711         len -= wlen;
    5712         buf += wlen;
    5713     }
    5714     return OK;
     5697    wlen = write_eintr(ip->bw_fd, buf, len);
     5698    return (wlen < len) ? FAIL : OK;
    57155699}
    57165700
    57175701#ifdef FEAT_MBYTE
     
    66626646        return -1;
    66636647    }
    66646648
    6665     while ((n = vim_read(fd_in, buffer, BUFSIZE)) > 0)
    6666         if (vim_write(fd_out, buffer, n) != n)
     6649    while ((n = read_eintr(fd_in, buffer, BUFSIZE)) > 0)
     6650        if (write_eintr(fd_out, buffer, n) != n)
    66676651        {
    66686652            errmsg = _("E208: Error writing to \"%s\"");
    66696653            break;
     
    1030410288    }
    1030510289    return reg_pat;
    1030610290}
     10291
     10292#if defined(EINTR) || defined(PROTO)
     10293/*
     10294 * Version of read() that retries when interrupted by EINTR (possibly
     10295 * by a SIGWINCH).
     10296 */
     10297    long
     10298read_eintr(fd, buf, bufsize)
     10299    int     fd;
     10300    void    *buf;
     10301    size_t  bufsize;
     10302{
     10303    long ret;
     10304
     10305    for (;;)
     10306    {
     10307        ret = vim_read(fd, buf, bufsize);
     10308        if (ret >= 0 || errno != EINTR)
     10309            break;
     10310    }
     10311    return ret;
     10312}
     10313
     10314/*
     10315 * Version of write() that retries when interrupted by EINTR (possibly
     10316 * by a SIGWINCH).
     10317 */
     10318    long
     10319write_eintr(fd, buf, bufsize)
     10320    int     fd;
     10321    void    *buf;
     10322    size_t  bufsize;
     10323{
     10324    long    ret = 0;
     10325    long    wlen;
     10326
     10327    /* Repeat the write() so long it didn't fail, other than being interrupted
     10328     * by a signal. */
     10329    while (ret < (long)bufsize)
     10330    {
     10331        wlen = vim_write(fd, (char *)buf + ret, bufsize - ret);
     10332        if (wlen < 0)
     10333        {
     10334            if (errno != EINTR)
     10335                break;
     10336        }
     10337        else
     10338            ret += wlen;
     10339    }
     10340    return ret;
     10341}
     10342#endif
  • src/getchar.c

    diff -Naur vim73.orig/src/getchar.c vim73/src/getchar.c
    old new  
    15061506    }
    15071507}
    15081508
    1509 #define KL_PART_KEY -1          /* keylen value for incomplete key-code */
    1510 #define KL_PART_MAP -2          /* keylen value for incomplete mapping */
    1511 
    15121509/*
    15131510 * Get the next input character.
    15141511 * Can return a special key or a multi-byte character.
     
    21712168                                        if (!timedout)
    21722169                                        {
    21732170                                            /* break at a partly match */
    2174                                             keylen = KL_PART_MAP;
     2171                                            keylen = KEYLEN_PART_MAP;
    21752172                                            break;
    21762173                                        }
    21772174                                    }
     
    21922189
    21932190                        /* If no partly match found, use the longest full
    21942191                         * match. */
    2195                         if (keylen != KL_PART_MAP)
     2192                        if (keylen != KEYLEN_PART_MAP)
    21962193                        {
    21972194                            mp = mp_match;
    21982195                            keylen = mp_match_len;
     
    22302227                        }
    22312228                        /* Need more chars for partly match. */
    22322229                        if (mlen == typebuf.tb_len)
    2233                             keylen = KL_PART_KEY;
     2230                            keylen = KEYLEN_PART_KEY;
    22342231                        else if (max_mlen < mlen)
    22352232                            /* no match, may have to check for termcode at
    22362233                             * next character */
     
    22382235                    }
    22392236
    22402237                    if ((mp == NULL || max_mlen >= mp_match_len)
    2241                                                      && keylen != KL_PART_MAP)
     2238                                                 && keylen != KEYLEN_PART_MAP)
    22422239                    {
    22432240                        int     save_keylen = keylen;
    22442241
     
    22642261                            /* If no termcode matched but 'pastetoggle'
    22652262                             * matched partially it's like an incomplete key
    22662263                             * sequence. */
    2267                             if (keylen == 0 && save_keylen == KL_PART_KEY)
    2268                                 keylen = KL_PART_KEY;
     2264                            if (keylen == 0 && save_keylen == KEYLEN_PART_KEY)
     2265                                keylen = KEYLEN_PART_KEY;
    22692266
    22702267                            /*
    22712268                             * When getting a partial match, but the last
     
    23022299                                    continue;
    23032300                                }
    23042301                                if (*s == NUL)      /* need more characters */
    2305                                     keylen = KL_PART_KEY;
     2302                                    keylen = KEYLEN_PART_KEY;
    23062303                            }
    23072304                            if (keylen >= 0)
    23082305#endif
     
    23392336                        if (keylen > 0)     /* full matching terminal code */
    23402337                        {
    23412338#if defined(FEAT_GUI) && defined(FEAT_MENU)
    2342                             if (typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
     2339                            if (typebuf.tb_len >= 2
     2340                                && typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
    23432341                                         && typebuf.tb_buf[typebuf.tb_off + 1]
    23442342                                                                   == KS_MENU)
    23452343                            {
     
    23812379                        /* Partial match: get some more characters.  When a
    23822380                         * matching mapping was found use that one. */
    23832381                        if (mp == NULL || keylen < 0)
    2384                             keylen = KL_PART_KEY;
     2382                            keylen = KEYLEN_PART_KEY;
    23852383                        else
    23862384                            keylen = mp_match_len;
    23872385                    }
     
    25532551#endif
    25542552                        && typebuf.tb_maplen == 0
    25552553                        && (State & INSERT)
    2556                         && (p_timeout || (keylen == KL_PART_KEY && p_ttimeout))
     2554                        && (p_timeout
     2555                            || (keylen == KEYLEN_PART_KEY && p_ttimeout))
    25572556                        && (c = inchar(typebuf.tb_buf + typebuf.tb_off
    25582557                                                     + typebuf.tb_len, 3, 25L,
    25592558                                                 typebuf.tb_change_cnt)) == 0)
     
    27832782                            ? 0
    27842783                            : ((typebuf.tb_len == 0
    27852784                                    || !(p_timeout || (p_ttimeout
    2786                                                    && keylen == KL_PART_KEY)))
     2785                                               && keylen == KEYLEN_PART_KEY)))
    27872786                                    ? -1L
    2788                                     : ((keylen == KL_PART_KEY && p_ttm >= 0)
     2787                                    : ((keylen == KEYLEN_PART_KEY && p_ttm >= 0)
    27892788                                            ? p_ttm
    27902789                                            : p_tm)), typebuf.tb_change_cnt);
    27912790
     
    31683167    int         expr = FALSE;
    31693168#endif
    31703169    int         noremap;
     3170    char_u      *orig_rhs;
    31713171
    31723172    keys = arg;
    31733173    map_table = maphash;
     
    32663266    }
    32673267    if (*p != NUL)
    32683268        *p++ = NUL;
     3269
    32693270    p = skipwhite(p);
    32703271    rhs = p;
    32713272    hasarg = (*rhs != NUL);
     
    32883289     */
    32893290    if (haskey)
    32903291        keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, special);
     3292    orig_rhs = rhs;
    32913293    if (hasarg)
    32923294    {
    32933295        if (STRICMP(rhs, "<nop>") == 0)     /* "<Nop>" means nothing */
     
    32983300
    32993301#ifdef FEAT_FKMAP
    33003302    /*
    3301      * when in right-to-left mode and alternate keymap option set,
     3303     * When in right-to-left mode and alternate keymap option set,
    33023304     * reverse the character flow in the rhs in Farsi.
    33033305     */
    33043306    if (p_altkeymap && curwin->w_p_rl)
     
    35563558                                }
    35573559                                vim_free(mp->m_str);
    35583560                                mp->m_str = newstr;
     3561                                vim_free(mp->m_orig_str);
     3562                                mp->m_orig_str = vim_strsave(orig_rhs);
    35593563                                mp->m_noremap = noremap;
    35603564                                mp->m_silent = silent;
    35613565                                mp->m_mode = mode;
     
    36333637
    36343638    mp->m_keys = vim_strsave(keys);
    36353639    mp->m_str = vim_strsave(rhs);
     3640    mp->m_orig_str = vim_strsave(orig_rhs);
    36363641    if (mp->m_keys == NULL || mp->m_str == NULL)
    36373642    {
    36383643        vim_free(mp->m_keys);
    36393644        vim_free(mp->m_str);
     3645        vim_free(mp->m_orig_str);
    36403646        vim_free(mp);
    36413647        retval = 4;     /* no mem */
    36423648        goto theend;
     
    36823688    mp = *mpp;
    36833689    vim_free(mp->m_keys);
    36843690    vim_free(mp->m_str);
     3691    vim_free(mp->m_orig_str);
    36853692    *mpp = mp->m_next;
    36863693    vim_free(mp);
    36873694}
     
    38513858    }
    38523859}
    38533860
     3861/*
     3862 * Return characters to represent the map mode in an allocated string.
     3863 * Returns NULL when out of memory.
     3864 */
     3865    char_u *
     3866map_mode_to_chars(mode)
     3867    int mode;
     3868{
     3869    garray_T    mapmode;
     3870
     3871    ga_init2(&mapmode, 1, 7);
     3872
     3873    if ((mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
     3874        ga_append(&mapmode, '!');                       /* :map! */
     3875    else if (mode & INSERT)
     3876        ga_append(&mapmode, 'i');                       /* :imap */
     3877    else if (mode & LANGMAP)
     3878        ga_append(&mapmode, 'l');                       /* :lmap */
     3879    else if (mode & CMDLINE)
     3880        ga_append(&mapmode, 'c');                       /* :cmap */
     3881    else if ((mode & (NORMAL + VISUAL + SELECTMODE + OP_PENDING))
     3882                                 == NORMAL + VISUAL + SELECTMODE + OP_PENDING)
     3883        ga_append(&mapmode, ' ');                       /* :map */
     3884    else
     3885    {
     3886        if (mode & NORMAL)
     3887            ga_append(&mapmode, 'n');                   /* :nmap */
     3888        if (mode & OP_PENDING)
     3889            ga_append(&mapmode, 'o');                   /* :omap */
     3890        if ((mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE)
     3891            ga_append(&mapmode, 'v');                   /* :vmap */
     3892        else
     3893        {
     3894            if (mode & VISUAL)
     3895                ga_append(&mapmode, 'x');               /* :xmap */
     3896            if (mode & SELECTMODE)
     3897                ga_append(&mapmode, 's');               /* :smap */
     3898        }
     3899    }
     3900
     3901    ga_append(&mapmode, NUL);
     3902    return (char_u *)mapmode.ga_data;
     3903}
     3904
    38543905    static void
    38553906showmap(mp, local)
    38563907    mapblock_T  *mp;
    38573908    int         local;      /* TRUE for buffer-local map */
    38583909{
    3859     int len = 1;
     3910    int         len = 1;
     3911    char_u      *mapchars;
    38603912
    38613913    if (msg_didout || msg_silent != 0)
    38623914    {
     
    38643916        if (got_int)        /* 'q' typed at MORE prompt */
    38653917            return;
    38663918    }
    3867     if ((mp->m_mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
    3868         msg_putchar('!');                       /* :map! */
    3869     else if (mp->m_mode & INSERT)
    3870         msg_putchar('i');                       /* :imap */
    3871     else if (mp->m_mode & LANGMAP)
    3872         msg_putchar('l');                       /* :lmap */
    3873     else if (mp->m_mode & CMDLINE)
    3874         msg_putchar('c');                       /* :cmap */
    3875     else if ((mp->m_mode & (NORMAL + VISUAL + SELECTMODE + OP_PENDING))
    3876                                  == NORMAL + VISUAL + SELECTMODE + OP_PENDING)
    3877         msg_putchar(' ');                       /* :map */
    3878     else
     3919
     3920    mapchars = map_mode_to_chars(mp->m_mode);
     3921    if (mapchars != NULL)
    38793922    {
    3880         len = 0;
    3881         if (mp->m_mode & NORMAL)
    3882         {
    3883             msg_putchar('n');           /* :nmap */
    3884             ++len;
    3885         }
    3886         if (mp->m_mode & OP_PENDING)
    3887         {
    3888             msg_putchar('o');           /* :omap */
    3889             ++len;
    3890         }
    3891         if ((mp->m_mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE)
    3892         {
    3893             msg_putchar('v');           /* :vmap */
    3894             ++len;
    3895         }
    3896         else
    3897         {
    3898             if (mp->m_mode & VISUAL)
    3899             {
    3900                 msg_putchar('x');               /* :xmap */
    3901                 ++len;
    3902             }
    3903             if (mp->m_mode & SELECTMODE)
    3904             {
    3905                 msg_putchar('s');               /* :smap */
    3906                 ++len;
    3907             }
    3908         }
     3923        msg_puts(mapchars);
     3924        len = (int)STRLEN(mapchars);
     3925        vim_free(mapchars);
    39093926    }
     3927
    39103928    while (++len <= 3)
    39113929        msg_putchar(' ');
    39123930
     
    39313949        msg_putchar(' ');
    39323950
    39333951    /* Use FALSE below if we only want things like <Up> to show up as such on
    3934      * the rhs, and not M-x etc, TRUE gets both -- webb
    3935      */
     3952     * the rhs, and not M-x etc, TRUE gets both -- webb */
    39363953    if (*mp->m_str == NUL)
    39373954        msg_puts_attr((char_u *)"<Nop>", hl_attr(HLF_8));
    39383955    else
     
    49955012    sourcing_name = save_name;
    49965013}
    49975014
    4998 #ifdef FEAT_EVAL
     5015#if defined(FEAT_EVAL) || defined(PROTO)
    49995016/*
    5000  * Check the string "keys" against the lhs of all mappings
    5001  * Return pointer to rhs of mapping (mapblock->m_str)
    5002  * NULL otherwise
     5017 * Check the string "keys" against the lhs of all mappings.
     5018 * Return pointer to rhs of mapping (mapblock->m_str).
     5019 * NULL when no mapping found.
    50035020 */
    50045021    char_u *
    5005 check_map(keys, mode, exact, ign_mod, abbr)
     5022check_map(keys, mode, exact, ign_mod, abbr, mp_ptr, local_ptr)
    50065023    char_u      *keys;
    50075024    int         mode;
    50085025    int         exact;          /* require exact match */
    50095026    int         ign_mod;        /* ignore preceding modifier */
    50105027    int         abbr;           /* do abbreviations */
     5028    mapblock_T  **mp_ptr;       /* return: pointer to mapblock or NULL */
     5029    int         *local_ptr;     /* return: buffer-local mapping or NULL */
    50115030{
    50125031    int         hash;
    50135032    int         len, minlen;
     
    50625081                            minlen = mp->m_keylen - 3;
    50635082                    }
    50645083                    if (STRNCMP(s, keys, minlen) == 0)
     5084                    {
     5085                        if (mp_ptr != NULL)
     5086                            *mp_ptr = mp;
     5087                        if (local_ptr != NULL)
     5088#ifdef FEAT_LOCALMAP
     5089                            *local_ptr = local;
     5090#else
     5091                            *local_ptr = 0;
     5092#endif
    50655093                        return mp->m_str;
     5094                    }
    50665095                }
    50675096            }
    50685097        }
  • src/globals.h

    diff -Naur vim73.orig/src/globals.h vim73/src/globals.h
    old new  
    510510EXTERN VimClipboard clip_plus;  /* CLIPBOARD selection in X11 */
    511511# else
    512512#  define clip_plus clip_star   /* there is only one clipboard */
     513#  define ONE_CLIPBOARD
    513514# endif
    514 EXTERN int      clip_unnamed INIT(= FALSE);
     515
     516#define CLIP_UNNAMED      1
     517#define CLIP_UNNAMED_PLUS 2
     518EXTERN int      clip_unnamed INIT(= 0); /* above two values or'ed */
     519
    515520EXTERN int      clip_autoselect INIT(= FALSE);
    516521EXTERN int      clip_autoselectml INIT(= FALSE);
    517522EXTERN int      clip_html INIT(= FALSE);
  • src/gui.c

    diff -Naur vim73.orig/src/gui.c vim73/src/gui.c
    old new  
    105105
    106106#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11)
    107107    if (gui.in_use)
     108    {
     109# ifdef FEAT_EVAL
     110        Window  x11_window;
     111        Display *x11_display;
     112
     113        if (gui_get_x11_windis(&x11_window, &x11_display) == OK)
     114            set_vim_var_nr(VV_WINDOWID, (long)x11_window);
     115# endif
     116
    108117        /* Display error messages in a dialog now. */
    109118        display_errors();
     119    }
    110120#endif
    111121
    112122#if defined(MAY_FORK) && !defined(__QNXNTO__)
     
    23522362    if (draw_sign)
    23532363        /* Draw the sign on top of the spaces. */
    23542364        gui_mch_drawsign(gui.row, col, gui.highlight_mask);
    2355 # if defined(FEAT_NETBEANS_INTG) && (defined(FEAT_GUI_MOTIF) \
     2365# if defined(FEAT_NETBEANS_INTG) && (defined(FEAT_GUI_X11) \
    23562366        || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32))
    23572367    if (multi_sign)
    23582368        netbeans_draw_multisign_indicator(gui.row);
  • src/gui_gtk.c

    diff -Naur vim73.orig/src/gui_gtk.c vim73/src/gui_gtk.c
    old new  
    12871287        entry = gtk_entry_new();
    12881288        gtk_widget_show(entry);
    12891289
     1290        /* Make Enter work like pressing OK. */
     1291        gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
     1292
    12901293        text = CONVERT_TO_UTF8(textfield);
    12911294        gtk_entry_set_text(GTK_ENTRY(entry), (const char *)text);
    12921295        CONVERT_TO_UTF8_FREE(text);
     
    17951798    char_u              *repl_text;
    17961799    gboolean            direction_down;
    17971800    SharedFindReplace   *sfr;
    1798     int                 rc;
    17991801
    18001802    flags = (int)(long)data;        /* avoid a lint warning here */
    18011803
     
    18211823
    18221824    repl_text = CONVERT_FROM_UTF8(repl_text);
    18231825    find_text = CONVERT_FROM_UTF8(find_text);
    1824     rc = gui_do_findrepl(flags, find_text, repl_text, direction_down);
     1826    gui_do_findrepl(flags, find_text, repl_text, direction_down);
    18251827    CONVERT_FROM_UTF8_FREE(repl_text);
    18261828    CONVERT_FROM_UTF8_FREE(find_text);
    18271829}
  • src/gui_mac.c

    diff -Naur vim73.orig/src/gui_mac.c vim73/src/gui_mac.c
    old new  
    14801480 *
    14811481 *  Returns the index inside the menu wher
    14821482 */
    1483     short /* Shoulde we return MenuItemIndex? */
     1483    short /* Should we return MenuItemIndex? */
    14841484gui_mac_get_menu_item_index(vimmenu_T *pMenu)
    14851485{
    14861486    short       index;
     
    18231823        p.h += gui.scrollbar_width;
    18241824    if (gui.which_scrollbars[SBAR_RIGHT])
    18251825        p.h += gui.scrollbar_width;
    1826     /* ideal height is as heigh as we can get */
     1826    /* ideal height is as high as we can get */
    18271827    p.v = 15 * 1024;
    18281828
    18291829    thePart = IsWindowInStandardState(whichWindow, &p, &r)
     
    44814481         * event arrives.  No need to check for input_buf_full because we are
    44824482         * returning as soon as it contains a single char.
    44834483         */
    4484         /* TODO: reduce wtime accordinly???  */
     4484        /* TODO: reduce wtime accordingly???  */
    44854485        if (wtime > -1)
    44864486            sleeppyTick = 60 * wtime / 1000;
    44874487        else
     
    57235723    iconDITL = GetResource('DITL', 131);
    57245724    switch (type)
    57255725    {
    5726         case VIM_GENERIC:  useIcon = kNoteIcon;
    5727         case VIM_ERROR:    useIcon = kStopIcon;
    5728         case VIM_WARNING:  useIcon = kCautionIcon;
    5729         case VIM_INFO:     useIcon = kNoteIcon;
    5730         case VIM_QUESTION: useIcon = kNoteIcon;
    5731         default:      useIcon = kStopIcon;
    5732     };
     5726        case VIM_GENERIC:
     5727        case VIM_INFO:
     5728        case VIM_QUESTION: useIcon = kNoteIcon; break;
     5729        case VIM_WARNING:  useIcon = kCautionIcon; break;
     5730        case VIM_ERROR:    useIcon = kStopIcon; break;
     5731        default:           useIcon = kStopIcon;
     5732    }
    57335733    AppendDITL(theDialog, iconDITL, overlayDITL);
    57345734    ReleaseResource(iconDITL);
    57355735    GetDialogItem(theDialog, iconItm.idx, &itemType, &itemHandle, &box);
     
    58925892
    58935893    return itemHit;
    58945894/*
    5895  * Usefull thing which could be used
     5895 * Useful thing which could be used
    58965896 * SetDialogTimeout(): Auto click a button after timeout
    58975897 * SetDialogTracksCursor() : Get the I-beam cursor over input box
    58985898 * MoveDialogItem():        Probably better than SetDialogItem
     
    61006100#endif
    61016101
    61026102/*
    6103  * Transfered from os_mac.c for MacOS X using os_unix.c prep work
     6103 * Transferred from os_mac.c for MacOS X using os_unix.c prep work
    61046104 */
    61056105
    61066106    int
     
    65436543static ControlRef dataBrowser = NULL;
    65446544
    65456545// when the tabline is hidden, vim doesn't call update_tabline(). When
    6546 // the tabline is shown again, show_tabline() is called before upate_tabline(),
     6546// the tabline is shown again, show_tabline() is called before update_tabline(),
    65476547// and because of this, the tab labels and vims internal tabs are out of sync
    65486548// for a very short time. to prevent inconsistent state, we store the labels
    65496549// of the tabs, not pointers to the tabs (which are invalid for a short time).
  • src/gui_w32.c

    diff -Naur vim73.orig/src/gui_w32.c vim73/src/gui_w32.c
    old new  
    289289
    290290#ifdef FEAT_MENU
    291291static UINT     s_menu_id = 100;
     292#endif
    292293
    293294/*
    294295 * Use the system font for dialogs and tear-off menus.  Remove this line to
    295296 * use DLG_FONT_NAME.
    296297 */
    297 # define USE_SYSMENU_FONT
    298 #endif
     298#define USE_SYSMENU_FONT
    299299
    300300#define VIM_NAME        "vim"
    301301#define VIM_CLASS       "Vim"
     
    12601260
    12611261    /* try and load the user32.dll library and get the entry points for
    12621262     * multi-monitor-support. */
    1263     if ((user32_lib = LoadLibrary("User32.dll")) != NULL)
     1263    if ((user32_lib = vimLoadLib("User32.dll")) != NULL)
    12641264    {
    12651265        pMonitorFromWindow = (TMonitorFromWindow)GetProcAddress(user32_lib,
    12661266                                                         "MonitorFromWindow");
     
    15731573# endif
    15741574#endif
    15751575
     1576#ifdef FEAT_EVAL
     1577    /* set the v:windowid variable */
     1578    set_vim_var_nr(VV_WINDOWID, (long)s_hwnd);
     1579#endif
     1580
    15761581theend:
    15771582    /* Display any pending error messages */
    15781583    display_errors();
     
    41884193    static void
    41894194dyn_imm_load(void)
    41904195{
    4191     hLibImm = LoadLibrary("imm32.dll");
     4196    hLibImm = vimLoadLib("imm32.dll");
    41924197    if (hLibImm == NULL)
    41934198        return;
    41944199
  • src/gui_w48.c

    diff -Naur vim73.orig/src/gui_w48.c vim73/src/gui_w48.c
    old new  
    18101810                 * mapped we want to use the mapping instead. */
    18111811                if (vk == VK_F10
    18121812                        && gui.menu_is_active
    1813                         && check_map(k10, State, FALSE, TRUE, FALSE) == NULL)
     1813                        && check_map(k10, State, FALSE, TRUE, FALSE,
     1814                                                          NULL, NULL) == NULL)
    18141815                    break;
    18151816#endif
    18161817                if (GetKeyState(VK_SHIFT) & 0x8000)
     
    19241925    /* Check for <F10>: Default effect is to select the menu.  When <F10> is
    19251926     * mapped we need to stop it here to avoid strange effects (e.g., for the
    19261927     * key-up event) */
    1927     if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE) == NULL)
     1928    if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE,
     1929                                                          NULL, NULL) == NULL)
    19281930#endif
    19291931        DispatchMessage(&msg);
    19301932}
  • src/gui_x11.c

    diff -Naur vim73.orig/src/gui_x11.c vim73/src/gui_x11.c
    old new  
    28952895            focus = gui.in_focus;
    28962896        }
    28972897
     2898#if defined(FEAT_NETBEANS_INTG)
     2899        /* Process any queued netbeans messages. */
     2900        netbeans_parse_messages();
     2901#endif
     2902
    28982903        /*
    28992904         * Don't use gui_mch_update() because then we will spin-lock until a
    29002905         * char arrives, instead we use XtAppProcessEvent() to hang until an
  • src/if_cscope.c

    diff -Naur vim73.orig/src/if_cscope.c vim73/src/if_cscope.c
    old new  
    1313
    1414#if defined(FEAT_CSCOPE) || defined(PROTO)
    1515
    16 #include <string.h>
    17 #include <errno.h>
    1816#include <assert.h>
    1917#include <sys/types.h>
    2018#include <sys/stat.h>
    2119#if defined(UNIX)
    2220# include <sys/wait.h>
    23 #else
    24     /* not UNIX, must be WIN32 */
    25 # include "vimio.h"
    2621#endif
    2722#include "if_cscope.h"
    2823
     
    12741269                {
    12751270                    win_split(postponed_split > 0 ? postponed_split : 0,
    12761271                                                       postponed_split_flags);
    1277 #  ifdef FEAT_SCROLLBIND
    1278                     curwin->w_p_scb = FALSE;
    1279 #  endif
     1272                    RESET_BINDING(curwin);
    12801273                    postponed_split = 0;
    12811274                }
    12821275# endif
     
    13531346                       "       g: Find this definition\n"
    13541347                       "       i: Find files #including this file\n"
    13551348                       "       s: Find this C symbol\n"
    1356                        "       t: Find assignments to\n"));
     1349                       "       t: Find this text string\n"));
    13571350
    13581351        cmdp++;
    13591352    }
     
    16641657/*
    16651658 * PRIVATE: cs_make_vim_style_matches
    16661659 *
    1667  * convert the cscope output into into a ctags style entry (as might be found
     1660 * convert the cscope output into a ctags style entry (as might be found
    16681661 * in a ctags tags file).  there's one catch though: cscope doesn't tell you
    16691662 * the type of the tag you are looking for.  for example, in Darren Hiebert's
    16701663 * ctags (the one that comes with vim), #define's use a line number to find the
  • src/if_lua.c

    diff -Naur vim73.orig/src/if_lua.c vim73/src/if_lua.c
    old new  
    4949# define symbol_from_dll dlsym
    5050# define close_dll dlclose
    5151#else
    52 # define load_dll LoadLibrary
     52# define load_dll vimLoadLib
    5353# define symbol_from_dll GetProcAddress
    5454# define close_dll FreeLibrary
    5555#endif
  • src/if_mzsch.c

    diff -Naur vim73.orig/src/if_mzsch.c vim73/src/if_mzsch.c
    old new  
    556556
    557557    if (hMzGC && hMzSch)
    558558        return OK;
    559     hMzSch = LoadLibrary(sch_dll);
    560     hMzGC = LoadLibrary(gc_dll);
     559    hMzSch = vimLoadLib(sch_dll);
     560    hMzGC = vimLoadLib(gc_dll);
    561561
    562562    if (!hMzSch)
    563563    {
     
    794794#endif
    795795}
    796796
     797#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) && defined(USE_THREAD_LOCAL)
     798static __declspec(thread) void *tls_space;
     799#endif
     800
    797801    void
    798802mzscheme_main(void)
    799803{
     804#if MZSCHEME_VERSION_MAJOR >= 500 && defined(WIN32) && defined(USE_THREAD_LOCAL)
     805    scheme_register_tls_space(&tls_space, 0);
     806#endif
    800807#if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400
    801808    /* use trampoline for precise GC in MzScheme >= 4.x */
    802809    scheme_main_setup(TRUE, mzscheme_env_main, 0, NULL);
  • src/if_perl.xs

    diff -Naur vim73.orig/src/if_perl.xs vim73/src/if_perl.xs
    old new  
    106106#define close_dll dlclose
    107107#else
    108108#define PERL_PROC FARPROC
    109 #define load_dll LoadLibrary
     109#define load_dll vimLoadLib
    110110#define symbol_from_dll GetProcAddress
    111111#define close_dll FreeLibrary
    112112#endif
  • src/if_py_both.h

    diff -Naur vim73.orig/src/if_py_both.h vim73/src/if_py_both.h
    old new  
    3434static PyObject *OutputWrite(PyObject *, PyObject *);
    3535static PyObject *OutputWritelines(PyObject *, PyObject *);
    3636
     37/* Function to write a line, points to either msg() or emsg(). */
    3738typedef void (*writefn)(char_u *);
    3839static void writer(writefn fn, char_u *str, PyInt n);
    3940
     
    122123    return Py_None;
    123124}
    124125
    125 static char_u *buffer = NULL;
    126 static PyInt buffer_len = 0;
    127 static PyInt buffer_size = 0;
    128 
     126/* Buffer IO, we write one whole line at a time. */
     127static garray_T io_ga = {0, 0, 1, 80, NULL};
    129128static writefn old_fn = NULL;
    130129
    131130    static void
    132 buffer_ensure(PyInt n)
    133 {
    134     PyInt new_size;
    135     char_u *new_buffer;
    136 
    137     if (n < buffer_size)
    138         return;
    139 
    140     new_size = buffer_size;
    141     while (new_size < n)
    142         new_size += 80;
    143 
    144     if (new_size != buffer_size)
    145     {
    146         new_buffer = alloc((unsigned)new_size);
    147         if (new_buffer == NULL)
    148             return;
    149 
    150         if (buffer)
    151         {
    152             memcpy(new_buffer, buffer, buffer_len);
    153             vim_free(buffer);
    154         }
    155 
    156         buffer = new_buffer;
    157         buffer_size = new_size;
    158     }
    159 }
    160 
    161     static void
    162131PythonIO_Flush(void)
    163132{
    164     if (old_fn && buffer_len)
     133    if (old_fn != NULL && io_ga.ga_len > 0)
    165134    {
    166         buffer[buffer_len] = 0;
    167         old_fn(buffer);
     135        ((char_u *)io_ga.ga_data)[io_ga.ga_len] = NUL;
     136        old_fn((char_u *)io_ga.ga_data);
    168137    }
    169 
    170     buffer_len = 0;
     138    io_ga.ga_len = 0;
    171139}
    172140
    173141    static void
     
    175143{
    176144    char_u *ptr;
    177145
    178     if (fn != old_fn && old_fn != NULL)
     146    /* Flush when switching output function. */
     147    if (fn != old_fn)
    179148        PythonIO_Flush();
    180 
    181149    old_fn = fn;
    182150
     151    /* Write each NL separated line.  Text after the last NL is kept for
     152     * writing later. */
    183153    while (n > 0 && (ptr = memchr(str, '\n', n)) != NULL)
    184154    {
    185155        PyInt len = ptr - str;
    186156
    187         buffer_ensure(buffer_len + len + 1);
     157        if (ga_grow(&io_ga, (int)(len + 1)) == FAIL)
     158            break;
    188159
    189         memcpy(buffer + buffer_len, str, len);
    190         buffer_len += len;
    191         buffer[buffer_len] = 0;
    192         fn(buffer);
     160        mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)len);
     161        ((char *)io_ga.ga_data)[io_ga.ga_len + len] = NUL;
     162        fn((char_u *)io_ga.ga_data);
    193163        str = ptr + 1;
    194164        n -= len + 1;
    195         buffer_len = 0;
     165        io_ga.ga_len = 0;
    196166    }
    197167
    198     /* Put the remaining text into the buffer for later printing */
    199     buffer_ensure(buffer_len + n + 1);
    200     memcpy(buffer + buffer_len, str, n);
    201     buffer_len += n;
     168    /* Put the remaining text into io_ga for later printing. */
     169    if (n > 0 && ga_grow(&io_ga, (int)(n + 1)) == OK)
     170    {
     171        mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)n);
     172        io_ga.ga_len += (int)n;
     173    }
    202174}
    203175
    204176/***************/
  • src/if_python.c

    diff -Naur vim73.orig/src/if_python.c vim73/src/if_python.c
    old new  
    102102#  include <dlfcn.h>
    103103#  define FARPROC void*
    104104#  define HINSTANCE void*
    105 #  ifdef PY_NO_RTLD_GLOBAL
     105#  if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)
    106106#   define load_dll(n) dlopen((n), RTLD_LAZY)
    107107#  else
    108108#   define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
     
    110110#  define close_dll dlclose
    111111#  define symbol_from_dll dlsym
    112112# else
    113 #  define load_dll LoadLibrary
     113#  define load_dll vimLoadLib
    114114#  define close_dll FreeLibrary
    115115#  define symbol_from_dll GetProcAddress
    116116# endif
     
    168168# define Py_BuildValue dll_Py_BuildValue
    169169# define Py_FindMethod dll_Py_FindMethod
    170170# define Py_InitModule4 dll_Py_InitModule4
     171# define Py_SetPythonHome dll_Py_SetPythonHome
    171172# define Py_Initialize dll_Py_Initialize
    172173# define Py_Finalize dll_Py_Finalize
    173174# define Py_IsInitialized dll_Py_IsInitialized
     
    226227static PyObject*(*dll_Py_BuildValue)(char *, ...);
    227228static PyObject*(*dll_Py_FindMethod)(struct PyMethodDef[], PyObject *, char *);
    228229static PyObject*(*dll_Py_InitModule4)(char *, struct PyMethodDef *, char *, PyObject *, int);
     230static void(*dll_Py_SetPythonHome)(char *home);
    229231static void(*dll_Py_Initialize)(void);
    230232static void(*dll_Py_Finalize)(void);
    231233static int(*dll_Py_IsInitialized)(void);
     
    310312# else
    311313    {"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
    312314# endif
     315    {"Py_SetPythonHome", (PYTHON_PROC*)&dll_Py_SetPythonHome},
    313316    {"Py_Initialize", (PYTHON_PROC*)&dll_Py_Initialize},
    314317    {"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize},
    315318    {"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized},
     
    349352{
    350353    int i;
    351354
    352 #if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON3)
     355#if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3)
    353356    /* Can't have Python and Python3 loaded at the same time.
    354357     * It cause a crash, because RTLD_GLOBAL is needed for
    355358     * standard C extension libraries of one or both python versions. */
     
    543546        }
    544547#endif
    545548
     549#ifdef PYTHON_HOME
     550        Py_SetPythonHome(PYTHON_HOME);
     551#endif
     552
    546553        init_structs();
    547554
    548555#if !defined(MACOS) || defined(MACOS_X_UNIX)
  • src/if_python3.c

    diff -Naur vim73.orig/src/if_python3.c vim73/src/if_python3.c
    old new  
    8080#  include <dlfcn.h>
    8181#  define FARPROC void*
    8282#  define HINSTANCE void*
    83 #  ifdef PY_NO_RTLD_GLOBAL
     83#  if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)
    8484#   define load_dll(n) dlopen((n), RTLD_LAZY)
    8585#  else
    8686#   define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
     
    8888#  define close_dll dlclose
    8989#  define symbol_from_dll dlsym
    9090# else
    91 #  define load_dll LoadLibrary
     91#  define load_dll vimLoadLib
    9292#  define close_dll FreeLibrary
    9393#  define symbol_from_dll GetProcAddress
    9494# endif
     
    132132# define PyType_Ready py3_PyType_Ready
    133133#undef Py_BuildValue
    134134# define Py_BuildValue py3_Py_BuildValue
     135# define Py_SetPythonHome py3_Py_SetPythonHome
    135136# define Py_Initialize py3_Py_Initialize
    136137# define Py_Finalize py3_Py_Finalize
    137138# define Py_IsInitialized py3_Py_IsInitialized
     
    170171 * Pointers for dynamic link
    171172 */
    172173static int (*py3_PySys_SetArgv)(int, wchar_t **);
     174static void (*py3_Py_SetPythonHome)(wchar_t *home);
    173175static void (*py3_Py_Initialize)(void);
    174176static PyObject* (*py3_PyList_New)(Py_ssize_t size);
    175177static PyGILState_STATE (*py3_PyGILState_Ensure)(void);
     
    254256} py3_funcname_table[] =
    255257{
    256258    {"PySys_SetArgv", (PYTHON_PROC*)&py3_PySys_SetArgv},
     259    {"Py_SetPythonHome", (PYTHON_PROC*)&py3_Py_SetPythonHome},
    257260    {"Py_Initialize", (PYTHON_PROC*)&py3_Py_Initialize},
    258261    {"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
    259262    {"PyList_New", (PYTHON_PROC*)&py3_PyList_New},
     
    336339    int i;
    337340    void *ucs_from_string, *ucs_from_string_and_size;
    338341
    339 # if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON)
     342# if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON)
    340343    /* Can't have Python and Python3 loaded at the same time.
    341344     * It cause a crash, because RTLD_GLOBAL is needed for
    342345     * standard C extension libraries of one or both python versions. */
     
    539542
    540543        init_structs();
    541544
     545
     546#ifdef PYTHON3_HOME
     547        Py_SetPythonHome(PYTHON3_HOME);
     548#endif
     549
    542550        /* initialise threads */
    543551        PyEval_InitThreads();
    544552
  • src/if_ruby.c

    diff -Naur vim73.orig/src/if_ruby.c vim73/src/if_ruby.c
    old new  
    44 *
    55 * Ruby interface by Shugo Maeda
    66 *   with improvements by SegPhault (Ryan Paul)
     7 *   with improvements by Jon Maken
    78 *
    89 * Do ":help uganda"  in Vim to read copying and usage conditions.
    910 * Do ":help credits" in Vim to see a list of people who contributed.
     
    1314#include <stdio.h>
    1415#include <string.h>
    1516
     17#ifdef HAVE_CONFIG_H
     18# include "auto/config.h"
     19#endif
     20
    1621#ifdef _WIN32
    1722# if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18)
    1823#   define NT
     
    2631# define RUBYEXTERN extern
    2732#endif
    2833
     34#ifdef DYNAMIC_RUBY
    2935/*
    3036 * This is tricky.  In ruby.h there is (inline) function rb_class_of()
    3137 * definition.  This function use these variables.  But we want function to
    3238 * use dll_* variables.
    3339 */
    34 #ifdef DYNAMIC_RUBY
    3540# define rb_cFalseClass         (*dll_rb_cFalseClass)
    3641# define rb_cFixnum             (*dll_rb_cFixnum)
    3742# define rb_cNilClass           (*dll_rb_cNilClass)
     
    4651 */
    4752#  define RUBY_EXPORT
    4853# endif
     54
     55#if !(defined(WIN32) || defined(_WIN64))
     56# include <dlfcn.h>
     57# define HINSTANCE void*
     58# define RUBY_PROC void*
     59# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
     60# define symbol_from_dll dlsym
     61# define close_dll dlclose
     62#else
     63# define RUBY_PROC FARPROC
     64# define load_dll vimLoadLib
     65# define symbol_from_dll GetProcAddress
     66# define close_dll FreeLibrary
    4967#endif
    5068
     69#endif  /* ifdef DYNAMIC_RUBY */
     70
    5171/* suggested by Ariya Mizutani */
    5272#if (_MSC_VER == 1200)
    5373# undef _WIN32_WINNT
     
    7090# include <ruby/encoding.h>
    7191#endif
    7292
     93#undef off_t    /* ruby defines off_t as _int64, Mingw uses long */
    7394#undef EXTERN
    7495#undef _
    7596
     
    160181#define rb_lastline_get                 dll_rb_lastline_get
    161182#define rb_lastline_set                 dll_rb_lastline_set
    162183#define rb_load_protect                 dll_rb_load_protect
     184#ifndef RUBY19_OR_LATER
    163185#define rb_num2long                     dll_rb_num2long
     186#endif
    164187#define rb_num2ulong                    dll_rb_num2ulong
    165188#define rb_obj_alloc                    dll_rb_obj_alloc
    166189#define rb_obj_as_string                dll_rb_obj_as_string
    167190#define rb_obj_id                       dll_rb_obj_id
    168191#define rb_raise                        dll_rb_raise
    169 #define rb_str2cstr                     dll_rb_str2cstr
    170192#define rb_str_cat                      dll_rb_str_cat
    171193#define rb_str_concat                   dll_rb_str_concat
    172194#define rb_str_new                      dll_rb_str_new
    173195#ifdef rb_str_new2
    174196/* Ruby may #define rb_str_new2 to use rb_str_new_cstr. */
    175197# define need_rb_str_new_cstr 1
     198/* Ruby's headers #define rb_str_new_cstr to make use of GCC's
     199 * __builtin_constant_p extension. */
     200# undef rb_str_new_cstr
    176201# define rb_str_new_cstr                dll_rb_str_new_cstr
    177202#else
    178203# define rb_str_new2                    dll_rb_str_new2
    179204#endif
    180205#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
     206# define rb_string_value                dll_rb_string_value
    181207# define rb_string_value_ptr            dll_rb_string_value_ptr
    182208# define rb_float_new                   dll_rb_float_new
    183209# define rb_ary_new                     dll_rb_ary_new
    184210# define rb_ary_push                    dll_rb_ary_push
     211#else
     212# define rb_str2cstr                    dll_rb_str2cstr
    185213#endif
    186214#ifdef RUBY19_OR_LATER
    187215# define rb_errinfo                     dll_rb_errinfo
     
    190218#endif
    191219#define ruby_init                       dll_ruby_init
    192220#define ruby_init_loadpath              dll_ruby_init_loadpath
    193 #define NtInitialize                    dll_NtInitialize
    194 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
    195 # define rb_w32_snprintf                dll_rb_w32_snprintf
     221#ifdef WIN3264
     222# define NtInitialize                   dll_NtInitialize
     223# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
     224#  define rb_w32_snprintf               dll_rb_w32_snprintf
     225# endif
    196226#endif
    197227
    198228#ifdef RUBY19_OR_LATER
     
    201231# define rb_enc_find                    dll_rb_enc_find
    202232# define rb_enc_str_new                 dll_rb_enc_str_new
    203233# define rb_sprintf                     dll_rb_sprintf
     234# define rb_require                     dll_rb_require
    204235# define ruby_init_stack                dll_ruby_init_stack
     236# define ruby_process_options           dll_ruby_process_options
    205237#endif
    206238
    207239/*
     
    246278static VALUE (*dll_rb_obj_as_string) (VALUE);
    247279static VALUE (*dll_rb_obj_id) (VALUE);
    248280static void (*dll_rb_raise) (VALUE, const char*, ...);
     281#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
     282static VALUE (*dll_rb_string_value) (volatile VALUE*);
     283#else
    249284static char *(*dll_rb_str2cstr) (VALUE,int*);
     285#endif
    250286static VALUE (*dll_rb_str_cat) (VALUE, const char*, long);
    251287static VALUE (*dll_rb_str_concat) (VALUE, VALUE);
    252288static VALUE (*dll_rb_str_new) (const char*, long);
     
    263299#endif
    264300static void (*dll_ruby_init) (void);
    265301static void (*dll_ruby_init_loadpath) (void);
     302#ifdef WIN3264
    266303static void (*dll_NtInitialize) (int*, char***);
     304# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
     305static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
     306# endif
     307#endif
    267308#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
    268309static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
    269310static VALUE (*dll_rb_float_new) (double);
     
    273314#ifdef RUBY19_OR_LATER
    274315static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
    275316#endif
    276 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
    277 static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
    278 #endif
    279317
    280318#ifdef RUBY19_OR_LATER
    281319static void (*dll_ruby_script) (const char*);
     
    283321static rb_encoding* (*dll_rb_enc_find) (const char*);
    284322static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
    285323static VALUE (*dll_rb_sprintf) (const char*, ...);
     324static VALUE (*dll_rb_require) (const char*);
    286325static void (*ruby_init_stack)(VALUE*);
     326static void* (*ruby_process_options)(int, char**);
    287327#endif
    288328
    289329#ifdef RUBY19_OR_LATER
     
    297337}
    298338#endif
    299339
    300 static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
     340static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */
    301341
    302342/*
    303343 * Table of name to function pointer of ruby.
    304344 */
    305 #define RUBY_PROC FARPROC
    306345static struct
    307346{
    308347    char *name;
     
    347386    {"rb_obj_as_string", (RUBY_PROC*)&dll_rb_obj_as_string},
    348387    {"rb_obj_id", (RUBY_PROC*)&dll_rb_obj_id},
    349388    {"rb_raise", (RUBY_PROC*)&dll_rb_raise},
     389#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
     390    {"rb_string_value", (RUBY_PROC*)&dll_rb_string_value},
     391#else
    350392    {"rb_str2cstr", (RUBY_PROC*)&dll_rb_str2cstr},
     393#endif
    351394    {"rb_str_cat", (RUBY_PROC*)&dll_rb_str_cat},
    352395    {"rb_str_concat", (RUBY_PROC*)&dll_rb_str_concat},
    353396    {"rb_str_new", (RUBY_PROC*)&dll_rb_str_new},
     
    363406#endif
    364407    {"ruby_init", (RUBY_PROC*)&dll_ruby_init},
    365408    {"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
     409#ifdef WIN3264
    366410    {
    367 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
     411# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 19
    368412    "NtInitialize",
    369 #else
     413# else
    370414    "ruby_sysinit",
    371 #endif
     415# endif
    372416                        (RUBY_PROC*)&dll_NtInitialize},
    373 #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
     417# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
    374418    {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
     419# endif
    375420#endif
    376421#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
    377422    {"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
     
    386431    {"rb_enc_find", (RUBY_PROC*)&dll_rb_enc_find},
    387432    {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new},
    388433    {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
     434    {"rb_require", (RUBY_PROC*)&dll_rb_require},
    389435    {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
     436    {"ruby_process_options", (RUBY_PROC*)&dll_ruby_process_options},
    390437#endif
    391438    {"", NULL},
    392439};
     
    399446{
    400447    if (hinstRuby)
    401448    {
    402         FreeLibrary(hinstRuby);
    403         hinstRuby = 0;
     449        close_dll(hinstRuby);
     450        hinstRuby = NULL;
    404451    }
    405452}
    406453
     
    416463
    417464    if (hinstRuby)
    418465        return OK;
    419     hinstRuby = LoadLibrary(libname);
     466    hinstRuby = load_dll(libname);
    420467    if (!hinstRuby)
    421468    {
    422469        if (verbose)
     
    426473
    427474    for (i = 0; ruby_funcname_table[i].ptr; ++i)
    428475    {
    429         if (!(*ruby_funcname_table[i].ptr = GetProcAddress(hinstRuby,
     476        if (!(*ruby_funcname_table[i].ptr = symbol_from_dll(hinstRuby,
    430477                        ruby_funcname_table[i].name)))
    431478        {
    432             FreeLibrary(hinstRuby);
    433             hinstRuby = 0;
     479            close_dll(hinstRuby);
     480            hinstRuby = NULL;
    434481            if (verbose)
    435482                EMSG2(_(e_loadfunc), ruby_funcname_table[i].name);
    436483            return FAIL;
     
    539586        if (u_save(eap->line1 - 1, eap->line2 + 1) != OK)
    540587            return;
    541588        for (i = eap->line1; i <= eap->line2; i++) {
    542             VALUE line, oldline;
     589            VALUE line;
    543590
    544             line = oldline = vim_str2rb_enc_str((char *)ml_get(i));
     591            line = vim_str2rb_enc_str((char *)ml_get(i));
    545592            rb_lastline_set(line);
    546593            eval_enc_string_protect((char *) eap->arg, &state);
    547594            if (state) {
     
    616663                ruby_init();
    617664            }
    618665#ifdef RUBY19_OR_LATER
     666            {
     667                int dummy_argc = 2;
     668                char *dummy_argv[] = {"vim-ruby", "-e0"};
     669                ruby_process_options(dummy_argc, dummy_argv);
     670            }
    619671            ruby_script("vim-ruby");
    620 #endif
     672#else
    621673            ruby_init_loadpath();
    622             ruby_io_init();
    623 #ifdef RUBY19_OR_LATER
    624             rb_enc_find_index("encdb");
    625674#endif
     675            ruby_io_init();
    626676            ruby_vim_init();
    627677            ruby_initialized = 1;
    628678#ifdef DYNAMIC_RUBY
     
    906956
    907957static VALUE get_buffer_line(buf_T *buf, linenr_T n)
    908958{
    909     if (n > 0 && n <= buf->b_ml.ml_line_count)
    910     {
    911         char *line = (char *)ml_get_buf(buf, n, FALSE);
    912         return line ? vim_str2rb_enc_str(line) : Qnil;
    913     }
    914     rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
    915 #ifndef __GNUC__
    916     return Qnil; /* For stop warning */
    917 #endif
     959    if (n <= 0 || n > buf->b_ml.ml_line_count)
     960        rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
     961    return vim_str2rb_enc_str((char *)ml_get_buf(buf, n, FALSE));
    918962}
    919963
    920964static VALUE buffer_aref(VALUE self, VALUE num)
     
    953997    else
    954998    {
    955999        rb_raise(rb_eIndexError, "line number %ld out of range", (long)n);
    956 #ifndef __GNUC__
    957         return Qnil; /* For stop warning */
    958 #endif
    9591000    }
    9601001    return str;
    9611002}
     
    10101051    long        n = NUM2LONG(num);
    10111052    aco_save_T  aco;
    10121053
    1013     if (line == NULL) {
     1054    if (line == NULL)
     1055    {
    10141056        rb_raise(rb_eIndexError, "NULL line");
    10151057    }
    10161058    else if (n >= 0 && n <= buf->b_ml.ml_line_count)
     
    10341076
    10351077        update_curbuf(NOT_VALID);
    10361078    }
    1037     else {
     1079    else
     1080    {
    10381081        rb_raise(rb_eIndexError, "line number %ld out of range", n);
    10391082    }
    10401083    return str;
  • src/if_sniff.c

    diff -Naur vim73.orig/src/if_sniff.c vim73/src/if_sniff.c
    old new  
    99
    1010#ifdef WIN32
    1111# include <stdio.h>
    12 # include "vimio.h"
    1312# include <process.h>
    1413# include <string.h>
    1514# include <assert.h>
  • src/if_tcl.c

    diff -Naur vim73.orig/src/if_tcl.c vim73/src/if_tcl.c
    old new  
    7474#endif
    7575
    7676#include <tcl.h>
    77 #include <errno.h>
    7877#include <string.h>
    7978
    8079typedef struct
  • src/integration.c

    diff -Naur vim73.orig/src/integration.c vim73/src/integration.c
    old new  
    3333#include <sys/un.h>
    3434#endif
    3535
    36 #include <errno.h>
    3736#include <sys/types.h>
    3837#include <sys/socket.h>
    3938#include <sys/param.h>
  • src/link.sh

    diff -Naur vim73.orig/src/link.sh vim73/src/link.sh
    old new  
    55# libraries when they exist, but this doesn't mean they are needed for Vim.
    66#
    77#      Author: Bram Moolenaar
    8 # Last change: 2006 Sep 26
     8# Last change: 2010 Nov 03
    99#     License: Public domain
    1010#
    1111# Warning: This fails miserably if the linker doesn't return an error code!
     
    1616echo "$LINK " >link.cmd
    1717exit_value=0
    1818
     19if test "$LINK_AS_NEEDED" = yes; then
     20  echo "link.sh: \$LINK_AS_NEEDED set to 'yes': invoking linker directly."
     21  cat link.cmd
     22  if sh link.cmd; then
     23    exit_value=0
     24    echo "link.sh: Linked fine"
     25  else
     26    exit_value=$?
     27    echo "link.sh: Linking failed"
     28  fi
     29else
     30  if test -f auto/link.sed; then
     31
    1932#
    2033# If auto/link.sed already exists, use it.  We assume a previous run of
    2134# link.sh has found the correct set of libraries.
    2235#
    23 if test -f auto/link.sed; then
    2436  echo "link.sh: The file 'auto/link.sed' exists, which is going to be used now."
    2537  echo "link.sh: If linking fails, try deleting the auto/link.sed file."
    2638  echo "link.sh: If this fails too, try creating an empty auto/link.sed file."
     
    124136  fi
    125137fi
    126138
     139fi
     140
    127141#
    128142# cleanup
    129143#
  • src/macros.h

    diff -Naur vim73.orig/src/macros.h vim73/src/macros.h
    old new  
    285285#else
    286286# define DO_AUTOCHDIR
    287287#endif
     288
     289#if defined(FEAT_SCROLLBIND) && defined(FEAT_CURSORBIND)
     290# define RESET_BINDING(wp)  (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
     291#else
     292# if defined(FEAT_SCROLLBIND)
     293#  define RESET_BINDING(wp)  (wp)->w_p_scb = FALSE
     294# else
     295#  if defined(FEAT_CURSORBIND)
     296#   define RESET_BINDING(wp)  (wp)->w_p_crb = FALSE
     297#  else
     298#   define RESET_BINDING(wp)
     299#  endif
     300# endif
     301#endif
  • src/main.c

    diff -Naur vim73.orig/src/main.c vim73/src/main.c
    old new  
    77 * See README.txt for an overview of the Vim source code.
    88 */
    99
    10 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
    11 # include "vimio.h"             /* for close() and dup() */
    12 #endif
    13 
    1410#define EXTERN
    1511#include "vim.h"
    1612
     
    940936    if (netbeansArg != NULL && strncmp("-nb", netbeansArg, 3) == 0)
    941937    {
    942938# ifdef FEAT_GUI
    943 #  if !defined(FEAT_GUI_MOTIF) && !defined(FEAT_GUI_GTK)  \
     939#  if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK)  \
    944940                && !defined(FEAT_GUI_W32)
    945941        if (gui.in_use)
    946942        {
     
    38173813    /* Check if we have at least one argument. */
    38183814    if (filec <= 0)
    38193815        mainerr_arg_missing((char_u *)filev[-1]);
     3816
     3817    /* Temporarily cd to the current directory to handle relative file names. */
    38203818    if (mch_dirname(cwd, MAXPATHL) != OK)
    38213819        return NULL;
    38223820    if ((p = vim_strsave_escaped_ext(cwd,
     
    38583856        ga_concat(&ga, p);
    38593857        vim_free(p);
    38603858    }
     3859    ga_concat(&ga, (char_u *)"|if exists('*inputrestore')|call inputrestore()|endif<CR>");
     3860
    38613861    /* The :drop commands goes to Insert mode when 'insertmode' is set, use
    38623862     * CTRL-\ CTRL-N again. */
    3863     ga_concat(&ga, (char_u *)"|if exists('*inputrestore')|call inputrestore()|endif<CR>");
    3864     ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd -");
     3863    ga_concat(&ga, (char_u *)"<C-\\><C-N>");
     3864
     3865    /* Switch back to the correct current directory (prior to temporary path
     3866     * switch) unless 'autochdir' is set, in which case it will already be
     3867     * correct after the :drop command. */
     3868    ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|cd -|endif<CR>");
     3869
    38653870    if (sendReply)
    3866         ga_concat(&ga, (char_u *)"<CR>:call SetupRemoteReplies()");
    3867     ga_concat(&ga, (char_u *)"<CR>:");
     3871        ga_concat(&ga, (char_u *)":call SetupRemoteReplies()<CR>");
     3872    ga_concat(&ga, (char_u *)":");
    38683873    if (inicmd != NULL)
    38693874    {
    38703875        /* Can't use <CR> after "inicmd", because an "startinsert" would cause
  • src/mbyte.c

    diff -Naur vim73.orig/src/mbyte.c vim73/src/mbyte.c
    old new  
    31243124                /* If one of the two characters is incomplete return -1. */
    31253125                if (incomplete || i + utf_byte2len(s2[i]) > n)
    31263126                    return -1;
     3127                /* Don't case-fold illegal bytes or truncated characters. */
     3128                if (utf_ptr2len(s1 + i) < l || utf_ptr2len(s2 + i) < l)
     3129                    return -1;
    31273130                cdiff = utf_fold(utf_ptr2char(s1 + i))
    31283131                                             - utf_fold(utf_ptr2char(s2 + i));
    31293132                if (cdiff != 0)
     
    41594162{
    41604163    if (hIconvDLL != 0 && hMsvcrtDLL != 0)
    41614164        return TRUE;
    4162     hIconvDLL = LoadLibrary(DYNAMIC_ICONV_DLL);
     4165    hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL);
    41634166    if (hIconvDLL == 0)         /* sometimes it's called libiconv.dll */
    4164         hIconvDLL = LoadLibrary(DYNAMIC_ICONV_DLL_ALT);
     4167        hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT);
    41654168    if (hIconvDLL != 0)
    4166         hMsvcrtDLL = LoadLibrary(DYNAMIC_MSVCRT_DLL);
     4169        hMsvcrtDLL = vimLoadLib(DYNAMIC_MSVCRT_DLL);
    41674170    if (hIconvDLL == 0 || hMsvcrtDLL == 0)
    41684171    {
    41694172        /* Only give the message when 'verbose' is set, otherwise it might be
     
    51675170    void
    51685171xim_set_preedit()
    51695172{
    5170     if (xic == NULL)
    5171         return;
    5172 
    5173     xim_set_focus(TRUE);
    5174 
    51755173    XVaNestedList attr_list;
    51765174    XRectangle spot_area;
    51775175    XPoint over_spot;
    51785176    int line_space;
    51795177
     5178    if (xic == NULL)
     5179        return;
     5180
     5181    xim_set_focus(TRUE);
     5182
    51805183    if (!xim_has_focus)
    51815184    {
    51825185        /* hide XIM cursor */
     
    55545557    void
    55555558xim_set_status_area()
    55565559{
    5557     if (xic == NULL)
    5558         return;
    5559 
    55605560    XVaNestedList preedit_list = 0, status_list = 0, list = 0;
    55615561    XRectangle pre_area, status_area;
    55625562
     5563    if (xic == NULL)
     5564        return;
     5565
    55635566    if (input_style & XIMStatusArea)
    55645567    {
    55655568        if (input_style & XIMPreeditArea)
  • src/memfile.c

    diff -Naur vim73.orig/src/memfile.c vim73/src/memfile.c
    old new  
    3232 * file is opened.
    3333 */
    3434
    35 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
    36 # include "vimio.h"     /* for lseek(), must be before vim.h */
    37 #endif
    38 
    3935#include "vim.h"
    4036
    4137/*
     
    10491045        PERROR(_("E294: Seek error in swap file read"));
    10501046        return FAIL;
    10511047    }
    1052     if ((unsigned)vim_read(mfp->mf_fd, hp->bh_data, size) != size)
     1048    if ((unsigned)read_eintr(mfp->mf_fd, hp->bh_data, size) != size)
    10531049    {
    10541050        PERROR(_("E295: Read error in swap file"));
    10551051        return FAIL;
     
    11681164    }
    11691165#endif
    11701166
    1171     if ((unsigned)vim_write(mfp->mf_fd, data, size) != size)
     1167    if ((unsigned)write_eintr(mfp->mf_fd, data, size) != size)
    11721168        result = FAIL;
    11731169
    11741170#ifdef FEAT_CRYPT
  • src/memline.c

    diff -Naur vim73.orig/src/memline.c vim73/src/memline.c
    old new  
    4242 *  mf_get().
    4343 */
    4444
    45 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
    46 # include "vimio.h"     /* for mch_open(), must be before vim.h */
    47 #endif
    48 
    4945#include "vim.h"
    5046
    5147#ifndef UNIX            /* it's in os_unix.h for Unix */
     
    5652# include <proto/dos.h>     /* for Open() and Close() */
    5753#endif
    5854
    59 #ifdef HAVE_ERRNO_H
    60 # include <errno.h>
    61 #endif
    62 
    6355typedef struct block0           ZERO_BL;    /* contents of the first block */
    6456typedef struct pointer_block    PTR_BL;     /* contents of a pointer block */
    6557typedef struct data_block       DATA_BL;    /* contents of a data block */
     
    582574            idx = ip->ip_index + 1;         /* go to next index */
    583575            page_count = 1;
    584576        }
     577
     578        if (error > 0)
     579            EMSG(_("E843: Error while updating swap file crypt"));
    585580    }
    586581
    587582    mfp->mf_old_key = NULL;
     
    20592054    fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0);
    20602055    if (fd >= 0)
    20612056    {
    2062         if (read(fd, (char *)&b0, sizeof(b0)) == sizeof(b0))
     2057        if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0))
    20632058        {
    20642059            if (STRNCMP(b0.b0_version, "VIM 3.0", 7) == 0)
    20652060            {
     
    23842379 * Make a copy of the line if necessary.
    23852380 */
    23862381/*
    2387  * get a pointer to a (read-only copy of a) line
     2382 * Return a pointer to a (read-only copy of a) line.
    23882383 *
    23892384 * On failure an error message is given and IObuff is returned (to avoid
    23902385 * having to check for error everywhere).
     
    23972392}
    23982393
    23992394/*
    2400  * ml_get_pos: get pointer to position 'pos'
     2395 * Return pointer to position "pos".
    24012396 */
    24022397    char_u *
    24032398ml_get_pos(pos)
     
    24072402}
    24082403
    24092404/*
    2410  * ml_get_curline: get pointer to cursor line.
     2405 * Return pointer to cursor line.
    24112406 */
    24122407    char_u *
    24132408ml_get_curline()
     
    24162411}
    24172412
    24182413/*
    2419  * ml_get_cursor: get pointer to cursor position
     2414 * Return pointer to cursor position.
    24202415 */
    24212416    char_u *
    24222417ml_get_cursor()
     
    24262421}
    24272422
    24282423/*
    2429  * get a pointer to a line in a specific buffer
     2424 * Return a pointer to a line in a specific buffer
    24302425 *
    24312426 * "will_change": if TRUE mark the buffer dirty (chars in the line will be
    24322427 * changed)
     
    43894384                fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0);
    43904385                if (fd >= 0)
    43914386                {
    4392                     if (read(fd, (char *)&b0, sizeof(b0)) == sizeof(b0))
     4387                    if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0))
    43934388                    {
    43944389                        /*
    43954390                         * If the swapfile has the same directory as the
  • src/menu.c

    diff -Naur vim73.orig/src/menu.c vim73/src/menu.c
    old new  
    15121512{
    15131513#ifdef FEAT_MULTI_LANG
    15141514    if (menu->en_name != NULL
    1515             && (menu_namecmp(name,menu->en_name)
    1516                 || menu_namecmp(name,menu->en_dname)))
     1515            && (menu_namecmp(name, menu->en_name)
     1516                || menu_namecmp(name, menu->en_dname)))
    15171517        return TRUE;
    15181518#endif
    15191519    return menu_namecmp(name, menu->name) || menu_namecmp(name, menu->dname);
     
    23422342
    23432343        while (menu != NULL)
    23442344        {
    2345             if (STRCMP(name, menu->name) == 0 || STRCMP(name, menu->dname) == 0)
     2345            if (menu_name_equal(name, menu))
    23462346            {
    23472347                if (menu->children == NULL)
    23482348                {
  • src/message.c

    diff -Naur vim73.orig/src/message.c vim73/src/message.c
    old new  
    569569    int         severe;
    570570#endif
    571571
     572    /* Skip this if not giving error messages at the moment. */
     573    if (emsg_not_now())
     574        return TRUE;
     575
    572576    called_emsg = TRUE;
    573577    ex_exitval = 1;
    574578
     
    581585    emsg_severe = FALSE;
    582586#endif
    583587
    584     /* Skip this if not giving error messages at the moment. */
    585     if (emsg_not_now())
    586         return TRUE;
    587 
    588588    if (!emsg_off || vim_strchr(p_debug, 't') != NULL)
    589589    {
    590590#ifdef FEAT_EVAL
     
    14771477    return retval;
    14781478}
    14791479
     1480#if defined(FEAT_EVAL) || defined(PROTO)
     1481/*
     1482 * Return the lhs or rhs of a mapping, with the key codes turned into printable
     1483 * strings, in an allocated string.
     1484 */
     1485    char_u *
     1486str2special_save(str, is_lhs)
     1487    char_u  *str;
     1488    int     is_lhs;  /* TRUE for lhs, FALSE for rhs */
     1489{
     1490    garray_T    ga;
     1491    char_u      *p = str;
     1492
     1493    ga_init2(&ga, 1, 40);
     1494    while (*p != NUL)
     1495        ga_concat(&ga, str2special(&p, is_lhs));
     1496    ga_append(&ga, NUL);
     1497    return (char_u *)ga.ga_data;
     1498}
     1499#endif
     1500
    14801501/*
    14811502 * Return the printable string for the key codes at "*sp".
    14821503 * Used for translating the lhs or rhs of a mapping to printable chars.
  • src/misc1.c

    diff -Naur vim73.orig/src/misc1.c vim73/src/misc1.c
    old new  
    31143114               && (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm)))
    31153115            continue;
    31163116
    3117         /* found a termcode: adjust length */
    3118         if (n > 0)
     3117        if (n == KEYLEN_REMOVED)  /* key code removed */
     3118            continue;
     3119        if (n > 0)              /* found a termcode: adjust length */
    31193120            len = n;
    3120         if (len == 0)       /* nothing typed yet */
     3121        if (len == 0)           /* nothing typed yet */
    31213122            continue;
    31223123
    31233124        /* Handle modifier and/or special key code. */
     
    91619162#ifdef CASE_INSENSITIVE_FILENAME
    91629163    regmatch.rm_ic = TRUE;              /* Behave like Terminal.app */
    91639164#else
    9164     regmatch.rm_ic = FALSE;             /* Don't ever ignore case */
     9165    if (flags & EW_ICASE)
     9166        regmatch.rm_ic = TRUE;          /* 'wildignorecase' set */
     9167    else
     9168        regmatch.rm_ic = FALSE;         /* Don't ignore case */
    91659169#endif
    91669170    regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
    91679171    vim_free(pat);
     
    93179321            continue;  /* it's different when it's shorter */
    93189322
    93199323        rival = other_paths[j] + other_path_len - candidate_len;
    9320         if (fnamecmp(maybe_unique, rival) == 0)
     9324        if (fnamecmp(maybe_unique, rival) == 0
     9325                && (rival == other_paths[j] || vim_ispathsep(*(rival - 1))))
    93219326            return FALSE;  /* match */
    93229327    }
    93239328
     
    96429647    if (paths == NULL)
    96439648        return 0;
    96449649
    9645     files = globpath(paths, pattern, 0);
     9650    files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
    96469651    vim_free(paths);
    96479652    if (files == NULL)
    96489653        return 0;
  • src/misc2.c

    diff -Naur vim73.orig/src/misc2.c vim73/src/misc2.c
    old new  
    200200        }
    201201#endif
    202202
    203         idx = -1;
    204203        ptr = line;
    205204        while (col <= wcol && *ptr != NUL)
    206205        {
     
    12231222#endif
    12241223
    12251224/*
    1226  * copy a string into newly allocated memory
     1225 * Copy "string" into newly allocated memory.
    12271226 */
    12281227    char_u *
    12291228vim_strsave(string)
     
    12391238    return p;
    12401239}
    12411240
     1241/*
     1242 * Copy up to "len" bytes of "string" into newly allocated memory and
     1243 * terminate with a NUL.
     1244 * The allocated memory always has size "len + 1", also when "string" is
     1245 * shorter.
     1246 */
    12421247    char_u *
    12431248vim_strnsave(string, len)
    12441249    char_u      *string;
  • src/netbeans.c

    diff -Naur vim73.orig/src/netbeans.c vim73/src/netbeans.c
    old new  
    1616 * See ":help netbeans-protocol" for explanation.
    1717 */
    1818
    19 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
    20 # include "vimio.h"     /* for mch_open(), must be before vim.h */
    21 #endif
    22 
    2319#include "vim.h"
    2420
    2521#if defined(FEAT_NETBEANS_INTG) || defined(PROTO)
     
    8783static void nb_init_graphics __ARGS((void));
    8884static void coloncmd __ARGS((char *cmd, ...));
    8985static void nb_set_curbuf __ARGS((buf_T *buf));
    90 #ifdef FEAT_GUI_MOTIF
     86#ifdef FEAT_GUI_X11
    9187static void messageFromNetbeans __ARGS((XtPointer, int *, XtInputId *));
    9288#endif
    9389#ifdef FEAT_GUI_GTK
     
    112108static NBSOCK nbsock = -1;              /* socket fd for Netbeans connection */
    113109#define NETBEANS_OPEN (nbsock != -1)
    114110
    115 #ifdef FEAT_GUI_MOTIF
     111#ifdef FEAT_GUI_X11
    116112static XtInputId inputHandler = (XtInputId)NULL;  /* Cookie for input */
    117113#endif
    118114#ifdef FEAT_GUI_GTK
     
    135131static int needupdate = 0;
    136132static int inAtomic = 0;
    137133
     134/*
     135 * Close the socket and remove the input handlers.
     136 */
    138137    static void
    139 netbeans_close(void)
     138nb_close_socket(void)
    140139{
    141     if (!NETBEANS_OPEN)
    142         return;
    143 
    144     netbeans_send_disconnect();
    145 
    146 #ifdef FEAT_GUI_MOTIF
     140#ifdef FEAT_GUI_X11
    147141    if (inputHandler != (XtInputId)NULL)
    148142    {
    149143        XtRemoveInput(inputHandler);
     
    167161# endif
    168162#endif
    169163
     164    sock_close(nbsock);
     165    nbsock = -1;
     166}
     167
     168/*
     169 * Close the connection and cleanup.
     170 * May be called when nb_close_socket() was called earlier.
     171 */
     172    static void
     173netbeans_close(void)
     174{
     175    if (NETBEANS_OPEN)
     176    {
     177        netbeans_send_disconnect();
     178        nb_close_socket();
     179    }
     180
    170181#ifdef FEAT_BEVAL
    171182    bevalServers &= ~BEVAL_NETBEANS;
    172183#endif
    173184
    174     sock_close(nbsock);
    175     nbsock = -1;
    176 
    177185    needupdate = 0;
    178186    inAtomic = 0;
    179187    nb_free();
     
    311319    server.sin_port = htons(port);
    312320    if ((host = gethostbyname(hostname)) == NULL)
    313321    {
    314         if (mch_access(hostname, R_OK) >= 0)
    315         {
    316             /* DEBUG: input file */
    317             sd = mch_open(hostname, O_RDONLY, 0);
    318             goto theend;
    319         }
    320322        nbdebug(("error in gethostbyname() in netbeans_connect()\n"));
    321323        PERROR("gethostbyname() in netbeans_connect()");
     324        sock_close(sd);
    322325        goto theend;
    323326    }
    324327    memcpy((char *)&server.sin_addr, host->h_addr, host->h_length);
     
    368371                                                         || (errno == EINTR)))
    369372                {
    370373                    nbdebug(("retrying...\n"));
    371                     sleep(5);
    372                     if (!doabort)
     374                    mch_delay(3000L, TRUE);
     375                    ui_breakcheck();
     376                    if (got_int)
    373377                    {
    374                         ui_breakcheck();
    375                         if (got_int)
    376                         {
    377                             errno = EINTR;
    378                             break;
    379                         }
     378                        errno = EINTR;
     379                        break;
    380380                    }
    381381                    if (connect(sd, (struct sockaddr *)&server,
    382382                                                         sizeof(server)) == 0)
     
    391391                    /* Get here when the server can't be found. */
    392392                    nbdebug(("Cannot connect to Netbeans #2\n"));
    393393                    PERROR(_("Cannot connect to Netbeans #2"));
     394                    sock_close(sd);
    394395                    if (doabort)
    395396                        getout(1);
    396397                    goto theend;
     
    401402        {
    402403            nbdebug(("Cannot connect to Netbeans\n"));
    403404            PERROR(_("Cannot connect to Netbeans"));
     405            sock_close(sd);
    404406            if (doabort)
    405407                getout(1);
    406408            goto theend;
     
    631633{
    632634    char_u      *p;
    633635    queue_T     *node;
    634 
    635     if (!NETBEANS_OPEN)
    636         return;
     636    int         own_node;
    637637
    638638    while (head.next != NULL && head.next != &head)
    639639    {
     
    672672            *p++ = NUL;
    673673            if (*p == NUL)
    674674            {
     675                own_node = TRUE;
    675676                head.next = node->next;
    676677                node->next->prev = node->prev;
    677678            }
     679            else
     680                own_node = FALSE;
    678681
    679682            /* now, parse and execute the commands */
    680683            nb_parse_cmd(node->buffer);
    681684
    682             if (*p == NUL)
     685            if (own_node)
    683686            {
    684687                /* buffer finished, dispose of the node and buffer */
    685688                vim_free(node->buffer);
    686689                vim_free(node);
    687690            }
    688             else
     691            /* Check that "head" wasn't changed under our fingers, e.g. when a
     692             * DETACH command was handled. */
     693            else if (head.next == node)
    689694            {
    690695                /* more follows, move to the start */
    691696                STRMOVE(node->buffer, p);
     
    700705/*
    701706 * Read a command from netbeans.
    702707 */
    703 #ifdef FEAT_GUI_MOTIF
     708#ifdef FEAT_GUI_X11
    704709    static void
    705710messageFromNetbeans(XtPointer clientData UNUSED,
    706711                    int *unused1 UNUSED,
     
    720725}
    721726#endif
    722727
     728#define DETACH_MSG "DETACH\n"
     729
    723730    void
    724731netbeans_read()
    725732{
    726733    static char_u       *buf = NULL;
    727734    int                 len = 0;
    728735    int                 readlen = 0;
    729 #if defined(NB_HAS_GUI) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)
    730     static int          level = 0;
    731 #endif
    732736#ifdef HAVE_SELECT
    733737    struct timeval      tval;
    734738    fd_set              rfds;
     
    744748        return;
    745749    }
    746750
    747 #if defined(NB_HAS_GUI) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)
    748     /* recursion guard; this will be called from the X event loop at unknown
    749      * moments */
    750     if (NB_HAS_GUI)
    751         ++level;
    752 #endif
    753 
    754751    /* Allocate a buffer to read into. */
    755752    if (buf == NULL)
    756753    {
     
    790787            break;      /* did read everything that's available */
    791788    }
    792789
     790    /* Reading a socket disconnection (readlen == 0), or a socket error. */
    793791    if (readlen <= 0)
    794792    {
    795         /* read error or didn't read anything */
    796         netbeans_close();
    797         nbdebug(("messageFromNetbeans: Error in read() from socket\n"));
     793        /* Queue a "DETACH" netbeans message in the command queue in order to
     794         * terminate the netbeans session later. Do not end the session here
     795         * directly as we may be running in the context of a call to
     796         * netbeans_parse_messages():
     797         *      netbeans_parse_messages
     798         *          -> autocmd triggered while processing the netbeans cmd
     799         *              -> ui_breakcheck
     800         *                  -> gui event loop or select loop
     801         *                      -> netbeans_read()
     802         */
     803        save((char_u *)DETACH_MSG, (int)strlen(DETACH_MSG));
     804        nb_close_socket();
     805
    798806        if (len < 0)
    799807        {
    800808            nbdebug(("read from Netbeans socket\n"));
    801809            PERROR(_("read from Netbeans socket"));
    802810        }
    803         return; /* don't try to parse it */
    804811    }
    805812
    806 #if defined(NB_HAS_GUI) && !defined(FEAT_GUI_W32)
    807     /* Let the main loop handle messages. */
    808     if (NB_HAS_GUI)
    809     {
    810 # ifdef FEAT_GUI_GTK
    811         if (gtk_main_level() > 0)
    812             gtk_main_quit();
    813 # else
    814         /* Parse the messages now, but avoid recursion. */
    815         if (level == 1)
    816             netbeans_parse_messages();
    817 
    818         --level;
    819 # endif
    820     }
     813#if defined(NB_HAS_GUI) && defined(FEAT_GUI_GTK)
     814    if (NB_HAS_GUI && gtk_main_level() > 0)
     815        gtk_main_quit();
    821816#endif
    822817}
    823818
     
    955950    keyQ_T *key_node = keyHead.next;
    956951    queue_T *cmd_node = head.next;
    957952    nbbuf_T buf;
    958     buf_T *bufp;
    959953    int i;
    960954
    961955    /* free the netbeans buffer list */
     
    964958        buf = buf_list[i];
    965959        vim_free(buf.displayname);
    966960        vim_free(buf.signmap);
    967         if ((bufp=buf.bufp) != NULL)
     961        if (buf.bufp != NULL)
    968962        {
    969963            buf.bufp->b_netbeans_file = FALSE;
    970964            buf.bufp->b_was_netbeans_file = FALSE;
     
    11861180
    11871181    nbdebug(("REP %d: <none>\n", cmdno));
    11881182
     1183    /* Avoid printing an annoying error message. */
     1184    if (!NETBEANS_OPEN)
     1185        return;
     1186
    11891187    sprintf(reply, "%d\n", cmdno);
    11901188    nb_send(reply, "nb_reply_nil");
    11911189}
     
    27732771ex_nbstart(eap)
    27742772    exarg_T     *eap;
    27752773{
     2774#ifdef FEAT_GUI
     2775# if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK)  \
     2776                && !defined(FEAT_GUI_W32)
     2777    if (gui.in_use)
     2778    {
     2779        EMSG(_("E838: netbeans is not supported with this GUI"));
     2780        return;
     2781    }
     2782# endif
     2783#endif
    27762784    netbeans_open((char *)eap->arg, FALSE);
    27772785}
    27782786
     
    29372945    if (!NB_HAS_GUI || !NETBEANS_OPEN)
    29382946        return;
    29392947
    2940 # ifdef FEAT_GUI_MOTIF
     2948# ifdef FEAT_GUI_X11
    29412949    /* tell notifier we are interested in being called
    29422950     * when there is input on the editor connection socket
    29432951     */
     
    30273035    }
    30283036}
    30293037
    3030 #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_W32) || defined(PROTO)
     3038#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_W32) || defined(PROTO)
    30313039/*
    30323040 * Tell netbeans that the window was moved or resized.
    30333041 */
     
    34583466    return FALSE;
    34593467}
    34603468
    3461 #if defined(FEAT_GUI_MOTIF) || defined(PROTO)
     3469#if defined(FEAT_GUI_X11) || defined(PROTO)
    34623470/*
    34633471 * We have multiple signs to draw at the same location. Draw the
    34643472 * multi-sign indicator instead. This is the Motif version.
     
    34873495    XDrawPoint(gui.dpy, gui.wid, gui.text_gc, x+3, y++);
    34883496    XDrawPoint(gui.dpy, gui.wid, gui.text_gc, x+2, y);
    34893497}
    3490 #endif /* FEAT_GUI_MOTIF */
     3498#endif /* FEAT_GUI_X11 */
    34913499
    34923500#if defined(FEAT_GUI_GTK) && !defined(PROTO)
    34933501/*
  • src/normal.c

    diff -Naur vim73.orig/src/normal.c vim73/src/normal.c
    old new  
    2525static int      restart_VIsual_select = 0;
    2626#endif
    2727
     28#ifdef FEAT_EVAL
     29static void     set_vcount_ca __ARGS((cmdarg_T *cap, int *set_prevcount));
     30#endif
    2831static int
    2932# ifdef __BORLANDC__
    3033_RTLENTRYF
     
    648651    dont_scroll = FALSE;        /* allow scrolling here */
    649652#endif
    650653
     654#ifdef FEAT_EVAL
     655    /* Set v:count here, when called from main() and not a stuffed
     656     * command, so that v:count can be used in an expression mapping
     657     * when there is no count. */
     658    if (toplevel && stuff_empty())
     659        set_vcount_ca(&ca, &set_prevcount);
     660#endif
     661
    651662    /*
    652663     * Get the command character from the user.
    653664     */
     
    725736             * command, so that v:count can be used in an expression mapping
    726737             * right after the count. */
    727738            if (toplevel && stuff_empty())
    728             {
    729                 long count = ca.count0;
    730 
    731                 /* multiply with ca.opcount the same way as below */
    732                 if (ca.opcount != 0)
    733                     count = ca.opcount * (count == 0 ? 1 : count);
    734                 set_vcount(count, count == 0 ? 1 : count, set_prevcount);
    735                 set_prevcount = FALSE;  /* only set v:prevcount once */
    736             }
     739                set_vcount_ca(&ca, &set_prevcount);
    737740#endif
    738741            if (ctrl_w)
    739742            {
     
    13861389    opcount = ca.opcount;
    13871390}
    13881391
     1392#ifdef FEAT_EVAL
     1393/*
     1394 * Set v:count and v:count1 according to "cap".
     1395 * Set v:prevcount only when "set_prevcount" is TRUE.
     1396 */
     1397    static void
     1398set_vcount_ca(cap, set_prevcount)
     1399    cmdarg_T    *cap;
     1400    int         *set_prevcount;
     1401{
     1402    long count = cap->count0;
     1403
     1404    /* multiply with cap->opcount the same way as above */
     1405    if (cap->opcount != 0)
     1406        count = cap->opcount * (count == 0 ? 1 : count);
     1407    set_vcount(count, count == 0 ? 1 : count, *set_prevcount);
     1408    *set_prevcount = FALSE;  /* only set v:prevcount once */
     1409}
     1410#endif
     1411
    13891412/*
    13901413 * Handle an operator after visual mode or when the movement is finished
    13911414 */
     
    56665689        else if (cmdchar == '#')
    56675690            aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
    56685691        else if (tag_cmd)
    5669             /* Don't escape spaces and Tabs in a tag with a backslash */
    5670             aux_ptr = (char_u *)"\\|\"\n[";
     5692        {
     5693            if (curbuf->b_help)
     5694                /* ":help" handles unescaped argument */
     5695                aux_ptr = (char_u *)"";
     5696            else
     5697                aux_ptr = (char_u *)"\\|\"\n[";
     5698        }
    56715699        else
    56725700            aux_ptr = (char_u *)"\\|\"\n*?[";
    56735701
     
    85248552    else
    85258553        curwin->w_curswant = 0;
    85268554    /* keep curswant at the column where we wanted to go, not where
    8527        we ended; differs if line is too short */
     8555     * we ended; differs if line is too short */
    85288556    curwin->w_set_curswant = FALSE;
    85298557}
    85308558
  • src/ops.c

    diff -Naur vim73.orig/src/ops.c vim73/src/ops.c
    old new  
    15841584adjust_clip_reg(rp)
    15851585    int         *rp;
    15861586{
    1587     /* If no reg. specified, and "unnamed" is in 'clipboard', use '*' reg. */
    1588     if (*rp == 0 && clip_unnamed)
    1589         *rp = '*';
     1587    /* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard',
     1588     * use '*' or '+' reg, respectively. "unnamedplus" prevails. */
     1589    if (*rp == 0 && clip_unnamed != 0)
     1590        *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
     1591                                                                  ? '+' : '*';
    15901592    if (!clip_star.available && *rp == '*')
    15911593        *rp = 0;
    15921594    if (!clip_plus.available && *rp == '+')
     
    28422844    char_u              *p;
    28432845    char_u              *pnew;
    28442846    struct block_def    bd;
     2847#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
     2848    int                 did_star = FALSE;
     2849#endif
    28452850
    28462851                                    /* check for read-only register */
    28472852    if (oap->regname != 0 && !valid_yank_reg(oap->regname, TRUE))
     
    31153120     */
    31163121    if (clip_star.available
    31173122            && (curr == &(y_regs[STAR_REGISTER])
    3118                 || (!deleting && oap->regname == 0 && clip_unnamed)))
     3123                || (!deleting && oap->regname == 0
     3124                                           && (clip_unnamed & CLIP_UNNAMED))))
    31193125    {
    31203126        if (curr != &(y_regs[STAR_REGISTER]))
    31213127            /* Copy the text from register 0 to the clipboard register. */
     
    31233129
    31243130        clip_own_selection(&clip_star);
    31253131        clip_gen_set_selection(&clip_star);
     3132# ifdef FEAT_X11
     3133        did_star = TRUE;
     3134# endif
    31263135    }
    31273136
    31283137# ifdef FEAT_X11
     
    31303139     * If we were yanking to the '+' register, send result to selection.
    31313140     * Also copy to the '*' register, in case auto-select is off.
    31323141     */
    3133     else if (clip_plus.available && curr == &(y_regs[PLUS_REGISTER]))
     3142    if (clip_plus.available
     3143            && (curr == &(y_regs[PLUS_REGISTER])
     3144                || (!deleting && oap->regname == 0
     3145                                      && (clip_unnamed & CLIP_UNNAMED_PLUS))))
    31343146    {
     3147        if (curr != &(y_regs[PLUS_REGISTER]))
     3148            /* Copy the text from register 0 to the clipboard register. */
     3149            copy_yank_reg(&(y_regs[PLUS_REGISTER]));
     3150
    31353151        /* No need to copy to * register upon 'unnamed' now - see below */
    31363152        clip_own_selection(&clip_plus);
    31373153        clip_gen_set_selection(&clip_plus);
    3138         if (!clip_isautosel())
     3154        if (!clip_isautosel() && !did_star)
    31393155        {
    31403156            copy_yank_reg(&(y_regs[STAR_REGISTER]));
    31413157            clip_own_selection(&clip_star);
     
    39793995    for (i = -1; i < NUM_REGISTERS && !got_int; ++i)
    39803996    {
    39813997        name = get_register_name(i);
    3982         if (arg != NULL && vim_strchr(arg, name) == NULL)
     3998        if (arg != NULL && vim_strchr(arg, name) == NULL
     3999#ifdef ONE_CLIPBOARD
     4000            /* Star register and plus register contain the same thing. */
     4001                && (name != '*' || vim_strchr(arg, '+') == NULL)
     4002#endif
     4003                )
    39834004            continue;       /* did not ask for this register */
    39844005
    39854006#ifdef FEAT_CLIPBOARD
     
    41534174    int     save_undo;
    41544175{
    41554176    char_u      *curr = NULL;
     4177    char_u      *curr_start = NULL;
    41564178    char_u      *cend;
    41574179    char_u      *newp;
    4158     char_u      *spaces;        /* number of spaces inserte before a line */
     4180    char_u      *spaces;        /* number of spaces inserted before a line */
    41594181    int         endcurr1 = NUL;
    41604182    int         endcurr2 = NUL;
    41614183    int         currsize = 0;   /* size of the current line */
     
    41814203     */
    41824204    for (t = 0; t < count; ++t)
    41834205    {
    4184         curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
     4206        curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
    41854207        if (insert_space && t > 0)
    41864208        {
    41874209            curr = skipwhite(curr);
     
    42654287            copy_spaces(cend, (size_t)(spaces[t]));
    42664288        }
    42674289        mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t,
    4268                                  (long)(cend - newp + spaces[t]));
     4290                         (long)(cend - newp + spaces[t] - (curr - curr_start)));
    42694291        if (t == 0)
    42704292            break;
    4271         curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1));
     4293        curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1));
    42724294        if (insert_space && t > 1)
    42734295            curr = skipwhite(curr);
    42744296        currsize = (int)STRLEN(curr);
  • src/option.c

    diff -Naur vim73.orig/src/option.c vim73/src/option.c
    old new  
    27402740                            (char_u *)&p_wc, PV_NONE,
    27412741                            {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
    27422742                            SCRIPTID_INIT},
    2743     {"wildcharm",   "wcm",   P_NUM|P_VI_DEF,
     2743    {"wildcharm",   "wcm",  P_NUM|P_VI_DEF,
    27442744                            (char_u *)&p_wcm, PV_NONE,
    27452745                            {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
    27462746    {"wildignore",  "wig",  P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
     
    27502750                            (char_u *)NULL, PV_NONE,
    27512751#endif
    27522752                            {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
     2753    {"wildignorecase", "wic", P_BOOL|P_VI_DEF,
     2754                            (char_u *)&p_wic, PV_NONE,
     2755                            {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
    27532756    {"wildmenu",    "wmnu", P_BOOL|P_VI_DEF,
    27542757#ifdef FEAT_WILDMENU
    27552758                            (char_u *)&p_wmnu, PV_NONE,
     
    73047307    static char_u *
    73057308check_clipboard_option()
    73067309{
    7307     int         new_unnamed = FALSE;
     7310    int         new_unnamed = 0;
    73087311    int         new_autoselect = FALSE;
    73097312    int         new_autoselectml = FALSE;
    73107313    int         new_html = FALSE;
     
    73167319    {
    73177320        if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
    73187321        {
    7319             new_unnamed = TRUE;
     7322            new_unnamed |= CLIP_UNNAMED;
    73207323            p += 7;
    73217324        }
     7325        else if (STRNCMP(p, "unnamedplus", 11) == 0
     7326                                            && (p[11] == ',' || p[11] == NUL))
     7327        {
     7328            new_unnamed |= CLIP_UNNAMED_PLUS;
     7329            p += 11;
     7330        }
    73227331        else if (STRNCMP(p, "autoselect", 10) == 0
    73237332                                        && (p[10] == ',' || p[10] == NUL))
    73247333        {
     
    97569765#ifdef FEAT_SCROLLBIND
    97579766    to->wo_scb = from->wo_scb;
    97589767#endif
     9768#ifdef FEAT_CURSORBIND
     9769    to->wo_crb = from->wo_crb;
     9770#endif
    97599771#ifdef FEAT_SPELL
    97609772    to->wo_spell = from->wo_spell;
    97619773#endif
     
    1001110023            buf->b_p_smc = p_smc;
    1001210024#endif
    1001310025#ifdef FEAT_SPELL
    10014             buf->b_s.b_p_spc = vim_strsave(p_spf);
     10026            buf->b_s.b_p_spc = vim_strsave(p_spc);
    1001510027            (void)compile_cap_prog(&buf->b_s);
    1001610028            buf->b_s.b_p_spf = vim_strsave(p_spf);
    1001710029            buf->b_s.b_p_spl = vim_strsave(p_spl);
  • src/option.h

    diff -Naur vim73.orig/src/option.h vim73/src/option.h
    old new  
    872872EXTERN char_u   *p_ww;          /* 'whichwrap' */
    873873EXTERN long     p_wc;           /* 'wildchar' */
    874874EXTERN long     p_wcm;          /* 'wildcharm' */
     875EXTERN long     p_wic;          /* 'wildignorecase' */
    875876EXTERN char_u   *p_wim;         /* 'wildmode' */
    876877#ifdef FEAT_WILDMENU
    877878EXTERN int      p_wmnu;         /* 'wildmenu' */
  • src/os_macosx.m

    diff -Naur vim73.orig/src/os_macosx.m vim73/src/os_macosx.m
    old new  
    1515    Error: MACOS 9 is no longer supported in Vim 7
    1616#endif
    1717
     18/* Avoid a conflict for the definition of Boolean between Mac header files and
     19 * X11 header files. */
     20#define NO_X11_INCLUDES
     21
    1822#include "vim.h"
    1923#import <Cocoa/Cocoa.h>
    2024
  • src/os_msdos.c

    diff -Naur vim73.orig/src/os_msdos.c vim73/src/os_msdos.c
    old new  
    2121 * Some functions are also used for Win16 (MS-Windows 3.1).
    2222 */
    2323
    24 #include "vimio.h"
    2524#include "vim.h"
    2625
    2726#include <conio.h>
  • src/os_mswin.c

    diff -Naur vim73.orig/src/os_mswin.c vim73/src/os_mswin.c
    old new  
    2222# endif
    2323#endif
    2424
    25 #include "vimio.h"
    2625#include "vim.h"
    2726
    2827#ifdef WIN16
     
    3130# include <string.h>
    3231#endif
    3332#include <sys/types.h>
    34 #include <errno.h>
    3533#include <signal.h>
    3634#include <limits.h>
    3735#include <process.h>
     
    817815    BOOL fRunTimeLinkSuccess = FALSE;
    818816
    819817    // Get a handle to the DLL module.
     818# ifdef WIN16
    820819    hinstLib = LoadLibrary(libname);
     820# else
     821    hinstLib = vimLoadLib(libname);
     822# endif
    821823
    822824    // If the handle is valid, try to get the function address.
    823825    if (hinstLib != NULL)
  • src/os_unix.c

    diff -Naur vim73.orig/src/os_unix.c vim73/src/os_unix.c
    old new  
    11231123}
    11241124#endif
    11251125
     1126# if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
     1127static void loose_clipboard __ARGS((void));
     1128
     1129/*
     1130 * Called when Vim is going to sleep or execute a shell command.
     1131 * We can't respond to requests for the X selections.  Lose them, otherwise
     1132 * other applications will hang.  But first copy the text to cut buffer 0.
     1133 */
     1134    static void
     1135loose_clipboard()
     1136{
     1137    if (clip_star.owned || clip_plus.owned)
     1138    {
     1139        x11_export_final_selection();
     1140        if (clip_star.owned)
     1141            clip_lose_selection(&clip_star);
     1142        if (clip_plus.owned)
     1143            clip_lose_selection(&clip_plus);
     1144        if (x11_display != NULL)
     1145            XFlush(x11_display);
     1146    }
     1147}
     1148#endif
     1149
    11261150/*
    11271151 * If the machine has job control, use it to suspend the program,
    11281152 * otherwise fake it by starting a new shell.
     
    11371161    out_flush();            /* needed to disable mouse on some systems */
    11381162
    11391163# if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
    1140     /* Since we are going to sleep, we can't respond to requests for the X
    1141      * selections.  Lose them, otherwise other applications will hang.  But
    1142      * first copy the text to cut buffer 0. */
    1143     if (clip_star.owned || clip_plus.owned)
    1144     {
    1145         x11_export_final_selection();
    1146         if (clip_star.owned)
    1147             clip_lose_selection(&clip_star);
    1148         if (clip_plus.owned)
    1149             clip_lose_selection(&clip_plus);