source: patches/vim-7.2-branch_update-5.patch @ 7352c10

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 7352c10 was 7352c10, checked in by Jim Gifford <clfs@…>, 15 years ago

Added: vim-7.2-branch_update-5.patch

  • Property mode set to 100644
File size: 176.2 KB
  • Filelist

    Submitted By: Jim Gifford (jim at cross-lfs dot org)
    Date: 01-19-2009
    Initial Package Version: 7.2
    Origin: Upstream
    Upstream Status: Applied
    Description: Contains all upstream patches up to 7.2.084
                 The following patches were skipped
                 007 036 041 049 071 072 074
    
    diff -Naur vim72.orig/Filelist vim72/Filelist
    old new  
    285285                src/proto/os_win32.pro \
    286286                src/proto/os_mswin.pro \
    287287                src/testdir/Make_dos.mak \
     288                src/testdir/Make_ming.mak \
    288289                src/testdir/dos.vim \
    289290                src/uninstal.c \
    290291                src/vim.def \
  • runtime/doc/cmdline.txt

    diff -Naur vim72.orig/runtime/doc/cmdline.txt vim72/runtime/doc/cmdline.txt
    old new  
    1 *cmdline.txt*   For Vim version 7.2.  Last change: 2008 Jul 29
     1*cmdline.txt*   For Vim version 7.2.  Last change: 2008 Sep 18
    22
    33
    44                  VIM REFERENCE MANUAL    by Bram Moolenaar
     
    157157                                (doesn't work at the expression prompt; some
    158158                                things such as changing the buffer or current
    159159                                window are not allowed to avoid side effects)
     160                                When the result is a |List| the items are used
     161                                as lines.  They can have line breaks inside
     162                                too.
     163                                When the result is a Float it's automatically
     164                                converted to a String.
    160165                See |registers| about registers.  {not in Vi}
    161166                Implementation detail: When using the |expression| register
    162167                and invoking setcmdpos(), this sets the position before
     
    730735In Ex commands, at places where a file name can be used, the following
    731736characters have a special meaning.  These can also be used in the expression
    732737function expand() |expand()|.
    733         %       is replaced with the current file name                  *:_%*
    734         #       is replaced with the alternate file name                *:_#*
     738        %       Is replaced with the current file name.           *:_%* *c_%*
     739        #       Is replaced with the alternate file name.         *:_#* *c_#*
    735740        #n      (where n is a number) is replaced with the file name of
    736                 buffer n.  "#0" is the same as "#"
    737         ##      is replaced with all names in the argument list         *:_##*
     741                buffer n.  "#0" is the same as "#".
     742        ##      Is replaced with all names in the argument list   *:_##* *c_##*
    738743                concatenated, separated by spaces.  Each space in a name
    739744                is preceded with a backslash.
    740 Note that these give the file name as it was typed.  If an absolute path is
    741 needed (when using the file name from a different directory), you need to add
    742 ":p".  See |filename-modifiers|.
     745        #<n     (where n is a number > 0) is replaced with old    *:_#<* *c_#<*
     746                file name n.  See |:oldfiles| or |v:oldfiles| to get the
     747                number.                                                 *E809*
     748                {only when compiled with the +eval and +viminfo features}
     749
     750Note that these, except "#<n", give the file name as it was typed.  If an
     751absolute path is needed (when using the file name from a different directory),
     752you need to add ":p".  See |filename-modifiers|.
     753
     754The "#<n" item returns an absolute path, but it will start with "~/" for files
     755below your home directory.
     756
    743757Note that backslashes are inserted before spaces, so that the command will
    744758correctly interpret the file name.  But this doesn't happen for shell
    745 commands.  For those you probably have to use quotes: >
     759commands.  For those you probably have to use quotes (this fails for files
     760that contain a quote and wildcards): >
    746761        :!ls "%"
    747762        :r !spell "%"
    748763
  • runtime/doc/eval.txt

    diff -Naur vim72.orig/runtime/doc/eval.txt vim72/runtime/doc/eval.txt
    old new  
    1 *eval.txt*      For Vim version 7.2.  Last change: 2008 Aug 09
     1*eval.txt*      For Vim version 7.2.  Last change: 2008 Nov 27
    22
    33
    44                  VIM REFERENCE MANUAL    by Bram Moolenaar
     
    14841484                This is the screen column number, like with |virtcol()|.  The
    14851485                value is zero when there was no mouse button click.
    14861486
     1487                                        *v:oldfiles* *oldfiles-variable*
     1488v:oldfiles      List of file names that is loaded from the |viminfo| file on
     1489                startup.  These are the files that Vim remembers marks for.
     1490                The length of the List is limited by the ' argument of the
     1491                'viminfo' option (default is 100).
     1492                Also see |:oldfiles| and |c_#<|.
     1493                The List can be modified, but this has no effect on what is
     1494                stored in the |viminfo| file later.  If you use values other
     1495                than String this will cause trouble.
     1496                {only when compiled with the +viminfo feature}
     1497
    14871498                                        *v:operator* *operator-variable*
    14881499v:operator      The last operator given in Normal mode.  This is a single
    14891500                character except for commands starting with <g> or <z>,
     
    16951706exists( {expr})                 Number  TRUE if {expr} exists
    16961707extend({expr1}, {expr2} [, {expr3}])
    16971708                                List/Dict insert items of {expr2} into {expr1}
    1698 expand( {expr})                 String  expand special keywords in {expr}
     1709expand( {expr} [, {flag}])      String  expand special keywords in {expr}
    16991710feedkeys( {string} [, {mode}])  Number  add key sequence to typeahead buffer
    17001711filereadable( {file})           Number  TRUE if {file} is a readable file
    17011712filewritable( {file})           Number  TRUE if {file} is a writable file
     
    17471758getwinposx()                    Number  X coord in pixels of GUI Vim window
    17481759getwinposy()                    Number  Y coord in pixels of GUI Vim window
    17491760getwinvar( {nr}, {varname})     any     variable {varname} in window {nr}
    1750 glob( {expr})                   String  expand file wildcards in {expr}
    1751 globpath( {path}, {expr})       String  do glob({expr}) for all dirs in {path}
     1761glob( {expr} [, {flag}])        String  expand file wildcards in {expr}
     1762globpath( {path}, {expr} [, {flag}])
     1763                                String  do glob({expr}) for all dirs in {path}
    17521764has( {feature})                 Number  TRUE if feature {feature} supported
    17531765has_key( {dict}, {key})         Number  TRUE if {dict} has entry {key}
    17541766haslocaldir()                   Number  TRUE if current window executed |:lcd|
     
    32753287                        :let list_is_on = getwinvar(2, '&list')
    32763288                        :echo "myvar = " . getwinvar(1, 'myvar')
    32773289<
    3278                                                         *glob()*
    3279 glob({expr})    Expand the file wildcards in {expr}.  See |wildcards| for the
     3290glob({expr} [, {flag}])                                 *glob()*
     3291                Expand the file wildcards in {expr}.  See |wildcards| for the
    32803292                use of special characters.
    32813293                The result is a String.
    32823294                When there are several matches, they are separated by <NL>
    32833295                characters.
    3284                 The 'wildignore' option applies: Names matching one of the
    3285                 patterns in 'wildignore' will be skipped.
     3296                Unless the optional {flag} argument is given and is non-zero,
     3297                the 'suffixes' and 'wildignore' options apply: Names matching
     3298                one of the patterns in 'wildignore' will be skipped and
     3299                'suffixes' affect the ordering of matches.
    32863300                If the expansion fails, the result is an empty string.
    32873301                A name for a non-existing file is not included.
    32883302
     
    32963310                See |expand()| for expanding special Vim variables.  See
    32973311                |system()| for getting the raw output of an external command.
    32983312
    3299 globpath({path}, {expr})                                *globpath()*
     3313globpath({path}, {expr} [, {flag}])                     *globpath()*
    33003314                Perform glob() on all directories in {path} and concatenate
    33013315                the results.  Example: >
    33023316                        :echo globpath(&rtp, "syntax/c.vim")
    33033317<               {path} is a comma-separated list of directory names.  Each
    33043318                directory name is prepended to {expr} and expanded like with
    3305                 glob().  A path separator is inserted when needed.
     3319                |glob()|.  A path separator is inserted when needed.
    33063320                To add a comma inside a directory name escape it with a
    33073321                backslash.  Note that on MS-Windows a directory may have a
    33083322                trailing backslash, remove it if you put a comma after it.
    33093323                If the expansion fails for one of the directories, there is no
    33103324                error message.
    3311                 The 'wildignore' option applies: Names matching one of the
    3312                 patterns in 'wildignore' will be skipped.
     3325                Unless the optional {flag} argument is given and is non-zero,
     3326                the 'suffixes' and 'wildignore' options apply: Names matching
     3327                one of the patterns in 'wildignore' will be skipped and
     3328                'suffixes' affect the ordering of matches.
    33133329
    33143330                The "**" item can be used to search in a directory tree.
    33153331                For example, to find all "README.txt" files in the directories
     
    53325348                "fg"            foreground color (GUI: color name used to set
    53335349                                the color, cterm: color number as a string,
    53345350                                term: empty string)
    5335                 "bg"            background color (like "fg")
     5351                "bg"            background color (as with "fg")
     5352                "sp"            special color (as with "fg") |highlight-guisp|
    53365353                "fg#"           like "fg", but for the GUI and the GUI is
    53375354                                running the name in "#RRGGBB" form
    53385355                "bg#"           like "fg#" for "bg"
     5356                "sp#"           like "fg#" for "sp"
    53395357                "bold"          "1" if bold
    53405358                "italic"        "1" if italic
    53415359                "reverse"       "1" if reverse
     
    58235841mouse_pterm             Compiled with support for qnx pterm mouse.
    58245842mouse_sysmouse          Compiled with support for sysmouse (*BSD console mouse)
    58255843mouse_xterm             Compiled with support for xterm mouse.
    5826 multi_byte              Compiled with support for editing Korean et al.
     5844multi_byte              Compiled with support for 'encoding'
     5845multi_byte_encoding     'encoding' is set to a multi-byte encoding.
    58275846multi_byte_ime          Compiled with support for IME input method.
    58285847multi_lang              Compiled with support for multiple languages.
    58295848mzscheme                Compiled with MzScheme interface |mzscheme|.
  • runtime/doc/netbeans.txt

    diff -Naur vim72.orig/runtime/doc/netbeans.txt vim72/runtime/doc/netbeans.txt
    old new  
    1 *netbeans.txt*  For Vim version 7.2.  Last change: 2008 Jun 28
     1*netbeans.txt*  For Vim version 7.2.  Last change: 2009 Jan 06
    22
    33
    44                  VIM REFERENCE MANUAL    by Gordon Prieur et al.
     
    722722                of the cursor.
    723723                New in version 2.1.
    724724
    725 killed          A file was closed by the user.  Only for files that have been
    726                 assigned a number by the IDE.
     725killed          A file was deleted or wiped out by the user and the buffer
     726                annotations have been removed.  The bufID number for this
     727                buffer has become invalid.  Only for files that have been
     728                assigned a bufID number by the IDE.
    727729
    728730newDotAndMark off off
    729731                Reports the position of the cursor being at "off" bytes into
  • runtime/doc/options.txt

    diff -Naur vim72.orig/runtime/doc/options.txt vim72/runtime/doc/options.txt
    old new  
    1 *options.txt*   For Vim version 7.2.  Last change: 2008 Aug 06
     1*options.txt*   For Vim version 7.2.  Last change: 2008 Nov 25
    22
    33
    44                  VIM REFERENCE MANUAL    by Bram Moolenaar
     
    74727472                        {not available when compiled without the |+wildignore|
    74737473                        feature}
    74747474        A list of file patterns.  A file that matches with one of these
    7475         patterns is ignored when completing file or directory names.
     7475        patterns is ignored when completing file or directory names, and
     7476        influences the result of |expand()|, |glob()| and |globpath()| unless
     7477        a flag is passed to disable this.
    74767478        The pattern is used like with |:autocmd|, see |autocmd-patterns|.
    74777479        Also see 'suffixes'.
    74787480        Example: >
  • runtime/doc/spell.txt

    diff -Naur vim72.orig/runtime/doc/spell.txt vim72/runtime/doc/spell.txt
    old new  
    1 *spell.txt*     For Vim version 7.2.  Last change: 2008 Jun 21
     1*spell.txt*     For Vim version 7.2.  Last change: 2008 Nov 30
    22
    33
    44                  VIM REFERENCE MANUAL    by Bram Moolenaar
     
    831831
    832832        # comment line ~
    833833
    834 With some items it's also possible to put a comment after it, but this isn't
    835 supported in general.
     834Items with a fixed number of arguments can be followed by a comment.  But only
     835if none of the arguments can contain white space.  The comment must start with
     836a "#" character.  Example:
     837
     838        KEEPCASE =  # fix case for words with this flag ~
    836839
    837840
    838841ENCODING                                                        *spell-SET*
     
    965968
    966969Note: When using utf-8 only characters up to 65000 may be used for flags.
    967970
     971Note: even when using "num" or "long" the number of flags available to
     972compounding and prefixes is limited to about 250.
     973
    968974
    969975AFFIXES
    970976                                            *spell-PFX* *spell-SFX*
     
    11781184The flag also applies to the word with affixes, thus this can be used to mark
    11791185a whole bunch of related words as bad.
    11801186
     1187                                                        *spell-FORBIDDENWORD*
     1188FORBIDDENWORD can be used just like BAD.  For compatibility with Hunspell.
     1189
    11811190                                                        *spell-NEEDAFFIX*
    11821191The NEEDAFFIX flag is used to require that a word is used with an affix.  The
    11831192word itself is not a good word (unless there is an empty affix).  Example:
     
    12681277
    12691278        NEEDCOMPOUND & ~
    12701279
     1280                                                        *spell-ONLYINCOMPOUND*
     1281The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND.  Supported for
     1282compatiblity with Hunspell.
     1283
    12711284                                                        *spell-COMPOUNDMIN*
    12721285The minimal character length of a word used for compounding is specified with
    12731286COMPOUNDMIN.  Example:
     
    13281341rules.  Can also be used for an affix to count the affix as a compounding
    13291342word.
    13301343
     1344                                                *spell-CHECKCOMPOUNDPATTERN*
     1345CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
     1346position where two words are compounded together forbids the compound.
     1347For example:
     1348        CHECKCOMPOUNDPATTERN o e ~
     1349
     1350This forbids compounding if the first word ends in "o" and the second word
     1351starts with "e".
     1352
     1353The arguments must be plain text, no patterns are actually supported, despite
     1354the item name.  Case is always ignored.
     1355
     1356The Hunspell feature to use three arguments and flags is not supported.
     1357
    13311358                                                        *spell-SYLLABLE*
    13321359The SYLLABLE item defines characters or character sequences that are used to
    13331360count the number of syllables in a word.  Example:
     
    14961523ACCENT          (Hunspell)                              *spell-ACCENT*
    14971524                Use MAP instead. |spell-MAP|
    14981525
     1526BREAK           (Hunspell)                              *spell-BREAK*
     1527                Define break points.  Unclear how it works exactly.
     1528                Not supported.
     1529
    14991530CHECKCOMPOUNDCASE  (Hunspell)                   *spell-CHECKCOMPOUNDCASE*
    15001531                Disallow uppercase letters at compound word boundaries.
    15011532                Not supported.
     
    15121543                Forbid three identical characters when compounding.  Not
    15131544                supported.
    15141545
    1515 CHECKCOMPOUNDPATTERN  (Hunspell)                *spell-CHECKCOMPOUNDPATTERN*
    1516                 Forbid compounding when patterns match.  Not supported.
    1517 
    15181546COMPLEXPREFIXES  (Hunspell)                             *spell-COMPLEXPREFIXES*
    15191547                Enables using two prefixes.  Not supported.
    15201548
     
    15361564COMPOUNDMIDDLE  (Hunspell)                              *spell-COMPOUNDMIDDLE*
    15371565                Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
    15381566
     1567COMPOUNDRULES   (Hunspell)                              *spell-COMPOUNDRULES*
     1568                Number of COMPOUNDRULE lines following.  Ignored, but the
     1569                argument must be a number.
     1570
    15391571COMPOUNDSYLLABLE  (Hunspell)                    *spell-COMPOUNDSYLLABLE*
    15401572                Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
    15411573                |spell-COMPOUNDSYLMAX|
    15421574
    1543 FORBIDDENWORD   (Hunspell)                              *spell-FORBIDDENWORD*
    1544                 Use BAD instead. |spell-BAD|
    1545 
     1575KEY             (Hunspell)                              *spell-KEY*
     1576                Define characters that are close together on the keyboard.
     1577                Used to give better suggestions.  Not supported.
     1578               
    15461579LANG            (Hunspell)                              *spell-LANG*
    15471580                This specifies language-specific behavior.  This actually
    15481581                moves part of the language knowledge into the program,
     
    15531586                Only needed for morphological analysis.
    15541587
    15551588MAXNGRAMSUGS    (Hunspell)                              *spell-MAXNGRAMSUGS*
    1556                 Not supported.
    1557 
    1558 ONLYINCOMPOUND  (Hunspell)                              *spell-ONLYINCOMPOUND*
    1559                 Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
     1589                Set number of n-gram suggestions.  Not supported.
    15601590
    15611591PSEUDOROOT      (Hunspell)                              *spell-PSEUDOROOT*
    15621592                Use NEEDAFFIX instead. |spell-NEEDAFFIX|
  • runtime/doc/starting.txt

    diff -Naur vim72.orig/runtime/doc/starting.txt vim72/runtime/doc/starting.txt
    old new  
    1 *starting.txt*  For Vim version 7.2.  Last change: 2008 Jun 21
     1*starting.txt*  For Vim version 7.2.  Last change: 2008 Nov 09
    22
    33
    44                  VIM REFERENCE MANUAL    by Bram Moolenaar
     
    13371337                                                        *viminfo-read*
    13381338When Vim is started and the 'viminfo' option is non-empty, the contents of
    13391339the viminfo file are read and the info can be used in the appropriate places.
    1340 The marks are not read in at startup (but file marks are).  See
    1341 |initialization| for how to set the 'viminfo' option upon startup.
     1340The |v:oldfiles| variable is filled.  The marks are not read in at startup
     1341(but file marks are).  See |initialization| for how to set the 'viminfo'
     1342option upon startup.
    13421343
    13431344                                                        *viminfo-write*
    13441345When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo
     
    13721373that start with any string given with the "r" flag in 'viminfo'.  This can be
    13731374used to avoid saving marks for files on removable media (for MS-DOS you would
    13741375use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:").
     1376The |v:oldfiles| variable is filled with the file names that the viminfo file
     1377has marks for.
    13751378
    13761379                                                        *viminfo-file-marks*
    13771380Uppercase marks ('A to 'Z) are stored when writing the viminfo file.  The
     
    14631466                                                   *:rv* *:rviminfo* *E195*
    14641467:rv[iminfo][!] [file]   Read from viminfo file [file] (default: see above).
    14651468                        If [!] is given, then any information that is
    1466                         already set (registers, marks, etc.) will be
    1467                         overwritten.  {not in Vi}
     1469                        already set (registers, marks, |v:oldfiles|, etc.)
     1470                        will be overwritten   {not in Vi}
    14681471
    14691472                                        *:wv* *:wviminfo* *E137* *E138* *E574*
    14701473:wv[iminfo][!] [file]   Write to viminfo file [file] (default: see above).
     
    14791482                        the .viminfo file.
    14801483                        {not in Vi}
    14811484
     1485                                                *:ol* *:oldfiles*
     1486:ol[dfiles]             List the files that have marks stored in the viminfo
     1487                        file.  This list is read on startup and only changes
     1488                        afterwards with ":rviminfo!".  Also see |v:oldfiles|.
     1489                        The number can be used with |c_#<|.
     1490                        {not in Vi, only when compiled with the +eval feature}
     1491
     1492:bro[wse] ol[dfiles][!]
     1493                        List file names as with |:oldfiles|, and then prompt
     1494                        for a number.  When the number is valid that file from
     1495                        the list is edited.
     1496                        If you get the |press-enter| prompt you can press "q"
     1497                        and still get the prompt to enter a file number.
     1498                        Use ! to abondon a modified buffer. |abandon|
     1499                        {not when compiled with tiny or small features}
     1500
    14821501 vim:tw=78:ts=8:ft=help:norl:
  • runtime/doc/usr_21.txt

    diff -Naur vim72.orig/runtime/doc/usr_21.txt vim72/runtime/doc/usr_21.txt
    old new  
    1 *usr_21.txt*    For Vim version 7.2.  Last change: 2007 May 01
     1*usr_21.txt*    For Vim version 7.2.  Last change: 2008 Nov 09
    22
    33                     VIM USER MANUAL - by Bram Moolenaar
    44
     
    153153to be lost.  Each item can be remembered only once.
    154154
    155155
    156 GETTING BACK TO WHERE YOU WERE
     156GETTING BACK TO WHERE YOU STOPPED VIM
    157157
    158158You are halfway editing a file and it's time to leave for holidays.  You exit
    159159Vim and go enjoy yourselves, forgetting all about your work.  After a couple
     
    168168   The |:marks| command is useful to find out where '0 to '9 will take you.
    169169
    170170
     171GETTING BACK TO SOME FILE
     172
     173If you want to go back to a file that you edited recently, but not when
     174exiting Vim, there is a slightly more complicated way.  You can see a list of
     175files by typing the command: >
     176
     177        :oldfiles
     178<       1: ~/.viminfo ~
     179        2: ~/text/resume.txt ~
     180        3: /tmp/draft ~
     181
     182Now you would like to edit the second file, which is in the list preceded by
     183"2:".  You type: >
     184
     185        :e #<2
     186
     187Instead of ":e" you can use any command that has a file name argument, the
     188"#<2" item works in the same place as "%" (current file name) and "#"
     189(alternate file name).  So you can also split the window to edit the third
     190file: >
     191
     192        :split #<3
     193
     194That #<123 thing is a bit complicated when you just want to edit a file.
     195Fortunately there is a simpler way: >
     196
     197        :browse oldfiles
     198<       1: ~/.viminfo ~
     199        2: ~/text/resume.txt ~
     200        3: /tmp/draft ~
     201        -- More --
     202
     203You get the same list of files as with |:oldfiles|.  If you want to edit
     204"resume.txt" first press "q" to stop the listing.  You will get a prompt:
     205
     206        Type number and <Enter> (empty cancels): ~
     207
     208Type "2" and press <Enter> to edit the second file.
     209
     210More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
     211
     212
    171213MOVE INFO FROM ONE VIM TO ANOTHER
    172214
    173215You can use the ":wviminfo" and ":rviminfo" commands to save and restore the
  • runtime/scripts.vim

    diff -Naur vim72.orig/runtime/scripts.vim vim72/runtime/scripts.vim
    old new  
    234234  elseif s:line1 =~ '\<DTD\s\+XHTML\s'
    235235    set ft=xhtml
    236236
     237    " HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
     238  elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
     239    set ft=html
     240
    237241    " PDF
    238242  elseif s:line1 =~ '^%PDF-'
    239243    set ft=pdf
  • src/auto/configure

    diff -Naur vim72.orig/src/auto/configure vim72/src/auto/configure
    old new  
    1681916819  LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
    1682016820fi
    1682116821
    16822 { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
    16823 $as_echo_n "checking for GCC 3 or later... " >&6; }
    1682416822DEPEND_CFLAGS_FILTER=
    1682516823if test "$GCC" = yes; then
     16824  { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
     16825$as_echo_n "checking for GCC 3 or later... " >&6; }
    1682616826  gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
    1682716827  if test "$gccmajor" -gt "2"; then
    1682816828    DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
    16829   fi
    16830 fi
    16831 if test "$DEPEND_CFLAGS_FILTER" = ""; then
    16832   { $as_echo "$as_me:$LINENO: result: no" >&5
     16829    { $as_echo "$as_me:$LINENO: result: yes" >&5
     16830$as_echo "yes" >&6; }
     16831  else
     16832    { $as_echo "$as_me:$LINENO: result: no" >&5
    1683316833$as_echo "no" >&6; }
    16834 else
    16835   { $as_echo "$as_me:$LINENO: result: yes" >&5
     16834  fi
     16835      { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
     16836$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
     16837  if test "$gccmajor" -gt "3"; then
     16838    CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
     16839    { $as_echo "$as_me:$LINENO: result: yes" >&5
    1683616840$as_echo "yes" >&6; }
     16841  else
     16842    { $as_echo "$as_me:$LINENO: result: no" >&5
     16843$as_echo "no" >&6; }
     16844  fi
    1683716845fi
    1683816846
    1683916847
  • src/buffer.c

    diff -Naur vim72.orig/src/buffer.c vim72/src/buffer.c
    old new  
    437437        return;
    438438#endif
    439439
    440 #ifdef FEAT_NETBEANS_INTG
    441     if (usingNetbeans)
    442         netbeans_file_closed(buf);
    443 #endif
    444440    /* Change directories when the 'acd' option is set. */
    445441    DO_AUTOCHDIR
    446442
     
    639635#ifdef FEAT_SIGNS
    640636    buf_delete_signs(buf);              /* delete any signs */
    641637#endif
     638#ifdef FEAT_NETBEANS_INTG
     639    if (usingNetbeans)
     640        netbeans_file_killed(buf);
     641#endif
    642642#ifdef FEAT_LOCALMAP
    643643    map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE);  /* clear local mappings */
    644644    map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE);   /* clear local abbrevs */
     
    647647    vim_free(buf->b_start_fenc);
    648648    buf->b_start_fenc = NULL;
    649649#endif
     650#ifdef FEAT_SPELL
     651    ga_clear(&buf->b_langp);
     652#endif
    650653}
    651654
    652655/*
     
    812815    int         bnr;            /* buffer number */
    813816    char_u      *p;
    814817
    815 #ifdef FEAT_NETBEANS_INTG
    816     netbeansCloseFile = 1;
    817 #endif
    818818    if (addr_count == 0)
    819819    {
    820820        (void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
     
    909909        }
    910910    }
    911911
    912 #ifdef FEAT_NETBEANS_INTG
    913     netbeansCloseFile = 0;
    914 #endif
    915912
    916913    return errormsg;
    917914}
     
    12371234         * "buf" if one exists */
    12381235        if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
    12391236            return OK;
    1240         /* If 'switchbuf' contians "usetab": jump to first window in any tab
     1237        /* If 'switchbuf' contains "usetab": jump to first window in any tab
    12411238         * page containing "buf" if one exists */
    12421239        if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
    12431240            return OK;
     
    13511348        }
    13521349    }
    13531350#ifdef FEAT_AUTOCMD
     1351    /* An autocommand may have deleted "buf", already entered it (e.g., when
     1352     * it did ":bunload") or aborted the script processing! */
    13541353# ifdef FEAT_EVAL
    1355     /* An autocommand may have deleted buf or aborted the script processing! */
    1356     if (buf_valid(buf) && !aborting())
     1354    if (buf_valid(buf) && buf != curbuf && !aborting())
    13571355# else
    1358     if (buf_valid(buf))     /* an autocommand may have deleted buf! */
     1356    if (buf_valid(buf) && buf != curbuf)
    13591357# endif
    13601358#endif
    13611359        enter_buffer(buf);
     
    13971395    curwin->w_cursor.coladd = 0;
    13981396#endif
    13991397    curwin->w_set_curswant = TRUE;
     1398#ifdef FEAT_AUTOCMD
     1399    curwin->w_topline_was_set = FALSE;
     1400#endif
    14001401
    14011402    /* Make sure the buffer is loaded. */
    14021403    if (curbuf->b_ml.ml_mfp == NULL)    /* need to load the file */
     
    14361437    maketitle();
    14371438#endif
    14381439#ifdef FEAT_AUTOCMD
    1439     if (curwin->w_topline == 1)         /* when autocmds didn't change it */
     1440        /* when autocmds didn't change it */
     1441    if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
    14401442#endif
    14411443        scroll_cursor_halfway(FALSE);   /* redisplay at correct position */
    14421444
     
    39633965    width = vim_strsize(out);
    39643966    if (maxwidth > 0 && width > maxwidth)
    39653967    {
    3966         /* Result is too long, must trunctate somewhere. */
     3968        /* Result is too long, must truncate somewhere. */
    39673969        l = 0;
    39683970        if (itemcnt == 0)
    39693971            s = out;
     
    50625064    {
    50635065        if (buf->b_sfname != NULL)
    50645066            return (char *)buf->b_sfname;
    5065         return "[Scratch]";
     5067        return _("[Scratch]");
    50665068    }
    50675069#endif
    50685070    if (buf->b_fname == NULL)
  • src/configure.in

    diff -Naur vim72.orig/src/configure.in vim72/src/configure.in
    old new  
    31523152dnl But only when making dependencies, cproto and lint don't take "-isystem".
    31533153dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
    31543154dnl the number before the version number.
    3155 AC_MSG_CHECKING(for GCC 3 or later)
    31563155DEPEND_CFLAGS_FILTER=
    31573156if test "$GCC" = yes; then
     3157  AC_MSG_CHECKING(for GCC 3 or later)
    31583158  gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
    31593159  if test "$gccmajor" -gt "2"; then
    31603160    DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
     3161    AC_MSG_RESULT(yes)
     3162  else
     3163    AC_MSG_RESULT(no)
     3164  fi
     3165  dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
     3166  dnl declared as char x[1] but actually longer.  Introduced in gcc 4.0.
     3167  AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
     3168  if test "$gccmajor" -gt "3"; then
     3169    CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
     3170    AC_MSG_RESULT(yes)
     3171  else
     3172    AC_MSG_RESULT(no)
    31613173  fi
    3162 fi
    3163 if test "$DEPEND_CFLAGS_FILTER" = ""; then
    3164   AC_MSG_RESULT(no)
    3165 else
    3166   AC_MSG_RESULT(yes)
    31673174fi
    31683175AC_SUBST(DEPEND_CFLAGS_FILTER)
    31693176
  • src/diff.c

    diff -Naur vim72.orig/src/diff.c vim72/src/diff.c
    old new  
    7373        {
    7474            tp->tp_diffbuf[i] = NULL;
    7575            tp->tp_diff_invalid = TRUE;
     76            if (tp == curtab)
     77                diff_redraw(TRUE);
    7678        }
    7779    }
    7880}
     
    102104            {
    103105                curtab->tp_diffbuf[i] = NULL;
    104106                curtab->tp_diff_invalid = TRUE;
     107                diff_redraw(TRUE);
    105108            }
    106109        }
    107110    }
     
    131134        {
    132135            curtab->tp_diffbuf[i] = buf;
    133136            curtab->tp_diff_invalid = TRUE;
     137            diff_redraw(TRUE);
    134138            return;
    135139        }
    136140
     
    661665    char_u      *tmp_diff;
    662666    FILE        *fd;
    663667    int         ok;
     668    int         io_error = FALSE;
    664669
    665670    /* Delete all diffblocks. */
    666671    diff_clear(curtab);
     
    697702    {
    698703        ok = FALSE;
    699704        fd = mch_fopen((char *)tmp_orig, "w");
    700         if (fd != NULL)
     705        if (fd == NULL)
     706            io_error = TRUE;
     707        else
    701708        {
    702             fwrite("line1\n", (size_t)6, (size_t)1, fd);
     709            if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1)
     710                io_error = TRUE;
    703711            fclose(fd);
    704712            fd = mch_fopen((char *)tmp_new, "w");
    705             if (fd != NULL)
     713            if (fd == NULL)
     714                io_error = TRUE;
     715            else
    706716            {
    707                 fwrite("line2\n", (size_t)6, (size_t)1, fd);
     717                if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
     718                    io_error = TRUE;
    708719                fclose(fd);
    709720                diff_file(tmp_orig, tmp_new, tmp_diff);
    710721                fd = mch_fopen((char *)tmp_diff, "r");
    711                 if (fd != NULL)
     722                if (fd == NULL)
     723                    io_error = TRUE;
     724                else
    712725                {
    713726                    char_u      linebuf[LBUFLEN];
    714727
     
    761774    }
    762775    if (!ok)
    763776    {
     777        if (io_error)
     778            EMSG(_("E810: Cannot read or write temp files"));
    764779        EMSG(_("E97: Cannot create diffs"));
    765780        diff_a_works = MAYBE;
    766781#if defined(MSWIN) || defined(MSDOS)
     
    925940    {
    926941# ifdef TEMPDIRNAMES
    927942        if (vim_tempdir != NULL)
    928             mch_chdir((char *)vim_tempdir);
     943            ignored = mch_chdir((char *)vim_tempdir);
    929944        else
    930945# endif
    931             mch_chdir("/tmp");
     946            ignored = mch_chdir("/tmp");
    932947        shorten_fnames(TRUE);
    933948    }
    934949#endif
  • src/edit.c

    diff -Naur vim72.orig/src/edit.c vim72/src/edit.c
    old new  
    147147static int  ins_compl_bs __ARGS((void));
    148148static void ins_compl_new_leader __ARGS((void));
    149149static void ins_compl_addleader __ARGS((int c));
     150static int ins_compl_len __ARGS((void));
    150151static void ins_compl_restart __ARGS((void));
    151152static void ins_compl_set_original_text __ARGS((char_u *str));
    152153static void ins_compl_addfrommatch __ARGS((void));
     
    197198static void mb_replace_pop_ins __ARGS((int cc));
    198199#endif
    199200static void replace_flush __ARGS((void));
    200 static void replace_do_bs __ARGS((void));
     201static void replace_do_bs __ARGS((int limit_col));
     202static int del_char_after_col __ARGS((int limit_col));
    201203#ifdef FEAT_CINDENT
    202204static int cindent_on __ARGS((void));
    203205#endif
     
    19331935/*
    19341936 * Backspace the cursor until the given column.  Handles REPLACE and VREPLACE
    19351937 * modes correctly.  May also be used when not in insert mode at all.
     1938 * Will attempt not to go before "col" even when there is a composing
     1939 * character.
    19361940 */
    19371941    void
    19381942backspace_until_column(col)
     
    19421946    {
    19431947        curwin->w_cursor.col--;
    19441948        if (State & REPLACE_FLAG)
    1945             replace_do_bs();
    1946         else
    1947             (void)del_char(FALSE);
     1949            replace_do_bs(col);
     1950        else if (!del_char_after_col(col))
     1951            break;
    19481952    }
    19491953}
    19501954#endif
    19511955
     1956/*
     1957 * Like del_char(), but make sure not to go before column "limit_col".
     1958 * Only matters when there are composing characters.
     1959 * Return TRUE when something was deleted.
     1960 */
     1961   static int
     1962del_char_after_col(limit_col)
     1963    int limit_col;
     1964{
     1965#ifdef FEAT_MBYTE
     1966    if (enc_utf8 && limit_col >= 0)
     1967    {
     1968        int ecol = curwin->w_cursor.col + 1;
     1969
     1970        /* Make sure the cursor is at the start of a character, but
     1971         * skip forward again when going too far back because of a
     1972         * composing character. */
     1973        mb_adjust_cursor();
     1974        while (curwin->w_cursor.col < limit_col)
     1975        {
     1976            int l = utf_ptr2len(ml_get_cursor());
     1977
     1978            if (l == 0)  /* end of line */
     1979                break;
     1980            curwin->w_cursor.col += l;
     1981        }
     1982        if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
     1983            return FALSE;
     1984        del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE);
     1985    }
     1986    else
     1987#endif
     1988        (void)del_char(FALSE);
     1989    return TRUE;
     1990}
     1991
    19521992#if defined(FEAT_INS_EXPAND) || defined(PROTO)
    19531993/*
    19541994 * CTRL-X pressed in Insert mode.
     
    24182458        {
    24192459            had_match = (curwin->w_cursor.col > compl_col);
    24202460            ins_compl_delete();
    2421             ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
     2461            ins_bytes(compl_leader + ins_compl_len());
    24222462            ins_redraw(FALSE);
    24232463
    24242464            /* When the match isn't there (to avoid matching itself) remove it
     
    24702510            *p = NUL;
    24712511            had_match = (curwin->w_cursor.col > compl_col);
    24722512            ins_compl_delete();
    2473             ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
     2513            ins_bytes(compl_leader + ins_compl_len());
    24742514            ins_redraw(FALSE);
    24752515
    24762516            /* When the match isn't there (to avoid matching itself) remove it
     
    32093249{
    32103250    ins_compl_del_pum();
    32113251    ins_compl_delete();
    3212     ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
     3252    ins_bytes(compl_leader + ins_compl_len());
    32133253    compl_used_match = FALSE;
    32143254
    32153255    if (compl_started)
     
    32643304}
    32653305
    32663306/*
     3307 * Return the length of the completion, from the completion start column to
     3308 * the cursor column.  Making sure it never goes below zero.
     3309 */
     3310    static int
     3311ins_compl_len()
     3312{
     3313    int off = curwin->w_cursor.col - compl_col;
     3314
     3315    if (off < 0)
     3316        return 0;
     3317    return off;
     3318}
     3319
     3320/*
    32673321 * Append one character to the match leader.  May reduce the number of
    32683322 * matches.
    32693323 */
     
    36213675            {
    36223676                ins_compl_delete();
    36233677                if (compl_leader != NULL)
    3624                     ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
     3678                    ins_bytes(compl_leader + ins_compl_len());
    36253679                else if (compl_first_match != NULL)
    3626                     ins_bytes(compl_orig_text
    3627                                           + curwin->w_cursor.col - compl_col);
     3680                    ins_bytes(compl_orig_text + ins_compl_len());
    36283681                retval = TRUE;
    36293682            }
    36303683
     
    42564309    static void
    42574310ins_compl_insert()
    42584311{
    4259     ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);
     4312    ins_bytes(compl_shown_match->cp_str + ins_compl_len());
    42604313    if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
    42614314        compl_used_match = FALSE;
    42624315    else
     
    44254478        if (!compl_get_longest || compl_used_match)
    44264479            ins_compl_insert();
    44274480        else
    4428             ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
     4481            ins_bytes(compl_leader + ins_compl_len());
    44294482    }
    44304483    else
    44314484        compl_used_match = FALSE;
     
    71237176 * cc == 0: character was inserted, delete it
    71247177 * cc > 0: character was replaced, put cc (first byte of original char) back
    71257178 * and check for more characters to be put back
     7179 * When "limit_col" is >= 0, don't delete before this column.  Matters when
     7180 * using composing characters, use del_char_after_col() instead of del_char().
    71267181 */
    71277182    static void
    7128 replace_do_bs()
     7183replace_do_bs(limit_col)
     7184    int         limit_col;
    71297185{
    71307186    int         cc;
    71317187#ifdef FEAT_VREPLACE
     
    71537209#ifdef FEAT_MBYTE
    71547210        if (has_mbyte)
    71557211        {
    7156             del_char(FALSE);
     7212            (void)del_char_after_col(limit_col);
    71577213# ifdef FEAT_VREPLACE
    71587214            if (State & VREPLACE_FLAG)
    71597215                orig_len = (int)STRLEN(ml_get_cursor());
     
    72037259        changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
    72047260    }
    72057261    else if (cc == 0)
    7206         (void)del_char(FALSE);
     7262        (void)del_char_after_col(limit_col);
    72077263}
    72087264
    72097265#ifdef FEAT_CINDENT
     
    82398295         * Replace mode */
    82408296        if (curwin->w_cursor.lnum != Insstart.lnum
    82418297                || curwin->w_cursor.col >= Insstart.col)
    8242             replace_do_bs();
     8298            replace_do_bs(-1);
    82438299    }
    82448300    else
    82458301        (void)del_char(FALSE);
     
    85568612                break;
    85578613            }
    85588614            if (State & REPLACE_FLAG)
    8559                 replace_do_bs();
     8615                replace_do_bs(-1);
    85608616            else
    85618617            {
    85628618#ifdef FEAT_MBYTE
  • src/eval.c

    diff -Naur vim72.orig/src/eval.c vim72/src/eval.c
    old new  
    3232
    3333#define DICT_MAXNEST 100        /* maximum nesting of lists and dicts */
    3434
     35#define DO_NOT_FREE_CNT 99999   /* refcount for dict or list that should not
     36                                   be freed. */
     37
    3538/*
    3639 * In a hashtab item "hi_key" points to "di_key" in a dictitem.
    3740 * This avoids adding a pointer to the hashtab item.
     
    348351    {VV_NAME("mouse_col",        VAR_NUMBER), 0},
    349352    {VV_NAME("operator",         VAR_STRING), VV_RO},
    350353    {VV_NAME("searchforward",    VAR_NUMBER), 0},
     354    {VV_NAME("oldfiles",         VAR_LIST), 0},
    351355};
    352356
    353357/* shorthand */
     
    355359#define vv_nr           vv_di.di_tv.vval.v_number
    356360#define vv_float        vv_di.di_tv.vval.v_float
    357361#define vv_str          vv_di.di_tv.vval.v_string
     362#define vv_list         vv_di.di_tv.vval.v_list
    358363#define vv_tv           vv_di.di_tv
    359364
    360365/*
     
    426431static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
    427432static void list_append __ARGS((list_T *l, listitem_T *item));
    428433static int list_append_tv __ARGS((list_T *l, typval_T *tv));
    429 static int list_append_string __ARGS((list_T *l, char_u *str, int len));
    430434static int list_append_number __ARGS((list_T *l, varnumber_T n));
    431435static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
    432436static int list_extend __ARGS((list_T   *l1, list_T *l2, listitem_T *bef));
     
    788792static void func_unref __ARGS((char_u *name));
    789793static void func_ref __ARGS((char_u *name));
    790794static void call_user_func __ARGS((ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, linenr_T firstline, linenr_T lastline, dict_T *selfdict));
     795static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ;
     796static void free_funccal __ARGS((funccall_T *fc, int free_val));
    791797static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr));
    792798static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp));
    793799static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
     
    845851        p = &vimvars[i];
    846852        if (p->vv_di.di_tv.v_type == VAR_STRING)
    847853        {
    848             vim_free(p->vv_di.di_tv.vval.v_string);
    849             p->vv_di.di_tv.vval.v_string = NULL;
     854            vim_free(p->vv_str);
     855            p->vv_str = NULL;
     856        }
     857        else if (p->vv_di.di_tv.v_type == VAR_LIST)
     858        {
     859            list_unref(p->vv_list);
     860            p->vv_list = NULL;
    850861        }
    851862    }
    852863    hash_clear(&vimvarht);
     864    hash_init(&vimvarht);  /* garbage_collect() will access it */
    853865    hash_clear(&compat_hashtab);
    854866
    855867    /* script-local variables */
     
    916928/* pointer to funccal for currently active function */
    917929funccall_T *current_funccal = NULL;
    918930
     931/* pointer to list of previously used funccal, still around because some
     932 * item in it is still being used. */
     933funccall_T *previous_funccal = NULL;
     934
    919935/*
    920936 * Return TRUE when a function was ended by a ":return" command.
    921937 */
     
    12561272
    12571273/*
    12581274 * Top level evaluation function, returning a string.
     1275 * When "convert" is TRUE convert a List into a sequence of lines and convert
     1276 * a Float to a String.
    12591277 * Return pointer to allocated memory, or NULL for failure.
    12601278 */
    12611279    char_u *
    1262 eval_to_string(arg, nextcmd, dolist)
     1280eval_to_string(arg, nextcmd, convert)
    12631281    char_u      *arg;
    12641282    char_u      **nextcmd;
    1265     int         dolist;         /* turn List into sequence of lines */
     1283    int         convert;
    12661284{
    12671285    typval_T    tv;
    12681286    char_u      *retval;
    12691287    garray_T    ga;
     1288    char_u      numbuf[NUMBUFLEN];
    12701289
    12711290    if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
    12721291        retval = NULL;
    12731292    else
    12741293    {
    1275         if (dolist && tv.v_type == VAR_LIST)
     1294        if (convert && tv.v_type == VAR_LIST)
    12761295        {
    12771296            ga_init2(&ga, (int)sizeof(char), 80);
    12781297            if (tv.vval.v_list != NULL)
     
    12801299            ga_append(&ga, NUL);
    12811300            retval = (char_u *)ga.ga_data;
    12821301        }
     1302#ifdef FEAT_FLOAT
     1303        else if (convert && tv.v_type == VAR_FLOAT)
     1304        {
     1305            vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
     1306            retval = vim_strsave(numbuf);
     1307        }
     1308#endif
    12831309        else
    12841310            retval = vim_strsave(get_tv_string(&tv));
    12851311        clear_tv(&tv);
     
    32773303
    32783304    if (*startarg != '(')
    32793305    {
    3280         EMSG2(_("E107: Missing braces: %s"), eap->arg);
     3306        EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
    32813307        goto end;
    32823308    }
    32833309
     
    36573683}
    36583684
    36593685/*
    3660  * Return TRUE if typeval "tv" is locked: Either tha value is locked itself or
    3661  * it refers to a List or Dictionary that is locked.
     3686 * Return TRUE if typeval "tv" is locked: Either that value is locked itself
     3687 * or it refers to a List or Dictionary that is locked.
    36623688 */
    36633689    static int
    36643690tv_islocked(tv)
     
    60476073}
    60486074
    60496075/*
     6076 * Get list item "l[idx - 1]" as a string.  Returns NULL for failure.
     6077 */
     6078    char_u *
     6079list_find_str(l, idx)
     6080    list_T      *l;
     6081    long        idx;
     6082{
     6083    listitem_T  *li;
     6084
     6085    li = list_find(l, idx - 1);
     6086    if (li == NULL)
     6087    {
     6088        EMSGN(_(e_listidx), idx);
     6089        return NULL;
     6090    }
     6091    return get_tv_string(&li->li_tv);
     6092}
     6093
     6094/*
    60506095 * Locate "item" list "l" and return its index.
    60516096 * Returns -1 when "item" is not in the list.
    60526097 */
     
    61376182 * When "len" >= 0 use "str[len]".
    61386183 * Returns FAIL when out of memory.
    61396184 */
    6140     static int
     6185    int
    61416186list_append_string(l, str, len)
    61426187    list_T      *l;
    61436188    char_u      *str;
     
    64546499    buf_T       *buf;
    64556500    win_T       *wp;
    64566501    int         i;
    6457     funccall_T  *fc;
     6502    funccall_T  *fc, **pfc;
    64586503    int         did_free = FALSE;
    64596504#ifdef FEAT_WINDOWS
    64606505    tabpage_T   *tp;
     
    64976542        set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
    64986543    }
    64996544
     6545    /* v: vars */
     6546    set_ref_in_ht(&vimvarht, copyID);
     6547
    65006548    /*
    65016549     * 2. Go through the list of dicts and free items without the copyID.
    65026550     */
     
    65356583        else
    65366584            ll = ll->lv_used_next;
    65376585
     6586    /* check if any funccal can be freed now */
     6587    for (pfc = &previous_funccal; *pfc != NULL; )
     6588    {
     6589        if (can_free_funccal(*pfc, copyID))
     6590        {
     6591            fc = *pfc;
     6592            *pfc = fc->caller;
     6593            free_funccal(fc, TRUE);
     6594            did_free = TRUE;
     6595        }
     6596        else
     6597            pfc = &(*pfc)->caller;
     6598    }
     6599
    65386600    return did_free;
    65396601}
    65406602
     
    65876649    {
    65886650        case VAR_DICT:
    65896651            dd = tv->vval.v_dict;
    6590             if (dd->dv_copyID != copyID)
     6652            if (dd != NULL && dd->dv_copyID != copyID)
    65916653            {
    65926654                /* Didn't see this dict yet. */
    65936655                dd->dv_copyID = copyID;
     
    65976659
    65986660        case VAR_LIST:
    65996661            ll = tv->vval.v_list;
    6600             if (ll->lv_copyID != copyID)
     6662            if (ll != NULL && ll->lv_copyID != copyID)
    66016663            {
    66026664                /* Didn't see this list yet. */
    66036665                ll->lv_copyID = copyID;
     
    75257587    {"getwinposx",      0, 0, f_getwinposx},
    75267588    {"getwinposy",      0, 0, f_getwinposy},
    75277589    {"getwinvar",       2, 2, f_getwinvar},
    7528     {"glob",            1, 1, f_glob},
    7529     {"globpath",        2, 2, f_globpath},
     7590    {"glob",            1, 2, f_glob},
     7591    {"globpath",        2, 3, f_globpath},
    75307592    {"has",             1, 1, f_has},
    75317593    {"has_key",         2, 2, f_has_key},
    75327594    {"haslocaldir",     0, 0, f_haslocaldir},
     
    95189580    else
    95199581    {
    95209582        /* When the optional second argument is non-zero, don't remove matches
    9521          * for 'suffixes' and 'wildignore' */
     9583         * for 'wildignore' and don't put matches for 'suffixes' at the end. */
    95229584        if (argvars[1].v_type != VAR_UNKNOWN
    95239585                                    && get_tv_number_chk(&argvars[1], &error))
    95249586            flags |= WILD_KEEP_ALL;
     
    1030010362    s = get_tv_string(&argvars[0]);
    1030110363    if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
    1030210364        EMSG2(_(e_invarg2), s);
    10303     else if (!function_exists(s))
     10365    /* Don't check an autoload name for existence here. */
     10366    else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
    1030410367        EMSG2(_("E700: Unknown function: %s"), s);
    1030510368    else
    1030610369    {
     
    1060210665# ifdef FEAT_WINDOWS
    1060310666            win_T       *wp;
    1060410667# endif
    10605             int         n = 1;
     10668            int         winnr = 1;
    1060610669
    1060710670            if (row >= 0 && col >= 0)
    1060810671            {
     
    1061210675                (void)mouse_comp_pos(win, &row, &col, &lnum);
    1061310676# ifdef FEAT_WINDOWS
    1061410677                for (wp = firstwin; wp != win; wp = wp->w_next)
    10615                     ++n;
     10678                    ++winnr;
    1061610679# endif
    10617                 vimvars[VV_MOUSE_WIN].vv_nr = n;
     10680                vimvars[VV_MOUSE_WIN].vv_nr = winnr;
    1061810681                vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
    1061910682                vimvars[VV_MOUSE_COL].vv_nr = col + 1;
    1062010683            }
     
    1128411347    typval_T    *argvars;
    1128511348    typval_T    *rettv;
    1128611349{
     11350    int         flags = WILD_SILENT|WILD_USE_NL;
    1128711351    expand_T    xpc;
     11352    int         error = FALSE;
    1128811353
    11289     ExpandInit(&xpc);
    11290     xpc.xp_context = EXPAND_FILES;
     11354    /* When the optional second argument is non-zero, don't remove matches
     11355    * for 'wildignore' and don't put matches for 'suffixes' at the end. */
     11356    if (argvars[1].v_type != VAR_UNKNOWN
     11357                                && get_tv_number_chk(&argvars[1], &error))
     11358        flags |= WILD_KEEP_ALL;
    1129111359    rettv->v_type = VAR_STRING;
    11292     rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
    11293                                      NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
     11360    if (!error)
     11361    {
     11362        ExpandInit(&xpc);
     11363        xpc.xp_context = EXPAND_FILES;
     11364        rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
     11365                                                       NULL, flags, WILD_ALL);
     11366    }
     11367    else
     11368        rettv->vval.v_string = NULL;
    1129411369}
    1129511370
    1129611371/*
     
    1130111376    typval_T    *argvars;
    1130211377    typval_T    *rettv;
    1130311378{
     11379    int         flags = 0;
    1130411380    char_u      buf1[NUMBUFLEN];
    1130511381    char_u      *file = get_tv_string_buf_chk(&argvars[1], buf1);
     11382    int         error = FALSE;
    1130611383
     11384    /* When the optional second argument is non-zero, don't remove matches
     11385    * for 'wildignore' and don't put matches for 'suffixes' at the end. */
     11386    if (argvars[2].v_type != VAR_UNKNOWN
     11387                                && get_tv_number_chk(&argvars[2], &error))
     11388        flags |= WILD_KEEP_ALL;
    1130711389    rettv->v_type = VAR_STRING;
    11308     if (file == NULL)
     11390    if (file == NULL || error)
    1130911391        rettv->vval.v_string = NULL;
    1131011392    else
    11311         rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
     11393        rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
     11394                                                                       flags);
    1131211395}
    1131311396
    1131411397/*
     
    1178211865            n = has_patch(atoi((char *)name + 5));
    1178311866        else if (STRICMP(name, "vim_starting") == 0)
    1178411867            n = (starting != 0);
     11868#ifdef FEAT_MBYTE
     11869        else if (STRICMP(name, "multi_byte_encoding") == 0)
     11870            n = has_mbyte;
     11871#endif
    1178511872#if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32)
    1178611873        else if (STRICMP(name, "balloon_multiline") == 0)
    1178711874            n = multiline_balloon_available();
     
    1583815925    if (res == FAIL)
    1583915926        res = ITEM_COMPARE_FAIL;
    1584015927    else
    15841         /* return value has wrong type */
    1584215928        res = get_tv_number_chk(&rettv, &item_compare_func_err);
    1584315929    if (item_compare_func_err)
    15844         res = ITEM_COMPARE_FAIL;
     15930        res = ITEM_COMPARE_FAIL;  /* return value has wrong type */
    1584515931    clear_tv(&rettv);
    1584615932    return res;
    1584715933}
     
    1659016676                p = highlight_has_attr(id, HL_INVERSE, modec);
    1659116677                break;
    1659216678
    16593         case 's':                                       /* standout */
    16594                 p = highlight_has_attr(id, HL_STANDOUT, modec);
     16679        case 's':
     16680                if (TOLOWER_ASC(what[1]) == 'p')        /* sp[#] */
     16681                    p = highlight_color(id, what, modec);
     16682                else                                    /* standout */
     16683                    p = highlight_has_attr(id, HL_STANDOUT, modec);
    1659516684                break;
    1659616685
    1659716686        case 'u':
     
    1665816747    col = get_tv_number(&argvars[1]) - 1;       /* -1 on type error */
    1665916748
    1666016749    if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
    16661             && col >= 0 && col < (long)STRLEN(ml_get(lnum))
     16750            && col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum)))
    1666216751            && rettv_list_alloc(rettv) != FAIL)
    1666316752    {
    1666416753        (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
     
    1809718186}
    1809818187
    1809918188/*
    18100  * Set v:count, v:count1 and v:prevcount.
     18189 * Get List v: variable value.  Caller must take care of reference count when
     18190 * needed.
     18191 */
     18192    list_T *
     18193get_vim_var_list(idx)
     18194    int         idx;
     18195{
     18196    return vimvars[idx].vv_list;
     18197}
     18198
     18199/*
     18200 * Set v:count to "count" and v:count1 to "count1".
     18201 * When "set_prevcount" is TRUE first set v:prevcount from v:count.
    1810118202 */
    1810218203    void
    18103 set_vcount(count, count1)
     18204set_vcount(count, count1, set_prevcount)
    1810418205    long        count;
    1810518206    long        count1;
     18207    int         set_prevcount;
    1810618208{
    18107     vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
     18209    if (set_prevcount)
     18210        vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
    1810818211    vimvars[VV_COUNT].vv_nr = count;
    1810918212    vimvars[VV_COUNT1].vv_nr = count1;
    1811018213}
     
    1813218235}
    1813318236
    1813418237/*
     18238 * Set List v: variable to "val".
     18239 */
     18240    void
     18241set_vim_var_list(idx, val)
     18242    int         idx;
     18243    list_T      *val;
     18244{
     18245    list_unref(vimvars[idx].vv_list);
     18246    vimvars[idx].vv_list = val;
     18247    if (val != NULL)
     18248        ++val->lv_refcount;
     18249}
     18250
     18251/*
    1813518252 * Set v:register if needed.
    1813618253 */
    1813718254    void
     
    1886818985    dictitem_T  *dict_var;
    1886918986{
    1887018987    hash_init(&dict->dv_hashtab);
    18871     dict->dv_refcount = 99999;
     18988    dict->dv_refcount = DO_NOT_FREE_CNT;
    1887218989    dict_var->di_tv.vval.v_dict = dict;
    1887318990    dict_var->di_tv.v_type = VAR_DICT;
    1887418991    dict_var->di_tv.v_lock = VAR_FIXED;
     
    1920519322 * Copy the values from typval_T "from" to typval_T "to".
    1920619323 * When needed allocates string or increases reference count.
    1920719324 * Does not make a copy of a list or dict but copies the reference!
     19325 * It is OK for "from" and "to" to point to the same item.  This is used to
     19326 * make a copy later.
    1920819327 */
    1920919328    static void
    1921019329copy_tv(from, to)
     
    2059020709    int         st_len = 0;
    2059120710
    2059220711    todo = (int)func_hashtab.ht_used;
     20712    if (todo == 0)
     20713        return;     /* nothing to dump */
     20714
    2059320715    sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
    2059420716
    2059520717    for (hi = func_hashtab.ht_array; todo > 0; ++hi)
     
    2063820760                                                              prof_self_cmp);
    2063920761        prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
    2064020762    }
     20763
     20764    vim_free(sorttab);
    2064120765}
    2064220766
    2064320767    static void
     
    2101221136    char_u      *save_sourcing_name;
    2101321137    linenr_T    save_sourcing_lnum;
    2101421138    scid_T      save_current_SID;
    21015     funccall_T  fc;
     21139    funccall_T  *fc;
    2101621140    int         save_did_emsg;
    2101721141    static int  depth = 0;
    2101821142    dictitem_T  *v;
     
    2103821162
    2103921163    line_breakcheck();          /* check for CTRL-C hit */
    2104021164
    21041     fc.caller = current_funccal;
    21042     current_funccal = &fc;
    21043     fc.func = fp;
    21044     fc.rettv = rettv;
     21165    fc = (funccall_T *)alloc(sizeof(funccall_T));
     21166    fc->caller = current_funccal;
     21167    current_funccal = fc;
     21168    fc->func = fp;
     21169    fc->rettv = rettv;
    2104521170    rettv->vval.v_number = 0;
    21046     fc.linenr = 0;
    21047     fc.returned = FALSE;
    21048     fc.level = ex_nesting_level;
     21171    fc->linenr = 0;
     21172    fc->returned = FALSE;
     21173    fc->level = ex_nesting_level;
    2104921174    /* Check if this function has a breakpoint. */
    21050     fc.breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
    21051     fc.dbg_tick = debug_tick;
     21175    fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
     21176    fc->dbg_tick = debug_tick;
    2105221177
    2105321178    /*
    21054      * Note about using fc.fixvar[]: This is an array of FIXVAR_CNT variables
     21179     * Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables
    2105521180     * with names up to VAR_SHORT_LEN long.  This avoids having to alloc/free
    2105621181     * each argument variable and saves a lot of time.
    2105721182     */
    2105821183    /*
    2105921184     * Init l: variables.
    2106021185     */
    21061     init_var_dict(&fc.l_vars, &fc.l_vars_var);
     21186    init_var_dict(&fc->l_vars, &fc->l_vars_var);
    2106221187    if (selfdict != NULL)
    2106321188    {
    2106421189        /* Set l:self to "selfdict".  Use "name" to avoid a warning from
    2106521190         * some compiler that checks the destination size. */
    21066         v = &fc.fixvar[fixvar_idx++].var;
     21191        v = &fc->fixvar[fixvar_idx++].var;
    2106721192        name = v->di_key;
    2106821193        STRCPY(name, "self");
    2106921194        v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
    21070         hash_add(&fc.l_vars.dv_hashtab, DI2HIKEY(v));
     21195        hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
    2107121196        v->di_tv.v_type = VAR_DICT;
    2107221197        v->di_tv.v_lock = 0;
    2107321198        v->di_tv.vval.v_dict = selfdict;
     
    2107921204     * Set a:0 to "argcount".
    2108021205     * Set a:000 to a list with room for the "..." arguments.
    2108121206     */
    21082     init_var_dict(&fc.l_avars, &fc.l_avars_var);
    21083     add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
     21207    init_var_dict(&fc->l_avars, &fc->l_avars_var);
     21208    add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0",
    2108421209                                (varnumber_T)(argcount - fp->uf_args.ga_len));
    21085     v = &fc.fixvar[fixvar_idx++].var;
    21086     STRCPY(v->di_key, "000");
     21210    /* Use "name" to avoid a warning from some compiler that checks the
     21211     * destination size. */
     21212    v = &fc->fixvar[fixvar_idx++].var;
     21213    name = v->di_key;
     21214    STRCPY(name, "000");
    2108721215    v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
    21088     hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
     21216    hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
    2108921217    v->di_tv.v_type = VAR_LIST;
    2109021218    v->di_tv.v_lock = VAR_FIXED;
    21091     v->di_tv.vval.v_list = &fc.l_varlist;
    21092     vim_memset(&fc.l_varlist, 0, sizeof(list_T));
    21093     fc.l_varlist.lv_refcount = 99999;
    21094     fc.l_varlist.lv_lock = VAR_FIXED;
     21219    v->di_tv.vval.v_list = &fc->l_varlist;
     21220    vim_memset(&fc->l_varlist, 0, sizeof(list_T));
     21221    fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
     21222    fc->l_varlist.lv_lock = VAR_FIXED;
    2109521223
    2109621224    /*
    2109721225     * Set a:firstline to "firstline" and a:lastline to "lastline".
    2109821226     * Set a:name to named arguments.
    2109921227     * Set a:N to the "..." arguments.
    2110021228     */
    21101     add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",
     21229    add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
    2110221230                                                      (varnumber_T)firstline);
    21103     add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",
     21231    add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
    2110421232                                                       (varnumber_T)lastline);
    2110521233    for (i = 0; i < argcount; ++i)
    2110621234    {
     
    2111621244        }
    2111721245        if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN)
    2111821246        {
    21119             v = &fc.fixvar[fixvar_idx++].var;
     21247            v = &fc->fixvar[fixvar_idx++].var;
    2112021248            v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
    2112121249        }
    2112221250        else
     
    2112821256            v->di_flags = DI_FLAGS_RO;
    2112921257        }
    2113021258        STRCPY(v->di_key, name);
    21131         hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
     21259        hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
    2113221260
    2113321261        /* Note: the values are copied directly to avoid alloc/free.
    2113421262         * "argvars" must have VAR_FIXED for v_lock. */
     
    2113721265
    2113821266        if (ai >= 0 && ai < MAX_FUNC_ARGS)
    2113921267        {
    21140             list_append(&fc.l_varlist, &fc.l_listitems[ai]);
    21141             fc.l_listitems[ai].li_tv = argvars[i];
    21142             fc.l_listitems[ai].li_tv.v_lock = VAR_FIXED;
     21268            list_append(&fc->l_varlist, &fc->l_listitems[ai]);
     21269            fc->l_listitems[ai].li_tv = argvars[i];
     21270            fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED;
    2114321271        }
    2114421272    }
    2114521273
     
    2120421332        if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
    2120521333            func_do_profile(fp);
    2120621334        if (fp->uf_profiling
    21207                        || (fc.caller != NULL && &fc.caller->func->uf_profiling))
     21335                    || (fc->caller != NULL && fc->caller->func->uf_profiling))
    2120821336        {
    2120921337            ++fp->uf_tm_count;
    2121021338            profile_start(&call_start);
     
    2122021348    did_emsg = FALSE;
    2122121349
    2122221350    /* call do_cmdline() to execute the lines */
    21223     do_cmdline(NULL, get_func_line, (void *)&fc,
     21351    do_cmdline(NULL, get_func_line, (void *)fc,
    2122421352                                     DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
    2122521353
    2122621354    --RedrawingDisabled;
     
    2123521363
    2123621364#ifdef FEAT_PROFILE
    2123721365    if (do_profiling == PROF_YES && (fp->uf_profiling
    21238                     || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
     21366                    || (fc->caller != NULL && fc->caller->func->uf_profiling)))
    2123921367    {
    2124021368        profile_end(&call_start);
    2124121369        profile_sub_wait(&wait_start, &call_start);
    2124221370        profile_add(&fp->uf_tm_total, &call_start);
    2124321371        profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
    21244         if (fc.caller != NULL && &fc.caller->func->uf_profiling)
     21372        if (fc->caller != NULL && fc->caller->func->uf_profiling)
    2124521373        {
    21246             profile_add(&fc.caller->func->uf_tm_children, &call_start);
    21247             profile_add(&fc.caller->func->uf_tml_children, &call_start);
     21374            profile_add(&fc->caller->func->uf_tm_children, &call_start);
     21375            profile_add(&fc->caller->func->uf_tml_children, &call_start);
    2124821376        }
    2124921377    }
    2125021378#endif
     
    2125721385
    2125821386        if (aborting())
    2125921387            smsg((char_u *)_("%s aborted"), sourcing_name);
    21260         else if (fc.rettv->v_type == VAR_NUMBER)
     21388        else if (fc->rettv->v_type == VAR_NUMBER)
    2126121389            smsg((char_u *)_("%s returning #%ld"), sourcing_name,
    21262                                                (long)fc.rettv->vval.v_number);
     21390                                               (long)fc->rettv->vval.v_number);
    2126321391        else
    2126421392        {
    2126521393            char_u      buf[MSG_BUF_LEN];
     
    2127021398            /* The value may be very long.  Skip the middle part, so that we
    2127121399             * have some idea how it starts and ends. smsg() would always
    2127221400             * truncate it at the end. */
    21273             s = tv2string(fc.rettv, &tofree, numbuf2, 0);
     21401            s = tv2string(fc->rettv, &tofree, numbuf2, 0);
    2127421402            if (s != NULL)
    2127521403            {
    2127621404                trunc_string(s, buf, MSG_BUF_CLEN);
     
    2130621434    }
    2130721435
    2130821436    did_emsg |= save_did_emsg;
    21309     current_funccal = fc.caller;
     21437    current_funccal = fc->caller;
     21438    --depth;
    2131021439
    21311     /* The a: variables typevals were not allocated, only free the allocated
    21312      * variables. */
    21313     vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
     21440    /* if the a:000 list and the a: dict are not referenced we can free the
     21441     * funccall_T and what's in it. */
     21442    if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
     21443            && fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
     21444            && fc->l_avars.dv_refcount == DO_NOT_FREE_CNT)
     21445    {
     21446        free_funccal(fc, FALSE);
     21447    }
     21448    else
     21449    {
     21450        hashitem_T      *hi;
     21451        listitem_T      *li;
     21452        int             todo;
    2131421453
    21315     vars_clear(&fc.l_vars.dv_hashtab);          /* free all l: variables */
    21316     --depth;
     21454        /* "fc" is still in use.  This can happen when returning "a:000" or
     21455         * assigning "l:" to a global variable.
     21456         * Link "fc" in the list for garbage collection later. */
     21457        fc->caller = previous_funccal;
     21458        previous_funccal = fc;
     21459
     21460        /* Make a copy of the a: variables, since we didn't do that above. */
     21461        todo = (int)fc->l_avars.dv_hashtab.ht_used;
     21462        for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
     21463        {
     21464            if (!HASHITEM_EMPTY(hi))
     21465            {
     21466                --todo;
     21467                v = HI2DI(hi);
     21468                copy_tv(&v->di_tv, &v->di_tv);
     21469            }
     21470        }
     21471
     21472        /* Make a copy of the a:000 items, since we didn't do that above. */
     21473        for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
     21474            copy_tv(&li->li_tv, &li->li_tv);
     21475    }
     21476}
     21477
     21478/*
     21479 * Return TRUE if items in "fc" do not have "copyID".  That means they are not
     21480 * referenced from anywyere.
     21481 */
     21482    static int
     21483can_free_funccal(fc, copyID)
     21484    funccall_T  *fc;
     21485    int         copyID;
     21486{
     21487    return (fc->l_varlist.lv_copyID != copyID
     21488            && fc->l_vars.dv_copyID != copyID
     21489            && fc->l_avars.dv_copyID != copyID);
     21490}
     21491
     21492/*
     21493 * Free "fc" and what it contains.
     21494 */
     21495   static void
     21496free_funccal(fc, free_val)
     21497    funccall_T  *fc;
     21498    int         free_val;  /* a: vars were allocated */
     21499{
     21500    listitem_T  *li;
     21501
     21502    /* The a: variables typevals may not have been allocated, only free the
     21503     * allocated variables. */
     21504    vars_clear_ext(&fc->l_avars.dv_hashtab, free_val);
     21505
     21506    /* free all l: variables */
     21507    vars_clear(&fc->l_vars.dv_hashtab);
     21508
     21509    /* Free the a:000 variables if they were allocated. */
     21510    if (free_val)
     21511        for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
     21512            clear_tv(&li->li_tv);
     21513
     21514    vim_free(fc);
    2131721515}
    2131821516
    2131921517/*
     
    2188622084    }
    2188722085}
    2188822086
     22087/*
     22088 * List v:oldfiles in a nice way.
     22089 */
     22090/*ARGSUSED*/
     22091    void
     22092ex_oldfiles(eap)
     22093    exarg_T     *eap;
     22094{
     22095    list_T      *l = vimvars[VV_OLDFILES].vv_list;
     22096    listitem_T  *li;
     22097    int         nr = 0;
     22098
     22099    if (l == NULL)
     22100        msg((char_u *)_("No old files"));
     22101    else
     22102    {
     22103        msg_start();
     22104        msg_scroll = TRUE;
     22105        for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
     22106        {
     22107            msg_outnum((long)++nr);
     22108            MSG_PUTS(": ");
     22109            msg_outtrans(get_tv_string(&li->li_tv));
     22110            msg_putchar('\n');
     22111            out_flush();            /* output one line at a time */
     22112            ui_breakcheck();
     22113        }
     22114        /* Assume "got_int" was set to truncate the listing. */
     22115        got_int = FALSE;
     22116
     22117#ifdef FEAT_BROWSE_CMD
     22118        if (cmdmod.browse)
     22119        {
     22120            quit_more = FALSE;
     22121            nr = prompt_for_number(FALSE);
     22122            msg_starthere();
     22123            if (nr > 0)
     22124            {
     22125                char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
     22126                                                                    (long)nr);
     22127
     22128                if (p != NULL)
     22129                {
     22130                    p = expand_env_save(p);
     22131                    eap->arg = p;
     22132                    eap->cmdidx = CMD_edit;
     22133                    cmdmod.browse = FALSE;
     22134                    do_exedit(eap, NULL);
     22135                    vim_free(p);
     22136                }
     22137            }
     22138        }
     22139#endif
     22140    }
     22141}
     22142
    2188922143#endif /* FEAT_EVAL */
    2189022144
    2189122145
  • src/ex_cmds.c

    diff -Naur vim72.orig/src/ex_cmds.c vim72/src/ex_cmds.c
    old new  
    2424static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
    2525#ifdef FEAT_VIMINFO
    2626static char_u *viminfo_filename __ARGS((char_u  *));
    27 static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));
     27static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags));
    2828static int viminfo_encoding __ARGS((vir_T *virp));
    2929static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
    3030#endif
     
    4949    exarg_T     *eap;
    5050{
    5151    int         c;
     52    int         cval;
    5253    char        buf1[20];
    5354    char        buf2[20];
    5455    char_u      buf3[7];
     
    7576    {
    7677        if (c == NL)        /* NUL is stored as NL */
    7778            c = NUL;
     79        if (c == CAR && get_fileformat(curbuf) == EOL_MAC)
     80            cval = NL;      /* NL is stored as CR */
     81        else
     82            cval = c;
    7883        if (vim_isprintc_strict(c) && (c < ' '
    7984#ifndef EBCDIC
    8085                    || c > '~'
     
    9499            buf2[0] = NUL;
    95100        vim_snprintf((char *)IObuff, IOSIZE,
    96101                _("<%s>%s%s  %d,  Hex %02x,  Octal %03o"),
    97                                            transchar(c), buf1, buf2, c, c, c);
     102                                  transchar(c), buf1, buf2, cval, cval, cval);
    98103#ifdef FEAT_MBYTE
    99104        if (enc_utf8)
    100105            c = cc[ci++];
     
    16761681
    16771682/*
    16781683 * read_viminfo() -- Read the viminfo file.  Registers etc. which are already
    1679  * set are not over-written unless force is TRUE. -- webb
     1684 * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
    16801685 */
    16811686    int
    1682 read_viminfo(file, want_info, want_marks, forceit)
    1683     char_u      *file;
    1684     int         want_info;
    1685     int         want_marks;
    1686     int         forceit;
     1687read_viminfo(file, flags)
     1688    char_u      *file;      /* file name or NULL to use default name */
     1689    int         flags;      /* VIF_WANT_INFO et al. */
    16871690{
    16881691    FILE        *fp;
    16891692    char_u      *fname;
     
    16911694    if (no_viminfo())
    16921695        return FAIL;
    16931696
    1694     fname = viminfo_filename(file);         /* may set to default if NULL */
     1697    fname = viminfo_filename(file);     /* get file name in allocated buffer */
    16951698    if (fname == NULL)
    16961699        return FAIL;
    16971700    fp = mch_fopen((char *)fname, READBIN);
     
    17011704        verbose_enter();
    17021705        smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
    17031706                fname,
    1704                 want_info ? _(" info") : "",
    1705                 want_marks ? _(" marks") : "",
     1707                (flags & VIF_WANT_INFO) ? _(" info") : "",
     1708                (flags & VIF_WANT_MARKS) ? _(" marks") : "",
     1709                (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "",
    17061710                fp == NULL ? _(" FAILED") : "");
    17071711        verbose_leave();
    17081712    }
     
    17121716        return FAIL;
    17131717
    17141718    viminfo_errcnt = 0;
    1715     do_viminfo(fp, NULL, want_info, want_marks, forceit);
     1719    do_viminfo(fp, NULL, flags);
    17161720
    17171721    fclose(fp);
    1718 
    17191722    return OK;
    17201723}
    17211724
     
    19431946             * root.
    19441947             */
    19451948            if (fp_out != NULL)
    1946                 (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
     1949                ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
    19471950#endif
    19481951        }
    19491952    }
     
    19681971    }
    19691972
    19701973    viminfo_errcnt = 0;
    1971     do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
     1974    do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
    19721975
    19731976    fclose(fp_out);         /* errors are ignored !? */
    19741977    if (fp_in != NULL)
     
    20412044 * do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
    20422045 */
    20432046    static void
    2044 do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
     2047do_viminfo(fp_in, fp_out, flags)
    20452048    FILE        *fp_in;
    20462049    FILE        *fp_out;
    2047     int         want_info;
    2048     int         want_marks;
    2049     int         force_read;
     2050    int         flags;
    20502051{
    20512052    int         count = 0;
    20522053    int         eof = FALSE;
     
    20612062
    20622063    if (fp_in != NULL)
    20632064    {
    2064         if (want_info)
    2065             eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL);
     2065        if (flags & VIF_WANT_INFO)
     2066            eof = read_viminfo_up_to_marks(&vir,
     2067                                         flags & VIF_FORCEIT, fp_out != NULL);
    20662068        else
    20672069            /* Skip info, find start of marks */
    20682070            while (!(eof = viminfo_readline(&vir))
     
    20922094        write_viminfo_bufferlist(fp_out);
    20932095        count = write_viminfo_marks(fp_out);
    20942096    }
    2095     if (fp_in != NULL && want_marks)
    2096         copy_viminfo_marks(&vir, fp_out, count, eof);
     2097    if (fp_in != NULL
     2098            && (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
     2099        copy_viminfo_marks(&vir, fp_out, count, eof, flags);
    20972100
    20982101    vim_free(vir.vir_line);
    20992102#ifdef FEAT_MBYTE
     
    50595062
    50605063            if (did_sub)
    50615064                ++sub_nlines;
     5065            vim_free(new_start);        /* for when substitute was cancelled */
    50625066            vim_free(sub_firstline);    /* free the copy of the original line */
    50635067            sub_firstline = NULL;
    50645068        }
  • src/ex_cmds.h

    diff -Naur vim72.orig/src/ex_cmds.h vim72/src/ex_cmds.h
    old new  
    278278EX(CMD_crewind,         "crewind",      ex_cc,
    279279                        RANGE|NOTADR|COUNT|TRLBAR|BANG),
    280280EX(CMD_cscope,          "cscope",       do_cscope,
    281                         EXTRA|NOTRLCOM|SBOXOK|XFILE),
     281                        EXTRA|NOTRLCOM|XFILE),
    282282EX(CMD_cstag,           "cstag",        do_cstag,
    283283                        BANG|TRLBAR|WORD1),
    284284EX(CMD_cunmap,          "cunmap",       ex_unmap,
     
    506506EX(CMD_lclose,          "lclose",       ex_cclose,
    507507                        RANGE|NOTADR|COUNT|TRLBAR),
    508508EX(CMD_lcscope,         "lcscope",      do_cscope,
    509                         EXTRA|NOTRLCOM|SBOXOK|XFILE),
     509                        EXTRA|NOTRLCOM|XFILE),
    510510EX(CMD_left,            "left",         ex_align,
    511511                        TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
    512512EX(CMD_leftabove,       "leftabove",    ex_wrongmodifier,
     
    635635                        RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
    636636EX(CMD_noremap,         "noremap",      ex_map,
    637637                        BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
     638EX(CMD_noautocmd,       "noautocmd",    ex_wrongmodifier,
     639                        NEEDARG|EXTRA|NOTRLCOM),
    638640EX(CMD_nohlsearch,      "nohlsearch",   ex_nohlsearch,
    639641                        TRLBAR|SBOXOK|CMDWIN),
    640642EX(CMD_noreabbrev,      "noreabbrev",   ex_abbreviate,
     
    651653                        EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
    652654EX(CMD_open,            "open",         ex_open,
    653655                        RANGE|EXTRA),
     656EX(CMD_oldfiles,        "oldfiles",     ex_oldfiles,
     657                        BANG|TRLBAR|SBOXOK|CMDWIN),
    654658EX(CMD_omap,            "omap",         ex_map,
    655659                        EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
    656660EX(CMD_omapclear,       "omapclear",    ex_mapclear,
     
    802806EX(CMD_scriptencoding,  "scriptencoding", ex_scriptencoding,
    803807                        WORD1|TRLBAR|CMDWIN),
    804808EX(CMD_scscope,         "scscope",      do_scscope,
    805                         EXTRA|NOTRLCOM|SBOXOK),
     809                        EXTRA|NOTRLCOM),
    806810EX(CMD_set,             "set",          ex_set,
    807811                        TRLBAR|EXTRA|CMDWIN|SBOXOK),
    808812EX(CMD_setfiletype,     "setfiletype",  ex_setfiletype,
  • src/ex_cmds2.c

    diff -Naur vim72.orig/src/ex_cmds2.c vim72/src/ex_cmds2.c
    old new  
    31453145        verbose_leave();
    31463146    }
    31473147#ifdef STARTUPTIME
    3148     vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
    3149     time_msg(IObuff, &tv_start);
     3148    vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
     3149    time_msg((char *)IObuff, &tv_start);
    31503150    time_pop(&tv_rel);
    31513151#endif
    31523152
  • src/ex_docmd.c

    diff -Naur vim72.orig/src/ex_docmd.c vim72/src/ex_docmd.c
    old new  
    364364# define ex_function            ex_ni
    365365# define ex_delfunction         ex_ni
    366366# define ex_return              ex_ni
     367# define ex_oldfiles            ex_ni
    367368#endif
    368369static char_u   *arg_all __ARGS((void));
    369370#ifdef FEAT_SESSION
     
    17701771                        }
    17711772                        if (checkforcmd(&ea.cmd, "browse", 3))
    17721773                        {
    1773 #ifdef FEAT_BROWSE
     1774#ifdef FEAT_BROWSE_CMD
    17741775                            cmdmod.browse = TRUE;
    17751776#endif
    17761777                            continue;
     
    29782979    {"keepmarks", 3, FALSE},
    29792980    {"leftabove", 5, FALSE},
    29802981    {"lockmarks", 3, FALSE},
     2982    {"noautocmd", 3, FALSE},
    29812983    {"rightbelow", 6, FALSE},
    29822984    {"sandbox", 3, FALSE},
    29832985    {"silent", 3, FALSE},
     
    36083610            return set_context_in_autocmd(xp, arg, FALSE);
    36093611
    36103612        case CMD_doautocmd:
     3613        case CMD_doautoall:
    36113614            return set_context_in_autocmd(xp, arg, TRUE);
    36123615#endif
    36133616        case CMD_set:
     
    87498752                else if (*dirnow != NUL
    87508753                        && (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
    87518754                {
    8752                     (void)mch_chdir((char *)globaldir);
    8753                     shorten_fnames(TRUE);
     8755                    if (mch_chdir((char *)globaldir) == OK)
     8756                        shorten_fnames(TRUE);
    87548757                }
    87558758
    87568759                failed |= (makeopens(fd, dirnow) == FAIL);
     
    95069509                    break;
    95079510                }
    95089511                s = src + 1;
     9512                if (*s == '<')          /* "#<99" uses v:oldfiles */
     9513                    ++s;
    95099514                i = (int)getdigits(&s);
    95109515                *usedlen = (int)(s - src); /* length of what we expand */
    95119516
    9512                 buf = buflist_findnr(i);
    9513                 if (buf == NULL)
     9517                if (src[1] == '<')
    95149518                {
    9515                     *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
     9519                    if (*usedlen < 2)
     9520                    {
     9521                        /* Should we give an error message for #<text? */
     9522                        *usedlen = 1;
     9523                        return NULL;
     9524                    }
     9525#ifdef FEAT_EVAL
     9526                    result = list_find_str(get_vim_var_list(VV_OLDFILES),
     9527                                                                     (long)i);
     9528                    if (result == NULL)
     9529                    {
     9530                        *errormsg = (char_u *)"";
     9531                        return NULL;
     9532                    }
     9533#else
     9534                    *errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
    95169535                    return NULL;
     9536#endif
    95179537                }
    9518                 if (lnump != NULL)
    9519                     *lnump = ECMD_LAST;
    9520                 if (buf->b_fname == NULL)
     9538                else
    95219539                {
    9522                     result = (char_u *)"";
    9523                     valid = 0;      /* Must have ":p:h" to be valid */
     9540                    buf = buflist_findnr(i);
     9541                    if (buf == NULL)
     9542                    {
     9543                        *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
     9544                        return NULL;
     9545                    }
     9546                    if (lnump != NULL)
     9547                        *lnump = ECMD_LAST;
     9548                    if (buf->b_fname == NULL)
     9549                    {
     9550                        result = (char_u *)"";
     9551                        valid = 0;          /* Must have ":p:h" to be valid */
     9552                    }
     9553                    else
     9554                        result = buf->b_fname;
    95249555                }
    9525                 else
    9526                     result = buf->b_fname;
    95279556                break;
    95289557
    95299558#ifdef FEAT_SEARCHPATH
     
    95419570#ifdef FEAT_AUTOCMD
    95429571        case SPEC_AFILE:        /* file name for autocommand */
    95439572                result = autocmd_fname;
     9573                if (result != NULL && !autocmd_fname_full)
     9574                {
     9575                    /* Still need to turn the fname into a full path.  It is
     9576                     * postponed to avoid a delay when <afile> is not used. */
     9577                    autocmd_fname_full = TRUE;
     9578                    result = FullName_save(autocmd_fname, FALSE);
     9579                    vim_free(autocmd_fname);
     9580                    autocmd_fname = result;
     9581                }
    95449582                if (result == NULL)
    95459583                {
    95469584                    *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
     
    1006710105     */
    1006810106    if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
    1006910107            || put_line(fd, "if file_readable(s:sx)") == FAIL
    10070             || put_line(fd, "  exe \"source \" . s:sx") == FAIL
     10108            || put_line(fd, "  exe \"source \" . fnameescape(s:sx)") == FAIL
    1007110109            || put_line(fd, "endif") == FAIL)
    1007210110        return FAIL;
    1007310111
     
    1068910727        p_viminfo = (char_u *)"'100";
    1069010728    if (eap->cmdidx == CMD_rviminfo)
    1069110729    {
    10692         if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL)
     10730        if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
     10731                                  | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
    1069310732            EMSG(_("E195: Cannot open viminfo file for reading"));
    1069410733    }
    1069510734    else
  • src/ex_getln.c

    diff -Naur vim72.orig/src/ex_getln.c vim72/src/ex_getln.c
    old new  
    3131    int         cmdattr;        /* attributes for prompt */
    3232    int         overstrike;     /* Typing mode on the command line.  Shared by
    3333                                   getcmdline() and put_on_cmdline(). */
     34    expand_T    *xpc;           /* struct being used for expansion, xp_pattern
     35                                   may point into cmdbuff */
    3436    int         xp_context;     /* type of expansion */
    3537# ifdef FEAT_EVAL
    3638    char_u      *xp_arg;        /* user-defined expansion arg */
     
    3840# endif
    3941};
    4042
    41 static struct cmdline_info ccline;      /* current cmdline_info */
     43/* The current cmdline_info.  It is initialized in getcmdline() and after that
     44 * used by other functions.  When invoking getcmdline() recursively it needs
     45 * to be saved with save_cmdline() and restored with restore_cmdline().
     46 * TODO: make it local to getcmdline() and pass it around. */
     47static struct cmdline_info ccline;
    4248
    4349static int      cmd_showtail;           /* Only show path tail in lists ? */
    4450
     
    238244    }
    239245
    240246    ExpandInit(&xpc);
     247    ccline.xpc = &xpc;
    241248
    242249#ifdef FEAT_RIGHTLEFT
    243250    if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
     
    408415#endif
    409416
    410417        /*
    411          * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
     418         * When there are matching completions to select <S-Tab> works like
     419         * CTRL-P (unless 'wc' is <S-Tab>).
    412420         */
    413         if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
     421        if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
    414422            c = Ctrl_P;
    415423
    416424#ifdef FEAT_WILDMENU
     
    15131521                    int         old_firstc;
    15141522
    15151523                    vim_free(ccline.cmdbuff);
     1524                    xpc.xp_context = EXPAND_NOTHING;
    15161525                    if (hiscnt == hislen)
    15171526                        p = lookfor;    /* back to the old one */
    15181527                    else
     
    18391848#endif
    18401849
    18411850    ExpandCleanup(&xpc);
     1851    ccline.xpc = NULL;
    18421852
    18431853#ifdef FEAT_SEARCH_EXTRA
    18441854    if (did_incsearch)
     
    25082518    }
    25092519    mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
    25102520    vim_free(p);
     2521
     2522    if (ccline.xpc != NULL
     2523            && ccline.xpc->xp_pattern != NULL
     2524            && ccline.xpc->xp_context != EXPAND_NOTHING
     2525            && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
     2526    {
     2527        int i = (int)(ccline.xpc->xp_pattern - p);
     2528
     2529        /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
     2530         * to point into the newly allocated memory. */
     2531        if (i >= 0 && i <= ccline.cmdlen)
     2532            ccline.xpc->xp_pattern = ccline.cmdbuff + i;
     2533    }
     2534
    25112535    return OK;
    25122536}
    25132537
     
    28752899    prev_ccline = ccline;
    28762900    ccline.cmdbuff = NULL;
    28772901    ccline.cmdprompt = NULL;
     2902    ccline.xpc = NULL;
    28782903}
    28792904
    28802905/*
     
    35823607ExpandInit(xp)
    35833608    expand_T    *xp;
    35843609{
     3610    xp->xp_pattern = NULL;
    35853611    xp->xp_backslash = XP_BS_NONE;
    35863612#ifndef BACKSLASH_IN_FILENAME
    35873613    xp->xp_shell = FALSE;
     
    48714897    if (s == NULL)
    48724898        return FAIL;
    48734899    sprintf((char *)s, "%s/%s*.vim", dirname, pat);
    4874     all = globpath(p_rtp, s);
     4900    all = globpath(p_rtp, s, 0);
    48754901    vim_free(s);
    48764902    if (all == NULL)
    48774903        return FAIL;
     
    49124938 * newlines.  Returns NULL for an error or no matches.
    49134939 */
    49144940    char_u *
    4915 globpath(path, file)
     4941globpath(path, file, expand_options)
    49164942    char_u      *path;
    49174943    char_u      *file;
     4944    int         expand_options;
    49184945{
    49194946    expand_T    xpc;
    49204947    char_u      *buf;
     
    49434970        {
    49444971            add_pathsep(buf);
    49454972            STRCAT(buf, file);
    4946             if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
    4947                                                                 && num_p > 0)
     4973            if (ExpandFromContext(&xpc, buf, &num_p, &p,
     4974                             WILD_SILENT|expand_options) != FAIL && num_p > 0)
    49484975            {
    4949                 ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
     4976                ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
    49504977                for (len = 0, i = 0; i < num_p; ++i)
    49514978                    len += (int)STRLEN(p[i]) + 1;
    49524979
  • src/feature.h

    diff -Naur vim72.orig/src/feature.h vim72/src/feature.h
    old new  
    767767
    768768/*
    769769 * +browse              ":browse" command.
     770 *                      or just the ":browse" command modifier
    770771 */
    771 #if defined(FEAT_NORMAL) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC))
    772 # define FEAT_BROWSE
     772#if defined(FEAT_NORMAL)
     773# define FEAT_BROWSE_CMD
     774# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
     775#  define FEAT_BROWSE
     776# endif
    773777#endif
    774778
    775779/*
  • src/fileio.c

    diff -Naur vim72.orig/src/fileio.c vim72/src/fileio.c
    old new  
    932932    else
    933933    {
    934934        if (eap != NULL && eap->force_ff != 0)
     935        {
    935936            fileformat = get_fileformat_force(curbuf, eap);
     937            try_unix = try_dos = try_mac = FALSE;
     938        }
    936939        else if (curbuf->b_p_bin)
    937940            fileformat = EOL_UNIX;              /* binary: use Unix format */
    938941        else if (*p_ffs == NUL)
     
    22112214    {
    22122215        /* Use stderr for stdin, makes shell commands work. */
    22132216        close(0);
    2214         dup(2);
     2217        ignored = dup(2);
    22152218    }
    22162219#endif
    22172220
     
    23412344                STRCAT(IObuff, _("[CR missing]"));
    23422345                c = TRUE;
    23432346            }
    2344             if (ff_error == EOL_MAC)
    2345             {
    2346                 STRCAT(IObuff, _("[NL found]"));
    2347                 c = TRUE;
    2348             }
    23492347            if (split)
    23502348            {
    23512349                STRCAT(IObuff, _("[long lines split]"));
     
    27112709{
    27122710    if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
    27132711                                                  && curbuf->b_ffname != NULL)
    2714         read_viminfo(NULL, FALSE, TRUE, FALSE);
     2712        read_viminfo(NULL, VIF_WANT_MARKS);
    27152713
    27162714    /* Always set b_marks_read; needed when 'viminfo' is changed to include
    27172715     * the ' parameter after opening a buffer. */
     
    34513449                {
    34523450# ifdef UNIX
    34533451#  ifdef HAVE_FCHOWN
    3454                     fchown(fd, st_old.st_uid, st_old.st_gid);
     3452                    ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
    34553453#  endif
    34563454                    if (mch_stat((char *)IObuff, &st) < 0
    34573455                            || st.st_uid != st_old.st_uid
     
    43674365                || st.st_uid != st_old.st_uid
    43684366                || st.st_gid != st_old.st_gid)
    43694367        {
    4370             fchown(fd, st_old.st_uid, st_old.st_gid);
     4368            ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
    43714369            if (perm >= 0)      /* set permission again, may have changed */
    43724370                (void)mch_setperm(wfname, perm);
    43734371        }
     
    55505548            name = "ucs-4le";   /* FF FE 00 00 */
    55515549            len = 4;
    55525550        }
    5553         else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
     5551        else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
    55545552            name = "ucs-2le";   /* FF FE */
    5555         else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
     5553        else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
     5554            /* utf-16le is preferred, it also works for ucs-2le text */
    55565555            name = "utf-16le";  /* FF FE */
    55575556    }
    55585557    else if (p[0] == 0xfe && p[1] == 0xff
     
    60316030        {
    60326031            tbuf[FGETS_SIZE - 2] = NUL;
    60336032#ifdef USE_CR
    6034             fgets_cr((char *)tbuf, FGETS_SIZE, fp);
     6033            ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
    60356034#else
    6036             fgets((char *)tbuf, FGETS_SIZE, fp);
     6035            ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
    60376036#endif
    60386037        } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
    60396038    }
     
    61076106#ifdef HAVE_ACL
    61086107    vim_acl_T   acl;            /* ACL from original file */
    61096108#endif
     6109#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
     6110    int         use_tmp_file = FALSE;
     6111#endif
    61106112
    61116113    /*
    6112      * When the names are identical, there is nothing to do.
     6114     * When the names are identical, there is nothing to do.  When they refer
     6115     * to the same file (ignoring case and slash/backslash differences) but
     6116     * the file name differs we need to go through a temp file.
    61136117     */
    61146118    if (fnamecmp(from, to) == 0)
    6115         return 0;
     6119    {
     6120#ifdef CASE_INSENSITIVE_FILENAME
     6121        if (STRCMP(gettail(from), gettail(to)) != 0)
     6122            use_tmp_file = TRUE;
     6123        else
     6124#endif
     6125            return 0;
     6126    }
    61166127
    61176128    /*
    61186129     * Fail if the "from" file doesn't exist.  Avoids that "to" is deleted.
     
    61206131    if (mch_stat((char *)from, &st) < 0)
    61216132        return -1;
    61226133
     6134#ifdef UNIX
     6135    {
     6136        struct stat     st_to;
     6137
     6138        /* It's possible for the source and destination to be the same file.
     6139         * This happens when "from" and "to" differ in case and are on a FAT32
     6140         * filesystem.  In that case go through a temp file name. */
     6141        if (mch_stat((char *)to, &st_to) >= 0
     6142                && st.st_dev == st_to.st_dev
     6143                && st.st_ino == st_to.st_ino)
     6144            use_tmp_file = TRUE;
     6145    }
     6146#endif
     6147
     6148#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
     6149    if (use_tmp_file)
     6150    {
     6151        char    tempname[MAXPATHL + 1];
     6152
     6153        /*
     6154         * Find a name that doesn't exist and is in the same directory.
     6155         * Rename "from" to "tempname" and then rename "tempname" to "to".
     6156         */
     6157        if (STRLEN(from) >= MAXPATHL - 5)
     6158            return -1;
     6159        STRCPY(tempname, from);
     6160        for (n = 123; n < 99999; ++n)
     6161        {
     6162            sprintf((char *)gettail((char_u *)tempname), "%d", n);
     6163            if (mch_stat(tempname, &st) < 0)
     6164            {
     6165                if (mch_rename((char *)from, tempname) == 0)
     6166                {
     6167                    if (mch_rename(tempname, (char *)to) == 0)
     6168                        return 0;
     6169                    /* Strange, the second step failed.  Try moving the
     6170                     * file back and return failure. */
     6171                    mch_rename(tempname, (char *)from);
     6172                    return -1;
     6173                }
     6174                /* If it fails for one temp name it will most likely fail
     6175                 * for any temp name, give up. */
     6176                return -1;
     6177            }
     6178        }
     6179        return -1;
     6180    }
     6181#endif
     6182
    61236183    /*
    61246184     * Delete the "to" file, this is required on some systems to make the
    61256185     * mch_rename() work, on other systems it makes sure that we don't have
     
    85238583    char_u      *save_sourcing_name;
    85248584    linenr_T    save_sourcing_lnum;
    85258585    char_u      *save_autocmd_fname;
     8586    int         save_autocmd_fname_full;
    85268587    int         save_autocmd_bufnr;
    85278588    char_u      *save_autocmd_match;
    85288589    int         save_autocmd_busy;
     
    86018662     * Save the autocmd_* variables and info about the current buffer.
    86028663     */
    86038664    save_autocmd_fname = autocmd_fname;
     8665    save_autocmd_fname_full = autocmd_fname_full;
    86048666    save_autocmd_bufnr = autocmd_bufnr;
    86058667    save_autocmd_match = autocmd_match;
    86068668    save_autocmd_busy = autocmd_busy;
     
    86188680        if (fname != NULL && *fname != NUL)
    86198681            autocmd_fname = fname;
    86208682        else if (buf != NULL)
    8621             autocmd_fname = buf->b_fname;
     8683            autocmd_fname = buf->b_ffname;
    86228684        else
    86238685            autocmd_fname = NULL;
    86248686    }
    86258687    else
    86268688        autocmd_fname = fname_io;
    86278689    if (autocmd_fname != NULL)
    8628         autocmd_fname = FullName_save(autocmd_fname, FALSE);
     8690        autocmd_fname = vim_strsave(autocmd_fname);
     8691    autocmd_fname_full = FALSE; /* call FullName_save() later */
    86298692
    86308693    /*
    86318694     * Set the buffer number to be used for <abuf>.
     
    88108873    sourcing_lnum = save_sourcing_lnum;
    88118874    vim_free(autocmd_fname);
    88128875    autocmd_fname = save_autocmd_fname;
     8876    autocmd_fname_full = save_autocmd_fname_full;
    88138877    autocmd_bufnr = save_autocmd_bufnr;
    88148878    autocmd_match = save_autocmd_match;
    88158879#ifdef FEAT_EVAL
     
    89188982    {
    89198983        apc->curpat = NULL;
    89208984
    8921         /* only use a pattern when it has not been removed, has commands and
     8985        /* Only use a pattern when it has not been removed, has commands and
    89228986         * the group matches. For buffer-local autocommands only check the
    89238987         * buffer number. */
    89248988        if (ap->pat != NULL && ap->cmds != NULL
     
    91049168set_context_in_autocmd(xp, arg, doautocmd)
    91059169    expand_T    *xp;
    91069170    char_u      *arg;
    9107     int         doautocmd;      /* TRUE for :doautocmd, FALSE for :autocmd */
     9171    int         doautocmd;      /* TRUE for :doauto*, FALSE for :autocmd */
    91089172{
    91099173    char_u      *p;
    91109174    int         group;
  • src/fold.c

    diff -Naur vim72.orig/src/fold.c vim72/src/fold.c
    old new  
    4848static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp));
    4949static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum));
    5050static void checkupdate __ARGS((win_T *wp));
    51 static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));
     51static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open));
    5252static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep));
    5353static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep));
    5454static void foldOpenNested __ARGS((fold_T *fpr));
     
    740740    garray_T    *found_ga;
    741741    fold_T      *found_fp = NULL;
    742742    linenr_T    found_off = 0;
    743     int         use_level = FALSE;
     743    int         use_level;
    744744    int         maybe_small = FALSE;
    745745    int         level = 0;
    746746    linenr_T    lnum = start;
     
    757757        gap = &curwin->w_folds;
    758758        found_ga = NULL;
    759759        lnum_off = 0;
     760        use_level = FALSE;
    760761        for (;;)
    761762        {
    762763            if (!foldFind(gap, lnum - lnum_off, &fp))
     
    783784        else
    784785        {
    785786            lnum = found_fp->fd_top + found_fp->fd_len + found_off;
    786             did_one = TRUE;
    787787
    788788            if (foldmethodIsManual(curwin))
    789789                deleteFoldEntry(found_ga,
    790790                    (int)(found_fp - (fold_T *)found_ga->ga_data), recursive);
    791791            else
    792792            {
    793                 if (found_fp->fd_top + found_off < first_lnum)
    794                     first_lnum = found_fp->fd_top;
    795                 if (lnum > last_lnum)
     793                if (first_lnum > found_fp->fd_top + found_off)
     794                    first_lnum = found_fp->fd_top + found_off;
     795                if (last_lnum < lnum)
    796796                    last_lnum = lnum;
    797                 parseMarker(curwin);
     797                if (!did_one)
     798                    parseMarker(curwin);
    798799                deleteFoldMarkers(found_fp, recursive, found_off);
    799800            }
     801            did_one = TRUE;
    800802
    801803            /* redraw window */
    802804            changed_window_setting();
     
    811813            redraw_curbuf_later(INVERTED);
    812814#endif
    813815    }
     816    else
     817        /* Deleting markers may make cursor column invalid. */
     818        check_cursor_col();
     819
    814820    if (last_lnum > 0)
    815821        changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L);
    816822}
     
    12411247 * Repeat "count" times.
    12421248 */
    12431249    static void
    1244 setFoldRepeat(lnum, count, open)
     1250setFoldRepeat(lnum, count, do_open)
    12451251    linenr_T    lnum;
    12461252    long        count;
    1247     int         open;
     1253    int         do_open;
    12481254{
    12491255    int         done;
    12501256    long        n;
     
    12521258    for (n = 0; n < count; ++n)
    12531259    {
    12541260        done = DONE_NOTHING;
    1255         (void)setManualFold(lnum, open, FALSE, &done);
     1261        (void)setManualFold(lnum, do_open, FALSE, &done);
    12561262        if (!(done & DONE_ACTION))
    12571263        {
    12581264            /* Only give an error message when no fold could be opened. */
  • src/getchar.c

    diff -Naur vim72.orig/src/getchar.c vim72/src/getchar.c
    old new  
    47024702                        return FAIL;
    47034703                    if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0)
    47044704                        return FAIL;
    4705                     if (fprintf(fd, cmd) < 0)
     4705                    if (fputs(cmd, fd) < 0)
    47064706                        return FAIL;
    47074707                    if (buf != NULL && fputs(" <buffer>", fd) < 0)
    47084708                        return FAIL;
     
    48014801            }
    48024802            if (IS_SPECIAL(c) || modifiers)     /* special key */
    48034803            {
    4804                 if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)
     4804                if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0)
    48054805                    return FAIL;
    48064806                continue;
    48074807            }
  • src/globals.h

    diff -Naur vim72.orig/src/globals.h vim72/src/globals.h
    old new  
    10221022#endif
    10231023#ifdef FEAT_AUTOCMD
    10241024EXTERN char_u   *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
     1025EXTERN int      autocmd_fname_full;          /* autocmd_fname is full path */
    10251026EXTERN int      autocmd_bufnr INIT(= 0);     /* fnum for <abuf> on cmdline */
    10261027EXTERN char_u   *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
    10271028EXTERN int      did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
     
    13391340
    13401341#ifdef FEAT_NETBEANS_INTG
    13411342EXTERN char *netbeansArg INIT(= NULL);  /* the -nb[:host:port:passwd] arg */
    1342 EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */
    13431343EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */
    13441344EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */
    13451345EXTERN int netbeansReadFile INIT(= 1);  /* OK to read from disk if != 0 */
     
    15481548EXTERN time_t starttime;
    15491549
    15501550/*
     1551 * Some compilers warn for not using a return value, but in some situations we
     1552 * can't do anything useful with the value.  Assign to this variable to avoid
     1553 * the warning.
     1554 */
     1555EXTERN int ignored;
     1556EXTERN char *ignoredp;
     1557
     1558/*
    15511559 * Optional Farsi support.  Include it here, so EXTERN and INIT are defined.
    15521560 */
    15531561#ifdef FEAT_FKMAP
  • src/gui.c

    diff -Naur vim72.orig/src/gui.c vim72/src/gui.c
    old new  
    139139                /* The read returns when the child closes the pipe (or when
    140140                 * the child dies for some reason). */
    141141                close(pipefd[1]);
    142                 (void)read(pipefd[0], &dummy, (size_t)1);
     142                ignored = (int)read(pipefd[0], &dummy, (size_t)1);
    143143                close(pipefd[0]);
    144144            }
    145145
     
    32413241            i = Rows;
    32423242            gui_update_tabline();
    32433243            Rows = i;
    3244             need_set_size = RESIZE_VERT;
     3244            need_set_size |= RESIZE_VERT;
    32453245            if (using_tabline)
    32463246                fix_size = TRUE;
    32473247            if (!gui_use_tabline())
     
    32753275                if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
    32763276                {
    32773277                    if (i == SBAR_BOTTOM)
    3278                         need_set_size = RESIZE_VERT;
     3278                        need_set_size |= RESIZE_VERT;
    32793279                    else
    3280                         need_set_size = RESIZE_HOR;
     3280                        need_set_size |= RESIZE_HOR;
    32813281                    if (gui.which_scrollbars[i])
    32823282                        fix_size = TRUE;
    32833283                }
     
    32973297            gui_mch_enable_menu(gui.menu_is_active);
    32983298            Rows = i;
    32993299            prev_menu_is_active = gui.menu_is_active;
    3300             need_set_size = RESIZE_VERT;
     3300            need_set_size |= RESIZE_VERT;
    33013301            if (gui.menu_is_active)
    33023302                fix_size = TRUE;
    33033303        }
     
    33083308        {
    33093309            gui_mch_show_toolbar(using_toolbar);
    33103310            prev_toolbar = using_toolbar;
    3311             need_set_size = RESIZE_VERT;
     3311            need_set_size |= RESIZE_VERT;
    33123312            if (using_toolbar)
    33133313                fix_size = TRUE;
    33143314        }
     
    33183318        {
    33193319            gui_mch_enable_footer(using_footer);
    33203320            prev_footer = using_footer;
    3321             need_set_size = RESIZE_VERT;
     3321            need_set_size |= RESIZE_VERT;
    33223322            if (using_footer)
    33233323                fix_size = TRUE;
    33243324        }
     
    33303330            prev_tearoff = using_tearoff;
    33313331        }
    33323332#endif
    3333         if (need_set_size)
     3333        if (need_set_size != 0)
    33343334        {
    33353335#ifdef FEAT_GUI_GTK
    3336             long    c = Columns;
     3336            long    prev_Columns = Columns;
     3337            long    prev_Rows = Rows;
    33373338#endif
    33383339            /* Adjust the size of the window to make the text area keep the
    33393340             * same size and to avoid that part of our window is off-screen
     
    33493350             * If you remove this, please test this command for resizing
    33503351             * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
    33513352             * Don't do this while starting up though.
    3352              * And don't change Rows, it may have be reduced intentionally
    3353              * when adding menu/toolbar/tabline. */
    3354             if (!gui.starting)
     3353             * Don't change Rows when adding menu/toolbar/tabline.
     3354             * Don't change Columns when adding vertical toolbar. */
     3355            if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
    33553356                (void)char_avail();
    3356             Columns = c;
     3357            if ((need_set_size & RESIZE_VERT) == 0)
     3358                Rows = prev_Rows;
     3359            if ((need_set_size & RESIZE_HOR) == 0)
     3360                Columns = prev_Columns;
    33573361#endif
    33583362        }
    33593363#ifdef FEAT_WINDOWS
  • src/gui_at_sb.c

    diff -Naur vim72.orig/src/gui_at_sb.c vim72/src/gui_at_sb.c
    old new  
    10781078    Cardinal    *num_params;    /* unused */
    10791079{
    10801080    ScrollbarWidget sbw = (ScrollbarWidget)w;
     1081    /* Use a union to avoid a warning for the weird conversion from float to
     1082     * XtPointer.  Comes from Xaw/Scrollbar.c. */
     1083    union {
     1084        XtPointer xtp;
     1085        float xtf;
     1086    } xtpf;
    10811087
    10821088    if (LookAhead(w, event))
    10831089        return;
     
    10851091    /* thumbProc is not pretty, but is necessary for backwards
    10861092       compatibility on those architectures for which it work{s,ed};
    10871093       the intent is to pass a (truncated) float by value. */
    1088     XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top);
     1094    xtpf.xtf = sbw->scrollbar.top;
     1095    XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
    10891096    XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
    10901097}
    10911098
  • src/gui_gtk_x11.c

    diff -Naur vim72.orig/src/gui_gtk_x11.c vim72/src/gui_gtk_x11.c
    old new  
    40704070
    40714071        if (mask & (XValue | YValue))
    40724072        {
    4073             int w, h;
    4074             gui_mch_get_screen_dimensions(&w, &h);
    4075             h += p_ghr + get_menu_tool_height();
    4076             w += get_menu_tool_width();
     4073            int ww, hh;
     4074            gui_mch_get_screen_dimensions(&ww, &hh);
     4075            hh += p_ghr + get_menu_tool_height();
     4076            ww += get_menu_tool_width();
    40774077            if (mask & XNegative)
    4078                 x += w - pixel_width;
     4078                x += ww - pixel_width;
    40794079            if (mask & YNegative)
    4080                 y += h - pixel_height;
     4080                y += hh - pixel_height;
    40814081#ifdef HAVE_GTK2
    40824082            gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
    40834083#else
  • src/gui_x11.c

    diff -Naur vim72.orig/src/gui_x11.c vim72/src/gui_x11.c
    old new  
    24502450        *colorPtr = colortable[closest];
    24512451    }
    24522452
    2453     free(colortable);
     2453    vim_free(colortable);
    24542454    return OK;
    24552455}
    24562456
  • src/gui_xmdlg.c

    diff -Naur vim72.orig/src/gui_xmdlg.c vim72/src/gui_xmdlg.c
    old new  
    369369    char        buf[TEMP_BUF_SIZE];
    370370    XmString    items[MAX_ENTRIES_IN_LIST];
    371371    int         i;
    372     int         index;
     372    int         idx;
    373373
    374     for (index = (int)ENCODING; index < (int)NONE; ++index)
    375         count[index] = 0;
     374    for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
     375        count[idx] = 0;
    376376
    377377    /* First we insert the wild char into every single list. */
    378378    if (fix != ENCODING)
     
    503503    /*
    504504     * Now loop trough the remaining lists and set them up.
    505505     */
    506     for (index = (int)NAME; index < (int)NONE; ++index)
     506    for (idx = (int)NAME; idx < (int)NONE; ++idx)
    507507    {
    508508        Widget w;
    509509
    510         if (fix == (enum ListSpecifier)index)
     510        if (fix == (enum ListSpecifier)idx)
    511511            continue;
    512512
    513         switch ((enum ListSpecifier)index)
     513        switch ((enum ListSpecifier)idx)
    514514        {
    515515            case NAME:
    516516                w = data->list[NAME];
     
    525525                w = (Widget)0;  /* for lint */
    526526        }
    527527
    528         for (i = 0; i < count[index]; ++i)
     528        for (i = 0; i < count[idx]; ++i)
    529529        {
    530             items[i] = XmStringCreateLocalized(list[index][i]);
    531             XtFree(list[index][i]);
     530            items[i] = XmStringCreateLocalized(list[idx][i]);
     531            XtFree(list[idx][i]);
    532532        }
    533533        XmListDeleteAllItems(w);
    534         XmListAddItems(w, items, count[index], 1);
    535         if (data->sel[index])
     534        XmListAddItems(w, items, count[idx], 1);
     535        if (data->sel[idx])
    536536        {
    537537            XmStringFree(items[0]);
    538             items[0] = XmStringCreateLocalized(data->sel[index]);
     538            items[0] = XmStringCreateLocalized(data->sel[idx]);
    539539            XmListSelectItem(w, items[0], False);
    540540            XmListSetBottomItem(w, items[0]);
    541541        }
    542         for (i = 0; i < count[index]; ++i)
     542        for (i = 0; i < count[idx]; ++i)
    543543            XmStringFree(items[i]);
    544544    }
    545545}
     
    695695        int         n;
    696696        XmString    str;
    697697        Arg         args[4];
    698         char        *msg = _("no specific match");
     698        char        *nomatch_msg = _("no specific match");
    699699
    700700        n = 0;
    701         str = XmStringCreateLocalized(msg);
     701        str = XmStringCreateLocalized(nomatch_msg);
    702702        XtSetArg(args[n], XmNlabelString, str); ++n;
    703703        XtSetValues(data->sample, args, n);
    704704        apply_fontlist(data->sample);
    705         XmTextSetString(data->name, msg);
     705        XmTextSetString(data->name, nomatch_msg);
    706706        XmStringFree(str);
    707707
    708708        return False;
     
    886886    {
    887887        int     i;
    888888        int     max;
    889         int     index = 0;
     889        int     idx = 0;
    890890        int     size;
    891         char    str[128];
     891        char    buf[128];
    892892
    893893        for (i = 0, max = 0; i < data->num; i++)
    894894        {
    895             get_part(fn(data, i), 7, str);
    896             size = atoi(str);
     895            get_part(fn(data, i), 7, buf);
     896            size = atoi(buf);
    897897            if ((size > max) && (size < MAX_DISPLAY_SIZE))
    898898            {
    899                 index = i;
     899                idx = i;
    900900                max = size;
    901901            }
    902902        }
    903         strcpy(big_font, fn(data, index));
     903        strcpy(big_font, fn(data, idx));
    904904    }
    905905    data->old = XLoadQueryFont(XtDisplay(parent), big_font);
    906906    data->old_list = gui_motif_create_fontlist(data->old);
     
    12171217
    12181218        if (i != 0)
    12191219        {
    1220             char name[TEMP_BUF_SIZE];
    1221             char style[TEMP_BUF_SIZE];
    1222             char size[TEMP_BUF_SIZE];
    1223             char encoding[TEMP_BUF_SIZE];
     1220            char namebuf[TEMP_BUF_SIZE];
     1221            char stylebuf[TEMP_BUF_SIZE];
     1222            char sizebuf[TEMP_BUF_SIZE];
     1223            char encodingbuf[TEMP_BUF_SIZE];
    12241224            char *found;
    12251225
    12261226            found = names[0];
    12271227
    1228             name_part(found, name);
    1229             style_part(found, style);
    1230             size_part(found, size, data->in_pixels);
    1231             encoding_part(found, encoding);
    1232 
    1233             if (strlen(name) > 0
    1234                     && strlen(style) > 0
    1235                     && strlen(size) > 0
    1236                     && strlen(encoding) > 0)
     1228            name_part(found, namebuf);
     1229            style_part(found, stylebuf);
     1230            size_part(found, sizebuf, data->in_pixels);
     1231            encoding_part(found, encodingbuf);
     1232
     1233            if (strlen(namebuf) > 0
     1234                    && strlen(stylebuf) > 0
     1235                    && strlen(sizebuf) > 0
     1236                    && strlen(encodingbuf) > 0)
    12371237            {
    1238                 data->sel[NAME] = XtNewString(name);
    1239                 data->sel[STYLE] = XtNewString(style);
    1240                 data->sel[SIZE] = XtNewString(size);
    1241                 data->sel[ENCODING] = XtNewString(encoding);
     1238                data->sel[NAME] = XtNewString(namebuf);
     1239                data->sel[STYLE] = XtNewString(stylebuf);
     1240                data->sel[SIZE] = XtNewString(sizebuf);
     1241                data->sel[ENCODING] = XtNewString(encodingbuf);
    12421242                data->font_name = XtNewString(names[0]);
    12431243                display_sample(data);
    12441244                XmTextSetString(data->name, data->font_name);
  • src/gui_xmebw.c

    diff -Naur vim72.orig/src/gui_xmebw.c vim72/src/gui_xmebw.c
    old new  
    12561256    }
    12571257    else
    12581258    {
    1259         int adjust = 0;
     1259        adjust = 0;
    12601260
    12611261#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
    12621262        /*
     
    12681268        {
    12691269            case XmEXTERNAL_HIGHLIGHT:
    12701270                adjust = (eb->primitive.highlight_thickness -
    1271                         (eb->pushbutton.default_button_shadow_thickness ?
    1272                          Xm3D_ENHANCE_PIXEL : 0));
     1271                         (eb->pushbutton.default_button_shadow_thickness
     1272                          ?  Xm3D_ENHANCE_PIXEL : 0));
    12731273                break;
    12741274
    12751275            case XmINTERNAL_HIGHLIGHT:
    1276                 adjust = 0;
    12771276                break;
    12781277
    12791278            default:
  • src/if_cscope.c

    diff -Naur vim72.orig/src/if_cscope.c vim72/src/if_cscope.c
    old new  
    7474    { "add",    cs_add,
    7575                N_("Add a new database"),     "add file|dir [pre-path] [flags]", 0 },
    7676    { "find",   cs_find,
    77                 N_("Query for a pattern"),    FIND_USAGE, 1 },
     77                N_("Query for a pattern"),    "find c|d|e|f|g|i|s|t name", 1 },
    7878    { "help",   cs_help,
    7979                N_("Show this message"),      "help", 0 },
    8080    { "kill",   cs_kill,
     
    11801180        (void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
    11811181                                      cmdp->name, _(cmdp->help), cmdp->usage);
    11821182        if (strcmp(cmdp->name, "find") == 0)
    1183             MSG_PUTS(FIND_HELP);
     1183            MSG_PUTS(_("\n"
     1184                       "       c: Find functions calling this function\n"
     1185                       "       d: Find functions called by this function\n"
     1186                       "       e: Find this egrep pattern\n"
     1187                       "       f: Find this file\n"
     1188                       "       g: Find this definition\n"
     1189                       "       i: Find files #including this file\n"
     1190                       "       s: Find this C symbol\n"
     1191                       "       t: Find assignments to\n"));
     1192
    11841193        cmdp++;
    11851194    }
    11861195
  • src/if_cscope.h

    diff -Naur vim72.orig/src/if_cscope.h vim72/src/if_cscope.h
    old new  
    4242 * f 7name      Find this file
    4343 * i 8name      Find files #including this file
    4444 */
    45 #define FIND_USAGE "find c|d|e|f|g|i|s|t name"
    46 #define FIND_HELP "\n\
    47        c: Find functions calling this function\n\
    48        d: Find functions called by this function\n\
    49        e: Find this egrep pattern\n\
    50        f: Find this file\n\
    51        g: Find this definition\n\
    52        i: Find files #including this file\n\
    53        s: Find this C symbol\n\
    54        t: Find assignments to\n"
    55 
    5645
    5746typedef struct {
    5847    char *  name;
  • src/if_perl.xs

    diff -Naur vim72.orig/src/if_perl.xs vim72/src/if_perl.xs
    old new  
    136136#  define Perl_newXS_flags dll_Perl_newXS_flags
    137137#endif
    138138# define Perl_sv_free dll_Perl_sv_free
     139# if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
     140#  define Perl_sv_free2 dll_Perl_sv_free2
     141# endif
    139142# define Perl_sv_isa dll_Perl_sv_isa
    140143# define Perl_sv_magic dll_Perl_sv_magic
    141144# define Perl_sv_setiv dll_Perl_sv_setiv
     
    163166# define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
    164167# define boot_DynaLoader dll_boot_DynaLoader
    165168
    166 # define Perl_sys_init3 dll_Perl_sys_init3
     169# define Perl_sys_init dll_Perl_sys_init
    167170# define Perl_sys_term dll_Perl_sys_term
    168171# define Perl_ISv_ptr dll_Perl_ISv_ptr
    169172# define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr
     
    268271static void (*boot_DynaLoader)_((pTHX_ CV*));
    269272
    270273#if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
    271 static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
     274static void (*Perl_sv_free2)(pTHX_ SV*);
     275static void (*Perl_sys_init)(int* argc, char*** argv);
    272276static void (*Perl_sys_term)(void);
    273277static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
    274278static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*);
     
    367371    {"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
    368372    {"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
    369373#else
    370     {"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
     374    {"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
     375    {"Perl_sys_init", (PERL_PROC*)&Perl_sys_init},
    371376    {"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
    372377    {"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
    373378    {"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr},
     
    455460    static char *argv[] = { "", "-e", "" };
    456461
    457462#if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
    458     Perl_sys_init3(&argc, (char***)&argv, NULL);
     463    Perl_sys_init(&argc, (char***)&argv);
    459464#endif
    460465    perl_interp = perl_alloc();
    461466    perl_construct(perl_interp);
  • src/if_python.c

    diff -Naur vim72.orig/src/if_python.c vim72/src/if_python.c
    old new  
    531531        if (PythonMod_Init())
    532532            goto fail;
    533533
     534        /* Remove the element from sys.path that was added because of our
     535         * argv[0] value in PythonMod_Init().  Previously we used an empty
     536         * string, but dependinding on the OS we then get an empty entry or
     537         * the current directory in sys.path. */
     538        PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
     539
    534540        /* the first python thread is vim's, release the lock */
    535541        Python_SaveThread();
    536542
     
    11451151
    11461152    /* Check if we run into a recursive loop.  The item must be in lookupDict
    11471153     * then and we can use it again. */
    1148     sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
    1149     result = PyDict_GetItemString(lookupDict, ptrBuf);
    1150     if (result != NULL)
    1151         Py_INCREF(result);
    1152     else if (our_tv->v_type == VAR_STRING)
     1154    if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
     1155            || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
     1156    {
     1157        sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U,
     1158                our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list
     1159                                           : (long_u)our_tv->vval.v_dict);
     1160        result = PyDict_GetItemString(lookupDict, ptrBuf);
     1161        if (result != NULL)
     1162        {
     1163            Py_INCREF(result);
     1164            return result;
     1165        }
     1166    }
     1167
     1168    if (our_tv->v_type == VAR_STRING)
    11531169    {
    11541170        result = Py_BuildValue("s", our_tv->vval.v_string);
    1155         PyDict_SetItemString(lookupDict, ptrBuf, result);
    11561171    }
    11571172    else if (our_tv->v_type == VAR_NUMBER)
    11581173    {
     
    11611176        /* For backwards compatibility numbers are stored as strings. */
    11621177        sprintf(buf, "%ld", (long)our_tv->vval.v_number);
    11631178        result = Py_BuildValue("s", buf);
    1164         PyDict_SetItemString(lookupDict, ptrBuf, result);
    11651179    }
    11661180# ifdef FEAT_FLOAT
    11671181    else if (our_tv->v_type == VAR_FLOAT)
     
    11701184
    11711185        sprintf(buf, "%f", our_tv->vval.v_float);
    11721186        result = Py_BuildValue("s", buf);
    1173         PyDict_SetItemString(lookupDict, ptrBuf, result);
    11741187    }
    11751188# endif
    11761189    else if (our_tv->v_type == VAR_LIST)
     
    11791192        listitem_T      *curr;
    11801193
    11811194        result = PyList_New(0);
    1182         PyDict_SetItemString(lookupDict, ptrBuf, result);
    11831195
    11841196        if (list != NULL)
    11851197        {
     1198            PyDict_SetItemString(lookupDict, ptrBuf, result);
     1199
    11861200            for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
    11871201            {
    11881202                newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
     
    11941208    else if (our_tv->v_type == VAR_DICT)
    11951209    {
    11961210        result = PyDict_New();
    1197         PyDict_SetItemString(lookupDict, ptrBuf, result);
    11981211
    11991212        if (our_tv->vval.v_dict != NULL)
    12001213        {
     
    12031216            hashitem_T  *hi;
    12041217            dictitem_T  *di;
    12051218
     1219            PyDict_SetItemString(lookupDict, ptrBuf, result);
     1220
    12061221            for (hi = ht->ht_array; todo > 0; ++hi)
    12071222            {
    12081223                if (!HASHITEM_EMPTY(hi))
     
    23452360{
    23462361    PyObject *mod;
    23472362    PyObject *dict;
    2348     static char *(argv[2]) = {"", NULL};
     2363    /* The special value is removed from sys.path in Python_Init(). */
     2364    static char *(argv[2]) = {"/must>not&exist/foo", NULL};
    23492365
    23502366    /* Fixups... */
    23512367    BufferType.ob_type = &PyType_Type;
  • src/if_xcmdsrv.c

    diff -Naur vim72.orig/src/if_xcmdsrv.c vim72/src/if_xcmdsrv.c
    old new  
    736736                + serverReply.ga_len;
    737737            e.id = w;
    738738            ga_init2(&e.strings, 1, 100);
    739             memcpy(p, &e, sizeof(e));
     739            mch_memmove(p, &e, sizeof(e));
    740740            serverReply.ga_len++;
    741741        }
    742742    }
     
    10181018        p++;
    10191019        count = numItems - (p - regProp);
    10201020        if (count > 0)
    1021             memcpy(entry, p, count);
     1021            mch_memmove(entry, p, count);
    10221022        XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
    10231023                        8, PropModeReplace, regProp,
    10241024                        (int)(numItems - (p - entry)));
     
    10721072                p++;
    10731073                lastHalf = numItems - (p - regProp);
    10741074                if (lastHalf > 0)
    1075                     memcpy(entry, p, lastHalf);
     1075                    mch_memmove(entry, p, lastHalf);
    10761076                numItems = (entry - regProp) + lastHalf;
    10771077                p = entry;
    10781078                continue;
  • src/main.c

    diff -Naur vim72.orig/src/main.c vim72/src/main.c
    old new  
    645645
    646646#ifdef FEAT_VIMINFO
    647647    /*
    648      * Read in registers, history etc, but not marks, from the viminfo file
     648     * Read in registers, history etc, but not marks, from the viminfo file.
     649     * This is where v:oldfiles gets filled.
    649650     */
    650651    if (*p_viminfo != NUL)
    651652    {
    652         read_viminfo(NULL, TRUE, FALSE, FALSE);
     653        read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
    653654        TIME_MSG("reading viminfo");
    654655    }
    655656#endif
     
    14571458        ++initstr;
    14581459    }
    14591460
    1460     if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
     1461    /* "gvim" starts the GUI.  Also accept "Gvim" for MS-Windows. */
     1462    if (TOLOWER_ASC(initstr[0]) == 'g')
    14611463    {
    14621464        main_start_gui();
    14631465#ifdef FEAT_GUI
     
    15081510early_arg_scan(parmp)
    15091511    mparm_T     *parmp;
    15101512{
    1511 #if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
     1513#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
     1514        || !defined(FEAT_NETBEANS_INTG)
    15121515    int         argc = parmp->argc;
    15131516    char        **argv = parmp->argv;
    15141517    int         i;
     
    15801583        else if (STRICMP(argv[i], "--echo-wid") == 0)
    15811584            echo_wid_arg = TRUE;
    15821585# endif
     1586# ifndef FEAT_NETBEANS_INTG
     1587        else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
     1588        {
     1589            mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
     1590            mch_exit(2);
     1591        }
     1592# endif
     1593
    15831594    }
    15841595#endif
    15851596}
     
    23612372     * Is there any other system that cannot do this?
    23622373     */
    23632374    close(0);
    2364     dup(2);
     2375    ignored = dup(2);
    23652376#endif
    23662377}
    23672378
  • src/mark.c

    diff -Naur vim72.orig/src/mark.c vim72/src/mark.c
    old new  
    16271627
    16281628/*
    16291629 * Handle marks in the viminfo file:
    1630  * fp_out == NULL   read marks for current buffer only
    1631  * fp_out != NULL   copy marks for buffers not in buffer list
     1630 * fp_out != NULL: copy marks for buffers not in buffer list
     1631 * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
     1632 * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
    16321633 */
    16331634    void
    1634 copy_viminfo_marks(virp, fp_out, count, eof)
     1635copy_viminfo_marks(virp, fp_out, count, eof, flags)
    16351636    vir_T       *virp;
    16361637    FILE        *fp_out;
    16371638    int         count;
    16381639    int         eof;
     1640    int         flags;
    16391641{
    16401642    char_u      *line = virp->vir_line;
    16411643    buf_T       *buf;
     
    16471649    char_u      *p;
    16481650    char_u      *name_buf;
    16491651    pos_T       pos;
     1652#ifdef FEAT_EVAL
     1653    list_T      *list = NULL;
     1654#endif
    16501655
    16511656    if ((name_buf = alloc(LSIZE)) == NULL)
    16521657        return;
    16531658    *name_buf = NUL;
     1659
     1660#ifdef FEAT_EVAL
     1661    if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
     1662    {
     1663        list = list_alloc();
     1664        if (list != NULL)
     1665            set_vim_var_list(VV_OLDFILES, list);
     1666    }
     1667#endif
     1668
    16541669    num_marked_files = get_viminfo_parameter('\'');
    16551670    while (!eof && (count < num_marked_files || fp_out == NULL))
    16561671    {
     
    16811696            p++;
    16821697        *p = NUL;
    16831698
     1699#ifdef FEAT_EVAL
     1700        if (list != NULL)
     1701            list_append_string(list, str, -1);
     1702#endif
     1703
    16841704        /*
    16851705         * If fp_out == NULL, load marks for current buffer.
    16861706         * If fp_out != NULL, copy marks for buffers not in buflist.
     
    16881708        load_marks = copy_marks_out = FALSE;
    16891709        if (fp_out == NULL)
    16901710        {
    1691             if (curbuf->b_ffname != NULL)
     1711            if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
    16921712            {
    16931713                if (*name_buf == NUL)       /* only need to do this once */
    16941714                    home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE);
  • src/mbyte.c

    diff -Naur vim72.orig/src/mbyte.c vim72/src/mbyte.c
    old new  
    717717                     * where mblen() returns 0 for invalid character.
    718718                     * Therefore, following condition includes 0.
    719719                     */
    720                     (void)mblen(NULL, 0);       /* First reset the state. */
     720                    ignored = mblen(NULL, 0);   /* First reset the state. */
    721721                    if (mblen(buf, (size_t)1) <= 0)
    722722                        n = 2;
    723723                    else
     
    25402540    return (int)(p - q);
    25412541}
    25422542
    2543 #if defined(FEAT_EVAL) || defined(PROTO)
    25442543/*
    25452544 * Copy a character from "*fp" to "*tp" and advance the pointers.
    25462545 */
     
    25552554    *tp += l;
    25562555    *fp += l;
    25572556}
    2558 #endif
    25592557
    25602558/*
    25612559 * Return the offset from "p" to the first byte of a character.  When "p" is
     
    31333131        else
    31343132            s = p + 1;
    31353133    }
    3136     for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i)
     3134    for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
    31373135    {
    31383136        if (s[i] == '_' || s[i] == '-')
    31393137            buf[i] = '-';
     
    52805278
    52815279/*ARGSUSED*/
    52825280    static void
    5283 preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
     5281preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
    52845282{
    52855283#ifdef XIM_DEBUG
    52865284    xim_log("xim_decide_input_style()\n");
     
    53145312
    53155313/*ARGSUSED*/
    53165314    static void
    5317 preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
     5315preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
    53185316{
    53195317    XIMPreeditDrawCallbackStruct *draw_data;
    53205318    XIMText     *text;
     
    53865384                        draw_feedback = (char *)alloc(draw_data->chg_first
    53875385                                                              + text->length);
    53885386                    else
    5389                         draw_feedback = realloc(draw_feedback,
     5387                        draw_feedback = vim_realloc(draw_feedback,
    53905388                                         draw_data->chg_first + text->length);
    53915389                    if (draw_feedback != NULL)
    53925390                    {
     
    54555453
    54565454/*ARGSUSED*/
    54575455    static void
    5458 preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
     5456preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
    54595457{
    54605458#ifdef XIM_DEBUG
    54615459    xim_log("preedit_caret_cbproc()\n");
     
    54645462
    54655463/*ARGSUSED*/
    54665464    static void
    5467 preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
     5465preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
    54685466{
    54695467#ifdef XIM_DEBUG
    54705468    xim_log("preedit_done_cbproc()\n");
  • src/menu.c

    diff -Naur vim72.orig/src/menu.c vim72/src/menu.c
    old new  
    11201120        parent = menu;
    11211121        menu = menu->children;
    11221122    }
     1123    vim_free(path_name);
    11231124
    11241125    /* Now we have found the matching menu, and we list the mappings */
    11251126                                                    /* Highlight title */
  • src/message.c

    diff -Naur vim72.orig/src/message.c vim72/src/message.c
    old new  
    45564556                        remove_trailing_zeroes = TRUE;
    45574557                    }
    45584558
    4559                     if (fmt_spec == 'f' && abs_f > 1.0e307)
     4559                    if (fmt_spec == 'f' &&
     4560#ifdef VAX
     4561                            abs_f > 1.0e38
     4562#else
     4563                            abs_f > 1.0e307
     4564#endif
     4565                            )
    45604566                    {
    45614567                        /* Avoid a buffer overflow */
    45624568                        strcpy(tmp, "inf");
     
    45854591                        if (remove_trailing_zeroes)
    45864592                        {
    45874593                            int i;
    4588                             char *p;
     4594                            char *tp;
    45894595
    45904596                            /* Using %g or %G: remove superfluous zeroes. */
    45914597                            if (fmt_spec == 'f')
    4592                                 p = tmp + str_arg_l - 1;
     4598                                tp = tmp + str_arg_l - 1;
    45934599                            else
    45944600                            {
    4595                                 p = (char *)vim_strchr((char_u *)tmp,
     4601                                tp = (char *)vim_strchr((char_u *)tmp,
    45964602                                                 fmt_spec == 'e' ? 'e' : 'E');
    4597                                 if (p != NULL)
     4603                                if (tp != NULL)
    45984604                                {
    45994605                                    /* Remove superfluous '+' and leading
    46004606                                     * zeroes from the exponent. */
    4601                                     if (p[1] == '+')
     4607                                    if (tp[1] == '+')
    46024608                                    {
    46034609                                        /* Change "1.0e+07" to "1.0e07" */
    4604                                         STRMOVE(p + 1, p + 2);
     4610                                        STRMOVE(tp + 1, tp + 2);
    46054611                                        --str_arg_l;
    46064612                                    }
    4607                                     i = (p[1] == '-') ? 2 : 1;
    4608                                     while (p[i] == '0')
     4613                                    i = (tp[1] == '-') ? 2 : 1;
     4614                                    while (tp[i] == '0')
    46094615                                    {
    46104616                                        /* Change "1.0e07" to "1.0e7" */
    4611                                         STRMOVE(p + i, p + i + 1);
     4617                                        STRMOVE(tp + i, tp + i + 1);
    46124618                                        --str_arg_l;
    46134619                                    }
    4614                                     --p;
     4620                                    --tp;
    46154621                                }
    46164622                            }
    46174623
    4618                             if (p != NULL && !precision_specified)
     4624                            if (tp != NULL && !precision_specified)
    46194625                                /* Remove trailing zeroes, but keep the one
    46204626                                 * just after a dot. */
    4621                                 while (p > tmp + 2 && *p == '0' && p[-1] != '.')
     4627                                while (tp > tmp + 2 && *tp == '0'
     4628                                                             && tp[-1] != '.')
    46224629                                {
    4623                                     STRMOVE(p, p + 1);
    4624                                     --p;
     4630                                    STRMOVE(tp, tp + 1);
     4631                                    --tp;
    46254632                                    --str_arg_l;
    46264633                                }
    46274634                        }
    46284635                        else
    46294636                        {
    4630                             char *p;
     4637                            char *tp;
    46314638
    46324639                            /* Be consistent: some printf("%e") use 1.0e+12
    46334640                             * and some 1.0e+012.  Remove one zero in the last
    46344641                             * case. */
    4635                             p = (char *)vim_strchr((char_u *)tmp,
     4642                            tp = (char *)vim_strchr((char_u *)tmp,
    46364643                                                 fmt_spec == 'e' ? 'e' : 'E');
    4637                             if (p != NULL && (p[1] == '+' || p[1] == '-')
    4638                                           && p[2] == '0'
    4639                                           && vim_isdigit(p[3])
    4640                                           && vim_isdigit(p[4]))
     4644                            if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
     4645                                          && tp[2] == '0'
     4646                                          && vim_isdigit(tp[3])
     4647                                          && vim_isdigit(tp[4]))
    46414648                            {
    4642                                 STRMOVE(p + 2, p + 3);
     4649                                STRMOVE(tp + 2, tp + 3);
    46434650                                --str_arg_l;
    46444651                            }
    46454652                        }
  • src/misc1.c

    diff -Naur vim72.orig/src/misc1.c vim72/src/misc1.c
    old new  
    32453245
    32463246    /* When using ":silent" assume that <CR> was entered. */
    32473247    if (mouse_used != NULL)
    3248         MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): "));
     3248        MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): "));
    32493249    else
    3250         MSG_PUTS(_("Choice number (<Enter> cancels): "));
     3250        MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
    32513251
    32523252    /* Set the state such that text can be selected/copied/pasted and we still
    32533253     * get mouse events. */
  • src/misc2.c

    diff -Naur vim72.orig/src/misc2.c vim72/src/misc2.c
    old new  
    873873            /* 3. check for available memory: call mch_avail_mem() */
    874874            if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
    875875            {
    876                 vim_free((char *)p);    /* System is low... no go! */
     876                free((char *)p);        /* System is low... no go! */
    877877                p = NULL;
    878878            }
    879879            else
     
    12571257    return escaped_string;
    12581258}
    12591259
    1260 #if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
    12611260/*
    12621261 * Return TRUE when 'shell' has "csh" in the tail.
    12631262 */
     
    12661265{
    12671266    return (strstr((char *)gettail(p_sh), "csh") != NULL);
    12681267}
    1269 #endif
    12701268
    1271 #if defined(FEAT_EVAL) || defined(PROTO)
    12721269/*
    12731270 * Escape "string" for use as a shell argument with system().
    12741271 * This uses single quotes, except when we know we need to use double qoutes
     
    13911388
    13921389    return escaped_string;
    13931390}
    1394 #endif
    13951391
    13961392/*
    13971393 * Like vim_strsave(), but make all characters uppercase.
     
    25652561    int         key;
    25662562    int         dlen = 0;
    25672563
    2568     key = find_special_key(srcp, &modifiers, keycode);
     2564    key = find_special_key(srcp, &modifiers, keycode, FALSE);
    25692565    if (key == 0)
    25702566        return 0;
    25712567
     
    26012597 * returns 0 if there is no match.
    26022598 */
    26032599    int
    2604 find_special_key(srcp, modp, keycode)
     2600find_special_key(srcp, modp, keycode, keep_x_key)
    26052601    char_u      **srcp;
    26062602    int         *modp;
    2607     int         keycode; /* prefer key code, e.g. K_DEL instead of DEL */
     2603    int         keycode;     /* prefer key code, e.g. K_DEL instead of DEL */
     2604    int         keep_x_key;  /* don't translate xHome to Home key */
    26082605{
    26092606    char_u      *last_dash;
    26102607    char_u      *end_of_name;
     
    26722669            else
    26732670            {
    26742671                key = get_special_key_code(last_dash + 1);
    2675                 key = handle_x_keys(key);
     2672                if (!keep_x_key)
     2673                    key = handle_x_keys(key);
    26762674            }
    26772675
    26782676            /*
  • src/move.c

    diff -Naur vim72.orig/src/move.c vim72/src/move.c
    old new  
    280280
    281281        if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
    282282        {
    283             if (curwin->w_cursor.lnum < curwin->w_botline
    284                     && ((long)curwin->w_cursor.lnum
     283            if (curwin->w_cursor.lnum < curwin->w_botline)
     284            {
     285              if (((long)curwin->w_cursor.lnum
    285286                                             >= (long)curwin->w_botline - p_so
    286287#ifdef FEAT_FOLDING
    287288                        || hasAnyFolding(curwin)
    288289#endif
    289290                        ))
    290             {
     291              {
    291292                lineoff_T       loff;
    292293
    293                 /* Cursor is above botline, check if there are 'scrolloff'
    294                  * window lines below the cursor.  If not, need to scroll. */
     294                /* Cursor is (a few lines) above botline, check if there are
     295                 * 'scrolloff' window lines below the cursor.  If not, need to
     296                 * scroll. */
    295297                n = curwin->w_empty_rows;
    296298                loff.lnum = curwin->w_cursor.lnum;
    297299#ifdef FEAT_FOLDING
     
    317319                if (n >= p_so)
    318320                    /* sufficient context, no need to scroll */
    319321                    check_botline = FALSE;
     322              }
     323              else
     324                  /* sufficient context, no need to scroll */
     325                  check_botline = FALSE;
    320326            }
    321327            if (check_botline)
    322328            {
     
    509515    /* Approximate the value of w_botline */
    510516    wp->w_botline += lnum - wp->w_topline;
    511517    wp->w_topline = lnum;
     518#ifdef FEAT_AUTOCMD
     519    wp->w_topline_was_set = TRUE;
     520#endif
    512521#ifdef FEAT_DIFF
    513522    wp->w_topfill = 0;
    514523#endif
  • src/netbeans.c

    diff -Naur vim72.orig/src/netbeans.c vim72/src/netbeans.c
    old new  
    10431043        nbdebug(("EVT: %s", buf));
    10441044/*      nb_send(buf, "netbeans_end");    avoid "write failed" messages */
    10451045        if (sd >= 0)
    1046             sock_write(sd, buf, (int)STRLEN(buf));  /* ignore errors */
     1046            ignored = sock_write(sd, buf, (int)STRLEN(buf));
    10471047    }
    10481048}
    10491049
     
    22772277            int serNum;
    22782278            int localTypeNum;
    22792279            int typeNum;
    2280 # ifdef NBDEBUG
    2281             int len;
    2282 # endif
    22832280            pos_T *pos;
    22842281
    22852282            if (buf == NULL || buf->bufp == NULL)
     
    23032300            pos = get_off_or_lnum(buf->bufp, &args);
    23042301
    23052302            cp = (char *)args;
    2306 # ifdef NBDEBUG
    2307             len =
    2308 # endif
    2309                 strtol(cp, &cp, 10);
     2303            ignored = (int)strtol(cp, &cp, 10);
    23102304            args = (char_u *)cp;
    23112305# ifdef NBDEBUG
    2312             if (len != -1)
     2306            if (ignored != -1)
    23132307            {
    23142308                nbdebug(("    partial line annotation -- Not Yet Implemented!\n"));
    23152309            }
     
    29242918}
    29252919
    29262920/*
    2927  * Tell netbeans a file was closed.
     2921 * Tell netbeans that a file was deleted or wiped out.
    29282922 */
    29292923    void
    2930 netbeans_file_closed(buf_T *bufp)
     2924netbeans_file_killed(buf_T *bufp)
    29312925{
    29322926    int         bufno = nb_getbufno(bufp);
    29332927    nbbuf_T     *nbbuf = nb_get_buf(bufno);
    29342928    char        buffer[2*MAXPATHL];
    29352929
    2936     if (!haveConnection || bufno < 0)
    2937         return;
    2938 
    2939     if (!netbeansCloseFile)
    2940     {
    2941         nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n",
    2942                     bufp->b_ffname));
     2930    if (!haveConnection || bufno == -1)
    29432931        return;
    2944     }
    2945 
    2946     nbdebug(("netbeans_file_closed:\n"));
    2947     nbdebug(("    Closing bufno: %d", bufno));
    2948     if (curbuf != NULL && curbuf != bufp)
    2949     {
    2950         nbdebug(("    Curbuf bufno:  %d\n", nb_getbufno(curbuf)));
    2951     }
    2952     else if (curbuf == bufp)
    2953     {
    2954         nbdebug(("    curbuf == bufp\n"));
    2955     }
    29562932
    2957     if (bufno <= 0)
    2958         return;
     2933    nbdebug(("netbeans_file_killed:\n"));
     2934    nbdebug(("    Killing bufno: %d", bufno));
    29592935
    29602936    sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno);
    29612937
    29622938    nbdebug(("EVT: %s", buffer));
    29632939
    2964     nb_send(buffer, "netbeans_file_closed");
     2940    nb_send(buffer, "netbeans_file_killed");
    29652941
    29662942    if (nbbuf != NULL)
    29672943        nbbuf->bufp = NULL;
  • src/normal.c

    diff -Naur vim72.orig/src/normal.c vim72/src/normal.c
    old new  
    183183static void     nv_cursorhold __ARGS((cmdarg_T *cap));
    184184#endif
    185185
     186static char *e_noident = N_("E349: No identifier under cursor");
     187
    186188/*
    187189 * Function to be called for a Normal or Visual mode command.
    188190 * The argument is a cmdarg_T.
     
    578580    static int  old_mapped_len = 0;
    579581#endif
    580582    int         idx;
     583#ifdef FEAT_EVAL
     584    int         set_prevcount = FALSE;
     585#endif
    581586
    582587    vim_memset(&ca, 0, sizeof(ca));     /* also resets ca.retval */
    583588    ca.oap = oap;
     
    613618    /* When not finishing an operator and no register name typed, reset the
    614619     * count. */
    615620    if (!finish_op && !oap->regname)
     621    {
    616622        ca.opcount = 0;
     623#ifdef FEAT_EVAL
     624        set_prevcount = TRUE;
     625#endif
     626    }
    617627
    618628#ifdef FEAT_AUTOCMD
    619629    /* Restore counts from before receiving K_CURSORHOLD.  This means after
     
    717727             * command, so that v:count can be used in an expression mapping
    718728             * right after the count. */
    719729            if (toplevel && stuff_empty())
    720                 set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
     730            {
     731                long count = ca.count0;
     732
     733                /* multiply with ca.opcount the same way as below */
     734                if (ca.opcount != 0)
     735                    count = ca.opcount * (count == 0 ? 1 : count);
     736                set_vcount(count, count == 0 ? 1 : count, set_prevcount);
     737                set_prevcount = FALSE;  /* only set v:prevcount once */
     738            }
    721739#endif
    722740            if (ctrl_w)
    723741            {
     
    804822     * Only set v:count when called from main() and not a stuffed command.
    805823     */
    806824    if (toplevel && stuff_empty())
    807         set_vcount(ca.count0, ca.count1);
     825        set_vcount(ca.count0, ca.count1, set_prevcount);
    808826#endif
    809827
    810828    /*
     
    11321150        out_flush();
    11331151#endif
    11341152#ifdef FEAT_AUTOCMD
    1135     did_cursorhold = FALSE;
     1153    if (ca.cmdchar != K_IGNORE)
     1154        did_cursorhold = FALSE;
    11361155#endif
    11371156
    11381157    State = NORMAL;
     
    35093528        if (find_type & FIND_STRING)
    35103529            EMSG(_("E348: No string under cursor"));
    35113530        else
    3512             EMSG(_("E349: No identifier under cursor"));
     3531            EMSG(_(e_noident));
    35133532        return 0;
    35143533    }
    35153534    ptr += col;
     
    54695488                STRCPY(buf, "he! ");
    54705489            else
    54715490            {
     5491                /* An external command will probably use an argument starting
     5492                 * with "-" as an option.  To avoid trouble we skip the "-". */
     5493                while (*ptr == '-' && n > 0)
     5494                {
     5495                    ++ptr;
     5496                    --n;
     5497                }
     5498                if (n == 0)
     5499                {
     5500                    EMSG(_(e_noident));  /* found dashes only */
     5501                    vim_free(buf);
     5502                    return;
     5503                }
     5504
    54725505                /* When a count is given, turn it into a range.  Is this
    54735506                 * really what we want? */
    54745507                isman = (STRCMP(kp, "man") == 0);
     
    55115544    /*
    55125545     * Now grab the chars in the identifier
    55135546     */
    5514     if (cmdchar == '*')
    5515         aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
    5516     else if (cmdchar == '#')
    5517         aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
    5518     else if (cmdchar == 'K' && !kp_help)
    5519         aux_ptr = (char_u *)" \t\\\"|!";
    5520     else
    5521         /* Don't escape spaces and Tabs in a tag with a backslash */
    5522         aux_ptr = (char_u *)"\\|\"";
    5523 
    5524     p = buf + STRLEN(buf);
    5525     while (n-- > 0)
    5526     {
    5527         /* put a backslash before \ and some others */
    5528         if (vim_strchr(aux_ptr, *ptr) != NULL)
    5529             *p++ = '\\';
    5530 #ifdef FEAT_MBYTE
    5531         /* When current byte is a part of multibyte character, copy all bytes
    5532          * of that character. */
    5533         if (has_mbyte)
     5547    if (cmdchar == 'K' && !kp_help)
     5548    {
     5549        /* Escape the argument properly for a shell command */
     5550        ptr = vim_strnsave(ptr, n);
     5551        p = vim_strsave_shellescape(ptr, TRUE);
     5552        vim_free(ptr);
     5553        if (p == NULL)
    55345554        {
    5535             int i;
    5536             int len = (*mb_ptr2len)(ptr) - 1;
    5537 
    5538             for (i = 0; i < len && n >= 1; ++i, --n)
    5539                 *p++ = *ptr++;
     5555            vim_free(buf);
     5556            return;
    55405557        }
     5558        buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
     5559        if (buf == NULL)
     5560        {
     5561            vim_free(buf);
     5562            vim_free(p);
     5563            return;
     5564        }
     5565        STRCAT(buf, p);
     5566        vim_free(p);
     5567    }
     5568    else
     5569    {
     5570        if (cmdchar == '*')
     5571            aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
     5572        else if (cmdchar == '#')
     5573            aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
     5574        else
     5575            /* Don't escape spaces and Tabs in a tag with a backslash */
     5576            aux_ptr = (char_u *)"\\|\"\n*?[";
     5577
     5578        p = buf + STRLEN(buf);
     5579        while (n-- > 0)
     5580        {
     5581            /* put a backslash before \ and some others */
     5582            if (vim_strchr(aux_ptr, *ptr) != NULL)
     5583                *p++ = '\\';
     5584#ifdef FEAT_MBYTE
     5585            /* When current byte is a part of multibyte character, copy all
     5586             * bytes of that character. */
     5587            if (has_mbyte)
     5588            {
     5589                int i;
     5590                int len = (*mb_ptr2len)(ptr) - 1;
     5591
     5592                for (i = 0; i < len && n >= 1; ++i, --n)
     5593                    *p++ = *ptr++;
     5594            }
    55415595#endif
    5542         *p++ = *ptr++;
     5596            *p++ = *ptr++;
     5597        }
     5598        *p = NUL;
    55435599    }
    5544     *p = NUL;
    55455600
    55465601    /*
    55475602     * Execute the command.
  • src/ops.c

    diff -Naur vim72.orig/src/ops.c vim72/src/ops.c
    old new  
    22092209    {
    22102210        for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
    22112211        {
     2212            int one_change;
     2213
    22122214            block_prep(oap, &bd, pos.lnum, FALSE);
    22132215            pos.col = bd.textcol;
    2214             did_change = swapchars(oap->op_type, &pos, bd.textlen);
     2216            one_change = swapchars(oap->op_type, &pos, bd.textlen);
     2217            did_change |= one_change;
    22152218
    22162219# ifdef FEAT_NETBEANS_INTG
    2217             if (usingNetbeans && did_change)
     2220            if (usingNetbeans && one_change)
    22182221            {
    22192222                char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
    22202223
  • src/option.c

    diff -Naur vim72.orig/src/option.c vim72/src/option.c
    old new  
    25932593#ifdef FEAT_VIMINFO
    25942594                            (char_u *)&p_viminfo, PV_NONE,
    25952595#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
    2596                             {(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
     2596                            {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
    25972597#else
    25982598# ifdef AMIGA
    25992599                            {(char_u *)"",
    2600                                  (char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
     2600                                 (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
    26012601# else
    2602                             {(char_u *)"", (char_u *)"'20,<50,s10,h"}
     2602                            {(char_u *)"", (char_u *)"'100,<50,s10,h"}
    26032603# endif
    26042604#endif
    26052605#else
     
    79747974        else /* curwin->w_p_scr > curwin->w_height */
    79757975            curwin->w_p_scr = curwin->w_height;
    79767976    }
     7977    if (p_hi < 0)
     7978    {
     7979        errmsg = e_positive;
     7980        p_hi = 0;
     7981    }
    79777982    if (p_report < 0)
    79787983    {
    79797984        errmsg = e_positive;
     
    82278232            {
    82288233                if (number == 0 && string != NULL)
    82298234                {
    8230                     int index;
     8235                    int idx;
    82318236
    82328237                    /* Either we are given a string or we are setting option
    82338238                     * to zero. */
    8234                     for (index = 0; string[index] == '0'; ++index)
     8239                    for (idx = 0; string[idx] == '0'; ++idx)
    82358240                        ;
    8236                     if (string[index] != NUL || index == 0)
     8241                    if (string[idx] != NUL || idx == 0)
    82378242                    {
    82388243                        /* There's another character after zeros or the string
    82398244                         * is empty.  In both cases, we are trying to set a
     
    83238328    {
    83248329        --arg;                      /* put arg at the '<' */
    83258330        modifiers = 0;
    8326         key = find_special_key(&arg, &modifiers, TRUE);
     8331        key = find_special_key(&arg, &modifiers, TRUE, TRUE);
    83278332        if (modifiers)              /* can't handle modifiers here */
    83288333            key = 0;
    83298334    }
  • src/os_unix.c

    diff -Naur vim72.orig/src/os_unix.c vim72/src/os_unix.c
    old new  
    315315    {-1,            "Unknown!", FALSE}
    316316};
    317317
     318/*
     319 * Write s[len] to the screen.
     320 */
    318321    void
    319322mch_write(s, len)
    320323    char_u      *s;
    321324    int         len;
    322325{
    323     write(1, (char *)s, len);
     326    ignored = (int)write(1, (char *)s, len);
    324327    if (p_wd)           /* Unix is too fast, slow down a bit more */
    325328        RealWaitForChar(read_cmd_fd, p_wd, NULL);
    326329}
     
    29052908     * Ignore any errors.
    29062909     */
    29072910#if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
    2908     signal_stack = malloc(SIGSTKSZ);
     2911    signal_stack = (char *)alloc(SIGSTKSZ);
    29092912    init_signal_stack();
    29102913#endif
    29112914}
     
    29362939    }
    29372940#  endif
    29382941# endif
    2939 # ifdef FEAT_X11
     2942    /* Don't close the display for GTK 1, it is done in exit(). */
     2943# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2))
    29402944    if (x11_display != NULL
    29412945#  ifdef FEAT_XCLIPBOARD
    29422946            && x11_display != xterm_dpy
     
    39263930                 */
    39273931                if (fd >= 0)
    39283932                {
    3929                     dup(fd); /* To replace stdin  (file descriptor 0) */
    3930                     dup(fd); /* To replace stdout (file descriptor 1) */
    3931                     dup(fd); /* To replace stderr (file descriptor 2) */
     3933                    ignored = dup(fd); /* To replace stdin  (fd 0) */
     3934                    ignored = dup(fd); /* To replace stdout (fd 1) */
     3935                    ignored = dup(fd); /* To replace stderr (fd 2) */
    39323936
    39333937                    /* Don't need this now that we've duplicated it */
    39343938                    close(fd);
     
    39964000
    39974001                    /* set up stdin/stdout/stderr for the child */
    39984002                    close(0);
    3999                     dup(pty_slave_fd);
     4003                    ignored = dup(pty_slave_fd);
    40004004                    close(1);
    4001                     dup(pty_slave_fd);
     4005                    ignored = dup(pty_slave_fd);
    40024006                    if (gui.in_use)
    40034007                    {
    40044008                        close(2);
    4005                         dup(pty_slave_fd);
     4009                        ignored = dup(pty_slave_fd);
    40064010                    }
    40074011
    40084012                    close(pty_slave_fd);    /* has been dupped, close it now */
     
    40134017                    /* set up stdin for the child */
    40144018                    close(fd_toshell[1]);
    40154019                    close(0);
    4016                     dup(fd_toshell[0]);
     4020                    ignored = dup(fd_toshell[0]);
    40174021                    close(fd_toshell[0]);
    40184022
    40194023                    /* set up stdout for the child */
    40204024                    close(fd_fromshell[0]);
    40214025                    close(1);
    4022                     dup(fd_fromshell[1]);
     4026                    ignored = dup(fd_fromshell[1]);
    40234027                    close(fd_fromshell[1]);
    40244028
    40254029# ifdef FEAT_GUI
     
    40274031                    {
    40284032                        /* set up stderr for the child */
    40294033                        close(2);
    4030                         dup(1);
     4034                        ignored = dup(1);
    40314035                    }
    40324036# endif
    40334037                }
     
    41584162                                            && (lnum !=
    41594163                                                    curbuf->b_ml.ml_line_count
    41604164                                                    || curbuf->b_p_eol)))
    4161                                     write(toshell_fd, "\n", (size_t)1);
     4165                                    ignored = write(toshell_fd, "\n",
     4166                                                                   (size_t)1);
    41624167                                ++lnum;
    41634168                                if (lnum > curbuf->b_op_end.lnum)
    41644169                                {
     
    68146819    if (xsmp_icefd != -1)
    68156820    {
    68166821        SmcCloseConnection(xsmp.smcconn, 0, NULL);
    6817         vim_free(xsmp.clientid);
     6822        if (xsmp.clientid != NULL)
     6823            free(xsmp.clientid);
    68186824        xsmp.clientid = NULL;
    68196825        xsmp_icefd = -1;
    68206826    }
  • src/proto/eval.pro

    diff -Naur vim72.orig/src/proto/eval.pro vim72/src/proto/eval.pro
    old new  
    1717int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
    1818char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
    1919int skip_expr __ARGS((char_u **pp));
    20 char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
     20char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert));
    2121char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
    2222int eval_to_number __ARGS((char_u *expr));
    2323list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
     
    4646void list_unref __ARGS((list_T *l));
    4747void list_free __ARGS((list_T *l, int recurse));
    4848dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
     49char_u *list_find_str __ARGS((list_T *l, long idx));
    4950int list_append_dict __ARGS((list_T *list, dict_T *dict));
     51int list_append_string __ARGS((list_T *l, char_u *str, int len));
    5052int garbage_collect __ARGS((void));
    5153dict_T *dict_alloc __ARGS((void));
    5254int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
     
    5860void set_vim_var_nr __ARGS((int idx, long val));
    5961long get_vim_var_nr __ARGS((int idx));
    6062char_u *get_vim_var_str __ARGS((int idx));
    61 void set_vcount __ARGS((long count, long count1));
     63list_T *get_vim_var_list __ARGS((int idx));
     64void set_vcount __ARGS((long count, long count1, int set_prevcount));
    6265void set_vim_var_string __ARGS((int idx, char_u *val, int len));
     66void set_vim_var_list __ARGS((int idx, list_T *val));
    6367void set_reg_var __ARGS((int c));
    6468char_u *v_exception __ARGS((char_u *oldval));
    6569char_u *v_throwpoint __ARGS((char_u *oldval));
     
    9498void write_viminfo_varlist __ARGS((FILE *fp));
    9599int store_session_globals __ARGS((FILE *fd));
    96100void last_set_msg __ARGS((scid_T scriptID));
     101void ex_oldfiles __ARGS((exarg_T *eap));
    97102int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
    98103char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
    99104/* vim: set ft=c : */
  • src/proto/ex_cmds.pro

    diff -Naur vim72.orig/src/proto/ex_cmds.pro vim72/src/proto/ex_cmds.pro
    old new  
    1111char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
    1212void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
    1313int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
    14 int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
     14int read_viminfo __ARGS((char_u *file, int flags));
    1515void write_viminfo __ARGS((char_u *file, int forceit));
    1616int viminfo_readline __ARGS((vir_T *virp));
    1717char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
  • src/proto/ex_getln.pro

    diff -Naur vim72.orig/src/proto/ex_getln.pro vim72/src/proto/ex_getln.pro
    old new  
    3131void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
    3232int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
    3333int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
    34 char_u *globpath __ARGS((char_u *path, char_u *file));
     34char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
    3535void init_history __ARGS((void));
    3636int get_histtype __ARGS((char_u *name));
    3737void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
  • src/proto/mark.pro

    diff -Naur vim72.orig/src/proto/mark.pro vim72/src/proto/mark.pro
    old new  
    2626void write_viminfo_filemarks __ARGS((FILE *fp));
    2727int removable __ARGS((char_u *name));
    2828int write_viminfo_marks __ARGS((FILE *fp_out));
    29 void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof));
     29void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags));
    3030/* vim: set ft=c : */
  • src/proto/misc2.pro

    diff -Naur vim72.orig/src/proto/misc2.pro vim72/src/proto/misc2.pro
    old new  
    5959int handle_x_keys __ARGS((int key));
    6060char_u *get_special_key_name __ARGS((int c, int modifiers));
    6161int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
    62 int find_special_key __ARGS((char_u **srcp, int *modp, int keycode));
     62int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key));
    6363int extract_modifiers __ARGS((int key, int *modp));
    6464int find_special_key_in_table __ARGS((int c));
    6565int get_special_key_code __ARGS((char_u *name));
  • src/proto/netbeans.pro

    diff -Naur vim72.orig/src/proto/netbeans.pro vim72/src/proto/netbeans.pro
    old new  
    1111void netbeans_frame_moved __ARGS((int new_x, int new_y));
    1212void netbeans_file_activated __ARGS((buf_T *bufp));
    1313void netbeans_file_opened __ARGS((buf_T *bufp));
    14 void netbeans_file_closed __ARGS((buf_T *bufp));
     14void netbeans_file_killed __ARGS((buf_T *bufp));
    1515void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen));
    1616void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
    1717void netbeans_unmodified __ARGS((buf_T *bufp));
  • src/pty.c

    diff -Naur vim72.orig/src/pty.c vim72/src/pty.c
    old new  
    270270}
    271271#endif
    272272
    273 #if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux)
     273#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
    274274
    275 /* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */
     275/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
     276 * Same for Mac OS X Leopard. */
    276277#define PTY_DONE
    277278    int
    278279OpenPTY(ttyn)
  • src/screen.c

    diff -Naur vim72.orig/src/screen.c vim72/src/screen.c
    old new  
    24392439
    24402440#ifdef FEAT_SYN_HL
    24412441    /* Show 'cursorcolumn' in the fold line. */
    2442     if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp))
    2443         ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr(
    2444                  ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC));
     2442    if (wp->w_p_cuc)
     2443    {
     2444        txtcol += wp->w_virtcol;
     2445        if (wp->w_p_wrap)
     2446            txtcol -= wp->w_skipcol;
     2447        else
     2448            txtcol -= wp->w_leftcol;
     2449        if (txtcol >= 0 && txtcol < W_WIDTH(wp))
     2450            ScreenAttrs[off + txtcol] = hl_combine_attr(
     2451                                 ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
     2452    }
    24452453#endif
    24462454
    24472455    SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
  • src/spell.c

    diff -Naur vim72.orig/src/spell.c vim72/src/spell.c
    old new  
    7777
    7878/*
    7979 * Do the opposite: based on a maximum end score and a known sound score,
    80  * compute the the maximum word score that can be used.
     80 * compute the maximum word score that can be used.
    8181 */
    8282#define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3)
    8383
     
    469469    garray_T    sl_comppat;     /* CHECKCOMPOUNDPATTERN items */
    470470    regprog_T   *sl_compprog;   /* COMPOUNDRULE turned into a regexp progrm
    471471                                 * (NULL when no compounding) */
     472    char_u      *sl_comprules;  /* all COMPOUNDRULE concatenated (or NULL) */
    472473    char_u      *sl_compstartflags; /* flags for first compound word */
    473474    char_u      *sl_compallflags; /* all flags for compound words */
    474475    char_u      sl_nobreak;     /* When TRUE: no spaces between words */
     
    625626/* TRUE if a word appears in the list of banned words.  */
    626627#define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word)))
    627628
    628 /* Number of suggestions kept when cleaning up.  we need to keep more than
     629/* Number of suggestions kept when cleaning up.  We need to keep more than
    629630 * what is displayed, because when rescore_suggestions() is called the score
    630631 * may change and wrong suggestions may be removed later. */
    631632#define SUG_CLEAN_COUNT(su)    ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20)
     
    839840static void slang_clear __ARGS((slang_T *lp));
    840841static void slang_clear_sug __ARGS((slang_T *lp));
    841842static void find_word __ARGS((matchinf_T *mip, int mode));
     843static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
    842844static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
     845static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
     846static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
    843847static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
    844848static void find_prefix __ARGS((matchinf_T *mip, int mode));
    845849static int fold_more __ARGS((matchinf_T *mip));
     
    15191523                                            ((unsigned)flags >> 24)))
    15201524                    continue;
    15211525
     1526                /* If there is a match with a CHECKCOMPOUNDPATTERN rule
     1527                 * discard the compound word. */
     1528                if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
     1529                    continue;
     1530
    15221531                if (mode == FIND_COMPOUND)
    15231532                {
    15241533                    int     capflags;
     
    15771586                    if (!can_compound(slang, fword, mip->mi_compflags))
    15781587                        continue;
    15791588                }
     1589                else if (slang->sl_comprules != NULL
     1590                             && !match_compoundrule(slang, mip->mi_compflags))
     1591                    /* The compound flags collected so far do not match any
     1592                     * COMPOUNDRULE, discard the compounded word. */
     1593                    continue;
    15801594            }
    15811595
    15821596            /* Check NEEDCOMPOUND: can't use word without compounding. */
     
    17271741}
    17281742
    17291743/*
     1744 * Return TRUE if there is a match between the word ptr[wlen] and
     1745 * CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
     1746 * word.
     1747 * A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
     1748 * end of ptr[wlen] and the second part matches after it.
     1749 */
     1750    static int
     1751match_checkcompoundpattern(ptr, wlen, gap)
     1752    char_u      *ptr;
     1753    int         wlen;
     1754    garray_T    *gap;  /* &sl_comppat */
     1755{
     1756    int         i;
     1757    char_u      *p;
     1758    int         len;
     1759
     1760    for (i = 0; i + 1 < gap->ga_len; i += 2)
     1761    {
     1762        p = ((char_u **)gap->ga_data)[i + 1];
     1763        if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
     1764        {
     1765            /* Second part matches at start of following compound word, now
     1766             * check if first part matches at end of previous word. */
     1767            p = ((char_u **)gap->ga_data)[i];
     1768            len = (int)STRLEN(p);
     1769            if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
     1770                return TRUE;
     1771        }
     1772    }
     1773    return FALSE;
     1774}
     1775
     1776/*
    17301777 * Return TRUE if "flags" is a valid sequence of compound flags and "word"
    17311778 * does not have too many syllables.
    17321779 */
     
    17731820}
    17741821
    17751822/*
     1823 * Return TRUE when the sequence of flags in "compflags" plus "flag" can
     1824 * possibly form a valid compounded word.  This also checks the COMPOUNDRULE
     1825 * lines if they don't contain wildcards.
     1826 */
     1827    static int
     1828can_be_compound(sp, slang, compflags, flag)
     1829    trystate_T  *sp;
     1830    slang_T     *slang;
     1831    char_u      *compflags;
     1832    int         flag;
     1833{
     1834    /* If the flag doesn't appear in sl_compstartflags or sl_compallflags
     1835     * then it can't possibly compound. */
     1836    if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
     1837                ? slang->sl_compstartflags : slang->sl_compallflags, flag))
     1838        return FALSE;
     1839
     1840    /* If there are no wildcards, we can check if the flags collected so far
     1841     * possibly can form a match with COMPOUNDRULE patterns.  This only
     1842     * makes sense when we have two or more words. */
     1843    if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
     1844    {
     1845        int v;
     1846
     1847        compflags[sp->ts_complen] = flag;
     1848        compflags[sp->ts_complen + 1] = NUL;
     1849        v = match_compoundrule(slang, compflags + sp->ts_compsplit);
     1850        compflags[sp->ts_complen] = NUL;
     1851        return v;
     1852    }
     1853
     1854    return TRUE;
     1855}
     1856
     1857
     1858/*
     1859 * Return TRUE if the compound flags in compflags[] match the start of any
     1860 * compound rule.  This is used to stop trying a compound if the flags
     1861 * collected so far can't possibly match any compound rule.
     1862 * Caller must check that slang->sl_comprules is not NULL.
     1863 */
     1864    static int
     1865match_compoundrule(slang, compflags)
     1866    slang_T     *slang;
     1867    char_u      *compflags;
     1868{
     1869    char_u      *p;
     1870    int         i;
     1871    int         c;
     1872
     1873    /* loop over all the COMPOUNDRULE entries */
     1874    for (p = slang->sl_comprules; *p != NUL; ++p)
     1875    {
     1876        /* loop over the flags in the compound word we have made, match
     1877         * them against the current rule entry */
     1878        for (i = 0; ; ++i)
     1879        {
     1880            c = compflags[i];
     1881            if (c == NUL)
     1882                /* found a rule that matches for the flags we have so far */
     1883                return TRUE;
     1884            if (*p == '/' || *p == NUL)
     1885                break;  /* end of rule, it's too short */
     1886            if (*p == '[')
     1887            {
     1888                int match = FALSE;
     1889
     1890                /* compare against all the flags in [] */
     1891                ++p;
     1892                while (*p != ']' && *p != NUL)
     1893                    if (*p++ == c)
     1894                        match = TRUE;
     1895                if (!match)
     1896                    break;  /* none matches */
     1897            }
     1898            else if (*p != c)
     1899                break;  /* flag of word doesn't match flag in pattern */
     1900            ++p;
     1901        }
     1902
     1903        /* Skip to the next "/", where the next pattern starts. */
     1904        p = vim_strchr(p, '/');
     1905        if (p == NULL)
     1906            break;
     1907    }
     1908
     1909    /* Checked all the rules and none of them match the flags, so there
     1910     * can't possibly be a compound starting with these flags. */
     1911    return FALSE;
     1912}
     1913
     1914/*
    17761915 * Return non-zero if the prefix indicated by "arridx" matches with the prefix
    17771916 * ID in "flags" for the word "word".
    17781917 * The WF_RAREPFX flag is included in the return value for a rare prefix.
     
    25132652    lp->sl_midword = NULL;
    25142653
    25152654    vim_free(lp->sl_compprog);
     2655    vim_free(lp->sl_comprules);
    25162656    vim_free(lp->sl_compstartflags);
    25172657    vim_free(lp->sl_compallflags);
    25182658    lp->sl_compprog = NULL;
     2659    lp->sl_comprules = NULL;
    25192660    lp->sl_compstartflags = NULL;
    25202661    lp->sl_compallflags = NULL;
    25212662
     
    34603601    char_u      *pp;
    34613602    char_u      *cp;
    34623603    char_u      *ap;
     3604    char_u      *crp;
    34633605    int         cnt;
    34643606    garray_T    *gap;
    34653607
     
    35453687    slang->sl_compallflags = ap;
    35463688    *ap = NUL;
    35473689
     3690    /* And a list of all patterns in their original form, for checking whether
     3691     * compounding may work in match_compoundrule().  This is freed when we
     3692     * encounter a wildcard, the check doesn't work then. */
     3693    crp = alloc(todo + 1);
     3694    slang->sl_comprules = crp;
     3695
    35483696    pp = pat;
    35493697    *pp++ = '^';
    35503698    *pp++ = '\\';
     
    35873735                    atstart = 0;
    35883736            }
    35893737        }
     3738
     3739        /* Copy flag to "sl_comprules", unless we run into a wildcard. */
     3740        if (crp != NULL)
     3741        {
     3742            if (c == '+' || c == '*')
     3743            {
     3744                vim_free(slang->sl_comprules);
     3745                slang->sl_comprules = NULL;
     3746                crp = NULL;
     3747            }
     3748            else
     3749                *crp++ = c;
     3750        }
     3751
    35903752        if (c == '/')       /* slash separates two items */
    35913753        {
    35923754            *pp++ = '\\';
     
    36113773    *pp++ = '$';
    36123774    *pp = NUL;
    36133775
     3776    if (crp != NULL)
     3777        *crp = NUL;
     3778
    36143779    slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
    36153780    vim_free(pat);
    36163781    if (slang->sl_compprog == NULL)
     
    49155080} spellinfo_T;
    49165081
    49175082static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
     5083static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int  mincount));
    49185084static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
    49195085static int spell_info_item __ARGS((char_u *s));
    49205086static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
     
    49505116static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd));
    49515117static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname));
    49525118static void clear_node __ARGS((wordnode_T *node));
    4953 static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree));
     5119static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree));
    49545120static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname));
    49555121static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang));
    49565122static int sug_maketable __ARGS((spellinfo_T *spin));
     
    52235389        /* Handle non-empty lines. */
    52245390        if (itemcnt > 0)
    52255391        {
    5226             if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
    5227                                                        && aff->af_enc == NULL)
     5392            if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
    52285393            {
    52295394#ifdef FEAT_MBYTE
    52305395                /* Setup for conversion from "ENC" to 'encoding'. */
     
    52395404                    smsg((char_u *)_("Conversion in %s not supported"), fname);
    52405405#endif
    52415406            }
    5242             else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
     5407            else if (is_aff_rule(items, itemcnt, "FLAG", 2)
    52435408                                              && aff->af_flagtype == AFT_CHAR)
    52445409            {
    52455410                if (STRCMP(items[1], "long") == 0)
     
    52845449                        spin->si_info = p;
    52855450                    }
    52865451            }
    5287             else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
     5452            else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
    52885453                                                           && midword == NULL)
    52895454            {
    52905455                midword = getroom_save(spin, items[1]);
    52915456            }
    5292             else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
     5457            else if (is_aff_rule(items, itemcnt, "TRY", 2))
    52935458            {
    52945459                /* ignored, we look in the tree for what chars may appear */
    52955460            }
    52965461            /* TODO: remove "RAR" later */
    5297             else if ((STRCMP(items[0], "RAR") == 0
    5298                         || STRCMP(items[0], "RARE") == 0) && itemcnt == 2
    5299                                                       && aff->af_rare == 0)
     5462            else if ((is_aff_rule(items, itemcnt, "RAR", 2)
     5463                        || is_aff_rule(items, itemcnt, "RARE", 2))
     5464                                                        && aff->af_rare == 0)
    53005465            {
    53015466                aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
    53025467                                                                 fname, lnum);
    53035468            }
    53045469            /* TODO: remove "KEP" later */
    5305             else if ((STRCMP(items[0], "KEP") == 0
    5306                     || STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
     5470            else if ((is_aff_rule(items, itemcnt, "KEP", 2)
     5471                        || is_aff_rule(items, itemcnt, "KEEPCASE", 2))
    53075472                                                     && aff->af_keepcase == 0)
    53085473            {
    53095474                aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
    53105475                                                                 fname, lnum);
    53115476            }
    5312             else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
    5313                                                        && aff->af_bad == 0)
     5477            else if ((is_aff_rule(items, itemcnt, "BAD", 2)
     5478                        || is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
     5479                                                          && aff->af_bad == 0)
    53145480            {
    53155481                aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
    53165482                                                                 fname, lnum);
    53175483            }
    5318             else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
     5484            else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
    53195485                                                    && aff->af_needaffix == 0)
    53205486            {
    53215487                aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
    53225488                                                                 fname, lnum);
    53235489            }
    5324             else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
     5490            else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
    53255491                                                    && aff->af_circumfix == 0)
    53265492            {
    53275493                aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
    53285494                                                                 fname, lnum);
    53295495            }
    5330             else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
     5496            else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
    53315497                                                    && aff->af_nosuggest == 0)
    53325498            {
    53335499                aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
    53345500                                                                 fname, lnum);
    53355501            }
    5336             else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
     5502            else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
     5503                        || is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
    53375504                                                     && aff->af_needcomp == 0)
    53385505            {
    53395506                aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
    53405507                                                                 fname, lnum);
    53415508            }
    5342             else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
     5509            else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
    53435510                                                     && aff->af_comproot == 0)
    53445511            {
    53455512                aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
    53465513                                                                 fname, lnum);
    53475514            }
    5348             else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
    5349                                    && itemcnt == 2 && aff->af_compforbid == 0)
     5515            else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
     5516                                                  && aff->af_compforbid == 0)
    53505517            {
    53515518                aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
    53525519                                                                 fname, lnum);
     
    53545521                    smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
    53555522                            fname, lnum);
    53565523            }
    5357             else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
    5358                                    && itemcnt == 2 && aff->af_comppermit == 0)
     5524            else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
     5525                                                  && aff->af_comppermit == 0)
    53595526            {
    53605527                aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
    53615528                                                                 fname, lnum);
     
    53635530                    smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
    53645531                            fname, lnum);
    53655532            }
    5366             else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
     5533            else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
    53675534                                                         && compflags == NULL)
    53685535            {
    53695536                /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
     
    53765543                    compflags = p;
    53775544                }
    53785545            }
    5379             else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
     5546            else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
     5547            {
     5548                /* We don't use the count, but do check that it's a number and
     5549                 * not COMPOUNDRULE mistyped. */
     5550                if (atoi((char *)items[1]) == 0)
     5551                    smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
     5552                                                       fname, lnum, items[1]);
     5553            }
     5554            else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
    53805555            {
    53815556                /* Concatenate this string to previously defined ones, using a
    53825557                 * slash to separate them. */
     
    53955570                    compflags = p;
    53965571                }
    53975572            }
    5398             else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
     5573            else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
    53995574                                                              && compmax == 0)
    54005575            {
    54015576                compmax = atoi((char *)items[1]);
     
    54035578                    smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
    54045579                                                       fname, lnum, items[1]);
    54055580            }
    5406             else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
     5581            else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
    54075582                                                           && compminlen == 0)
    54085583            {
    54095584                compminlen = atoi((char *)items[1]);
     
    54115586                    smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
    54125587                                                       fname, lnum, items[1]);
    54135588            }
    5414             else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
     5589            else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
    54155590                                                           && compsylmax == 0)
    54165591            {
    54175592                compsylmax = atoi((char *)items[1]);
     
    54195594                    smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
    54205595                                                       fname, lnum, items[1]);
    54215596            }
    5422             else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
     5597            else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
    54235598            {
    54245599                compoptions |= COMP_CHECKDUP;
    54255600            }
    5426             else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
     5601            else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
    54275602            {
    54285603                compoptions |= COMP_CHECKREP;
    54295604            }
    5430             else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
     5605            else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
    54315606            {
    54325607                compoptions |= COMP_CHECKCASE;
    54335608            }
    5434             else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
    5435                                                               && itemcnt == 1)
     5609            else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
    54365610            {
    54375611                compoptions |= COMP_CHECKTRIPLE;
    54385612            }
    5439             else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
    5440                                                               && itemcnt == 2)
     5613            else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
    54415614            {
    54425615                if (atoi((char *)items[1]) == 0)
    54435616                    smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
    54445617                                                       fname, lnum, items[1]);
    54455618            }
    5446             else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
    5447                                                               && itemcnt == 3)
     5619            else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
    54485620            {
    54495621                garray_T    *gap = &spin->si_comppat;
    54505622                int         i;
     
    54635635                                               = getroom_save(spin, items[2]);
    54645636                }
    54655637            }
    5466             else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
     5638            else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
    54675639                                                          && syllable == NULL)
    54685640            {
    54695641                syllable = getroom_save(spin, items[1]);
    54705642            }
    5471             else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
     5643            else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
    54725644            {
    54735645                spin->si_nobreak = TRUE;
    54745646            }
    5475             else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
     5647            else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
    54765648            {
    54775649                spin->si_nosplitsugs = TRUE;
    54785650            }
    5479             else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
     5651            else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
    54805652            {
    54815653                spin->si_nosugfile = TRUE;
    54825654            }
    5483             else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
     5655            else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
    54845656            {
    54855657                aff->af_pfxpostpone = TRUE;
    54865658            }
     
    57715943                    }
    57725944                }
    57735945            }
    5774             else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
    5775                                                                && fol == NULL)
     5946            else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
    57765947            {
    57775948                fol = vim_strsave(items[1]);
    57785949            }
    5779             else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
    5780                                                                && low == NULL)
     5950            else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
    57815951            {
    57825952                low = vim_strsave(items[1]);
    57835953            }
    5784             else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
    5785                                                                && upp == NULL)
     5954            else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
    57865955            {
    57875956                upp = vim_strsave(items[1]);
    57885957            }
    5789             else if ((STRCMP(items[0], "REP") == 0
    5790                         || STRCMP(items[0], "REPSAL") == 0)
    5791                     && itemcnt == 2)
     5958            else if (is_aff_rule(items, itemcnt, "REP", 2)
     5959                     || is_aff_rule(items, itemcnt, "REPSAL", 2))
    57925960            {
    57935961                /* Ignore REP/REPSAL count */;
    57945962                if (!isdigit(*items[1]))
     
    58195987                                         : &spin->si_rep, items[1], items[2]);
    58205988                }
    58215989            }
    5822             else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
     5990            else if (is_aff_rule(items, itemcnt, "MAP", 2))
    58235991            {
    58245992                /* MAP item or count */
    58255993                if (!found_map)
     
    58566024                    ga_append(&spin->si_map, '/');
    58576025                }
    58586026            }
    5859             /* Accept "SAL from to" and "SAL from to # comment". */
    5860             else if (STRCMP(items[0], "SAL") == 0
    5861                     && (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
     6027            /* Accept "SAL from to" and "SAL from to  #comment". */
     6028            else if (is_aff_rule(items, itemcnt, "SAL", 3))
    58626029            {
    58636030                if (do_sal)
    58646031                {
     
    58776044                                                                : items[2]);
    58786045                }
    58796046            }
    5880             else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
     6047            else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
    58816048                                                          && sofofrom == NULL)
    58826049            {
    58836050                sofofrom = getroom_save(spin, items[1]);
    58846051            }
    5885             else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
     6052            else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
    58866053                                                            && sofoto == NULL)
    58876054            {
    58886055                sofoto = getroom_save(spin, items[1]);
     
    59806147        else if (spin->si_newprefID == 0 || spin->si_newprefID == 127)
    59816148            MSG(_("Too many compound flags"));
    59826149        else
    5983             MSG(_("Too many posponed prefixes and/or compound flags"));
     6150            MSG(_("Too many postponed prefixes and/or compound flags"));
    59846151    }
    59856152
    59866153    if (syllable != NULL)
     
    60176184}
    60186185
    60196186/*
     6187 * Return TRUE when items[0] equals "rulename", there are "mincount" items or
     6188 * a comment is following after item "mincount".
     6189 */
     6190    static int
     6191is_aff_rule(items, itemcnt, rulename, mincount)
     6192    char_u      **items;
     6193    int         itemcnt;
     6194    char        *rulename;
     6195    int         mincount;
     6196{
     6197    return (STRCMP(items[0], rulename) == 0
     6198            && (itemcnt == mincount
     6199                || (itemcnt > mincount && items[mincount][0] == '#')));
     6200}
     6201
     6202/*
    60206203 * For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
    60216204 * ae_flags to ae_comppermit and ae_compforbid.
    60226205 */
     
    79268109    char_u      *p;
    79278110    int         rr;
    79288111    int         retval = OK;
     8112    size_t      fwv = 1;  /* collect return value of fwrite() to avoid
     8113                             warnings from picky compiler */
    79298114
    79308115    fd = mch_fopen((char *)fname, "w");
    79318116    if (fd == NULL)
     
    79368121
    79378122    /* <HEADER>: <fileID> <versionnr> */
    79388123                                                            /* <fileID> */
    7939     if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
    7940     {
    7941         EMSG(_(e_write));
    7942         retval = FAIL;
    7943     }
     8124    fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
     8125    if (fwv != (size_t)1)
     8126        /* Catch first write error, don't try writing more. */
     8127        goto theend;
     8128
    79448129    putc(VIMSPELLVERSION, fd);                              /* <versionnr> */
    79458130
    79468131    /*
     
    79558140
    79568141        i = (int)STRLEN(spin->si_info);
    79578142        put_bytes(fd, (long_u)i, 4);                    /* <sectionlen> */
    7958         fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
     8143        fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
    79598144    }
    79608145
    79618146    /* SN_REGION: <regionname> ...
     
    79668151        putc(SNF_REQUIRED, fd);                         /* <sectionflags> */
    79678152        l = spin->si_region_count * 2;
    79688153        put_bytes(fd, (long_u)l, 4);                    /* <sectionlen> */
    7969         fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
     8154        fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
    79708155                                                        /* <regionname> ... */
    79718156        regionmask = (1 << spin->si_region_count) - 1;
    79728157    }
     
    80168201        }
    80178202
    80188203        put_bytes(fd, (long_u)l, 2);                    /* <folcharslen> */
    8019         fwrite(folchars, (size_t)l, (size_t)1, fd);     /* <folchars> */
     8204        fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
    80208205    }
    80218206
    80228207    /* SN_MIDWORD: <midword> */
     
    80278212
    80288213        i = (int)STRLEN(spin->si_midword);
    80298214        put_bytes(fd, (long_u)i, 4);                    /* <sectionlen> */
    8030         fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
     8215        fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
     8216                                                        /* <midword> */
    80318217    }
    80328218
    80338219    /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
     
    81138299                p = rr == 1 ? ftp->ft_from : ftp->ft_to;
    81148300                l = (int)STRLEN(p);
    81158301                putc(l, fd);
    8116                 fwrite(p, l, (size_t)1, fd);
     8302                if (l > 0)
     8303                    fwv &= fwrite(p, l, (size_t)1, fd);
    81178304            }
    81188305        }
    81198306
     
    81318318                                                        /* <sectionlen> */
    81328319
    81338320        put_bytes(fd, (long_u)l, 2);                    /* <sofofromlen> */
    8134         fwrite(spin->si_sofofr, l, (size_t)1, fd);      /* <sofofrom> */
     8321        fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
    81358322
    81368323        l = (int)STRLEN(spin->si_sofoto);
    81378324        put_bytes(fd, (long_u)l, 2);                    /* <sofotolen> */
    8138         fwrite(spin->si_sofoto, l, (size_t)1, fd);      /* <sofoto> */
     8325        fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
    81398326    }
    81408327
    81418328    /* SN_WORDS: <word> ...
     
    81608347                    l = (int)STRLEN(hi->hi_key) + 1;
    81618348                    len += l;
    81628349                    if (round == 2)                     /* <word> */
    8163                         fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
     8350                        fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
    81648351                    --todo;
    81658352                }
    81668353            if (round == 1)
     
    81768363        putc(0, fd);                                    /* <sectionflags> */
    81778364        l = spin->si_map.ga_len;
    81788365        put_bytes(fd, (long_u)l, 4);                    /* <sectionlen> */
    8179         fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
     8366        fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
    81808367                                                        /* <mapstr> */
    81818368    }
    81828369
     
    82328419        {
    82338420            p = ((char_u **)(spin->si_comppat.ga_data))[i];
    82348421            putc((int)STRLEN(p), fd);                   /* <comppatlen> */
    8235             fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
     8422            fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
     8423                                                        /* <comppattext> */
    82368424        }
    82378425                                                        /* <compflags> */
    8238         fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
     8426        fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
    82398427                                                               (size_t)1, fd);
    82408428    }
    82418429
     
    82598447
    82608448        l = (int)STRLEN(spin->si_syllable);
    82618449        put_bytes(fd, (long_u)l, 4);                    /* <sectionlen> */
    8262         fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
     8450        fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
     8451                                                        /* <syllable> */
    82638452    }
    82648453
    82658454    /* end of <SECTIONS> */
     
    82958484        (void)put_node(fd, tree, 0, regionmask, round == 3);
    82968485    }
    82978486
    8298     /* Write another byte to check for errors. */
     8487    /* Write another byte to check for errors (file system full). */
    82998488    if (putc(0, fd) == EOF)
    83008489        retval = FAIL;
    8301 
     8490theend:
    83028491    if (fclose(fd) == EOF)
    83038492        retval = FAIL;
    83048493
     8494    if (fwv != (size_t)1)
     8495        retval = FAIL;
     8496    if (retval == FAIL)
     8497        EMSG(_(e_write));
     8498
    83058499    return retval;
    83068500}
    83078501
     
    989010084    char_u      *p;
    989110085    int         len;
    989210086    int         totlen;
     10087    size_t      x = 1;  /* collect return value of fwrite() */
    989310088
    989410089    if (fd != NULL)
    989510090        put_bytes(fd, (long_u)gap->ga_len, 2);      /* <prefcondcnt> */
     
    990610101            if (fd != NULL)
    990710102            {
    990810103                fputc(len, fd);
    9909                 fwrite(p, (size_t)len, (size_t)1, fd);
     10104                x &= fwrite(p, (size_t)len, (size_t)1, fd);
    991010105            }
    991110106            totlen += len;
    991210107        }
     
    1148011675                    vim_strncpy(preword + sp->ts_prewordlen,
    1148111676                            tword + sp->ts_splitoff,
    1148211677                            sp->ts_twordlen - sp->ts_splitoff);
    11483                     p = preword;
    11484                     while (*skiptowhite(p) != NUL)
    11485                         p = skipwhite(skiptowhite(p));
    11486                     if (fword_ends && !can_compound(slang, p,
    11487                                                 compflags + sp->ts_compsplit))
    11488                         /* Compound is not allowed.  But it may still be
    11489                          * possible if we add another (short) word. */
     11678
     11679                    /* Verify CHECKCOMPOUNDPATTERN  rules. */
     11680                    if (match_checkcompoundpattern(preword,  sp->ts_prewordlen,
     11681                                                          &slang->sl_comppat))
    1149011682                        compound_ok = FALSE;
    1149111683
     11684                    if (compound_ok)
     11685                    {
     11686                        p = preword;
     11687                        while (*skiptowhite(p) != NUL)
     11688                            p = skipwhite(skiptowhite(p));
     11689                        if (fword_ends && !can_compound(slang, p,
     11690                                                compflags + sp->ts_compsplit))
     11691                            /* Compound is not allowed.  But it may still be
     11692                             * possible if we add another (short) word. */
     11693                            compound_ok = FALSE;
     11694                    }
     11695
    1149211696                    /* Get pointer to last char of previous word. */
    1149311697                    p = preword + sp->ts_prewordlen;
    1149411698                    mb_ptr_back(preword, p);
     
    1168511889                        && (slang->sl_compsylmax < MAXWLEN
    1168611890                            || sp->ts_complen + 1 - sp->ts_compsplit
    1168711891                                                          < slang->sl_compmax)
    11688                         && (byte_in_str(sp->ts_complen == sp->ts_compsplit
    11689                                             ? slang->sl_compstartflags
    11690                                             : slang->sl_compallflags,
    11691                                                     ((unsigned)flags >> 24))))
     11892                        && (can_be_compound(sp, slang,
     11893                                         compflags, ((unsigned)flags >> 24))))
     11894
    1169211895                {
    1169311896                    try_compound = TRUE;
    1169411897                    compflags[sp->ts_complen] = ((unsigned)flags >> 24);
  • src/structs.h

    diff -Naur vim72.orig/src/structs.h vim72/src/structs.h
    old new  
    459459typedef struct
    460460{
    461461    int         hide;                   /* TRUE when ":hide" was used */
    462 # ifdef FEAT_BROWSE
     462# ifdef FEAT_BROWSE_CMD
    463463    int         browse;                 /* TRUE to invoke file dialog */
    464464# endif
    465465# ifdef FEAT_WINDOWS
     
    17841784#endif
    17851785
    17861786    /*
    1787      * The next three specify the offsets for displaying the buffer:
     1787     * "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
     1788     * displaying the buffer.
    17881789     */
    17891790    linenr_T    w_topline;          /* buffer line number of the line at the
    17901791                                       top of the window */
     1792#ifdef FEAT_AUTOCMD
     1793    char        w_topline_was_set;  /* flag set to TRUE when topline is set,
     1794                                       e.g. by winrestview() */
     1795#endif
    17911796#ifdef FEAT_DIFF
    17921797    int         w_topfill;          /* number of filler lines above w_topline */
    17931798    int         w_old_topfill;      /* w_topfill at last redraw */
  • src/tag.c

    diff -Naur vim72.orig/src/tag.c vim72/src/tag.c
    old new  
    515515             * If a count is supplied to the ":tag <name>" command, then
    516516             * jump to count'th matching tag.
    517517             */
    518             if (type == DT_TAG && count > 0)
     518            if (type == DT_TAG && *tag != NUL && count > 0)
    519519                cur_match = count - 1;
    520520
    521521            if (type == DT_SELECT || type == DT_JUMP
     
    27252725         */
    27262726        p_7f = vim_strchr(lbuf, 0x7f);
    27272727        if (p_7f == NULL)
     2728        {
     2729etag_fail:
     2730            if (vim_strchr(lbuf, '\n') == NULL)
     2731            {
     2732                /* Truncated line.  Ignore it. */
     2733                if (p_verbose >= 5)
     2734                {
     2735                    verbose_enter();
     2736                    MSG(_("Ignoring long line in tags file"));
     2737                    verbose_leave();
     2738                }
     2739                tagp->command = lbuf;
     2740                tagp->tagname = lbuf;
     2741                tagp->tagname_end = lbuf;
     2742                return OK;
     2743            }
    27282744            return FAIL;
     2745        }
    27292746
    27302747        /* Find ^A.  If not found the line number is after the 0x7f */
    27312748        p = vim_strchr(p_7f, Ctrl_A);
     
    27352752            ++p;
    27362753
    27372754        if (!VIM_ISDIGIT(*p))       /* check for start of line number */
    2738             return FAIL;
     2755            goto etag_fail;
    27392756        tagp->command = p;
    27402757
    27412758
     
    27492766            /* find end of tagname */
    27502767            for (p = p_7f - 1; !vim_iswordc(*p); --p)
    27512768                if (p == lbuf)
    2752                     return FAIL;
     2769                    goto etag_fail;
    27532770            tagp->tagname_end = p + 1;
    27542771            while (p >= lbuf && vim_iswordc(*p))
    27552772                --p;
  • src/testdir/Make_ming.mak

    diff -Naur vim72.orig/src/testdir/Make_ming.mak vim72/src/testdir/Make_ming.mak
    old new  
     1# Makefile to run tests for Vim, on Dos-like machines
     2# with sh.exe or zsh.exe in the path or not.
     3#
     4# Author: Bill McCarthy
     5#
     6# Note that test54 has been removed until it is fixed.
     7#
     8# Requires a set of Unix tools: echo, diff, etc.
     9
     10ifneq (sh.exe, $(SHELL))
     11DEL = rm -f
     12MV = mv
     13CP = cp
     14DIRSLASH = /
     15else
     16DEL = del
     17MV = rename
     18CP = copy
     19DIRSLASH = \\
     20endif
     21
     22VIMPROG = ..$(DIRSLASH)vim
     23
     24# Omitted:
     25# test2         "\\tmp" doesn't work.
     26# test10        'errorformat' is different
     27# test12        can't unlink a swap file
     28# test25        uses symbolic link
     29# test27        can't edit file with "*" in file name
     30# test31        16 bit version runs out of memory...
     31
     32SCRIPTS16 =     test1.out test19.out test20.out test22.out \
     33                test23.out test24.out test28.out test29.out \
     34                test35.out test36.out test43.out \
     35                test44.out test45.out test46.out test47.out \
     36                test48.out test51.out test53.out            \
     37                test55.out test56.out test57.out test58.out test59.out \
     38                test60.out test61.out test62.out test63.out test64.out
     39
     40# Had to remove test54 which doesn't work yet.
     41#                                                test54.out
     42
     43SCRIPTS =       test3.out test4.out test5.out test6.out test7.out \
     44                test8.out test9.out test11.out test13.out test14.out \
     45                test15.out test17.out test18.out test21.out test26.out \
     46                test30.out test31.out test32.out test33.out test34.out \
     47                test37.out test38.out test39.out test40.out test41.out \
     48                test42.out test52.out test65.out
     49
     50SCRIPTS32 =     test50.out
     51
     52SCRIPTS_GUI = test16.out
     53
     54.SUFFIXES: .in .out
     55
     56vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
     57        echo ALL DONE
     58
     59nongui: fixff $(SCRIPTS16) $(SCRIPTS)
     60        echo ALL DONE
     61
     62small:
     63        echo ALL DONE
     64
     65gui:    fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
     66        echo ALL DONE
     67
     68win32:  fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
     69        echo ALL DONE
     70
     71fixff:
     72        -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
     73
     74clean:
     75        -$(DEL) *.out
     76        -$(DEL) test.ok
     77        -$(DEL) small.vim
     78        -$(DEL) tiny.vim
     79        -$(DEL) mbyte.vim
     80        -$(DEL) X*
     81        -$(DEL) viminfo
     82
     83.in.out:
     84        $(CP) $*.ok test.ok
     85        $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
     86        diff test.out $*.ok
     87        -$(DEL) $*.out
     88        $(MV) test.out $*.out
     89        -$(DEL) X*
     90        -$(DEL) test.ok
     91        -$(DEL) viminfo
  • src/testdir/Makefile

    diff -Naur vim72.orig/src/testdir/Makefile vim72/src/testdir/Makefile
    old new  
    2626
    2727.SUFFIXES: .in .out
    2828
    29 nongui: nolog $(SCRIPTS)
    30         @echo
    31         @cat test.log
    32         @echo ALL DONE
     29nongui: nolog $(SCRIPTS) report
     30
     31gui:    nolog $(SCRIPTS) $(SCRIPTS_GUI) report
    3332
    34 gui:    nolog $(SCRIPTS) $(SCRIPTS_GUI)
     33report:
    3534        @echo
    36         @cat test.log
    37         @echo ALL DONE
     35        @echo 'Test results:'
     36        @/bin/sh -c "if test -f test.log; \
     37                then cat test.log; echo TEST FAILURE; exit 1; \
     38                else echo ALL DONE; \
     39                fi"
    3840
    3941$(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
    4042
     
    7173test60.out: test60.vim
    7274
    7375nolog:
    74         -echo Test results: >test.log
     76        -rm -f test.log
  • src/testdir/test42.ok

    diff -Naur vim72.orig/src/testdir/test42.ok vim72/src/testdir/test42.ok
    old new  
    2020ucs-2
    2121
    2222
    23   fileencoding=ucs-2le
     23  fileencoding=utf-16le
    2424  bomb
    2525ucs-2le
    2626
  • src/ui.c

    diff -Naur vim72.orig/src/ui.c vim72/src/ui.c
    old new  
    18201820#ifdef HAVE_DUP
    18211821            /* Use stderr for stdin, also works for shell commands. */
    18221822            close(0);
    1823             dup(2);
     1823            ignored = dup(2);
    18241824#else
    18251825            read_cmd_fd = 2;    /* read from stderr instead of stdin */
    18261826#endif
     
    20202020
    20212021    if (value == NULL || *length == 0)
    20222022    {
    2023         clip_free_selection(cbd);       /* ???  [what's the query?] */
     2023        clip_free_selection(cbd);       /* nothing received, clear register */
    20242024        *(int *)success = FALSE;
    20252025        return;
    20262026    }
     
    20762076        text_prop.value = (unsigned char *)value;
    20772077        text_prop.encoding = *type;
    20782078        text_prop.format = *format;
    2079         text_prop.nitems = STRLEN(value);
     2079        text_prop.nitems = len;
    20802080        status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
    20812081                                                         &text_list, &n_text);
    20822082        if (status != Success || n_text < 1)
     
    21102110    int         i;
    21112111    int         nbytes = 0;
    21122112    char_u      *buffer;
     2113    time_t      start_time;
     2114    int         timed_out = FALSE;
    21132115
    21142116    for (i =
    21152117#ifdef FEAT_MBYTE
     
    21292131            case 3:  type = text_atom;          break;
    21302132            default: type = XA_STRING;
    21312133        }
     2134        success = MAYBE;
    21322135        XtGetSelectionValue(myShell, cbd->sel_atom, type,
    21332136            clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
    21342137
     
    21412144         * characters, then they will appear before the one that requested the
    21422145         * paste!  Don't worry, we will catch up with any other events later.
    21432146         */
    2144         for (;;)
     2147        start_time = time(NULL);
     2148        while (success == MAYBE)
    21452149        {
    2146             if (XCheckTypedEvent(dpy, SelectionNotify, &event))
    2147                 break;
    2148             if (XCheckTypedEvent(dpy, SelectionRequest, &event))
    2149                 /* We may get a SelectionRequest here and if we don't handle
    2150                  * it we hang.  KDE klipper does this, for example. */
     2150            if (XCheckTypedEvent(dpy, SelectionNotify, &event)
     2151                    || XCheckTypedEvent(dpy, SelectionRequest, &event)
     2152                    || XCheckTypedEvent(dpy, PropertyNotify, &event))
     2153            {
     2154                /* This is where clip_x11_request_selection_cb() should be
     2155                 * called.  It may actually happen a bit later, so we loop
     2156                 * until "success" changes.
     2157                 * We may get a SelectionRequest here and if we don't handle
     2158                 * it we hang.  KDE klipper does this, for example.
     2159                 * We need to handle a PropertyNotify for large selections. */
    21512160                XtDispatchEvent(&event);
     2161                continue;
     2162            }
     2163
     2164            /* Time out after 2 to 3 seconds to avoid that we hang when the
     2165             * other process doesn't respond.  Note that the SelectionNotify
     2166             * event may still come later when the selection owner comes back
     2167             * to life and the text gets inserted unexpectedly.  Don't know
     2168             * why that happens or how to avoid that :-(. */
     2169            if (time(NULL) > start_time + 2)
     2170            {
     2171                timed_out = TRUE;
     2172                break;
     2173            }
    21522174
    21532175            /* Do we need this?  Probably not. */
    21542176            XSync(dpy, False);
    21552177
    2156             /* Bernhard Walle solved a slow paste response in an X terminal by
    2157              * adding: usleep(10000); here. */
     2178            /* Wait for 1 msec to avoid that we eat up all CPU time. */
     2179            ui_delay(1L, TRUE);
    21582180        }
    21592181
    2160         /* this is where clip_x11_request_selection_cb() is actually called */
    2161         XtDispatchEvent(&event);
    2162 
    2163         if (success)
     2182        if (success == TRUE)
    21642183            return;
     2184
     2185        /* don't do a retry with another type after timing out, otherwise we
     2186         * hang for 15 seconds. */
     2187        if (timed_out)
     2188            break;
    21652189    }
    21662190
    21672191    /* Final fallback position - use the X CUT_BUFFER0 store */
  • src/version.c

    diff -Naur vim72.orig/src/version.c vim72/src/version.c
    old new  
    677677static int included_patches[] =
    678678{   /* Add new patch number below this line */
    679679/**/
     680    84,
     681/**/
     682    83,
     683/**/
     684    82,
     685/**/
     686    81,
     687/**/
     688    80,
     689/**/
     690    79,
     691/**/
     692    78,
     693/**/
     694    77,
     695/**/
     696    76,
     697/**/
     698    75,
     699/**/
     700    73,
     701/**/
     702    70,
     703/**/
     704    69,
     705/**/
     706    68,
     707/**/
     708    67,
     709/**/
     710    66,
     711/**/
     712    65,
     713/**/
     714    64,
     715/**/
     716    63,
     717/**/
     718    62,
     719/**/
     720    61,
     721/**/
     722    60,
     723/**/
     724    59,
     725/**/
     726    58,
     727/**/
     728    57,
     729/**/
     730    56,
     731/**/
     732    55,
     733/**/
     734    54,
     735/**/
     736    53,
     737/**/
     738    52,
     739/**/
     740    51,
     741/**/
     742    50,
     743/**/
     744    48,
     745/**/
     746    47,
     747/**/
     748    46,
     749/**/
     750    45,
     751/**/
     752    44,
     753/**/
     754    43,
     755/**/
     756    42,
     757/**/
     758    40,
     759/**/
     760    39,
     761/**/
     762    38,
     763/**/
     764    37,
     765/**/
     766    35,
     767/**/
     768    34,
     769/**/
     770    33,
     771/**/
     772    32,
     773/**/
     774    31,
     775/**/
     776    30,
     777/**/
     778    29,
     779/**/
     780    28,
     781/**/
     782    27,
     783/**/
     784    26,
     785/**/
     786    25,
     787/**/
     788    24,
     789/**/
     790    23,
     791/**/
     792    22,
     793/**/
     794    21,
     795/**/
     796    20,
     797/**/
     798    19,
     799/**/
     800    18,
     801/**/
     802    17,
     803/**/
     804    16,
     805/**/
     806    15,
     807/**/
     808    14,
     809/**/
     810    13,
     811/**/
     812    12,
     813/**/
     814    11,
     815/**/
     816    10,
     817/**/
     818    9,
     819/**/
     820    8,
     821/**/
     822    6,
     823/**/
     824    5,
     825/**/
     826    4,
     827/**/
     828    3,
     829/**/
     830    2,
     831/**/
     832    1,
     833/**/
    680834    0
    681835};
    682836
     837/*
     838 * Place to put a short description when adding a feature with a patch.
     839 * Keep it short, e.g.,: "relative numbers", "persistent undo".
     840 * Also add a comment marker to separate the lines.
     841 * See the official Vim patches for the diff format: It must use a context of
     842 * one line only.  Create it by hand or use "diff -C2" and edit the patch.
     843 */
     844static char *(extra_patches[]) =
     845{   /* Add your patch description below this line */
     846/**/
     847    NULL
     848};
     849
    683850    int
    684851highest_patch()
    685852{
     
    786953    MSG_PUTS(_("\nRISC OS version"));
    787954#endif
    788955#ifdef VMS
    789     MSG_PUTS("\nOpenVMS version");
     956    MSG_PUTS(_("\nOpenVMS version"));
    790957# ifdef HAVE_PATHDEF
    791958    if (*compiled_arch != NUL)
    792959    {
     
    825992        }
    826993    }
    827994
     995    /* Print the list of extra patch descriptions if there is at least one. */
     996    if (extra_patches[0] != NULL)
     997    {
     998        MSG_PUTS(_("\nExtra patches: "));
     999        s = "";
     1000        for (i = 0; extra_patches[i] != NULL; ++i)
     1001        {
     1002            MSG_PUTS(s);
     1003            s = ", ";
     1004            MSG_PUTS(extra_patches[i]);
     1005        }
     1006    }
     1007
    8281008#ifdef MODIFIED_BY
    8291009    MSG_PUTS("\n");
    8301010    MSG_PUTS(_("Modified by "));
  • src/vim.h

    diff -Naur vim72.orig/src/vim.h vim72/src/vim.h
    old new  
    341341#ifdef BACKSLASH_IN_FILENAME
    342342# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<")
    343343#else
    344 # define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
    345 # define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
     344# ifdef VMS
     345    /* VMS allows a lot of characters in the file name */
     346#  define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!")
     347#  define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&")
     348# else
     349#  define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
     350#  define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
     351# endif
    346352#endif
    347353
    348354#define NUMBUFLEN 30        /* length of a buffer to store a number in ASCII */
     
    370376   * Define __w64 as an empty token for everything but MSVC 7.x or later.
    371377   */
    372378# if !defined(_MSC_VER) || (_MSC_VER < 1300)
    373 #  define __w64 
     379#  define __w64
    374380# endif
    375381typedef unsigned long __w64     long_u;
    376382typedef          long __w64     long_i;
     
    17281734#define VV_MOUSE_COL    51
    17291735#define VV_OP           52
    17301736#define VV_SEARCHFORWARD 53
    1731 #define VV_LEN          54      /* number of v: vars */
     1737#define VV_OLDFILES     54
     1738#define VV_LEN          55      /* number of v: vars */
    17321739
    17331740#ifdef FEAT_CLIPBOARD
    17341741
     
    19791986# endif
    19801987#endif
    19811988
     1989#ifndef FEAT_NETBEANS_INTG
     1990# undef NBDEBUG
     1991#endif
    19821992#ifdef NBDEBUG /* Netbeans debugging. */
    19831993# include "nbdebug.h"
    19841994#else
     
    20542064#define DOSO_VIMRC      1       /* loading vimrc file */
    20552065#define DOSO_GVIMRC     2       /* loading gvimrc file */
    20562066
     2067/* flags for read_viminfo() and children */
     2068#define VIF_WANT_INFO           1       /* load non-mark info */
     2069#define VIF_WANT_MARKS          2       /* load file marks */
     2070#define VIF_FORCEIT             4       /* overwrite info already read */
     2071#define VIF_GET_OLDFILES        8       /* load v:oldfiles */
     2072
    20572073#endif /* VIM__H */
  • src/window.c

    diff -Naur vim72.orig/src/window.c vim72/src/window.c
    old new  
    40284028            if (mch_dirname(cwd, MAXPATHL) == OK)
    40294029                globaldir = vim_strsave(cwd);
    40304030        }
    4031         mch_chdir((char *)curwin->w_localdir);
    4032         shorten_fnames(TRUE);
     4031        if (mch_chdir((char *)curwin->w_localdir) == 0)
     4032            shorten_fnames(TRUE);
    40334033    }
    40344034    else if (globaldir != NULL)
    40354035    {
    40364036        /* Window doesn't have a local directory and we are not in the global
    40374037         * directory: Change to the global directory. */
    4038         mch_chdir((char *)globaldir);
     4038        ignored = mch_chdir((char *)globaldir);
    40394039        vim_free(globaldir);
    40404040        globaldir = NULL;
    40414041        shorten_fnames(TRUE);
  • src/workshop.c

    diff -Naur vim72.orig/src/workshop.c vim72/src/workshop.c
    old new  
    11211121                                      ? (char *)curbuf->b_sfname : "<None>");
    11221122#endif
    11231123
    1124     strcpy(ffname, (char *) curbuf->b_ffname);
    1125     *filename = ffname;         /* copy so nobody can change b_ffname */
     1124    if (curbuf->b_ffname == NULL)
     1125        ffname[0] = NUL;
     1126    else
     1127        /* copy so nobody can change b_ffname */
     1128        strcpy(ffname, (char *) curbuf->b_ffname);
     1129    *filename = ffname;
    11261130    *curLine = curwin->w_cursor.lnum;
    11271131    *curCol = curwin->w_cursor.col;
    11281132
Note: See TracBrowser for help on using the repository browser.