From 9c8816bd306a003c2ac3dce161be3fef481c9902 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 19 Feb 2018 21:50:42 +0100 Subject: [PATCH 1/6] patch 8.0.1524: compiler warnings for uninitialized variables Problem: Compiler warnings for uninitialized variables. (Tony Mechelynck) Solution: Initialize variables. --- src/terminal.c | 6 +++--- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/terminal.c b/src/terminal.c index bcdc70025f..0f9aa8640d 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -3277,9 +3277,9 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff) char_u buf1[NUMBUFLEN]; char_u buf2[NUMBUFLEN]; char_u *fname1; - char_u *fname2; + char_u *fname2 = NULL; FILE *fd1; - FILE *fd2; + FILE *fd2 = NULL; char_u *textline = NULL; /* First open the files. If this fails bail out. */ @@ -3460,7 +3460,7 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff) theend: vim_free(textline); fclose(fd1); - if (do_diff) + if (fd2 != NULL) fclose(fd2); } diff --git a/src/version.c b/src/version.c index 11c5133911..78b8431d17 100644 --- a/src/version.c +++ b/src/version.c @@ -771,6 +771,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1524, /**/ 1523, /**/ From 7a76092a51fc5446426a4bfd9eb6503ec61bf9e9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 19 Feb 2018 23:10:02 +0100 Subject: [PATCH 2/6] patch 8.0.1525: using :wqa exits even if a job runs in a terminal window Problem: Using :wqa exits even if a job runs in a terminal window. (Jason Felice) Solution: Check if a terminal has a running job. (closes #2654) --- src/buffer.c | 4 ++-- src/ex_cmds.c | 8 ++++++++ src/ex_cmds2.c | 2 +- src/proto/buffer.pro | 2 +- src/testdir/test_terminal.vim | 9 +++++++++ src/version.c | 2 ++ 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index c3e0c50801..a3a7e00c47 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1875,10 +1875,10 @@ no_write_message(void) } void -no_write_message_nobang(void) +no_write_message_nobang(buf_T *buf UNUSED) { #ifdef FEAT_TERMINAL - if (term_job_running(curbuf->b_term)) + if (term_job_running(buf->b_term)) EMSG(_("E948: Job still running")); else #endif diff --git a/src/ex_cmds.c b/src/ex_cmds.c index a4d6221b01..e05215a596 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3428,6 +3428,14 @@ do_wqall(exarg_T *eap) FOR_ALL_BUFFERS(buf) { +#ifdef FEAT_TERMINAL + if (exiting && term_job_running(buf->b_term)) + { + no_write_message_nobang(buf); + ++error; + } + else +#endif if (bufIsChanged(buf) && !bt_dontwrite(buf)) { /* diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 6476d55169..805e8c4587 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -2110,7 +2110,7 @@ check_changed(buf_T *buf, int flags) if (flags & CCGD_EXCMD) no_write_message(); else - no_write_message_nobang(); + no_write_message_nobang(curbuf); return TRUE; } return FALSE; diff --git a/src/proto/buffer.pro b/src/proto/buffer.pro index 485eb027de..8b98843547 100644 --- a/src/proto/buffer.pro +++ b/src/proto/buffer.pro @@ -14,7 +14,7 @@ void set_curbuf(buf_T *buf, int action); void enter_buffer(buf_T *buf); void do_autochdir(void); void no_write_message(void); -void no_write_message_nobang(void); +void no_write_message_nobang(buf_T *buf); buf_T *buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags); void free_buf_options(buf_T *buf, int free_p_ff); int buflist_getfile(int n, linenr_T lnum, int options, int forceit); diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 0c2e289c10..ac54bbc1e1 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -712,6 +712,15 @@ func Test_terminal_wall() unlet g:job endfunc +func Test_terminal_wqall() + let buf = Run_shell_in_terminal({}) + call assert_fails('wqall', 'E948') + call Stop_shell_in_terminal(buf) + call term_wait(buf) + exe buf . 'bwipe' + unlet g:job +endfunc + func Test_terminal_composing_unicode() let save_enc = &encoding set encoding=utf-8 diff --git a/src/version.c b/src/version.c index 78b8431d17..3bed185ec3 100644 --- a/src/version.c +++ b/src/version.c @@ -771,6 +771,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1525, /**/ 1524, /**/ From da65058a9c4774dc534c7ae98d24c58b5db669fa Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 20 Feb 2018 15:51:40 +0100 Subject: [PATCH 3/6] patch 8.0.1526: no test using a screen dump yet Problem: No test using a screen dump yet. Solution: Add a test for C syntax highlighting. Add helper functions. --- runtime/doc/terminal.txt | 138 ++++++++++++++++++++---- src/terminal.c | 9 +- src/testdir/README.txt | 6 ++ src/testdir/dumps/Test_syntax_c_01.dump | 20 ++++ src/testdir/screendump.vim | 65 +++++++++++ src/testdir/shared.vim | 18 +++- src/testdir/test_syntax.vim | 38 ++++++- src/version.c | 2 + 8 files changed, 266 insertions(+), 30 deletions(-) create mode 100644 src/testdir/dumps/Test_syntax_c_01.dump create mode 100644 src/testdir/screendump.vim diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt index 896c55417e..9a35341f76 100644 --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -1,4 +1,4 @@ -*terminal.txt* For Vim version 8.0. Last change: 2018 Jan 28 +*terminal.txt* For Vim version 8.0. Last change: 2018 Feb 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -14,25 +14,29 @@ The terminal feature is optional, use this to check if your Vim has it: > If the result is "1" you have it. -1. Basic use |terminal-use| - Typing |terminal-typing| - Size and color |terminal-size-color| - Syntax |:terminal| - Resizing |terminal-resizing| - Terminal Modes |Terminal-mode| - Cursor style |terminal-cursor-style| - Special keys |terminal-special-keys| - Unix |terminal-unix| - MS-Windows |terminal-ms-windows| -2. Remote testing |terminal-testing| -3. Debugging |terminal-debug| - Starting |termdebug-starting| - Example session |termdebug-example| - Stepping through code |termdebug-stepping| - Inspecting variables |termdebug-variables| - Other commands |termdebug-commands| - Communication |termdebug-communication| - Customizing |termdebug-customizing| +1. Basic use |terminal-use| + Typing |terminal-typing| + Size and color |terminal-size-color| + Syntax |:terminal| + Resizing |terminal-resizing| + Terminal Modes |Terminal-mode| + Cursor style |terminal-cursor-style| + Special keys |terminal-special-keys| + Unix |terminal-unix| + MS-Windows |terminal-ms-windows| +2. Remote testing |terminal-testing| +3. Diffing screen dumps |terminal-diff| + Writing a screen dump test for Vim |terminal-dumptest| + Creating a screen dump |terminal-screendump| + Comparing screen dumps |terminal-diffscreendump| +4. Debugging |terminal-debug| + Starting |termdebug-starting| + Example session |termdebug-example| + Stepping through code |termdebug-stepping| + Inspecting variables |termdebug-variables| + Other commands |termdebug-commands| + Communication |termdebug-communication| + Customizing |termdebug-customizing| {Vi does not have any of these commands} {only available when compiled with the |+terminal| feature} @@ -360,7 +364,97 @@ term_scrape() inspect terminal screen ============================================================================== -3. Debugging *terminal-debug* +3. Diffing screen dumps *terminal-diff* + +In some cases it can be bothersome to test that Vim displays the right +characters on the screen. E.g. with syntax highlighting. To make this +simpler it is possible to take a screen dump of a terminal and compare it to +an expected screen dump. + +Vim uses the window size, text, color and other attributes as displayed. The +Vim screen size, font and other properties do not matter. Therefore this +mechanism is portable across systems. A convential screenshot would reflect +all differences, including font size and family. + + +Writing a screen dump test for Vim ~ + *terminal-dumptest* +For an example see the Test_syntax_c() function in +src/testdir/test_syntax.vim. The main parts are: +- Write a file you want to test with. This is useful for testing syntax + highlighting. You can also start Vim with en empty buffer. +- Run Vim in a terminal with a specific size. The default is 20 lines of 75 + characters. This makes sure the dump is always this size. The function + RunVimInTerminal() takes care of this. Pass it the arguments for the Vim + command. +- Send any commands to Vim using term_sendkeys(). For example: > + call term_sendkeys(buf, ":echo &lines &columns\") +- Check that the screen is now in the expected state, using + VerifyScreenDump(). This expects the reference screen dump to be in the + src/testdir/dumps/ directory. Pass the name without ".dump". It is + recommended to use the name of the test function and a sequence number, so + that we know what test is using the file. +- Repeat sending commands and checking the state. +- Finally stop Vim by calling StopVimInTerminal(). + +The first time you do this you won't have a screen dump yet. Create an empty +file for now, e.g.: > + touch src/testdir/dumps/Test_function_name_01.dump + +The test will then fail, giving you the command to compare the reference dump +and the failed dump, e.g.: > + call term_dumpdiff("Test_func.dump.failed", "dumps/Test_func.dump") + +Use this command in Vim, with the current directory set to src/testdir. +Once you are satisfied with the test, move the failed dump in place of the +reference: > + :!mv Test_func.dump.failed dumps/Test_func.dump + + +Creating a screen dump ~ + *terminal-screendump* + +To create the screen dump, run Vim (or any other program) in a terminal and +make it show the desired state. Then use the term_dumpwrite() function to +create a screen dump file. For example: > + :call term_dumpwrite(77, "mysyntax.dump") + +Here "77" is the buffer number of the terminal. Use `:ls!` to see it. + +You can view the screen dump with term_dumpload(): > + :call term_dumpload("mysyntax.dump") + +To verify that Vim still shows exactly the same screen, run Vim again with +exactly the same way to show the desired state. Then create a screen dump +again, using a different file name: > + :call term_dumpwrite(88, "test.dump") + +To assert that the files are exactly the same use assert_equalfile(): > + call assert_equalfile("mysyntax.dump", "test.dump") + +If there are differences then v:errors will contain the error message. + + +Comparing screen dumps ~ + *terminal-diffscreendump* + +assert_equalfile() does not make it easy to see what is different. +To spot the problem use term_dumpdiff(): > + call term_dumpdiff("mysyntax.dump", "test.dump") + +This will open a window consisting of three parts: +1. The contents of the first dump +2. The difference between the first and second dump +3. The contents of the second dump + +You can usually see what differs in the second part. Use the 'ruler' to +relate it to the postion in the first or second dump. + +Alternatively, press "s" to swap the first and second dump. Do this everal +times so that you can spot the difference in the context of the text. + +============================================================================== +4. Debugging *terminal-debug* The Terminal debugging plugin can be used to debug a program with gdb and view the source code in a Vim window. Since this is completely contained inside @@ -475,7 +569,7 @@ In the window showing the source code these commands can used to control gdb: :Delete delete a breakpoint at the current line :Step execute the gdb "step" command - :Over execute the gdb "next" command (:Next is a Vim command) + :Over execute the gdb "next" command (:Next is a Vim command) :Finish execute the gdb "finish" command :Continue execute the gdb "continue" command :Stop interrupt the program diff --git a/src/terminal.c b/src/terminal.c index 0f9aa8640d..73554a1066 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -410,10 +410,13 @@ term_start(typval_T *argvar, jobopt_T *opt, int without_job, int forceit) if (!opt->jo_hidden) { - /* only one size was taken care of with :new, do the other one */ - if (opt->jo_term_rows > 0 && (cmdmod.split & WSP_VERT)) + /* Only one size was taken care of with :new, do the other one. With + * "curwin" both need to be done. */ + if (opt->jo_term_rows > 0 && (opt->jo_curwin + || (cmdmod.split & WSP_VERT))) win_setheight(opt->jo_term_rows); - if (opt->jo_term_cols > 0 && !(cmdmod.split & WSP_VERT)) + if (opt->jo_term_cols > 0 && (opt->jo_curwin + || !(cmdmod.split & WSP_VERT))) win_setwidth(opt->jo_term_cols); } diff --git a/src/testdir/README.txt b/src/testdir/README.txt index 6cdf12fffb..7aa185f0a8 100644 --- a/src/testdir/README.txt +++ b/src/testdir/README.txt @@ -35,6 +35,12 @@ What you can use (see test_assert.vim for an example): - See the start of runtest.vim for more help. +TO ADD A SCREEN DUMP TEST: + +Mostly the same as writing a new style test. Additonally, see help on +"terminal-dumptest". Put the reference dump in "dumps/Test_func_name.dump". + + TO ADD AN OLD STYLE TEST: 1) Create test_.in and test_.ok files. diff --git a/src/testdir/dumps/Test_syntax_c_01.dump b/src/testdir/dumps/Test_syntax_c_01.dump new file mode 100644 index 0000000000..8cb0439c4d --- /dev/null +++ b/src/testdir/dumps/Test_syntax_c_01.dump @@ -0,0 +1,20 @@ +|/+0#0000e05#ffffff16|*| |c|o|m@1|e|n|t| |l|i|n|e| |a|t| |t|h|e| |t|o|p| |*|/| +0#0000001&@45 +| @1|i+0#00e0003&|n|t| +0#0000001&@69 +|m|a|i|n|(|i+0#00e0003&|n|t| +0#0000001&|a|r|g|c|,| |c+0#00e0003&|h|a|r| +0#0000001&|*@1|a|r|g|v|)|/+0#0000e05&@1| |a|n|o|t|h|e|r| |c|o|m@1|e|n|t| +0#0000001&@29 +|{| @73 +|#+0#e000e06&|i|f| |0| +0#0000001&@69 +| +0#0000e05&@2|i|n|t| @2|n|o|t|_|u|s|e|d|;| +0#0000001&@56 +|#+0#e000e06&|e|l|s|e| +0#0000001&@69 +| @2|i+0#00e0003&|n|t| +0#0000001&@2|u|s|e|d|;| @60 +|#+0#e000e06&|e|n|d|i|f| +0#0000001&@68 +| @2|p|r|i|n|t|f|(|"+0#e000002&|J|u|s|t| |a|n| |e|x|a|m|p|l|e| |p|i|e|c|e| |o|f| |C| |c|o|d|e|\+0#e000e06&|n|"+0#e000002&|)+0#0000001&|;| @27 +| @2|r+0#af5f00255&|e|t|u|r|n| +0#0000001&|0+0#e000002&|x|0|f@1|;+0#0000001&| @58 +|}| @73 +| @2|s+0#00e0003&|t|a|t|i|c| +0#0000001&|v+0#00e0003&|o|i|d| +0#0000001&@60 +|m|y|F|u|n|c|t|i|o|n|(|c+0#00e0003&|o|n|s|t| +0#0000001&|d+0#00e0003&|o|u|b|l|e| +0#0000001&|c|o|u|n|t|,| |s+0#00e0003&|t|r|u|c|t| +0#0000001&|n|o|t|h|i|n|g|,| |l+0#00e0003&|o|n|g| +0#0000001&|t|h|e|r|e|)| |{| @14 +| @1|/+0#0000e05&@1| |1+0#e000002&|2|3|:+0#0000e05&| |n|o|t|h|i|n|g| |t|o| |r|e|a|d| |h|e|r|e| +0#0000001&@44 +| @1|f+0#af5f00255&|o|r| +0#0000001&|(|i+0#00e0003&|n|t| +0#0000001&|i| |=| |0+0#e000002&|;+0#0000001&| |i| |<| |c|o|u|n|t|;| |+@1|i|)| |{| @39 +| @3|b+0#af5f00255&|r|e|a|k|;+0#0000001&| @64 +| @1|}| @71 +|}| @73 +|"|X|t|e|s|t|.|c|"| |1|9|L|,| |3|6|4|C| @37|1|,|1| @10|A|l@1| diff --git a/src/testdir/screendump.vim b/src/testdir/screendump.vim new file mode 100644 index 0000000000..5131b935ae --- /dev/null +++ b/src/testdir/screendump.vim @@ -0,0 +1,65 @@ +" Functions shared by tests making screen dumps. + +" Only load this script once. +if exists('*RunVimInTerminal') + finish +endif + +source shared.vim + +" Run Vim with "arguments" in a new terminal window. +" By default uses a size of 20 lines and 75 columns. +" Returns the buffer number of the terminal. +" +" Options is a dictionary (not used yet). +func RunVimInTerminal(arguments, options) + " Make a horizontal and vertical split, so that we can get exactly the right + " size terminal window. Works only when we currently have one window. + call assert_equal(1, winnr('$')) + split + vsplit + + " Always doo this with 256 colors and a light background. + set t_Co=256 + hi Normal ctermfg=0 ctermbg=15 + + let cmd = GetVimCommandClean() + let cmd .= ' ' . a:arguments + let buf = term_start(cmd, {'curwin': 1, 'term_rows': 20, 'term_cols': 75}) + call assert_equal([20, 75], term_getsize(buf)) + + return buf +endfunc + +" Stop a Vim running in terminal buffer "buf". +func StopVimInTerminal(buf) + call assert_equal("running", term_getstatus(a:buf)) + call term_sendkeys(a:buf, ":qa!\") + call WaitFor('term_getstatus(' . a:buf . ') == "finished"') + only! +endfunc + +" Verify that Vim running in terminal buffer "buf" matches the screen dump. +" The file name used is "dumps/{filename}.dump". +" Will wait for up to a second for the screen dump to match. +func VerifyScreenDump(buf, filename) + let reference = 'dumps/' . a:filename . '.dump' + let testfile = a:filename . '.dump.failed' + + let i = 0 + while 1 + call delete(testfile) + call term_dumpwrite(a:buf, testfile) + if readfile(reference) == readfile(testfile) + call delete(testfile) + break + endif + if i == 100 + " Leave the test file around for inspection. + call assert_report('See dump file difference: call term_dumpdiff("' . testfile . '", "' . reference . '")') + break + endif + sleep 10m + let i += 1 + endwhile +endfunc diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim index 8042428cf4..b16fdce3e8 100644 --- a/src/testdir/shared.vim +++ b/src/testdir/shared.vim @@ -178,17 +178,20 @@ endfunc " The Makefile writes it as the first line in the "vimcmd" file. func GetVimProg() if !filereadable('vimcmd') - return '' + " Assume the script was sourced instead of running "make". + return '../vim' endif return readfile('vimcmd')[0] endfunc " Get the command to run Vim, with -u NONE and --not-a-term arguments. " If there is an argument use it instead of "NONE". -" Returns an empty string on error. func GetVimCommand(...) if !filereadable('vimcmd') - return '' + echo 'Cannot read the "vimcmd" file, falling back to ../vim.' + let lines = ['../vim'] + else + let lines = readfile('vimcmd') endif if a:0 == 0 let name = 'NONE' @@ -199,7 +202,6 @@ func GetVimCommand(...) " "vimcmd" file, including environment options. " Other Makefiles just write the executable in the first line, so fall back " to that if there is no second line. - let lines = readfile('vimcmd') let cmd = get(lines, 1, lines[0]) let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '') if cmd !~ '-u '. name @@ -210,6 +212,14 @@ func GetVimCommand(...) return cmd endfunc +" Get the command to run Vim, with --clean. +func GetVimCommandClean() + let cmd = GetVimCommand() + let cmd = substitute(cmd, '-u NONE', '--clean', '') + let cmd = substitute(cmd, '--not-a-term', '', '') + return cmd +endfunc + " Run Vim, using the "vimcmd" file and "-u NORC". " "before" is a list of Vim commands to be executed before loading plugins. " "after" is a list of Vim commands to be executed after loading plugins. diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim index 33d7203e33..e60bb52878 100644 --- a/src/testdir/test_syntax.vim +++ b/src/testdir/test_syntax.vim @@ -5,6 +5,9 @@ if !has("syntax") endif source view_util.vim +if has('terminal') + source screendump.vim +endif func GetSyntaxItem(pat) let c = '' @@ -497,7 +500,7 @@ func Test_conceal() bw! endfunc -fun Test_synstack_synIDtrans() +func Test_synstack_synIDtrans() new setfiletype c syntax on @@ -520,3 +523,36 @@ fun Test_synstack_synIDtrans() syn clear bw! endfunc + +" Check highlighting for a small piece of C code with a screen dump. +func Test_syntax_c() + if !has('terminal') + return + endif + call writefile([ + \ '/* comment line at the top */', + \ ' int', + \ 'main(int argc, char **argv)// another comment', + \ '{', + \ '#if 0', + \ ' int not_used;', + \ '#else', + \ ' int used;', + \ '#endif', + \ ' printf("Just an example piece of C code\n");', + \ ' return 0x0ff;', + \ '}', + \ ' static void', + \ 'myFunction(const double count, struct nothing, long there) {', + \ ' // 123: nothing to read here', + \ ' for (int i = 0; i < count; ++i) {', + \ ' break;', + \ ' }', + \ '}', + \ ], 'Xtest.c') + let buf = RunVimInTerminal('Xtest.c', {}) + call VerifyScreenDump(buf, 'Test_syntax_c_01') + call StopVimInTerminal(buf) + + call delete('Xtest.c') +endfun diff --git a/src/version.c b/src/version.c index 3bed185ec3..9c869caee2 100644 --- a/src/version.c +++ b/src/version.c @@ -771,6 +771,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1526, /**/ 1525, /**/ From 3cc9f7440d857ff8360c15bb11e4e6229463920e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 20 Feb 2018 17:09:16 +0100 Subject: [PATCH 4/6] patch 8.0.1527: screen dump test fails on MS-Windows Problem: Screen dump test fails on MS-Windows. Solution: Skip dump test on MS-Windows for now. --- src/testdir/test_syntax.vim | 3 ++- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim index e60bb52878..554ff1620b 100644 --- a/src/testdir/test_syntax.vim +++ b/src/testdir/test_syntax.vim @@ -526,7 +526,8 @@ endfunc " Check highlighting for a small piece of C code with a screen dump. func Test_syntax_c() - if !has('terminal') + " Need to be able to run terminal Vim with 256 colors. + if !has('terminal') || has('win32') return endif call writefile([ diff --git a/src/version.c b/src/version.c index 9c869caee2..5bd6ead3a6 100644 --- a/src/version.c +++ b/src/version.c @@ -771,6 +771,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1527, /**/ 1526, /**/ From 81226e03102dd00b7cdce0e00775e1e30462f9a6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 20 Feb 2018 21:44:45 +0100 Subject: [PATCH 5/6] patch 8.0.1528: dead code found Problem: Dead code found. Solution: Remove the useless lines. (CodeAi, closes #2656) --- src/screen.c | 3 +-- src/spell.c | 1 - src/syntax.c | 1 - src/version.c | 2 ++ src/window.c | 2 -- 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/screen.c b/src/screen.c index 97f69882bf..8b7a519c08 100644 --- a/src/screen.c +++ b/src/screen.c @@ -10182,7 +10182,7 @@ screen_del_lines( } /* - * show the current mode and ruler + * Show the current mode and ruler. * * If clear_cmdline is TRUE, clear the rest of the cmdline. * If clear_cmdline is FALSE there may be a message there that needs to be @@ -10291,7 +10291,6 @@ showmode(void) msg_puts_attr(edit_submode_extra, sub_attr); } } - length = 0; } else #endif diff --git a/src/spell.c b/src/spell.c index 3c53d1d250..0e08e9e7b4 100644 --- a/src/spell.c +++ b/src/spell.c @@ -2404,7 +2404,6 @@ did_set_spelllang(win_T *wp) { vim_strncpy(region_cp, p + 1, 2); mch_memmove(p, p + 3, len - (p - lang) - 2); - len -= 3; region = region_cp; } else diff --git a/src/syntax.c b/src/syntax.c index e85dca76da..fcffdbf8af 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -6814,7 +6814,6 @@ syntime_report(void) MSG_PUTS("\n"); for (idx = 0; idx < ga.ga_len && !got_int; ++idx) { - spp = &(SYN_ITEMS(curwin->w_s)[idx]); p = ((time_entry_T *)ga.ga_data) + idx; MSG_PUTS(profile_msg(&p->total)); diff --git a/src/version.c b/src/version.c index 5bd6ead3a6..52b447e3a6 100644 --- a/src/version.c +++ b/src/version.c @@ -771,6 +771,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1528, /**/ 1527, /**/ diff --git a/src/window.c b/src/window.c index 38e1591cce..40a4607d0f 100644 --- a/src/window.c +++ b/src/window.c @@ -1899,7 +1899,6 @@ win_equal_rec( for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) { - n = m = 0; wincount = 1; if (fr->fr_next == NULL) /* last frame gets all that remains (avoid roundoff error) */ @@ -2041,7 +2040,6 @@ win_equal_rec( for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) { - n = m = 0; wincount = 1; if (fr->fr_next == NULL) /* last frame gets all that remains (avoid roundoff error) */ From 3049418f3dbc571463a04d068069f6c5b7a8ccf1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 20 Feb 2018 21:46:05 +0100 Subject: [PATCH 6/6] patch 8.0.1529: assert_equalfile() does not close file descriptors Problem: Assert_equalfile() does not close file descriptors. (Coverity) Solution: Close the file descriptors. --- src/eval.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/eval.c b/src/eval.c index d891353f00..98288d6b03 100644 --- a/src/eval.c +++ b/src/eval.c @@ -8889,6 +8889,8 @@ assert_equalfile(typval_T *argvars) } ++count; } + fclose(fd1); + fclose(fd2); } } if (IObuff[0] != NUL) diff --git a/src/version.c b/src/version.c index 52b447e3a6..aa236d28f2 100644 --- a/src/version.c +++ b/src/version.c @@ -771,6 +771,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1529, /**/ 1528, /**/