From 8b20179c657b4266dff115486ca68c6a50324071 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 25 Mar 2016 15:01:10 +0100 Subject: [PATCH 1/9] patch 7.4.1647 Problem: Using freed memory after setqflist() and ":caddbuffer". (Dominique) Solution: Set qf_ptr when adding the first item to the quickfix list. --- src/quickfix.c | 5 ++++- src/testdir/test_quickfix.vim | 8 ++++++++ src/version.c | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/quickfix.c b/src/quickfix.c index a2506e1a32..c2ff55a8c0 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -1027,6 +1027,8 @@ qf_add_entry( /* first element in the list */ { qi->qf_lists[qi->qf_curlist].qf_start = qfp; + qi->qf_lists[qi->qf_curlist].qf_ptr = qfp; + qi->qf_lists[qi->qf_curlist].qf_index = 0; qfp->qf_prev = qfp; /* first element points to itself */ } else @@ -4113,7 +4115,8 @@ set_errorlist( else qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].qf_start; - qi->qf_lists[qi->qf_curlist].qf_index = 1; + if (qi->qf_lists[qi->qf_curlist].qf_count > 0) + qi->qf_lists[qi->qf_curlist].qf_index = 1; #ifdef FEAT_WINDOWS qf_update_buffer(qi); diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 667ece4e67..e56c8a2391 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -679,3 +679,11 @@ function Test_quickfix_was_changed_by_autocmd() call XquickfixChangedByAutocmd('c') call XquickfixChangedByAutocmd('l') endfunction + +func Test_caddbuffer_to_empty() + helpgr quickfix + call setqflist([], 'r') + cad + call assert_fails('cn', 'E553:') + quit! +endfunc diff --git a/src/version.c b/src/version.c index 4ab8eed71f..95e2cba565 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1647, /**/ 1646, /**/ From bee6c0cf86a75faa2aa893f2c9db82fd944a89a5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 25 Mar 2016 15:40:50 +0100 Subject: [PATCH 2/9] patch 7.4.1648 Problem: Compiler has a problem copying a string into di_key[]. (Yegappan Lakshmanan) Solution: Add dictitem16_T. --- src/eval.c | 5 ++--- src/structs.h | 9 +++++++++ src/version.c | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/eval.c b/src/eval.c index db6ef9d5d8..770879661c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -292,13 +292,12 @@ typedef struct #define VV_RO 2 /* read-only */ #define VV_RO_SBX 4 /* read-only in the sandbox */ -#define VV_NAME(s, t) s, {{t, 0, {0}}, 0, {0}}, {0} +#define VV_NAME(s, t) s, {{t, 0, {0}}, 0, {0}} static struct vimvar { char *vv_name; /* name of variable, without v: */ - dictitem_T vv_di; /* value and name for key */ - char vv_filler[16]; /* space for LONGEST name below!!! */ + dictitem16_T vv_di; /* value and name for key (max 16 chars!) */ char vv_flags; /* VV_COMPAT, VV_RO, VV_RO_SBX */ } vimvars[VV_LEN] = { diff --git a/src/structs.h b/src/structs.h index 97eae57be3..abfe6cd781 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1221,6 +1221,15 @@ struct dictitem_S }; typedef struct dictitem_S dictitem_T; +/* A dictitem with a 16 character key (plus NUL). */ +struct dictitem16_S +{ + typval_T di_tv; /* type and value of the variable */ + char_u di_flags; /* flags (only used for variable) */ + char_u di_key[17]; /* key */ +}; +typedef struct dictitem16_S dictitem16_T; + #define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */ #define DI_FLAGS_RO_SBX 2 /* "di_flags" value: read-only in the sandbox */ #define DI_FLAGS_FIX 4 /* "di_flags" value: fixed: no :unlet or remove() */ diff --git a/src/version.c b/src/version.c index 95e2cba565..c929eaff80 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1648, /**/ 1647, /**/ From aedfcbe1e6c7df6edcd6756d7601bfdec7dd2087 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 25 Mar 2016 17:02:51 +0100 Subject: [PATCH 3/9] patch 7.4.1649 Problem: The matchit plugin needs to be copied to be used. Solution: Put the matchit plugin in an optional package. --- Filelist | 5 +- runtime/doc/usr_05.txt | 80 ++++++++++++++----- runtime/doc/usr_toc.txt | 11 +-- runtime/macros/README.txt | 8 +- .../dist/opt/matchit/doc}/matchit.txt | 0 runtime/pack/dist/opt/matchit/doc/tags | 50 ++++++++++++ .../dist/opt/matchit/plugin}/matchit.vim | 0 runtime/vimrc_example.vim | 9 ++- src/Makefile | 20 ++++- src/version.c | 2 + 10 files changed, 149 insertions(+), 36 deletions(-) rename runtime/{macros => pack/dist/opt/matchit/doc}/matchit.txt (100%) create mode 100644 runtime/pack/dist/opt/matchit/doc/tags rename runtime/{macros => pack/dist/opt/matchit/plugin}/matchit.vim (100%) diff --git a/Filelist b/Filelist index d6cbce7196..42b8a7a468 100644 --- a/Filelist +++ b/Filelist @@ -494,8 +494,6 @@ RT_ALL = \ runtime/macros/less.vim \ runtime/macros/life/click.me \ runtime/macros/life/life.vim \ - runtime/macros/matchit.vim \ - runtime/macros/matchit.txt \ runtime/macros/maze/README.txt \ runtime/macros/maze/[mM]akefile \ runtime/macros/maze/main.aap \ @@ -525,6 +523,9 @@ RT_ALL = \ runtime/tutor/tutor \ runtime/tutor/tutor.vim \ runtime/vimrc_example.vim \ + runtime/pack/dist/opt/matchit/plugin/matchit.vim \ + runtime/pack/dist/opt/matchit/doc/matchit.txt \ + runtime/pack/dist/opt/matchit/doc/tags \ # runtime files for all distributions without CR-NL translation RT_ALL_BIN = \ diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index f71cf42cff..b36f91f50b 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -1,4 +1,4 @@ -*usr_05.txt* For Vim version 7.4. Last change: 2012 Nov 20 +*usr_05.txt* For Vim version 7.4. Last change: 2016 Mar 25 VIM USER MANUAL - by Bram Moolenaar @@ -12,10 +12,11 @@ Vim's capabilities. Or define your own macros. |05.1| The vimrc file |05.2| The example vimrc file explained |05.3| Simple mappings -|05.4| Adding a plugin -|05.5| Adding a help file -|05.6| The option window -|05.7| Often used options +|05.4| Adding a package +|05.5| Adding a plugin +|05.6| Adding a help file +|05.7| The option window +|05.8| Often used options Next chapter: |usr_06.txt| Using syntax highlighting Previous chapter: |usr_04.txt| Making small changes @@ -263,7 +264,46 @@ The ":map" command (with no arguments) lists your current mappings. At least the ones for Normal mode. More about mappings in section |40.1|. ============================================================================== -*05.4* Adding a plugin *add-plugin* *plugin* +*05.4* Adding a package *add-package* *matchit-install* + +A package is a set of files that you can add to Vim. There are two kinds of +packages: optional and automatically loaded on startup. + +The Vim distribution comes with a few packages that you can optionally use. +For example, the matchit plugin. This plugin makes the "%" command jump to +matching HTML tags, if/else/endif in Vim scripts, etc. Very useful, although +it's not backwards compatible (that's why it is not enabled by default). + +To start using the matchit plugin, add one line to your vimrc file: > + packadd matchit + +That's all! You can also type the command to try it out. Now you can find +help about this plugin: > + :help matchit + +This works, because when `:packadd` loaded the plugin it also added the +package directory in 'runtimepath', so that the help file can be found. + +You can find packages on the Internet in various places. It usually comes as +an archive or as a repository. For an archive you can follow these steps: + 1. create the package directory: > + mkdir -p ~/.vim/pack/fancy +< "fancy" can be any name of your liking. Use one that describes the + package. + 2. unpack the archive in that directory. This assumes the top + directory in the archive is "start": > + cd ~/.vim/pack/fancy + unzip /tmp/fancy.zip +< If the archive layout is different make sure that you end up with a + path like this: + ~/.vim/pack/fancy/start/fancytext/plugin/fancy.vim ~ + Here "fancytext" is the name of the package, it can be anything + else. + +More information about packages can be found here: |packages|. + +============================================================================== +*05.5* Adding a plugin *add-plugin* *plugin* Vim's functionality can be extended by adding plugins. A plugin is nothing more than a Vim script file that is loaded automatically when Vim starts. You @@ -415,23 +455,19 @@ Further reading: |new-filetype| How to detect a new file type. ============================================================================== -*05.5* Adding a help file *add-local-help* *matchit-install* +*05.6* Adding a help file *add-local-help* If you are lucky, the plugin you installed also comes with a help file. We will explain how to install the help file, so that you can easily find help for your new plugin. - Let us use the "matchit.vim" plugin as an example (it is included with -Vim). This plugin makes the "%" command jump to matching HTML tags, -if/else/endif in Vim scripts, etc. Very useful, although it's not backwards -compatible (that's why it is not enabled by default). - This plugin comes with documentation: "matchit.txt". Let's first copy the -plugin to the right directory. This time we will do it from inside Vim, so -that we can use $VIMRUNTIME. (You may skip some of the "mkdir" commands if -you already have the directory.) > + Let us use the "doit.vim" plugin as an example. This plugin comes with +documentation: "doit.txt". Let's first copy the plugin to the right +directory. This time we will do it from inside Vim. (You may skip some of +the "mkdir" commands if you already have the directory.) > :!mkdir ~/.vim :!mkdir ~/.vim/plugin - :!cp $VIMRUNTIME/macros/matchit.vim ~/.vim/plugin + :!cp /tmp/doit.vim ~/.vim/plugin The "cp" command is for Unix, on MS-DOS you can use "copy". @@ -441,7 +477,7 @@ Now create a "doc" directory in one of the directories in 'runtimepath'. > Copy the help file to the "doc" directory. > - :!cp $VIMRUNTIME/macros/matchit.txt ~/.vim/doc + :!cp /tmp/doit.txt ~/.vim/doc Now comes the trick, which allows you to jump to the subjects in the new help file: Generate the local tags file with the |:helptags| command. > @@ -450,10 +486,10 @@ file: Generate the local tags file with the |:helptags| command. > Now you can use the > - :help g% + :help doit -command to find help for "g%" in the help file you just added. You can see an -entry for the local help file when you do: > +command to find help for "doit" in the help file you just added. You can see +an entry for the local help file when you do: > :help local-additions @@ -464,7 +500,7 @@ them through the tag. For writing a local help file, see |write-local-help|. ============================================================================== -*05.6* The option window +*05.7* The option window If you are looking for an option that does what you want, you can search in the help files here: |options|. Another way is by using this command: > @@ -503,7 +539,7 @@ border. This is what the 'scrolloff' option does, it specifies an offset from the window border where scrolling starts. ============================================================================== -*05.7* Often used options +*05.8* Often used options There are an awful lot of options. Most of them you will hardly ever use. Some of the more useful ones will be mentioned here. Don't forget you can diff --git a/runtime/doc/usr_toc.txt b/runtime/doc/usr_toc.txt index d98a999aa4..b0dc9390a3 100644 --- a/runtime/doc/usr_toc.txt +++ b/runtime/doc/usr_toc.txt @@ -1,4 +1,4 @@ -*usr_toc.txt* For Vim version 7.4. Last change: 2010 Jul 20 +*usr_toc.txt* For Vim version 7.4. Last change: 2016 Mar 25 VIM USER MANUAL - by Bram Moolenaar @@ -104,10 +104,11 @@ Read this from start to end to learn the essential commands. |05.1| The vimrc file |05.2| The example vimrc file explained |05.3| Simple mappings - |05.4| Adding a plugin - |05.5| Adding a help file - |05.6| The option window - |05.7| Often used options + |05.4| Adding a package + |05.5| Adding a plugin + |05.6| Adding a help file + |05.7| The option window + |05.8| Often used options |usr_06.txt| Using syntax highlighting |06.1| Switching it on diff --git a/runtime/macros/README.txt b/runtime/macros/README.txt index ce61cd361a..f599c0a750 100644 --- a/runtime/macros/README.txt +++ b/runtime/macros/README.txt @@ -15,8 +15,6 @@ dvorak for when you use a Dvorak keyboard justify.vim user function for justifying text -matchit.vim + matchit.txt make % match if-fi, HTML tags, and much more - less.sh + less.vim make Vim work like less (or more) shellmenu.vim menus for editing shell scripts in the GUI version @@ -26,5 +24,9 @@ swapmous.vim swap left and right mouse buttons editexisting.vim when editing a file that is already edited with another Vim instance -This one is only for Unix. It can be found in the extra archive: +This one is only for Unix. file_select.vim macros that make a handy file selector + +The matchit plugin has been moved to an optional package. To load it put this +line in your vimrc file: + :packadd matchit diff --git a/runtime/macros/matchit.txt b/runtime/pack/dist/opt/matchit/doc/matchit.txt similarity index 100% rename from runtime/macros/matchit.txt rename to runtime/pack/dist/opt/matchit/doc/matchit.txt diff --git a/runtime/pack/dist/opt/matchit/doc/tags b/runtime/pack/dist/opt/matchit/doc/tags new file mode 100644 index 0000000000..4ccdc8721c --- /dev/null +++ b/runtime/pack/dist/opt/matchit/doc/tags @@ -0,0 +1,50 @@ +:MatchDebug matchit.txt /*:MatchDebug* +MatchError matchit.txt /*MatchError* +[% matchit.txt /*[%* +]% matchit.txt /*]%* +b:match_col matchit.txt /*b:match_col* +b:match_debug matchit.txt /*b:match_debug* +b:match_ignorecase matchit.txt /*b:match_ignorecase* +b:match_ini matchit.txt /*b:match_ini* +b:match_iniBR matchit.txt /*b:match_iniBR* +b:match_match matchit.txt /*b:match_match* +b:match_pat matchit.txt /*b:match_pat* +b:match_skip matchit.txt /*b:match_skip* +b:match_table matchit.txt /*b:match_table* +b:match_tail matchit.txt /*b:match_tail* +b:match_wholeBR matchit.txt /*b:match_wholeBR* +b:match_word matchit.txt /*b:match_word* +b:match_words matchit.txt /*b:match_words* +g% matchit.txt /*g%* +matchit matchit.txt /*matchit* +matchit-% matchit.txt /*matchit-%* +matchit-\1 matchit.txt /*matchit-\\1* +matchit-activate matchit.txt /*matchit-activate* +matchit-backref matchit.txt /*matchit-backref* +matchit-bugs matchit.txt /*matchit-bugs* +matchit-choose matchit.txt /*matchit-choose* +matchit-configure matchit.txt /*matchit-configure* +matchit-debug matchit.txt /*matchit-debug* +matchit-details matchit.txt /*matchit-details* +matchit-highlight matchit.txt /*matchit-highlight* +matchit-hl matchit.txt /*matchit-hl* +matchit-intro matchit.txt /*matchit-intro* +matchit-languages matchit.txt /*matchit-languages* +matchit-modes matchit.txt /*matchit-modes* +matchit-newlang matchit.txt /*matchit-newlang* +matchit-o_% matchit.txt /*matchit-o_%* +matchit-parse matchit.txt /*matchit-parse* +matchit-s:notend matchit.txt /*matchit-s:notend* +matchit-s:sol matchit.txt /*matchit-s:sol* +matchit-spaces matchit.txt /*matchit-spaces* +matchit-troubleshoot matchit.txt /*matchit-troubleshoot* +matchit-v_% matchit.txt /*matchit-v_%* +matchit.txt matchit.txt /*matchit.txt* +matchit.vim matchit.txt /*matchit.vim* +o_[% matchit.txt /*o_[%* +o_]% matchit.txt /*o_]%* +o_g% matchit.txt /*o_g%* +v_[% matchit.txt /*v_[%* +v_]% matchit.txt /*v_]%* +v_a% matchit.txt /*v_a%* +v_g% matchit.txt /*v_g%* diff --git a/runtime/macros/matchit.vim b/runtime/pack/dist/opt/matchit/plugin/matchit.vim similarity index 100% rename from runtime/macros/matchit.vim rename to runtime/pack/dist/opt/matchit/plugin/matchit.vim diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim index f75dee3369..9cb66ee270 100644 --- a/runtime/vimrc_example.vim +++ b/runtime/vimrc_example.vim @@ -1,7 +1,7 @@ " An example for a vimrc file. " " Maintainer: Bram Moolenaar -" Last change: 2015 Mar 24 +" Last change: 2016 Mar 25 " " To use it, copy it to " for Unix and OS/2: ~/.vimrc @@ -100,3 +100,10 @@ if has('langmap') && exists('+langnoremap') " compatible). set langnoremap endif + + +" Add optional packages. +" +" The matchit plugin makes the % command work better, but it is not backwards +" compatible. +packadd matchit diff --git a/src/Makefile b/src/Makefile index e018811d2b..cf9636d526 100644 --- a/src/Makefile +++ b/src/Makefile @@ -130,6 +130,7 @@ # make installlinks only installs the Vim binary links # make installmanlinks only installs the Vim manpage links # make installmacros only installs the Vim macros +# make installpack only installs the packages # make installtutorbin only installs the Vim tutor program # make installtutor only installs the Vim tutor files # make installspell only installs the spell files @@ -1008,6 +1009,7 @@ LANGSUBDIR = /lang COMPSUBDIR = /compiler KMAPSUBDIR = /keymap MACROSUBDIR = /macros +PACKSUBDIR = /pack TOOLSSUBDIR = /tools TUTORSUBDIR = /tutor SPELLSUBDIR = /spell @@ -1029,6 +1031,7 @@ PODIR = po ### COMPSUBLOC location for compiler files ### KMAPSUBLOC location for keymap files ### MACROSUBLOC location for macro files +### PACKSUBLOC location for packages ### TOOLSSUBLOC location for tools files ### TUTORSUBLOC location for tutor files ### SPELLSUBLOC location for spell files @@ -1050,6 +1053,7 @@ LANGSUBLOC = $(VIMRTLOC)$(LANGSUBDIR) COMPSUBLOC = $(VIMRTLOC)$(COMPSUBDIR) KMAPSUBLOC = $(VIMRTLOC)$(KMAPSUBDIR) MACROSUBLOC = $(VIMRTLOC)$(MACROSUBDIR) +PACKSUBLOC = $(VIMRTLOC)$(PACKSUBDIR) TOOLSSUBLOC = $(VIMRTLOC)$(TOOLSSUBDIR) TUTORSUBLOC = $(VIMRTLOC)$(TUTORSUBDIR) SPELLSUBLOC = $(VIMRTLOC)$(SPELLSUBDIR) @@ -1155,6 +1159,9 @@ FTPLUGSOURCE = ../runtime/ftplugin # Where to copy the macro files from MACROSOURCE = ../runtime/macros +# Where to copy the package files from +PACKSOURCE = ../runtime/pack + # Where to copy the tools files from TOOLSSOURCE = ../runtime/tools @@ -1430,6 +1437,7 @@ DEST_LANG = $(DESTDIR)$(LANGSUBLOC) DEST_COMP = $(DESTDIR)$(COMPSUBLOC) DEST_KMAP = $(DESTDIR)$(KMAPSUBLOC) DEST_MACRO = $(DESTDIR)$(MACROSUBLOC) +DEST_PACK = $(DESTDIR)$(PACKSUBLOC) DEST_TOOLS = $(DESTDIR)$(TOOLSSUBLOC) DEST_TUTOR = $(DESTDIR)$(TUTORSUBLOC) DEST_SPELL = $(DESTDIR)$(SPELLSUBLOC) @@ -2107,7 +2115,7 @@ INSTALLMANARGS = $(VIMLOC) $(SCRIPTLOC) $(VIMRCLOC) $(HELPSOURCE) $(MANMOD) \ $(VIMNAME) $(VIMDIFFNAME) $(EVIMNAME) # Install most of the runtime files -installruntime: installrtbase installmacros installtutor installspell +installruntime: installrtbase installmacros installpack installtutor installspell # install the help files; first adjust the contents for the final location installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ @@ -2206,6 +2214,11 @@ installmacros: $(DEST_VIM) $(DEST_RT) $(DEST_MACRO) rm -rf $$cvs; \ fi +installpack: $(DEST_VIM) $(DEST_RT) $(DEST_PACK) + $(INSTALL_DATA_R) $(PACKSOURCE)/* $(DEST_PACK) + chmod $(DIRMOD) `find $(DEST_PACK) -type d -print` + chmod $(FILEMOD) `find $(DEST_PACK) -type f -print` + # install the tutor files installtutorbin: $(DEST_VIM) $(INSTALL_DATA) vimtutor $(DEST_BIN)/$(VIMNAME)tutor @@ -2355,8 +2368,8 @@ $(HELPSOURCE)/vim.1 $(MACROSOURCE) $(TOOLSSOURCE): $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ $(DEST_VIM) $(DEST_RT) $(DEST_HELP) \ $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) $(DEST_FTP) \ - $(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) \ - $(DEST_MACRO) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_SPELL) \ + $(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) $(DEST_MACRO) \ + $(DEST_PACK) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_SPELL) \ $(DEST_AUTO) $(DEST_AUTO)/xml $(DEST_PLUG): -$(SHELL) ./mkinstalldirs $@ -chmod $(DIRMOD) $@ @@ -2501,6 +2514,7 @@ uninstall_runtime: -rm -f $(DEST_SYN)/*.vim $(DEST_SYN)/README.txt -rm -f $(DEST_IND)/*.vim $(DEST_IND)/README.txt -rm -rf $(DEST_MACRO) + -rm -rf $(DEST_PACK) -rm -rf $(DEST_TUTOR) -rm -rf $(DEST_SPELL) -rm -rf $(DEST_TOOLS) diff --git a/src/version.c b/src/version.c index c929eaff80..9a7e19ea71 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1649, /**/ 1648, /**/ From f68f1d70799631d38461c36cd59d08cf839b010d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 25 Mar 2016 17:14:06 +0100 Subject: [PATCH 4/9] patch 7.4.1650 Problem: Quickfix test fails. Solution: Accept any number of matches. --- src/testdir/test_quickfix.vim | 7 ++++++- src/version.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index e56c8a2391..3908ce0938 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -684,6 +684,11 @@ func Test_caddbuffer_to_empty() helpgr quickfix call setqflist([], 'r') cad - call assert_fails('cn', 'E553:') + try + cn + catch + " number of matches is unknown + call assert_true(v:exception =~ 'E553:') + endtry quit! endfunc diff --git a/src/version.c b/src/version.c index 9a7e19ea71..1a5b6e7f64 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1650, /**/ 1649, /**/ From 780d4c3fff3c06baa3135a9f9739c56a0c280a94 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 25 Mar 2016 17:21:19 +0100 Subject: [PATCH 5/9] patch 7.4.1651 Problem: Some dead (MSDOS) code remains. Solution: Remove the unused lines. (Ken Takata) --- src/misc1.c | 45 ++------------------------------------------- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 43 deletions(-) diff --git a/src/misc1.c b/src/misc1.c index a764a7b07e..ddd9a07aa5 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -9737,18 +9737,6 @@ pstrcmp(const void *a, const void *b) return (pathcmp(*(char **)a, *(char **)b, -1)); } -# ifndef WIN3264 - static void -namelowcpy( - char_u *d, - char_u *s) -{ - while (*s) - *d++ = TOLOWER_LOC(*s++); - *d = NUL; -} -# endif - /* * Recursively expand one path component into all matching files and/or * directories. Adds matches to "gap". Handles "*", "?", "[a-z]", "**", etc. @@ -9777,16 +9765,12 @@ dos_expandpath( int len; int starstar = FALSE; static int stardepth = 0; /* depth for "**" expansion */ -#ifdef WIN3264 WIN32_FIND_DATA fb; HANDLE hFind = (HANDLE)0; # ifdef FEAT_MBYTE WIN32_FIND_DATAW wfb; WCHAR *wn = NULL; /* UCS-2 name, NULL when not used. */ # endif -#else - struct ffblk fb; -#endif char_u *matchname; int ok; @@ -9827,7 +9811,7 @@ dos_expandpath( else if (path_end >= path + wildoff && vim_strchr((char_u *)"*?[~", *path_end) != NULL) e = p; -#ifdef FEAT_MBYTE +# ifdef FEAT_MBYTE if (has_mbyte) { len = (*mb_ptr2len)(path_end); @@ -9836,7 +9820,7 @@ dos_expandpath( path_end += len; } else -#endif +# endif *p++ = *path_end++; } e = p; @@ -9897,7 +9881,6 @@ dos_expandpath( /* Scan all files in the directory with "dir/ *.*" */ STRCPY(s, "*.*"); -#ifdef WIN3264 # ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { @@ -9921,24 +9904,15 @@ dos_expandpath( # endif hFind = FindFirstFile((LPCSTR)buf, &fb); ok = (hFind != INVALID_HANDLE_VALUE); -#else - /* If we are expanding wildcards we try both files and directories */ - ok = (findfirst((char *)buf, &fb, - (*path_end != NUL || (flags & EW_DIR)) ? FA_DIREC : 0) == 0); -#endif while (ok) { -#ifdef WIN3264 # ifdef FEAT_MBYTE if (wn != NULL) p = utf16_to_enc(wfb.cFileName, NULL); /* p is allocated here */ else # endif p = (char_u *)fb.cFileName; -#else - p = (char_u *)fb.ff_name; -#endif /* Ignore entries starting with a dot, unless when asked for. Accept * all entries found with "matchname". */ if ((p[0] != '.' || starts_with_dot @@ -9950,11 +9924,7 @@ dos_expandpath( || ((flags & EW_NOTWILD) && fnamencmp(path + (s - buf), p, e - s) == 0))) { -#ifdef WIN3264 STRCPY(s, p); -#else - namelowcpy(s, p); -#endif len = (int)STRLEN(buf); if (starstar && stardepth < 100) @@ -9986,7 +9956,6 @@ dos_expandpath( } } -#ifdef WIN3264 # ifdef FEAT_MBYTE if (wn != NULL) { @@ -9996,16 +9965,12 @@ dos_expandpath( else # endif ok = FindNextFile(hFind, &fb); -#else - ok = (findnext(&fb) == 0); -#endif /* If no more matches and no match was used, try expanding the name * itself. Finds the long name of a short filename. */ if (!ok && matchname != NULL && gap->ga_len == start_len) { STRCPY(s, matchname); -#ifdef WIN3264 FindClose(hFind); # ifdef FEAT_MBYTE if (wn != NULL) @@ -10019,21 +9984,15 @@ dos_expandpath( # endif hFind = FindFirstFile((LPCSTR)buf, &fb); ok = (hFind != INVALID_HANDLE_VALUE); -#else - ok = (findfirst((char *)buf, &fb, - (*path_end != NUL || (flags & EW_DIR)) ? FA_DIREC : 0) == 0); -#endif vim_free(matchname); matchname = NULL; } } -#ifdef WIN3264 FindClose(hFind); # ifdef FEAT_MBYTE vim_free(wn); # endif -#endif vim_free(buf); vim_regfree(regmatch.regprog); vim_free(matchname); diff --git a/src/version.c b/src/version.c index 1a5b6e7f64..6d67c33da4 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1651, /**/ 1650, /**/ From 610cc1b9b3c8104382f5506606c1f87118c28114 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 25 Mar 2016 17:55:42 +0100 Subject: [PATCH 6/9] patch 7.4.1652 Problem: Old style test for fnamemodify(). Solution: Turn it into a new style test. --- src/testdir/Make_all.mak | 1 - src/testdir/test105.in | 47 -------------------------------- src/testdir/test105.ok | 31 --------------------- src/testdir/test_alot.vim | 1 + src/testdir/test_fnamemodify.vim | 43 +++++++++++++++++++++++++++++ src/version.c | 2 ++ 6 files changed, 46 insertions(+), 79 deletions(-) delete mode 100644 src/testdir/test105.in delete mode 100644 src/testdir/test105.ok create mode 100644 src/testdir/test_fnamemodify.vim diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 455ca7b61c..98cf98562f 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -85,7 +85,6 @@ SCRIPTS_ALL = \ test102.out \ test103.out \ test104.out \ - test105.out \ test107.out \ test108.out \ test_autocmd_option.out \ diff --git a/src/testdir/test105.in b/src/testdir/test105.in deleted file mode 100644 index 4cc0261445..0000000000 --- a/src/testdir/test105.in +++ /dev/null @@ -1,47 +0,0 @@ -Test filename modifiers vim: set ft=vim : - -STARTTEST -:source small.vim -:%delete _ -:set shell=sh -:set shellslash -:let tab="\t" -:command -nargs=1 Put :let expr= | $put =expr.tab.strtrans(string(eval(expr))) -:let $HOME=fnamemodify('.', ':p:h:h') -:Put fnamemodify('.', ':p' )[-1:] -:Put fnamemodify('.', ':p:h' )[-1:] -:Put fnamemodify('test.out', ':p' )[-1:] -:Put fnamemodify('test.out', ':.' ) -:Put fnamemodify('../testdir/a', ':.' ) -:Put fnamemodify('test.out', ':~' ) -:Put fnamemodify('../testdir/a', ':~' ) -:Put fnamemodify('../testdir/a', ':t' ) -:Put fnamemodify('.', ':p:t' ) -:Put fnamemodify('test.out', ':p:t' ) -:Put fnamemodify('test.out', ':p:e' ) -:Put fnamemodify('test.out', ':p:t:e' ) -:Put fnamemodify('abc.fb2.tar.gz', ':r' ) -:Put fnamemodify('abc.fb2.tar.gz', ':r:r' ) -:Put fnamemodify('abc.fb2.tar.gz', ':r:r:r' ) -:Put substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(testdir/.*\)', '\1', '') -:Put fnamemodify('abc.fb2.tar.gz', ':e' ) -:Put fnamemodify('abc.fb2.tar.gz', ':e:e' ) -:Put fnamemodify('abc.fb2.tar.gz', ':e:e:e' ) -:Put fnamemodify('abc.fb2.tar.gz', ':e:e:e:e') -:Put fnamemodify('abc.fb2.tar.gz', ':e:e:r' ) -:Put fnamemodify('abc def', ':S' ) -:Put fnamemodify('abc" "def', ':S' ) -:Put fnamemodify('abc"%"def', ':S' ) -:Put fnamemodify('abc'' ''def', ':S' ) -:Put fnamemodify('abc''%''def', ':S' ) -:Put fnamemodify("abc\ndef", ':S' ) -:Put expand('%:r:S') == shellescape(expand('%:r')) -:Put join([expand('%:r'), expand('%:r:S'), expand('%')], ',') -:set shell=tcsh -:Put fnamemodify("abc\ndef", ':S' ) -:$put ='vim: ts=8' -:1 delete _ -:w! test.out -:qa! -ENDTEST - diff --git a/src/testdir/test105.ok b/src/testdir/test105.ok deleted file mode 100644 index 6642bfe4fb..0000000000 --- a/src/testdir/test105.ok +++ /dev/null @@ -1,31 +0,0 @@ -fnamemodify('.', ':p' )[-1:] '/' -fnamemodify('.', ':p:h' )[-1:] 'r' -fnamemodify('test.out', ':p' )[-1:] 't' -fnamemodify('test.out', ':.' ) 'test.out' -fnamemodify('../testdir/a', ':.' ) 'a' -fnamemodify('test.out', ':~' ) '~/testdir/test.out' -fnamemodify('../testdir/a', ':~' ) '~/testdir/a' -fnamemodify('../testdir/a', ':t' ) 'a' -fnamemodify('.', ':p:t' ) '' -fnamemodify('test.out', ':p:t' ) 'test.out' -fnamemodify('test.out', ':p:e' ) 'out' -fnamemodify('test.out', ':p:t:e' ) 'out' -fnamemodify('abc.fb2.tar.gz', ':r' ) 'abc.fb2.tar' -fnamemodify('abc.fb2.tar.gz', ':r:r' ) 'abc.fb2' -fnamemodify('abc.fb2.tar.gz', ':r:r:r' ) 'abc' -substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(testdir/.*\)', '\1', '') 'testdir/abc.fb2' -fnamemodify('abc.fb2.tar.gz', ':e' ) 'gz' -fnamemodify('abc.fb2.tar.gz', ':e:e' ) 'tar.gz' -fnamemodify('abc.fb2.tar.gz', ':e:e:e' ) 'fb2.tar.gz' -fnamemodify('abc.fb2.tar.gz', ':e:e:e:e') 'fb2.tar.gz' -fnamemodify('abc.fb2.tar.gz', ':e:e:r' ) 'tar' -fnamemodify('abc def', ':S' ) '''abc def''' -fnamemodify('abc" "def', ':S' ) '''abc" "def''' -fnamemodify('abc"%"def', ':S' ) '''abc"%"def''' -fnamemodify('abc'' ''def', ':S' ) '''abc''\'''' ''\''''def''' -fnamemodify('abc''%''def', ':S' ) '''abc''\''''%''\''''def''' -fnamemodify("abc\ndef", ':S' ) '''abc^@def''' -expand('%:r:S') == shellescape(expand('%:r')) 1 -join([expand('%:r'), expand('%:r:S'), expand('%')], ',') 'test105,''test105'',test105.in' -fnamemodify("abc\ndef", ':S' ) '''abc\^@def''' -vim: ts=8 diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index 37cdc8b605..fcf358b534 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -8,6 +8,7 @@ source test_ex_undo.vim source test_expr.vim source test_expand.vim source test_feedkeys.vim +source test_fnamemodify.vim source test_file_perm.vim source test_glob2regpat.vim source test_help_tagjump.vim diff --git a/src/testdir/test_fnamemodify.vim b/src/testdir/test_fnamemodify.vim new file mode 100644 index 0000000000..902be40dcd --- /dev/null +++ b/src/testdir/test_fnamemodify.vim @@ -0,0 +1,43 @@ +" Test filename modifiers. + +func Test_fnamemodify() + let $HOME = fnamemodify('.', ':p:h:h') + set shell=sh + + call assert_equal('/', fnamemodify('.', ':p')[-1:]) + call assert_equal('r', fnamemodify('.', ':p:h')[-1:]) + call assert_equal('t', fnamemodify('test.out', ':p')[-1:]) + call assert_equal('test.out', fnamemodify('test.out', ':.')) + call assert_equal('a', fnamemodify('../testdir/a', ':.')) + call assert_equal('~/testdir/test.out', fnamemodify('test.out', ':~')) + call assert_equal('~/testdir/a', fnamemodify('../testdir/a', ':~')) + call assert_equal('a', fnamemodify('../testdir/a', ':t')) + call assert_equal('', fnamemodify('.', ':p:t')) + call assert_equal('test.out', fnamemodify('test.out', ':p:t')) + call assert_equal('out', fnamemodify('test.out', ':p:e')) + call assert_equal('out', fnamemodify('test.out', ':p:t:e')) + call assert_equal('abc.fb2.tar', fnamemodify('abc.fb2.tar.gz', ':r')) + call assert_equal('abc.fb2', fnamemodify('abc.fb2.tar.gz', ':r:r')) + call assert_equal('abc', fnamemodify('abc.fb2.tar.gz', ':r:r:r')) + call assert_equal('testdir/abc.fb2', substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(testdir/.*\)', '\1', '')) + call assert_equal('gz', fnamemodify('abc.fb2.tar.gz', ':e')) + call assert_equal('tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e')) + call assert_equal('fb2.tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e:e')) + call assert_equal('fb2.tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e:e:e')) + call assert_equal('tar', fnamemodify('abc.fb2.tar.gz', ':e:e:r')) + + call assert_equal('''abc def''', fnamemodify('abc def', ':S')) + call assert_equal('''abc" "def''', fnamemodify('abc" "def', ':S')) + call assert_equal('''abc"%"def''', fnamemodify('abc"%"def', ':S')) + call assert_equal('''abc''\'''' ''\''''def''', fnamemodify('abc'' ''def', ':S')) + call assert_equal('''abc''\''''%''\''''def''', fnamemodify('abc''%''def', ':S')) + call assert_equal(expand('%:r:S'), shellescape(expand('%:r'))) + sp test_alot.vim + call assert_equal('test_alot,''test_alot'',test_alot.vim', join([expand('%:r'), expand('%:r:S'), expand('%')], ',')) + quit + + call assert_equal("'abc\ndef'", fnamemodify("abc\ndef", ':S')) + set shell=tcsh + call assert_equal("'abc\\\ndef'", fnamemodify("abc\ndef", ':S')) + set shell& +endfunc diff --git a/src/version.c b/src/version.c index 6d67c33da4..bd65162b35 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1652, /**/ 1651, /**/ From da64ab322ae35e473a24b211d22d05b1439aa05c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 25 Mar 2016 18:35:01 +0100 Subject: [PATCH 7/9] patch 7.4.1653 Problem: Users who loaded matchit.vim manually have to change their startup. (Gary Johnson) Solution: Add a file in the old location that loads the package. --- Filelist | 1 + runtime/macros/matchit.vim | 3 +++ src/version.c | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 runtime/macros/matchit.vim diff --git a/Filelist b/Filelist index 42b8a7a468..d95c8f4142 100644 --- a/Filelist +++ b/Filelist @@ -494,6 +494,7 @@ RT_ALL = \ runtime/macros/less.vim \ runtime/macros/life/click.me \ runtime/macros/life/life.vim \ + runtime/macros/matchit.vim \ runtime/macros/maze/README.txt \ runtime/macros/maze/[mM]akefile \ runtime/macros/maze/main.aap \ diff --git a/runtime/macros/matchit.vim b/runtime/macros/matchit.vim new file mode 100644 index 0000000000..9cfe2e532f --- /dev/null +++ b/runtime/macros/matchit.vim @@ -0,0 +1,3 @@ +" Load the matchit package. +" For those users who were loading the matchit plugin from here. +packadd matchit diff --git a/src/version.c b/src/version.c index bd65162b35..1e8c41964e 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1653, /**/ 1652, /**/ From 52c6eaffd43a8c8865f8d6ed7cde0a8b137479e2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 25 Mar 2016 18:42:46 +0100 Subject: [PATCH 8/9] patch 7.4.1654 Problem: Crash when using expand('%:S') in a buffer without a name. Solution: Don't set a NUL. (James McCoy, closes #714) --- src/eval.c | 6 ++++-- src/testdir/test_fnamemodify.vim | 6 ++++++ src/version.c | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/eval.c b/src/eval.c index 770879661c..225658921c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -26439,9 +26439,11 @@ repeat: { /* vim_strsave_shellescape() needs a NUL terminated string. */ c = (*fnamep)[*fnamelen]; - (*fnamep)[*fnamelen] = NUL; + if (c != NUL) + (*fnamep)[*fnamelen] = NUL; p = vim_strsave_shellescape(*fnamep, FALSE, FALSE); - (*fnamep)[*fnamelen] = c; + if (c != NUL) + (*fnamep)[*fnamelen] = c; if (p == NULL) return -1; vim_free(*bufp); diff --git a/src/testdir/test_fnamemodify.vim b/src/testdir/test_fnamemodify.vim index 902be40dcd..2267e18e3b 100644 --- a/src/testdir/test_fnamemodify.vim +++ b/src/testdir/test_fnamemodify.vim @@ -41,3 +41,9 @@ func Test_fnamemodify() call assert_equal("'abc\\\ndef'", fnamemodify("abc\ndef", ':S')) set shell& endfunc + +func Test_expand() + new + call assert_equal("", expand('%:S')) + quit +endfunc diff --git a/src/version.c b/src/version.c index 1e8c41964e..c1f6db6278 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1654, /**/ 1653, /**/ From 1e7885abe8daa793fd9328d0fd6c456214cb467e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 25 Mar 2016 19:03:03 +0100 Subject: [PATCH 9/9] patch 7.4.1655 Problem: remote_expr() hangs. (Ramel) Solution: Check for messages in the waiting loop. --- src/if_xcmdsrv.c | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/if_xcmdsrv.c b/src/if_xcmdsrv.c index 0b9b1a8190..a94e7cd35a 100644 --- a/src/if_xcmdsrv.c +++ b/src/if_xcmdsrv.c @@ -606,6 +606,7 @@ ServerWait( { while (XCheckWindowEvent(dpy, commWindow, PropertyChangeMask, &event)) serverEventProc(dpy, &event, 1); + server_parse_messages(); if (endCond(endData) != 0) break; diff --git a/src/version.c b/src/version.c index c1f6db6278..a3d6e1eeb3 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1655, /**/ 1654, /**/