From c0514bf4777a1d55f5785b3887c5686fd0bbe870 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 17 Nov 2016 14:50:09 +0100 Subject: [PATCH 1/7] Updated runtime files. --- runtime/compiler/csslint.vim | 16 ++ runtime/compiler/pylint.vim | 16 ++ runtime/doc/channel.txt | 4 +- runtime/doc/pi_gzip.txt | 3 +- runtime/doc/scroll.txt | 5 +- runtime/doc/todo.txt | 49 +++- runtime/doc/version8.txt | 418 ++++++++++++++++++++++++++++++++++- runtime/indent/fortran.vim | 12 +- runtime/plugin/gzip.vim | 6 +- runtime/syntax/c.vim | 4 +- runtime/syntax/fortran.vim | 10 +- runtime/tutor/tutor.fr | 10 +- runtime/tutor/tutor.fr.utf-8 | 10 +- 13 files changed, 526 insertions(+), 37 deletions(-) create mode 100644 runtime/compiler/csslint.vim create mode 100644 runtime/compiler/pylint.vim diff --git a/runtime/compiler/csslint.vim b/runtime/compiler/csslint.vim new file mode 100644 index 0000000000..14c4289a24 --- /dev/null +++ b/runtime/compiler/csslint.vim @@ -0,0 +1,16 @@ +" Vim compiler file +" Compiler: csslint for CSS +" Maintainer: Daniel Moch +" Last Change: 2016 May 21 + +if exists("current_compiler") + finish +endif +let current_compiler = "csslint" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +CompilerSet makeprg=csslint\ --format=compact +CompilerSet errorformat=%-G,%-G%f:\ lint\ free!,%f:\ line\ %l\\,\ col\ %c\\,\ %trror\ -\ %m,%f:\ line\ %l\\,\ col\ %c\\,\ %tarning\ -\ %m,%f:\ line\ %l\\,\ col\ %c\\,\ %m diff --git a/runtime/compiler/pylint.vim b/runtime/compiler/pylint.vim new file mode 100644 index 0000000000..93079ce61d --- /dev/null +++ b/runtime/compiler/pylint.vim @@ -0,0 +1,16 @@ +" Vim compiler file +" Compiler: Pylint for Python +" Maintainer: Daniel Moch +" Last Change: 2016 May 20 + +if exists("current_compiler") + finish +endif +let current_compiler = "pylint" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +CompilerSet makeprg=pylint\ --output-format=text\ --msg-template=\"{path}:{line}:{column}:{C}:\ [{symbol}]\ {msg}\"\ --reports=no +CompilerSet errorformat=%A%f:%l:%c:%t:\ %m,%A%f:%l:\ %m,%A%f:(%l):\ %m,%-Z%p^%.%#,%-G%.%# diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt index bfd7246d2e..73105986f6 100644 --- a/runtime/doc/channel.txt +++ b/runtime/doc/channel.txt @@ -1,4 +1,4 @@ -*channel.txt* For Vim version 8.0. Last change: 2016 Oct 27 +*channel.txt* For Vim version 8.0. Last change: 2016 Nov 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -369,7 +369,7 @@ Leave out the fourth argument if no response is to be sent: ============================================================================== 6. Using a RAW or NL channel *channel-raw* -If mode is RAW or NL then a message can be send like this: > +If mode is RAW or NL then a message can be sent like this: > let response = ch_evalraw(channel, {string}) The {string} is sent as-is. The response will be what can be read from the diff --git a/runtime/doc/pi_gzip.txt b/runtime/doc/pi_gzip.txt index 70495708bf..d8f63acd2c 100644 --- a/runtime/doc/pi_gzip.txt +++ b/runtime/doc/pi_gzip.txt @@ -1,4 +1,4 @@ -*pi_gzip.txt* For Vim version 8.0. Last change: 2016 Oct 30 +*pi_gzip.txt* For Vim version 8.0. Last change: 2016 Nov 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -28,6 +28,7 @@ with these extensions: *.lzma lzma *.xz xz *.lz lzip + *.zst zstd That's actually the only thing you need to know. There are no options. diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt index b3696d3730..943531e3b4 100644 --- a/runtime/doc/scroll.txt +++ b/runtime/doc/scroll.txt @@ -1,4 +1,4 @@ -*scroll.txt* For Vim version 8.0. Last change: 2006 Aug 27 +*scroll.txt* For Vim version 8.0. Last change: 2016 Nov 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -108,7 +108,8 @@ z^ Without [count]: Redraw with the line just above the 3. Scrolling relative to cursor *scroll-cursor* The following commands reposition the edit window (the part of the buffer that -you see) while keeping the cursor on the same line: +you see) while keeping the cursor on the same line. Note that the 'scrolloff' +option may cause context lines to show above and below the cursor. *z* z Redraw, line [count] at top of window (default diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index f9349d0297..3b5205160c 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.0. Last change: 2016 Nov 06 +*todo.txt* For Vim version 8.0. Last change: 2016 Nov 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -28,13 +28,29 @@ See |develop.txt| for development plans. You can vote for which items should be worked on, but only if you sponsor Vim development. See |sponsor|. Issues can also be entered online: https://github.com/vim/vim/issues -Updates will be forwarded to the vim_dev maillist. Issues entered there will -not be repeated below, unless there is extra information. +Only use this for bug reports, not for questions! Those belong on the +maillist. Updates will be forwarded to the vim_dev maillist. Issues entered +there will not be repeated below, unless there is extra information. *known-bugs* -------------------- Known bugs and current work ----------------------- +Test_help_complete sometimes fails on MS-Windows: +function RunTheTest[9]..Test_help_complete line 22: Expected ['h test-char@ab', +'h test-char@en', 'h test-col@ab', 'h test-col@en'] but got ['h test-char@en', ' +h test-char@en\t', 'h test-col@ab', 'h test-col@en'] +Appears to be related to calling feedkeys() with exactly 8 characters. + +Patch for GTK3: Kazunobu Kuriyama, 14 Nov. + +Patch for fix breakindent bug (Christian, Nov 15) + +channel: +- Skip checking if job ended if there aren't any. (ichizok, 2016 Nov 7, #1196) +- problem with channel callback getting job, while the job was already + deleted. #1242. Fix in #1245 (ichizok), but is that correct? + Perhaps just replace job_still_alive() with job_still_useful()? + That's not sufficient. - Problem with stderr on Windows? (Vincent Rischmann, 2016 Aug 31, #1026) - Add 'cwd' argument to start_job(): directory to change to in the child. check for valid directory before forking. @@ -96,15 +112,29 @@ Regexp problems: - The pattern "\1" with the old engine gives E65, with the new engine it matches the empty string. (Dominique Pelle, 2015 Oct 2, Nov 24) had_endbrace[] is set but not initialized or used. +- Difference between two engines: ".*\zs\/\@>\/" on text "///" + (Chris Paul, 2016 Nov 13) New engine not greedy enough? Patch to support nested namespace syntax. (Pauli, 2016 Oct 30, #1214) +Patch to fix popup menu positioning. (Hirohito Higashi, 2016 Nov 7, #1241) + +Patch to make help tag jumps keep language. (Tatsuki, #1249) +Test by Hirohito Higashi. + Make html indent file use javascript indent, now that it's not just cindent. #1220 +Patch to use buffer id for system() and systemlist() (LemonBoy, 2016 Nov 7, +#1240) + json_encode(): should convert to utf-8. (Nikolai Pavlov, 2016 Jan 23) What if there is an invalid character? +Bug: ":earlier 100d" doesn't work after using undo file. +(Pavol Juhas, 2016 Nov 15, #1254) +Fix by Christian, but lacks a test. + Bug: Json with same key should not give internal error. (Lcd, 2016 Oct 26) Make dict_add give a duplicate key error. @@ -145,6 +175,9 @@ Or point to nightly builds: https://github.com/vim/vim-win32-installer/releases Problem passing non-UTF-8 strings to Python 3. (Björn Linse, 2016 Sep 11, #1053) With patch, does it work? +Patch to make finding duplicate tags much faster, using a hashtab. (James +McCoy, 2016 Sept 14, #1046) Should work now. Updated Nov 12. +> Use ADDR_OTHER instead of ADDR_LINES for many more commands. Add tests for using number larger than number of lines in buffer. @@ -187,6 +220,9 @@ Include the test. When 'keywordprg' starts with ":" the argument is still escaped as a shell command argument. (Romain Lafourcade, 2016 Oct 16, #1175) +Patch to support CamelCase for spell checking: See a lower-to-upper case +change as a word boundary. (btucker-MPCData, 2016 Nov 6, #1235) + Idea from Sven: record sequence of keys. Useful to show others what they are doing (look over the shoulder), and also to see what happened. Probably list of keystrokes, with some annotations for mode changes. @@ -296,9 +332,6 @@ Add redrawtabline command. (Naruhiko Nishino, 2016 Jun 11) Neovim patch for utfc_ptr2char_len() https://github.com/neovim/neovim/pull/4574 No test, needs some work to include. -Patch to make finding duplicate tags much faster, using a hashtab. (James -McCoy, 2016 Sept 14, #1046) Should work now. -> Patch to improve indenting for C++ constructor with initializer list. (Hirohito Higashi, 2016 Mar 31) @@ -3830,7 +3863,7 @@ Code size: left out. 8 When compiled with a GUI-only version, the termcap entries for terminals can be removed. -8 Can the check for libelf in configure.in be removed? +8 Can the check for libelf in configure.ac be removed? Messages: @@ -5552,7 +5585,7 @@ From vile: Far future and "big" extensions: - Instead of using a Makefile and autoconf, use a simple shell script to find the C compiler and do everything with C code. Translate something - like an Aap recipe and configure.in to C. Avoids depending on Python, + like an Aap recipe and configure.ac to C. Avoids depending on Python, thus will work everywhere. With batch file to find the C compiler it would also work on MS-Windows. - Make it easy to setup Vim for groups of users: novice vi users, novice diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt index af289fdc1a..a419bd7d1d 100644 --- a/runtime/doc/version8.txt +++ b/runtime/doc/version8.txt @@ -1,4 +1,4 @@ -*version8.txt* For Vim version 8.0. Last change: 2016 Sep 14 +*version8.txt* For Vim version 8.0. Last change: 2016 Nov 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -14507,4 +14507,420 @@ Problem: Test runner misses a comma. Solution: Add the comma. Files: src/testdir/runtest.vim +Patch 8.0.0001 +Problem: Intro screen still mentions version7. (Paul) +Solution: Change it to version8. +Files: src/version.c + +Patch 8.0.0002 +Problem: The netrw plugin does not work. +Solution: Make it accept version 8.0. +Files: runtime/autoload/netrw.vim + +Patch 8.0.0003 +Problem: getwinvar() returns wrong Value of boolean and number options, + especially non big endian systems. (James McCoy) +Solution: Cast the pointer to long or int. (closes #1060) +Files: src/option.c, src/testdir/test_bufwintabinfo.vim + +Patch 8.0.0004 +Problem: A string argument for function() that is not a function name + results in an error message with NULL. (Christian Brabandt) +Solution: Use the argument for the error message. +Files: src/evalfunc.c, src/testdir/test_expr.vim + +Patch 8.0.0005 +Problem: Netbeans test fails with Python 3. (Jonathonf) +Solution: Encode the string before sending it. (closes #1070) +Files: src/testdir/test_netbeans.py + +Patch 8.0.0006 +Problem: ":lb" is interpreted as ":lbottom" while the documentation says it + means ":lbuffer". +Solution: Adjust the order of the commands. (haya14busa, closes #1093) +Files: src/ex_cmds.h + +Patch 8.0.0007 +Problem: Vim 7.4 is still mentioned in a few places. +Solution: Update to Vim 8. (Uncle Bill, closes #1094) +Files: src/INSTALLpc.txt, src/vimtutor, uninstal.txt + +Patch 8.0.0008 +Problem: Popup complete test is disabled. +Solution: Enable the test and change the assert. (Hirohito Higashi) +Files: src/testdir/test_popup.vim + +Patch 8.0.0009 +Problem: Unnecessary workaround for AppVeyor. +Solution: Revert patch 7.4.990. (Christian Brabandt) +Files: appveyor.yml + +Patch 8.0.0010 +Problem: Crash when editing file that starts with crypt header. (igor2x) +Solution: Check for length of text. (Christian Brabandt) Add a test. +Files: src/fileio.c, src/testdir/test_crypt.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0011 +Problem: On OSX Test_pipe_through_sort_all() sometimes fails. +Solution: Add the test to the list of flaky tests. +Files: src/testdir/runtest.vim + +Patch 8.0.0012 +Problem: Typos in comments. +Solution: Change "its" to "it's". (Matthew Brener, closes #1088) +Files: src/evalfunc.c, src/main.aap, src/nbdebug.c, src/netbeans.c, + src/quickfix.c, src/workshop.c, src/wsdebug.c + +Patch 8.0.0013 (after 8.0.0011) +Problem: Missing comma in list. +Solution: Add the comma. +Files: src/testdir/runtest.vim + +Patch 8.0.0014 +Problem: Crypt tests are old style. +Solution: Convert to new style. +Files: src/testdir/test71.in, src/testdir/test71.ok, + src/testdir/test71a.in, src/testdir/test_crypt.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0015 +Problem: Can't tell which part of a channel has "buffered" status. +Solution: Add an optional argument to ch_status(). Let ch_info() also + return "buffered" for out_status and err_status. +Files: src/evalfunc.c, src/channel.c, src/proto/channel.pro, + src/testdir/test_channel.vim, runtime/doc/eval.txt + +Patch 8.0.0016 (after 8.0.0015) +Problem: Build fails. +Solution: Include missing change. +Files: src/eval.c + +Patch 8.0.0017 +Problem: Cannot get the number of the current quickfix or location list. +Solution: Use the current list if "nr" in "what" is zero. (Yegappan + Lakshmanan) Remove debug command from test. +Files: src/quickfix.c, src/testdir/test_quickfix.vim, + runtime/doc/eval.txt + +Patch 8.0.0018 +Problem: When using ":sleep" channel input is not handled. +Solution: When there is a channel check for input also when not in raw mode. + Check every 100 msec. +Files: src/channel.c, src/proto/channel.pro, src/ui.c, src/proto/ui.pro, + src/ex_docmd.c, src/os_amiga.c, src/proto/os_amiga.pro, + src/os_unix.c, src/proto/os_unix.pro, src/os_win32.c, + src/proto/os_win32.pro + +Patch 8.0.0019 +Problem: Test_command_count is old style. +Solution: Turn it into a new style test. (Naruhiko Nishino) + Use more assert functions. +Files: src/Makefile, src/testdir/Make_all.mak, src/testdir/test_alot.vim, + src/testdir/test_autocmd.vim, src/testdir/test_command_count.in, + src/testdir/test_command_count.ok, + src/testdir/test_command_count.vim + +Patch 8.0.0020 +Problem: The regexp engines are not reentrant. +Solution: Add regexec_T and save/restore the state when needed. +Files: src/regexp.c, src/regexp_nfa.c, src/testdir/test_expr.vim, + runtime/doc/eval.txt, runtime/doc/change.txt + +Patch 8.0.0021 +Problem: In the GUI when redrawing the cursor it may be on the second half + of a double byte character. +Solution: Correct the cursor column. (Yasuhiro Matsumoto) +Files: src/screen.c + +Patch 8.0.0022 +Problem: If a channel in NL mode is missing the NL at the end the remaining + characters are dropped. +Solution: When the channel is closed use the remaining text. (Ozaki Kiichi) +Files: src/channel.c, src/testdir/test_channel.vim + +Patch 8.0.0023 +Problem: "gd" and "gD" may find a match in a comment or string. +Solution: Ignore matches in comments and strings. (Anton Lindqvist) +Files: src/normal.c, src/testdir/test_goto.vim + +Patch 8.0.0024 +Problem: When the netbeans channel closes, "DETACH" is put in the output + part. (Ozaki Kiichi) +Solution: Write "DETACH" in the socket part. +Files: src/channel.c, src/testdir/test_netbeans.vim + +Patch 8.0.0025 +Problem: Inconsistent use of spaces vs tabs in gd test. +Solution: Use tabs. (Anton Lindqvist) +Files: src/testdir/test_goto.vim + +Patch 8.0.0026 +Problem: Error format with %W, %C and %Z does not work. (Gerd Wachsmuth) +Solution: Skip code when qf_multiignore is set. (Lcd) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0027 +Problem: A channel is closed when reading on stderr or stdout fails, but + there may still be something to read on another part. +Solution: Turn ch_to_be_closed into a bitfield. (Ozaki Kiichi) +Files: src/channel.c, src/eval.c, src/structs.h, src/proto/channel.pro, + src/testdir/test_channel.vim + +Patch 8.0.0028 +Problem: Superfluous semicolons. +Solution: Remove them. (Ozaki Kiichi) +Files: src/ex_cmds2.c + +Patch 8.0.0029 +Problem: Code for MS-Windows is complicated because of the exceptions for + old systems. +Solution: Drop support for MS-Windows older than Windows XP. (Ken Takata) +Files: runtime/doc/gui_w32.txt, runtime/doc/os_win32.txt, + runtime/doc/todo.txt, src/GvimExt/Makefile, src/Make_mvc.mak, + src/evalfunc.c, src/ex_cmds.c, src/ex_docmd.c, src/gui_w32.c, + src/if_cscope.c, src/misc1.c, src/misc2.c, src/option.c, + src/os_mswin.c, src/os_win32.c, src/os_win32.h, + src/proto/os_mswin.pro, src/proto/os_win32.pro, src/version.c + +Patch 8.0.0030 +Problem: Mouse mode is not automatically detected for tmux. +Solution: Check for 'term' to be "tmux". (Michael Henry) +Files: src/os_unix.c + +Patch 8.0.0031 +Problem: After ":bwipeout" 'fileformat' is not set to the right default. +Solution: Get the default from 'fileformats'. (Mike Williams) +Files: src/option.c, src/Makefile, src/testdir/test_fileformat.vim, + src/testdir/test_alot.vim + +Patch 8.0.0032 +Problem: Tests may change the input file when something goes wrong. +Solution: Avoid writing the input file. +Files: src/testdir/test51.in, src/testdir/test67.in, + src/testdir/test97.in, src/testdir/test_tabpage.vim + +Patch 8.0.0033 +Problem: Cannot use overlapping positions with matchaddpos(). +Solution: Check end of match. (Ozaki Kiichi) Add a test (Hirohito Higashi) +Files: src/screen.c, src/testdir/test_match.vim + +Patch 8.0.0034 +Problem: No completion for ":messages". +Solution: Complete "clear" argument. (Hirohito Higashi) +Files: src/ex_docmd.c, src/ex_getln.c, src/proto/ex_docmd.pro, + src/testdir/test_cmdline.vim, src/vim.h, + runtime/doc/eval.txt, runtime/doc/map.txt + +Patch 8.0.0035 (after 7.4.2013) +Problem: Order of matches for 'omnifunc' is messed up. (Danny Su) +Solution: Do not set compl_curr_match when called from complete_check(). + (closes #1168) +Files: src/edit.c, src/evalfunc.c, src/proto/edit.pro, src/search.c, + src/spell.c, src/tag.c, src/testdir/test76.in, + src/testdir/test76.ok, src/testdir/test_popup.vim, src/Makefile, + src/testdir/Make_all.mak + +Patch 8.0.0036 +Problem: Detecting that a job has finished may take a while. +Solution: Check for a finished job more often (Ozaki Kiichi) +Files: src/channel.c, src/os_unix.c, src/os_win32.c, + src/proto/os_unix.pro, src/proto/os_win32.pro, + src/testdir/test_channel.vim + +Patch 8.0.0037 +Problem: Get E924 when switching tabs. () +Solution: Use win_valid_any_tab() instead of win_valid(). (Martin Vuille, + closes #1167, closes #1171) +Files: src/quickfix.c, src/testdir/test_quickfix.vim + +Patch 8.0.0038 +Problem: OPEN_CHR_FILES not defined for FreeBSD using Debian userland + files. +Solution: Check for __FreeBSD_kernel__. (James McCoy, closes #1166) +Files: src/vim.h + +Patch 8.0.0039 +Problem: When Vim 8 reads an old viminfo and exits, the next time marks are + not read from viminfo. (Ned Batchelder) +Solution: Set a mark when it wasn't set before, even when the timestamp is + zero. (closes #1170) +Files: src/mark.c, src/testdir/test_viminfo.vim + +Patch 8.0.0040 (after 8.0.0033) +Problem: Whole line highlighting with matchaddpos() does not work. +Solution: Check for zero length. (Hirohito Higashi) +Files: src/screen.c, src/testdir/test_match.vim + +Patch 8.0.0041 +Problem: When using Insert mode completion but not actually inserting + anything an undo item is still created. (Tommy Allen) +Solution: Do not call stop_arrow() when not inserting anything. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0042 (after 8.0.0041) +Problem: When using Insert mode completion with 'completeopt' containing + "noinsert" change is not saved for undo. (Tommy Allen) +Solution: Call stop_arrow() before inserting for pressing Enter. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0043 (after 8.0.0041) +Problem: When using Insert mode completion with 'completeopt' containing + "noinsert" with CTRL-N the change is not saved for undo. (Tommy + Allen) +Solution: Call stop_arrow() before inserting for any key. +Files: src/edit.c, src/testdir/test_popup.vim + +Patch 8.0.0044 +Problem: In diff mode the cursor may end up below the last line, resulting + in an ml_get error. +Solution: Check the line to be valid. +Files: src/move.c, src/diff.c, src/proto/diff.pro, + src/testdir/test_diffmode.vim + +Patch 8.0.0045 +Problem: Calling job_stop() right after job_start() does not work. +Solution: Block signals while fork is still busy. (Ozaki Kiichi, closes + #1155) +Files: src/auto/configure, src/config.h.in, src/configure.in, + src/os_unix.c, src/testdir/test_channel.vim + +Patch 8.0.0046 +Problem: Using NUL instead of NULL. +Solution: Change to NULL. (Dominique Pelle) +Files: src/ex_cmds.c, src/json.c + +Patch 8.0.0047 +Problem: Crash when using the preview window from an unnamed buffer. + (lifepillar) +Solution: Do not clear the wrong buffer. (closes #1200) +Files: src/popupmnu.c + +Patch 8.0.0048 +Problem: On Windows job_stop() stops cmd.exe, not the processes it runs. + (Linwei) +Solution: Iterate over all processes and terminate the one where the parent + is the job process. (Yasuhiro Matsumoto, closes #1184) +Files: src/os_win32.c, src/structs.h + +Patch 8.0.0049 +Problem: When a match ends in part of concealed text highlighting, it might + mess up concealing by resetting prev_syntax_id. +Solution: Do not reset prev_syntax_id and add a test to verify. (Christian + Brabandt, closes #1092) +Files: src/screen.c, src/testdir/test_matchadd_conceal.vim + +Patch 8.0.0050 +Problem: An exiting job is detected with a large latency. +Solution: Check for pending job more often. (Ozaki Kiichi) Change the + double loop in mch_inchar() into one. +Files: src/channel.c, src/os_unix.c, src/testdir/shared.vim, + src/testdir/test_channel.vim + +Patch 8.0.0051 (after 8.0.0048) +Problem: New code for job_stop() breaks channel test on AppVeyor. +Solution: Revert the change. +Files: src/os_win32.c, src/structs.h + +Patch 8.0.0052 (after 8.0.0049) +Problem: Conceal test passes even without the bug fix. +Solution: Add a redraw command. (Christian Brabandt) +Files: src/testdir/test_matchadd_conceal.vim + +Patch 8.0.0053 (after 8.0.0047) +Problem: No test for what 8.0.0047 fixes. +Solution: Add a test. (Hirohito Higashi) +Files: src/testdir/test_popup.vim + +Patch 8.0.0054 (after 8.0.0051) +Problem: On Windows job_stop() stops cmd.exe, not the processes it runs. + (Linwei) +Solution: Iterate over all processes and terminate the one where the parent + is the job process. Now only when there is no job object. + (Yasuhiro Matsumoto, closes #1203) +Files: src/os_win32.c + +Patch 8.0.0055 +Problem: Minor comment and style deficiencies. +Solution: Update comments and fix style. +Files: src/buffer.c, src/misc2.c, src/os_unix.c + +Patch 8.0.0056 +Problem: When setting 'filetype' there is no check for a valid name. +Solution: Only allow valid characters in 'filetype', 'syntax' and 'keymap'. +Files: src/option.c, src/testdir/test_options.vim + +Patch 8.0.0057 (after 8.0.0056) +Problem: Tests fail without the 'keymap' features. +Solution: Check for feature in test. +Files: src/testdir/test_options.vim + +Patch 8.0.0058 +Problem: Positioning of the popup menu is not good. +Solution: Position it better. (Hirohito Higashi) +Files: src/popupmnu.c + +Patch 8.0.0059 +Problem: Vim does not build on VMS systems. +Solution: Various changes for VMS. (Zoltan Arpadffy) +Files: src/json.c, src/macros.h, src/Make_vms.mms, src/os_unix.c, + src/os_unix.h, src/os_vms.c, src/os_vms_conf.h, + src/proto/os_vms.pro, src/testdir/Make_vms.mms + +Patch 8.0.0060 +Problem: When using an Ex command for 'keywordprg' it is escaped as with a + shell command. (Romain Lafourcade) +Solution: Escape for an Ex command. (closes #1175) +Files: src/normal.c, src/testdir/test_normal.vim + +Patch 8.0.0061 (after 8.0.0058) +Problem: Compiler warning for unused variable. +Solution: Add #ifdef. (John Marriott) +Files: src/popupmnu.c + +Patch 8.0.0062 +Problem: No digraph for HORIZONTAL ELLIPSIS. +Solution: Use ",.". (Hans Ginzel, closes #1226) +Files: src/digraph.c, runtime/doc/digraph.txt + +Patch 8.0.0063 +Problem: Compiler warning for comparing with unsigned. (Zoltan Arpadffy) +Solution: Change <= to ==. +Files: src/undo.c + +Patch 8.0.0064 (after 8.0.0060) +Problem: Normal test fails on MS-Windows. +Solution: Don't try using an illegal file name. +Files: src/testdir/test_normal.vim + +Patch 8.0.0065 (after 8.0.0056) +Problem: Compiler warning for unused function in tiny build. (Tony + Mechelynck) +Solution: Add #ifdef. +Files: src/option.c + +Patch 8.0.0066 +Problem: when calling an operator function when 'linebreak' is set, it is + internally reset before calling the operator function. +Solution: Restore 'linebreak' before calling op_function(). (Christian + Brabandt) +Files: src/normal.c, src/testdir/test_normal.vim + +Patch 8.0.0067 +Problem: VMS has a problem with infinity. +Solution: Avoid an overflow. (Zoltan Arpadffy) +Files: src/json.c, src/macros.h + +Patch 8.0.0068 +Problem: Checking did_throw after executing autocommands is wrong. (Daniel + Hahler) +Solution: Call aborting() instead, and only when autocommands were executed. +Files: src/quickfix.c, src/if_cscope.c, src/testdir/test_quickfix.vim + +Patch 8.0.0069 +Problem: Compiler warning for self-comparison. +Solution: Define ONE_WINDOW and add #ifdef. +Files: src/globals.h, src/buffer.c, src/ex_docmd.c, src/move.c, + src/screen.c, src/quickfix.c, src/window.c + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim index c9bee78a6e..2ba69e86df 100644 --- a/runtime/indent/fortran.vim +++ b/runtime/indent/fortran.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) -" Version: 0.46 -" Last Change: 2016 Sep. 27 +" Version: 47 +" Last Change: 2016 Oct. 29 " Maintainer: Ajit J. Thakkar ; " Usage: For instructions, do :help fortran-indent from Vim " Credits: @@ -100,9 +100,9 @@ function FortranGetIndent(lnum) endif endif - "Add a shiftwidth to statements following if, else, else if, case, + "Add a shiftwidth to statements following if, else, else if, case, class, "where, else where, forall, type, interface and associate statements - if prevstat =~? '^\s*\(case\|else\|else\s*if\|else\s*where\)\>' + if prevstat =~? '^\s*\(case\|class\|else\|else\s*if\|else\s*where\)\>' \ ||prevstat=~? '^\s*\(type\|interface\|associate\|enum\)\>' \ ||prevstat=~?'^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*\(forall\|where\|block\)\>' \ ||prevstat=~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>' @@ -136,11 +136,11 @@ function FortranGetIndent(lnum) endif endif - "Subtract a shiftwidth from else, else if, elsewhere, case, end if, + "Subtract a shiftwidth from else, else if, elsewhere, case, class, end if, " end where, end select, end forall, end interface, end associate, " end enum, end type, end block and end type statements if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*' - \. '\(else\|else\s*if\|else\s*where\|case\|' + \. '\(else\|else\s*if\|else\s*where\|case\|class\|' \. 'end\s*\(if\|where\|select\|interface\|' \. 'type\|forall\|associate\|enum\|block\)\)\>' let ind = ind - shiftwidth() diff --git a/runtime/plugin/gzip.vim b/runtime/plugin/gzip.vim index f7ee9dc510..5e13b92d1e 100644 --- a/runtime/plugin/gzip.vim +++ b/runtime/plugin/gzip.vim @@ -20,29 +20,33 @@ augroup gzip " " Set binary mode before reading the file. " Use "gzip -d", gunzip isn't always available. - autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma,*.xz,*.lz setlocal bin + autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma,*.xz,*.lz,*.zst setlocal bin autocmd BufReadPost,FileReadPost *.gz call gzip#read("gzip -dn") autocmd BufReadPost,FileReadPost *.bz2 call gzip#read("bzip2 -d") autocmd BufReadPost,FileReadPost *.Z call gzip#read("uncompress") autocmd BufReadPost,FileReadPost *.lzma call gzip#read("lzma -d") autocmd BufReadPost,FileReadPost *.xz call gzip#read("xz -d") autocmd BufReadPost,FileReadPost *.lz call gzip#read("lzip -d") + autocmd BufReadPost,FileReadPost *.zst call gzip#read("zstd -d --rm") autocmd BufWritePost,FileWritePost *.gz call gzip#write("gzip") autocmd BufWritePost,FileWritePost *.bz2 call gzip#write("bzip2") autocmd BufWritePost,FileWritePost *.Z call gzip#write("compress -f") autocmd BufWritePost,FileWritePost *.lzma call gzip#write("lzma -z") autocmd BufWritePost,FileWritePost *.xz call gzip#write("xz -z") autocmd BufWritePost,FileWritePost *.lz call gzip#write("lzip") + autocmd BufWritePost,FileWritePost *.zst call gzip#write("zstd --rm") autocmd FileAppendPre *.gz call gzip#appre("gzip -dn") autocmd FileAppendPre *.bz2 call gzip#appre("bzip2 -d") autocmd FileAppendPre *.Z call gzip#appre("uncompress") autocmd FileAppendPre *.lzma call gzip#appre("lzma -d") autocmd FileAppendPre *.xz call gzip#appre("xz -d") autocmd FileAppendPre *.lz call gzip#appre("lzip -d") + autocmd FileAppendPre *.zst call gzip#appre("zstd -d --rm") autocmd FileAppendPost *.gz call gzip#write("gzip") autocmd FileAppendPost *.bz2 call gzip#write("bzip2") autocmd FileAppendPost *.Z call gzip#write("compress -f") autocmd FileAppendPost *.lzma call gzip#write("lzma -z") autocmd FileAppendPost *.xz call gzip#write("xz -z") autocmd FileAppendPost *.lz call gzip#write("lzip") + autocmd FileAppendPost *.zst call gzip#write("zstd --rm") augroup END diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index 2b946dd73d..cc99f674a1 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar -" Last Change: 2016 Oct 27 +" Last Change: 2016 Nov 17 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -365,7 +365,7 @@ if !exists("c_no_if0") syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\zs\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse if !exists("c_no_if0_fold") - syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\zs\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold + syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold else syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell endif diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index 9d9ab69a3a..4c26e78f16 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) -" Version: 0.99 -" Last Change: 2016 Sep. 23 +" Version: 100 +" Last Change: 2016 Oct. 29 " Maintainer: Ajit J. Thakkar ; " Usage: For instructions, do :help fortran-syntax from Vim " Credits: @@ -397,6 +397,7 @@ if exists("fortran_fold") syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\\)\=\)" contains=ALLBUT,fortranProgram,fortranModule syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\\)\=\)" contains=ALLBUT,fortranProgram,fortranModule syn region fortranBlockData transparent fold keepend start="\ + 3. Revenez ici en tapant la commande qui vous a mené à ce tutoriel. + Cela pourrait être : vimtutor 4. Si vous avez mémorisé ces étapes et êtes confiant, effectuez les étapes 1 à 3 pour sortir puis rentrer dans l'éditeur. @@ -154,7 +154,7 @@ NOTE : En avan !! NOTE : Lisez toute la leçon avant d'exécuter les instructions ci-dessous !! 1. Sortez de ce tutoriel comme vous l'avez fait dans la Leçon 1.2 : :q! - Ou, si vous avez accès à un autre terminal, exécutez y les actions + Ou, si vous avez accès à un autre terminal, exécutez-y les actions qui suivent. 2. À l'invite du shell, tapez cette commande : vim tutor @@ -704,7 +704,7 @@ NOTE : Si vous quittez Vim et le red 3. Appuyez : . En bas de l'écran :'<,'> va apparaître. 4. Tapez w TEST , où TEST est un nom de fichier qui n'existe pas. - Vérifiez que vous voyez :'<,'>w TEST avant de d'appuyer sur . + Vérifiez que vous voyez :'<,'>w TEST avant d'appuyer sur . 5. Vim va enregistrer les lignes sélectionnées dans le fichier TEST. Utilisez :!dir ou :!ls pour le voir. Ne l'effacez pas encore ! @@ -1034,5 +1034,5 @@ NOTE : Le compl Dernières mises à jour par Dominique Pellé. E-mail : dominique.pelle@gmail.com - Last Change : 2016 Jul 02 + Last Change : 2016 Nov 08 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.fr.utf-8 b/runtime/tutor/tutor.fr.utf-8 index 9c44db13f4..4e42fd3cb9 100644 --- a/runtime/tutor/tutor.fr.utf-8 +++ b/runtime/tutor/tutor.fr.utf-8 @@ -61,8 +61,8 @@ NOTE : Les touches fléchées devraient également fonctionner. Mais en utilisan Ceci quitte l'éditeur SANS enregistrer les changements que vous avez faits. - 3. Lorsque l'invite du shell vous sera présentée, tapez la commande qui - vous a mené dans ce tutoriel. Cela pourrait être : vimtutor + 3. Revenez ici en tapant la commande qui vous a mené à ce tutoriel. + Cela pourrait être : vimtutor 4. Si vous avez mémorisé ces étapes et êtes confiant, effectuez les étapes 1 à 3 pour sortir puis rentrer dans l'éditeur. @@ -154,7 +154,7 @@ NOTE : En avançant dans ce cours, n'essayez pas de mémoriser, apprenez par !! NOTE : Lisez toute la leçon avant d'exécuter les instructions ci-dessous !! 1. Sortez de ce tutoriel comme vous l'avez fait dans la Leçon 1.2 : :q! - Ou, si vous avez accès à un autre terminal, exécutez y les actions + Ou, si vous avez accès à un autre terminal, exécutez-y les actions qui suivent. 2. À l'invite du shell, tapez cette commande : vim tutor @@ -704,7 +704,7 @@ NOTE : Si vous quittez Vim et le redémarrez de nouveau avec le fichier TEST, 3. Appuyez : . En bas de l'écran :'<,'> va apparaître. 4. Tapez w TEST , où TEST est un nom de fichier qui n'existe pas. - Vérifiez que vous voyez :'<,'>w TEST avant de d'appuyer sur . + Vérifiez que vous voyez :'<,'>w TEST avant d'appuyer sur . 5. Vim va enregistrer les lignes sélectionnées dans le fichier TEST. Utilisez :!dir ou :!ls pour le voir. Ne l'effacez pas encore ! @@ -1034,5 +1034,5 @@ NOTE : Le complètement fonctionne pour de nombreuses commandes. Essayez Dernières mises à jour par Dominique Pellé. E-mail : dominique.pelle@gmail.com - Last Change : 2016 Jul 02 + Last Change : 2016 Nov 08 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 7df915d113ac1981792c50e8b000c9f5f784b78b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 17 Nov 2016 17:25:32 +0100 Subject: [PATCH 2/7] patch 8.0.0087 Problem: When the channel callback gets job info the job may already have been deleted. (lifepillar) Solution: Do not delete the job when the channel is still useful. (ichizok, closes #1242, closes #1245) --- src/channel.c | 141 +++++++++++++++++++++-------------- src/eval.c | 2 +- src/os_unix.c | 4 +- src/os_win32.c | 2 +- src/structs.h | 4 +- src/testdir/test_channel.vim | 26 +++++++ src/version.c | 2 + 7 files changed, 122 insertions(+), 59 deletions(-) diff --git a/src/channel.c b/src/channel.c index 1ddb1ece35..778a30e17c 100644 --- a/src/channel.c +++ b/src/channel.c @@ -4433,19 +4433,66 @@ job_free(job_T *job) } } +#if defined(EXITFREE) || defined(PROTO) + void +job_free_all(void) +{ + while (first_job != NULL) + job_free(first_job); +} +#endif + +/* + * Return TRUE if we need to check if the process of "job" has ended. + */ + static int +job_need_end_check(job_T *job) +{ + return job->jv_status == JOB_STARTED + && (job->jv_stoponexit != NULL || job->jv_exit_cb != NULL); +} + +/* + * Return TRUE if the channel of "job" is still useful. + */ + static int +job_channel_still_useful(job_T *job) +{ + return job->jv_channel != NULL && channel_still_useful(job->jv_channel); +} + +/* + * Return TRUE if the job should not be freed yet. Do not free the job when + * it has not ended yet and there is a "stoponexit" flag, an exit callback + * or when the associated channel will do something with the job output. + */ + static int +job_still_useful(job_T *job) +{ + return job_need_end_check(job) || job_channel_still_useful(job); +} + +/* + * NOTE: Must call job_cleanup() only once right after the status of "job" + * changed to JOB_ENDED (i.e. after job_status() returned "dead" first or + * mch_detect_ended_job() returned non-NULL). + */ static void job_cleanup(job_T *job) { if (job->jv_status != JOB_ENDED) return; + /* Ready to cleanup the job. */ + job->jv_status = JOB_FINISHED; + if (job->jv_exit_cb != NULL) { typval_T argv[3]; typval_T rettv; int dummy; - /* invoke the exit callback; make sure the refcount is > 0 */ + /* Invoke the exit callback. Make sure the refcount is > 0. */ ++job->jv_refcount; argv[0].v_type = VAR_JOB; argv[0].vval.v_job = job; @@ -4458,42 +4505,18 @@ job_cleanup(job_T *job) --job->jv_refcount; channel_need_redraw = TRUE; } - if (job->jv_refcount == 0) + + /* Do not free the job in case the close callback of the associated channel + * isn't invoked yet and may get information by job_info(). */ + if (job->jv_refcount == 0 && !job_channel_still_useful(job)) { - /* The job was already unreferenced, now that it ended it can be - * freed. Careful: caller must not use "job" after this! */ + /* The job was already unreferenced and the associated channel was + * detached, now that it ended it can be freed. Careful: caller must + * not use "job" after this! */ job_free(job); } } -#if defined(EXITFREE) || defined(PROTO) - void -job_free_all(void) -{ - while (first_job != NULL) - job_free(first_job); -} -#endif - -/* - * Return TRUE if the job should not be freed yet. Do not free the job when - * it has not ended yet and there is a "stoponexit" flag, an exit callback - * or when the associated channel will do something with the job output. - */ - static int -job_still_useful(job_T *job) -{ - return (job->jv_stoponexit != NULL || job->jv_exit_cb != NULL - || (job->jv_channel != NULL - && channel_still_useful(job->jv_channel))); -} - - static int -job_still_alive(job_T *job) -{ - return (job->jv_status == JOB_STARTED) && job_still_useful(job); -} - /* * Mark references in jobs that are still useful. */ @@ -4505,7 +4528,7 @@ set_ref_in_job(int copyID) typval_T tv; for (job = first_job; job != NULL; job = job->jv_next) - if (job_still_alive(job)) + if (job_still_useful(job)) { tv.v_type = VAR_JOB; tv.vval.v_job = job; @@ -4514,26 +4537,33 @@ set_ref_in_job(int copyID) return abort; } +/* + * Dereference "job". Note that after this "job" may have been freed. + */ void job_unref(job_T *job) { if (job != NULL && --job->jv_refcount <= 0) { - /* Do not free the job when it has not ended yet and there is a - * "stoponexit" flag or an exit callback. */ - if (!job_still_alive(job)) + /* Do not free the job if there is a channel where the close callback + * may get the job info. */ + if (!job_channel_still_useful(job)) { - job_free(job); - } - else if (job->jv_channel != NULL - && !channel_still_useful(job->jv_channel)) - { - /* Do remove the link to the channel, otherwise it hangs - * around until Vim exits. See job_free() for refcount. */ - ch_log(job->jv_channel, "detaching channel from job"); - job->jv_channel->ch_job = NULL; - channel_unref(job->jv_channel); - job->jv_channel = NULL; + /* Do not free the job when it has not ended yet and there is a + * "stoponexit" flag or an exit callback. */ + if (!job_need_end_check(job)) + { + job_free(job); + } + else if (job->jv_channel != NULL) + { + /* Do remove the link to the channel, otherwise it hangs + * around until Vim exits. See job_free() for refcount. */ + ch_log(job->jv_channel, "detaching channel from job"); + job->jv_channel->ch_job = NULL; + channel_unref(job->jv_channel); + job->jv_channel = NULL; + } } } } @@ -4546,7 +4576,7 @@ free_unused_jobs_contents(int copyID, int mask) for (job = first_job; job != NULL; job = job->jv_next) if ((job->jv_copyID & mask) != (copyID & mask) - && !job_still_alive(job)) + && !job_still_useful(job)) { /* Free the channel and ordinary items it contains, but don't * recurse into Lists, Dictionaries etc. */ @@ -4566,7 +4596,7 @@ free_unused_jobs(int copyID, int mask) { job_next = job->jv_next; if ((job->jv_copyID & mask) != (copyID & mask) - && !job_still_alive(job)) + && !job_still_useful(job)) { /* Free the job struct itself. */ job_free_job(job); @@ -4660,8 +4690,7 @@ has_pending_job(void) /* Only should check if the channel has been closed, if the channel is * open the job won't exit. */ if (job->jv_status == JOB_STARTED && job->jv_exit_cb != NULL - && (job->jv_channel == NULL - || !channel_still_useful(job->jv_channel))) + && !job_channel_still_useful(job)) return TRUE; return FALSE; } @@ -4676,14 +4705,18 @@ job_check_ended(void) { int i; + if (first_job == NULL) + return; + for (i = 0; i < MAX_CHECK_ENDED; ++i) { + /* NOTE: mch_detect_ended_job() must only return a job of which the + * status was just set to JOB_ENDED. */ job_T *job = mch_detect_ended_job(first_job); if (job == NULL) break; - if (job_still_useful(job)) - job_cleanup(job); /* may free "job" */ + job_cleanup(job); /* may free "job" */ } if (channel_need_redraw) @@ -4897,7 +4930,7 @@ job_status(job_T *job) { char *result; - if (job->jv_status == JOB_ENDED) + if (job->jv_status >= JOB_ENDED) /* No need to check, dead is dead. */ result = "dead"; else if (job->jv_status == JOB_FAILED) diff --git a/src/eval.c b/src/eval.c index 7ca129b378..9d2c5ac72b 100644 --- a/src/eval.c +++ b/src/eval.c @@ -7290,7 +7290,7 @@ get_tv_string_buf_chk(typval_T *varp, char_u *buf) if (job == NULL) return (char_u *)"no process"; status = job->jv_status == JOB_FAILED ? "fail" - : job->jv_status == JOB_ENDED ? "dead" + : job->jv_status >= JOB_ENDED ? "dead" : "run"; # ifdef UNIX vim_snprintf((char *)buf, NUMBUFLEN, diff --git a/src/os_unix.c b/src/os_unix.c index 6197c3fbdd..a63eb6e891 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5354,7 +5354,7 @@ mch_job_status(job_T *job) return "run"; return_dead: - if (job->jv_status != JOB_ENDED) + if (job->jv_status < JOB_ENDED) { ch_log(job->jv_channel, "Job ended"); job->jv_status = JOB_ENDED; @@ -5398,7 +5398,7 @@ mch_detect_ended_job(job_T *job_list) job->jv_exitval = WEXITSTATUS(status); else if (WIFSIGNALED(status)) job->jv_exitval = -1; - if (job->jv_status != JOB_ENDED) + if (job->jv_status < JOB_ENDED) { ch_log(job->jv_channel, "Job ended"); job->jv_status = JOB_ENDED; diff --git a/src/os_win32.c b/src/os_win32.c index 9fcb054d0e..f8e0f117d7 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -4978,7 +4978,7 @@ mch_job_status(job_T *job) || dwExitCode != STILL_ACTIVE) { job->jv_exitval = (int)dwExitCode; - if (job->jv_status != JOB_ENDED) + if (job->jv_status < JOB_ENDED) { ch_log(job->jv_channel, "Job ended"); job->jv_status = JOB_ENDED; diff --git a/src/structs.h b/src/structs.h index 31accea050..c749a3691d 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1421,11 +1421,13 @@ struct partial_S dict_T *pt_dict; /* dict for "self" */ }; +/* Status of a job. Order matters! */ typedef enum { JOB_FAILED, JOB_STARTED, - JOB_ENDED + JOB_ENDED, /* detected job done */ + JOB_FINISHED /* job done and cleanup done */ } jobstatus_T; /* diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim index c21e617b1e..42e0e04b81 100644 --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -1232,6 +1232,32 @@ func Test_out_cb_lambda() endtry endfunc +func Test_close_and_exit_cb() + if !has('job') + return + endif + call ch_log('Test_close_and_exit_cb') + + let dict = {'ret': {}} + func dict.close_cb(ch) dict + let self.ret['close_cb'] = job_status(ch_getjob(a:ch)) + endfunc + func dict.exit_cb(job, status) dict + let self.ret['exit_cb'] = job_status(a:job) + endfunc + + let g:job = job_start('echo', { + \ 'close_cb': dict.close_cb, + \ 'exit_cb': dict.exit_cb, + \ }) + call assert_equal('run', job_status(g:job)) + unlet g:job + call WaitFor('len(dict.ret) >= 2') + call assert_equal(2, len(dict.ret)) + call assert_match('^\%(dead\|run\)', dict.ret['close_cb']) + call assert_equal('dead', dict.ret['exit_cb']) +endfunc + """""""""" let g:Ch_unletResponse = '' diff --git a/src/version.c b/src/version.c index b1bf796ded..074c7ebc76 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 87, /**/ 86, /**/ From cc28e2d05d05552d8b72a520be8a193f3d9822d4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 17 Nov 2016 17:56:13 +0100 Subject: [PATCH 3/7] patch 8.0.0088 Problem: When a test fails in Setup or Teardown the problem is not reported. Solution: Add a try/catch. (Hirohito Higashi) --- src/testdir/runtest.vim | 14 ++++++++++++-- src/version.c | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index c4cb847324..3ba3b02648 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -89,7 +89,11 @@ endfunc function RunTheTest(test) echo 'Executing ' . a:test if exists("*SetUp") - call SetUp() + try + call SetUp() + catch + call add(v:errors, 'Caught exception in SetUp() before ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) + endtry endif call add(s:messages, 'Executing ' . a:test) @@ -104,7 +108,11 @@ function RunTheTest(test) endtry if exists("*TearDown") - call TearDown() + try + call TearDown() + catch + call add(v:errors, 'Caught exception in TearDown() after ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) + endtry endif " Close any extra windows and make the current one not modified. @@ -221,3 +229,5 @@ call append(line('$'), s:messages) write qall! + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 074c7ebc76..ada385c822 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 88, /**/ 87, /**/ From a859f04b4db651860c07db3587f29906517c552b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 17 Nov 2016 19:11:55 +0100 Subject: [PATCH 4/7] patch 8.0.0089 Problem: Various problems with GTK 3.22.2. Solution: Fix the problems, add #ifdefs. (Kazunobu Kuriyama) --- src/gui_beval.c | 11 +++++ src/gui_gtk.c | 71 +++++++++++++++++++++++++++++++ src/gui_gtk_x11.c | 106 +++++++++++++++++++++++++++++++++++++++++++++- src/version.c | 2 + 4 files changed, 188 insertions(+), 2 deletions(-) diff --git a/src/gui_beval.c b/src/gui_beval.c index 8569f60127..dd619450e5 100644 --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -1178,12 +1178,23 @@ drawBalloon(BalloonEval *beval) int y_offset = EVAL_OFFSET_Y; PangoLayout *layout; # ifdef HAVE_GTK_MULTIHEAD +# if GTK_CHECK_VERSION(3,22,2) + GdkRectangle rect; + GdkMonitor * const mon = gdk_display_get_monitor_at_window( + gtk_widget_get_display(beval->balloonShell), + gtk_widget_get_window(beval->balloonShell)); + gdk_monitor_get_geometry(mon, &rect); + + screen_w = rect.width; + screen_h = rect.height; +# else GdkScreen *screen; screen = gtk_widget_get_screen(beval->target); gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen); screen_w = gdk_screen_get_width(screen); screen_h = gdk_screen_get_height(screen); +# endif # else screen_w = gdk_screen_width(); screen_h = gdk_screen_height(); diff --git a/src/gui_gtk.c b/src/gui_gtk.c index 25a53eb236..8686381b0e 100644 --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -1881,10 +1881,36 @@ gui_mch_show_popupmenu(vimmenu_T *menu) # endif # endif /* FEAT_XIM */ +# if GTK_CHECK_VERSION(3,22,2) + { + GdkEventButton trigger; + + /* A pseudo event to have gtk_menu_popup_at_pointer() work. Since the + * function calculates the popup menu position on the basis of the + * actual pointer position when it is invoked, the fields x, y, x_root + * and y_root are set to zero for convenience. */ + trigger.type = GDK_BUTTON_PRESS; + trigger.window = gtk_widget_get_window(gui.drawarea); + trigger.send_event = FALSE; + trigger.time = gui.event_time; + trigger.x = 0.0; + trigger.y = 0.0; + trigger.axes = NULL; + trigger.state = 0; + trigger.button = 3; + trigger.device = NULL; + trigger.x_root = 0.0; + trigger.y_root = 0.0; + + gtk_menu_popup_at_pointer(GTK_MENU(menu->submenu_id), + (GdkEvent *)&trigger); + } +#else gtk_menu_popup(GTK_MENU(menu->submenu_id), NULL, NULL, (GtkMenuPositionFunc)NULL, NULL, 3U, gui.event_time); +#endif } /* Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to @@ -1942,10 +1968,55 @@ gui_make_popup(char_u *path_name, int mouse_pos) if (menu != NULL && menu->submenu_id != NULL) { +# if GTK_CHECK_VERSION(3,22,2) + GdkWindow * const win = gtk_widget_get_window(gui.drawarea); + GdkEventButton trigger; + + /* A pseudo event to have gtk_menu_popup_at_*() functions work. Since + * the position where the menu pops up is automatically adjusted by + * the functions, none of the fields x, y, x_root and y_root has to be + * set to a specific value here; therefore, they are set to zero for + * convenience.*/ + trigger.type = GDK_BUTTON_PRESS; + trigger.window = win; + trigger.send_event = FALSE; + trigger.time = GDK_CURRENT_TIME; + trigger.x = 0.0; + trigger.y = 0.0; + trigger.axes = NULL; + trigger.state = 0; + trigger.button = 0; + trigger.device = NULL; + trigger.x_root = 0.0; + trigger.y_root = 0.0; + + if (mouse_pos) + gtk_menu_popup_at_pointer(GTK_MENU(menu->submenu_id), + (GdkEvent *)&trigger); + else + { + gint origin_x, origin_y; + GdkRectangle rect = { 0, 0, 0, 0 }; + + gdk_window_get_origin(win, &origin_x, &origin_y); + popup_menu_position_func(NULL, &rect.x, &rect.y, NULL, NULL); + + rect.x -= origin_x; + rect.y -= origin_y; + + gtk_menu_popup_at_rect(GTK_MENU(menu->submenu_id), + win, + &rect, + GDK_GRAVITY_SOUTH_EAST, + GDK_GRAVITY_NORTH_WEST, + (GdkEvent *)&trigger); + } +# else gtk_menu_popup(GTK_MENU(menu->submenu_id), NULL, NULL, &popup_menu_position_func, NULL, 0U, (guint32)GDK_CURRENT_TIME); +# endif } } diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 388464215f..5020177d95 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -3076,10 +3076,16 @@ drawarea_unrealize_cb(GtkWidget *widget UNUSED, gpointer data UNUSED) gui.blank_pointer = NULL; } +#if GTK_CHECK_VERSION(3,22,2) + static void +drawarea_style_updated_cb(GtkWidget *widget UNUSED, + gpointer data UNUSED) +#else static void drawarea_style_set_cb(GtkWidget *widget UNUSED, GtkStyle *previous_style UNUSED, gpointer data UNUSED) +#endif { gui_mch_new_colors(); } @@ -3096,6 +3102,31 @@ drawarea_configure_event_cb(GtkWidget *widget, g_return_val_if_fail(event && event->width >= 1 && event->height >= 1, TRUE); +# if GTK_CHECK_VERSION(3,22,2) + /* As of 3.22.2, GdkWindows have started distributing configure events to + * their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0). + * + * As can be seen from the implementation of move_native_children() and + * configure_native_child() in gdkwindow.c, those functions actually + * propagate configure events to every child, failing to distinguish + * "native" one from non-native one. + * + * Naturally, configure events propagated to here like that are fallacious + * and, as a matter of fact, they trigger a geometric collapse of + * gui.drawarea in fullscreen and miximized modes. + * + * To filter out such nuisance events, we are making use of the fact that + * the field send_event of such GdkEventConfigures is set to FALSE in + * configure_native_child(). + * + * Obviously, this is a terrible hack making GVim depend on GTK's + * implementation details. Therefore, watch out any relevant internal + * changes happening in GTK in the feature (sigh). + */ + if (event->send_event == FALSE) + return TRUE; +# endif + if (event->width == cur_width && event->height == cur_height) return TRUE; @@ -3519,8 +3550,12 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event) /* If the event was generated for 3rd button popup the menu. */ if (bevent->button == 3) { +# if GTK_CHECK_VERSION(3,22,2) + gtk_menu_popup_at_pointer(GTK_MENU(widget), event); +# else gtk_menu_popup(GTK_MENU(widget), NULL, NULL, NULL, NULL, bevent->button, bevent->time); +# endif /* We handled the event. */ return TRUE; } @@ -4116,6 +4151,9 @@ gui_mch_init(void) #endif gui.drawarea = gtk_drawing_area_new(); +#if GTK_CHECK_VERSION(3,22,2) + gtk_widget_set_name(gui.drawarea, "vim-gui-drawarea"); +#endif #if GTK_CHECK_VERSION(3,0,0) gui.surface = NULL; gui.by_signal = FALSE; @@ -4167,8 +4205,13 @@ gui_mch_init(void) G_CALLBACK(drawarea_unrealize_cb), NULL); g_signal_connect(G_OBJECT(gui.drawarea), "configure-event", G_CALLBACK(drawarea_configure_event_cb), NULL); +# if GTK_CHECK_VERSION(3,22,2) + g_signal_connect_after(G_OBJECT(gui.drawarea), "style-updated", + G_CALLBACK(&drawarea_style_updated_cb), NULL); +# else g_signal_connect_after(G_OBJECT(gui.drawarea), "style-set", G_CALLBACK(&drawarea_style_set_cb), NULL); +# endif #else gtk_signal_connect(GTK_OBJECT(gui.drawarea), "realize", GTK_SIGNAL_FUNC(drawarea_realize_cb), NULL); @@ -4384,14 +4427,34 @@ set_cairo_source_rgba_from_color(cairo_t *cr, guicolor_T color) gui_mch_new_colors(void) { #if GTK_CHECK_VERSION(3,0,0) +# if !GTK_CHECK_VERSION(3,22,2) GdkWindow * const da_win = gtk_widget_get_window(gui.drawarea); +# endif if (gui.drawarea != NULL && gtk_widget_get_window(gui.drawarea) != NULL) #else if (gui.drawarea != NULL && gui.drawarea->window != NULL) #endif { -#if GTK_CHECK_VERSION(3,4,0) +#if GTK_CHECK_VERSION(3,22,2) + GtkStyleContext * const context + = gtk_widget_get_style_context(gui.drawarea); + GtkCssProvider * const provider = gtk_css_provider_new(); + gchar * const css = g_strdup_printf( + "widget#vim-gui-drawarea {\n" + " background-color: #%.2lx%.2lx%.2lx;\n" + "}\n", + (gui.back_pixel >> 16) & 0xff, + (gui.back_pixel >> 8) & 0xff, + gui.back_pixel & 0xff); + + gtk_css_provider_load_from_data(provider, css, -1, NULL); + gtk_style_context_add_provider(context, + GTK_STYLE_PROVIDER(provider), G_MAXUINT); + + g_free(css); + g_object_unref(provider); +#elif GTK_CHECK_VERSION(3,4,0) /* !GTK_CHECK_VERSION(3,22,2) */ GdkRGBA rgba; rgba = color_to_rgba(gui.back_pixel); @@ -4415,7 +4478,7 @@ gui_mch_new_colors(void) # else gdk_window_set_background(gui.drawarea->window, &color); # endif -#endif /* !GTK_CHECK_VERSION(3,4,0) */ +#endif /* !GTK_CHECK_VERSION(3,22,2) */ } } @@ -4429,6 +4492,26 @@ form_configure_event(GtkWidget *widget UNUSED, { int usable_height = event->height; +#if GTK_CHECK_VERSION(3,22,2) + /* As of 3.22.2, GdkWindows have started distributing configure events to + * their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0). + * + * As can be seen from the implementation of move_native_children() and + * configure_native_child() in gdkwindow.c, those functions actually + * propagate configure events to every child, failing to distinguish + * "native" one from non-native one. + * + * Naturally, configure events propagated to here like that are fallacious + * and, as a matter of fact, they trigger a geometric collapse of + * gui.formwin. + * + * To filter out such fallacious events, check if the given event is the + * one that was sent out to the right place. Ignore it if not. + */ + if (event->window != gtk_widget_get_window(gui.formwin)) + return TRUE; +#endif + /* When in a GtkPlug, we can't guarantee valid heights (as a round * no. of char-heights), so we have to manually sanitise them. * Widths seem to sort themselves out, don't ask me why. @@ -4890,6 +4973,16 @@ gui_mch_set_shellsize(int width, int height, gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) { #ifdef HAVE_GTK_MULTIHEAD +# if GTK_CHECK_VERSION(3,22,2) + GdkRectangle rect; + GdkMonitor * const mon = gdk_display_get_monitor_at_window( + gtk_widget_get_display(gui.mainwin), + gtk_widget_get_window(gui.mainwin)); + gdk_monitor_get_geometry(mon, &rect); + + *screen_w = rect.width; + *screen_h = rect.height - p_ghr; +# else GdkScreen* screen; if (gui.mainwin != NULL && gtk_widget_has_screen(gui.mainwin)) @@ -4899,6 +4992,7 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) *screen_w = gdk_screen_get_width(screen); *screen_h = gdk_screen_get_height(screen) - p_ghr; +# endif #else *screen_w = gdk_screen_width(); /* Subtract 'guiheadroom' from the height to allow some room for the @@ -6626,11 +6720,15 @@ gui_mch_clear_block(int row1, int col1, int row2, int col2) }; GdkWindow * const win = gtk_widget_get_window(gui.drawarea); cairo_t * const cr = cairo_create(gui.surface); +# if GTK_CHECK_VERSION(3,22,2) + set_cairo_source_rgba_from_color(cr, gui.back_pixel); +# else cairo_pattern_t * const pat = gdk_window_get_background_pattern(win); if (pat != NULL) cairo_set_source(cr, pat); else set_cairo_source_rgba_from_color(cr, gui.back_pixel); +# endif gdk_cairo_rectangle(cr, &rect); cairo_fill(cr); cairo_destroy(cr); @@ -6659,11 +6757,15 @@ gui_gtk_window_clear(GdkWindow *win) 0, 0, gdk_window_get_width(win), gdk_window_get_height(win) }; cairo_t * const cr = cairo_create(gui.surface); +# if GTK_CHECK_VERSION(3,22,2) + set_cairo_source_rgba_from_color(cr, gui.back_pixel); +# else cairo_pattern_t * const pat = gdk_window_get_background_pattern(win); if (pat != NULL) cairo_set_source(cr, pat); else set_cairo_source_rgba_from_color(cr, gui.back_pixel); +# endif gdk_cairo_rectangle(cr, &rect); cairo_fill(cr); cairo_destroy(cr); diff --git a/src/version.c b/src/version.c index ada385c822..1cf4d67430 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 89, /**/ 88, /**/ From 6c896867c4f5d759616028ef7cbfce2a9ed32600 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 17 Nov 2016 19:46:51 +0100 Subject: [PATCH 5/7] patch 8.0.0090 Problem: Test_help_complete sometimes fails in MS-Windows console. Solution: Use getcompletion() instead of feedkeys() and command line completion. (Hirohito Higashi) --- src/Makefile | 2 +- src/screen.c | 9 +- src/testdir/Make_all.mak | 2 +- src/testdir/test_breakindent.in | 122 ---------------- src/testdir/test_breakindent.ok | 74 ---------- src/testdir/test_breakindent.vim | 241 +++++++++++++++++++++++++++++++ src/version.c | 2 + 7 files changed, 251 insertions(+), 201 deletions(-) delete mode 100644 src/testdir/test_breakindent.in delete mode 100644 src/testdir/test_breakindent.ok create mode 100644 src/testdir/test_breakindent.vim diff --git a/src/Makefile b/src/Makefile index c519a3080d..7a6567736b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2029,7 +2029,6 @@ run_message_test: $(MESSAGE_TEST_TARGET) test1 \ test_autocmd_option \ test_autoformat_join \ - test_breakindent \ test_changelist \ test_close_count \ test_comparators \ @@ -2064,6 +2063,7 @@ test_arglist \ test_autochdir \ test_autocmd \ test_backspace_opt \ + test_breakindent \ test_bufwintabinfo \ test_cdo \ test_channel \ diff --git a/src/screen.c b/src/screen.c index 621f25c0d6..45e7c7c19a 100644 --- a/src/screen.c +++ b/src/screen.c @@ -3010,7 +3010,8 @@ win_line( #endif colnr_T trailcol = MAXCOL; /* start of trailing spaces */ #ifdef FEAT_LINEBREAK - int need_showbreak = FALSE; + int need_showbreak = FALSE; /* overlong line, skipping first x + chars */ #endif #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \ || defined(FEAT_SYN_HL) || defined(FEAT_DIFF) @@ -3793,13 +3794,15 @@ win_line( if (draw_state == WL_BRI - 1 && n_extra == 0) { draw_state = WL_BRI; - if (wp->w_p_bri && n_extra == 0 && row != startrow + /* if need_showbreak is set, breakindent also applies */ + if (wp->w_p_bri && n_extra == 0 + && (row != startrow || need_showbreak) # ifdef FEAT_DIFF && filler_lines == 0 # endif ) { - char_attr = 0; /* was: hl_attr(HLF_AT); */ + char_attr = 0; # ifdef FEAT_DIFF if (diff_hlf != (hlf_T)0) { diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 1c0c7157e6..49d2de0247 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -75,7 +75,6 @@ SCRIPTS_ALL = \ test108.out \ test_autocmd_option.out \ test_autoformat_join.out \ - test_breakindent.out \ test_changelist.out \ test_close_count.out \ test_comparators.out \ @@ -141,6 +140,7 @@ NEW_TESTS = test_arglist.res \ test_assert.res \ test_autochdir.res \ test_backspace_opt.res \ + test_breakindent.res \ test_bufwintabinfo.res \ test_cdo.res \ test_channel.res \ diff --git a/src/testdir/test_breakindent.in b/src/testdir/test_breakindent.in deleted file mode 100644 index d2869317f2..0000000000 --- a/src/testdir/test_breakindent.in +++ /dev/null @@ -1,122 +0,0 @@ -Test for breakindent - -STARTTEST -:so small.vim -:if !exists("+breakindent") | e! test.ok | w! test.out | qa! | endif -:10new|:vsp|:vert resize 20 -:put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\" -:set ts=4 sw=4 sts=4 breakindent -:fu! ScreenChar(line, width) -: let c='' -: for i in range(1,a:width) -: let c.=nr2char(screenchar(a:line, i)) -: endfor -: let c.="\n" -: for i in range(1,a:width) -: let c.=nr2char(screenchar(a:line+1, i)) -: endfor -: let c.="\n" -: for i in range(1,a:width) -: let c.=nr2char(screenchar(a:line+2, i)) -: endfor -: return c -:endfu -:fu DoRecordScreen() -: wincmd l -: $put =printf(\"\n%s\", g:test) -: $put =g:line1 -: wincmd p -:endfu -:set briopt=min:0 -:let g:test="Test 1: Simple breakindent" -:let line1=ScreenChar(line('.'),8) -:call DoRecordScreen() -:let g:test="Test 2: Simple breakindent + sbr=>>" -:set sbr=>> -:let line1=ScreenChar(line('.'),8) -:call DoRecordScreen() -:let g:test ="Test 3: Simple breakindent + briopt:sbr" -:set briopt=sbr,min:0 sbr=++ -:let line1=ScreenChar(line('.'),8) -:call DoRecordScreen() -:let g:test ="Test 4: Simple breakindent + min width: 18" -:set sbr= briopt=min:18 -:let line1=ScreenChar(line('.'),8) -:call DoRecordScreen() -:let g:test =" Test 5: Simple breakindent + shift by 2" -:set briopt=shift:2,min:0 -:let line1=ScreenChar(line('.'),8) -:call DoRecordScreen() -:let g:test=" Test 6: Simple breakindent + shift by -1" -:set briopt=shift:-1,min:0 -:let line1=ScreenChar(line('.'),8) -:call DoRecordScreen() -:let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr" -:set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 -:let line1=ScreenChar(line('.'),10) -:call DoRecordScreen() -:let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr" -:set briopt=shift:1,sbr,min:0 nu sbr=# list -:let line1=ScreenChar(line('.'),10) -:call DoRecordScreen() -:let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list" -:set briopt-=sbr -:let line1=ScreenChar(line('.'),10) -:call DoRecordScreen() -:let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n" -:set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 -:let line1=ScreenChar(line('.'),10) -:call DoRecordScreen() -:wincmd p -:let g:test="\n Test 11: strdisplaywidth when breakindent is on" -:set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 -:let text=getline(2) "skip leading tab when calculating text width -:let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times -:$put =g:test -:$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width) -:let g:str="\t\t\t\t\t{" -:let g:test=" Test 12: breakindent + long indent" -:wincmd p -:set all& breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 -:$put =g:str -zt:let line1=ScreenChar(1,10) -:wincmd p -:call DoRecordScreen() -:" -:" Test, that the string " a\tb\tc\td\te" is correctly -:" displayed in a 20 column wide window (see bug report -:" https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ -:only -:vert 20new -:set all& nocp breakindent briopt=min:10 -:call setline(1, [" a\tb\tc\td\te", " z y x w v"]) -:/^\s*a -fbgjyl:let line1 = @0 -:?^\s*z -fygjyl:let line2 = @0 -:quit! -:$put ='Test 13: breakindent with wrapping Tab' -:$put =line1 -:$put =line2 -:" -:let g:test="Test 14: breakindent + visual blockwise delete #1" -:set all& breakindent viminfo+=nviminfo -:30vnew -:normal! 3a1234567890 -:normal! a abcde -:exec "normal! 0\tex" -:let line1=ScreenChar(line('.'),8) -:call DoRecordScreen() -:" -:let g:test="Test 15: breakindent + visual blockwise delete #2" -:%d -:normal! 4a1234567890 -:exec "normal! >>\3f0x" -:let line1=ScreenChar(line('.'),20) -:call DoRecordScreen() -:quit! -:" -:%w! test.out -:qa! -ENDTEST -dummy text diff --git a/src/testdir/test_breakindent.ok b/src/testdir/test_breakindent.ok deleted file mode 100644 index 3eb9c24fd9..0000000000 --- a/src/testdir/test_breakindent.ok +++ /dev/null @@ -1,74 +0,0 @@ - - abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP - -Test 1: Simple breakindent - abcd - qrst - GHIJ - -Test 2: Simple breakindent + sbr=>> - abcd - >>qr - >>EF - -Test 3: Simple breakindent + briopt:sbr - abcd -++ qrst -++ GHIJ - -Test 4: Simple breakindent + min width: 18 - abcd - qrstuv - IJKLMN - - Test 5: Simple breakindent + shift by 2 - abcd - qr - EF - - Test 6: Simple breakindent + shift by -1 - abcd - qrstu - HIJKL - - Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr - 2 ab -? m -? x - - Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr - 2 ^Iabcd -# opq -# BCD - - Test 9: breakindent + shift by +1 + 'nu' + sbr=# list - 2 ^Iabcd - #op - #AB - - Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n - 2 ab -~ mn -~ yz - - Test 11: strdisplaywidth when breakindent is on -strdisplaywidth: 46 == calculated: 64 - { - - Test 12: breakindent + long indent -56 - -~ -Test 13: breakindent with wrapping Tab -d -w - -Test 14: breakindent + visual blockwise delete #1 -e -~ -~ - -Test 15: breakindent + visual blockwise delete #2 - 1234567890 -~ -~ diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim new file mode 100644 index 0000000000..bf363dcf8c --- /dev/null +++ b/src/testdir/test_breakindent.vim @@ -0,0 +1,241 @@ +" Test for breakindent +" +" Note: if you get strange failures when adding new tests, it might be that +" while the test is run, the breakindent cacheing gets in its way. +" It helps to change the tabastop setting and force a redraw (e.g. see +" Test_breakindent08()) +if !exists('+breakindent') + finish +endif + +let s:input ="\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" + +function s:screenline(lnum, width) abort + " always get 4 screen lines + redraw! + let line = [] + for j in range(3) + for c in range(1, a:width) + call add(line, nr2char(screenchar(a:lnum+j, c))) + endfor + call add(line, "\n") + endfor + return join(line, '') +endfunction + +function s:testwindows(...) + 10new + vsp + vert resize 20 + setl ts=4 sw=4 sts=4 breakindent + put =s:input + if a:0 + exe a:1 + endif +endfunction + +function s:close_windows(...) + bw! + if a:0 + exe a:1 + endif + unlet! g:line g:expect +endfunction + +function Test_breakindent01() + " simple breakindent test + call s:testwindows('setl briopt=min:0') + let g:line=s:screenline(line('.'),8) + let g:expect=" abcd\n qrst\n GHIJ\n" + call assert_equal(g:expect, g:line) + call s:close_windows() +endfunction + +function Test_breakindent02() + " simple breakindent test with showbreak set + call s:testwindows('setl briopt=min:0 sbr=>>') + let g:line=s:screenline(line('.'),8) + let g:expect=" abcd\n >>qr\n >>EF\n" + call assert_equal(g:expect, g:line) + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent03() + " simple breakindent test with showbreak set and briopt including sbr + call s:testwindows('setl briopt=sbr,min:0 sbr=++') + let g:line=s:screenline(line('.'),8) + let g:expect=" abcd\n++ qrst\n++ GHIJ\n" + call assert_equal(g:expect, g:line) + " clean up + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent04() + " breakindent set with min width 18 + call s:testwindows('setl sbr= briopt=min:18') + let g:line=s:screenline(line('.'),8) + let g:expect=" abcd\n qrstuv\n IJKLMN\n" + call assert_equal(g:expect, g:line) + " clean up + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent05() + " breakindent set and shift by 2 + call s:testwindows('setl briopt=shift:2,min:0') + let g:line=s:screenline(line('.'),8) + let g:expect=" abcd\n qr\n EF\n" + call assert_equal(g:expect, g:line) + call s:close_windows() +endfunction + +function Test_breakindent06() + " breakindent set and shift by -1 + call s:testwindows('setl briopt=shift:-1,min:0') + let g:line=s:screenline(line('.'),8) + let g:expect=" abcd\n qrstu\n HIJKL\n" + call assert_equal(g:expect, g:line) + call s:close_windows() +endfunction + +function Test_breakindent07() + " breakindent set and shift by 1, Number set sbr=? and briopt:sbr + call s:testwindows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n') + let g:line=s:screenline(line('.'),10) + let g:expect=" 2 ab\n? m\n? x\n" + call assert_equal(g:expect, g:line) + " clean up + call s:close_windows('set sbr= cpo-=n') +endfunction + +function Test_breakindent07a() + " breakindent set and shift by 1, Number set sbr=? and briopt:sbr + call s:testwindows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4') + let g:line=s:screenline(line('.'),10) + let g:expect=" 2 ab\n ? m\n ? x\n" + call assert_equal(g:expect, g:line) + " clean up + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent08() + " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr + call s:testwindows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4') + " make sure, cache is invalidated! + set ts=8 + redraw! + set ts=4 + redraw! + let g:line=s:screenline(line('.'),10) + let g:expect=" 2 ^Iabcd\n# opq\n# BCD\n" + call assert_equal(g:expect, g:line) + call s:close_windows('set sbr= cpo-=n') +endfunction + +function Test_breakindent08a() + " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr + call s:testwindows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list') + let g:line=s:screenline(line('.'),10) + let g:expect=" 2 ^Iabcd\n # opq\n # BCD\n" + call assert_equal(g:expect, g:line) + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent09() + " breakindent set and shift by 1, Number and list set sbr=# + call s:testwindows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list') + let g:line=s:screenline(line('.'),10) + let g:expect=" 2 ^Iabcd\n #op\n #AB\n" + call assert_equal(g:expect, g:line) + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent10() + " breakindent set, Number set sbr=~ + call s:testwindows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0') + " make sure, cache is invalidated! + set ts=8 + redraw! + set ts=4 + redraw! + let g:line=s:screenline(line('.'),10) + let g:expect=" 2 ab\n~ mn\n~ yz\n" + call assert_equal(g:expect, g:line) + call s:close_windows('set sbr= cpo-=n') +endfunction + +function Test_breakindent11() + " test strdisplaywidth() + call s:testwindows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4') + let text=getline(2) + let width = strlen(text[1:])+indent(2)+strlen(&sbr)*3 " text wraps 3 times + call assert_equal(width, strdisplaywidth(text)) + call s:close_windows('set sbr=') +endfunction + +function Test_breakindent12() + " test breakindent with long indent + let s:input="\t\t\t\t\t{" + call s:testwindows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>-') + let g:line=s:screenline(2,16) + let g:expect=" 2 >--->--->--->\n ---{ \n~ \n" + call assert_equal(g:expect, g:line) + call s:close_windows('set nuw=4 listchars=') +endfunction + +function Test_breakindent13() + let s:input="" + call s:testwindows('setl breakindent briopt=min:10 ts=8') + vert resize 20 + call setline(1, [" a\tb\tc\td\te", " z y x w v"]) + 1 + norm! fbgj"ayl + 2 + norm! fygj"byl + call assert_equal('d', @a) + call assert_equal('w', @b) + call s:close_windows() +endfunction + +function Test_breakindent14() + let s:input="" + call s:testwindows('setl breakindent briopt= ts=8') + vert resize 30 + norm! 3a1234567890 + norm! a abcde + exec "norm! 0\tex" + let g:line=s:screenline(line('.'),8) + let g:expect="e \n~ \n~ \n" + call assert_equal(g:expect, g:line) + call s:close_windows() +endfunction + +function Test_breakindent15() + let s:input="" + call s:testwindows('setl breakindent briopt= ts=8 sw=8') + vert resize 30 + norm! 4a1234567890 + exe "normal! >>\3f0x" + let g:line=s:screenline(line('.'),20) + let g:expect=" 1234567890 \n~ \n~ \n" + call assert_equal(g:expect, g:line) + call s:close_windows() +endfunction + +function Test_breakindent16() + " Check that overlong lines are indented correctly. + " TODO: currently it does not fail even when the bug is not fixed. + let s:input="" + call s:testwindows('setl breakindent briopt=min:0 ts=4') + call setline(1, "\t".repeat("1234567890", 10)) + resize 6 + norm! 1gg$ + redraw! + let g:line=s:screenline(1,10) + let g:expect=" 123456\n 789012\n 345678\n" + call assert_equal(g:expect, g:line) + let g:line=s:screenline(4,10) + let g:expect=" 901234\n 567890\n 123456\n" + call assert_equal(g:expect, g:line) + call s:close_windows() +endfunction diff --git a/src/version.c b/src/version.c index 1cf4d67430..d00ebd465f 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 90, /**/ 89, /**/ From 9f0e423c2818c0cacd0810f9c3c67cbb6b80963d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 17 Nov 2016 19:48:18 +0100 Subject: [PATCH 6/7] patch 8.0.0091 Problem: Test_help_complete sometimes fails in MS-Windows console. Solution: Use getcompletion() instead of feedkeys() and command line completion. (Hirohito Higashi) --- src/testdir/test_help_tagjump.vim | 57 +++++++++++++------------------ src/version.c | 2 ++ 2 files changed, 26 insertions(+), 33 deletions(-) diff --git a/src/testdir/test_help_tagjump.vim b/src/testdir/test_help_tagjump.vim index 778bd9c71f..d11a1fafbd 100644 --- a/src/testdir/test_help_tagjump.vim +++ b/src/testdir/test_help_tagjump.vim @@ -77,17 +77,8 @@ func s:doc_config_teardown() endif endfunc -func s:get_cmd_compl_list(cmd) - let list = [] - let str = '' - for cnt in range(1, 999) - call feedkeys(a:cmd . repeat("\", cnt) . "'\let str='\", 'tx') - if str ==# a:cmd[1:] - break - endif - call add(list, str) - endfor - return list +func s:get_help_compl_list(cmd) + return getcompletion(a:cmd, 'help') endfunc func Test_help_complete() @@ -99,49 +90,49 @@ func Test_help_complete() if has('multi_lang') set helplang= endif - let list = s:get_cmd_compl_list(":h test") - call assert_equal(['h test-col', 'h test-char'], list) + let list = s:get_help_compl_list("test") + call assert_equal(['test-col', 'test-char'], list) if has('multi_lang') " 'helplang=ab' and help file lang is 'en' set helplang=ab - let list = s:get_cmd_compl_list(":h test") - call assert_equal(['h test-col', 'h test-char'], list) + let list = s:get_help_compl_list("test") + call assert_equal(['test-col', 'test-char'], list) " 'helplang=' and help file lang is 'en' and 'ab' set rtp+=Xdir1/doc-ab set helplang= - let list = s:get_cmd_compl_list(":h test") - call assert_equal(sort(['h test-col@en', 'h test-col@ab', - \ 'h test-char@en', 'h test-char@ab']), sort(list)) + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col@en', 'test-col@ab', + \ 'test-char@en', 'test-char@ab']), sort(list)) " 'helplang=ab' and help file lang is 'en' and 'ab' set helplang=ab - let list = s:get_cmd_compl_list(":h test") - call assert_equal(sort(['h test-col', 'h test-col@en', - \ 'h test-char', 'h test-char@en']), sort(list)) + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col', 'test-col@en', + \ 'test-char', 'test-char@en']), sort(list)) " 'helplang=' and help file lang is 'en', 'ab' and 'ja' set rtp+=Xdir1/doc-ja set helplang= - let list = s:get_cmd_compl_list(":h test") - call assert_equal(sort(['h test-col@en', 'h test-col@ab', - \ 'h test-col@ja', 'h test-char@en', - \ 'h test-char@ab', 'h test-char@ja']), sort(list)) + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col@en', 'test-col@ab', + \ 'test-col@ja', 'test-char@en', + \ 'test-char@ab', 'test-char@ja']), sort(list)) " 'helplang=ab' and help file lang is 'en', 'ab' and 'ja' set helplang=ab - let list = s:get_cmd_compl_list(":h test") - call assert_equal(sort(['h test-col', 'h test-col@en', - \ 'h test-col@ja', 'h test-char', - \ 'h test-char@en', 'h test-char@ja']), sort(list)) + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col', 'test-col@en', + \ 'test-col@ja', 'test-char', + \ 'test-char@en', 'test-char@ja']), sort(list)) " 'helplang=ab,ja' and help file lang is 'en', 'ab' and 'ja' set helplang=ab,ja - let list = s:get_cmd_compl_list(":h test") - call assert_equal(sort(['h test-col', 'h test-col@ja', - \ 'h test-col@en', 'h test-char', - \ 'h test-char@ja', 'h test-char@en']), sort(list)) + let list = s:get_help_compl_list("test") + call assert_equal(sort(['test-col', 'test-col@ja', + \ 'test-col@en', 'test-char', + \ 'test-char@ja', 'test-char@en']), sort(list)) endif catch call assert_exception('X') diff --git a/src/version.c b/src/version.c index d00ebd465f..f07437de95 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 91, /**/ 90, /**/ From ca8b8d6956dd881de6446fc32c38e817a364a6cc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 17 Nov 2016 21:30:27 +0100 Subject: [PATCH 7/7] patch 8.0.0092 Problem: C indenting does not support nested namespaces that C++ 17 has. Solution: Add check that passes double colon inside a name. (Pauli, closes #1214) --- src/misc1.c | 9 +++++++++ src/testdir/test3.in | 20 ++++++++++++++++++++ src/testdir/test3.ok | 20 ++++++++++++++++++++ src/version.c | 2 ++ 4 files changed, 51 insertions(+) diff --git a/src/misc1.c b/src/misc1.c index 6bf7d75776..3630d7b3b3 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -5762,6 +5762,7 @@ cin_is_cpp_namespace(char_u *s) { char_u *p; int has_name = FALSE; + int has_name_start = FALSE; s = cin_skipcomment(s); if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) @@ -5780,10 +5781,18 @@ cin_is_cpp_namespace(char_u *s) } else if (vim_iswordc(*p)) { + has_name_start = TRUE; if (has_name) return FALSE; /* word character after skipping past name */ ++p; } + else if (p[0] == ':' && p[1] == ':' && vim_iswordc(p[2])) + { + if (!has_name_start || has_name) + return FALSE; + /* C++ 17 nested namespace */ + p += 3; + } else { return FALSE; diff --git a/src/testdir/test3.in b/src/testdir/test3.in index c0a68d0941..096f15219d 100644 --- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -1932,6 +1932,26 @@ namespace test { 111111111111111111; } +namespace test::cpp17 +{ + 111111111111111111; +} +namespace ::incorrectcpp17 +{ + 111111111111111111; +} +namespace test::incorrectcpp17:: +{ + 111111111111111111; +} +namespace test:incorrectcpp17 +{ + 111111111111111111; +} +namespace test:::incorrectcpp17 +{ + 111111111111111111; +} namespace{ 111111111111111111; } diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok index c4c01a3d4f..2f9572cc13 100644 --- a/src/testdir/test3.ok +++ b/src/testdir/test3.ok @@ -1730,6 +1730,26 @@ namespace test { 111111111111111111; } +namespace test::cpp17 +{ +111111111111111111; +} +namespace ::incorrectcpp17 +{ + 111111111111111111; +} +namespace test::incorrectcpp17:: +{ + 111111111111111111; +} +namespace test:incorrectcpp17 +{ + 111111111111111111; +} +namespace test:::incorrectcpp17 +{ + 111111111111111111; +} namespace{ 111111111111111111; } diff --git a/src/version.c b/src/version.c index f07437de95..5db35abc22 100644 --- a/src/version.c +++ b/src/version.c @@ -764,6 +764,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 92, /**/ 91, /**/