From 64f37d309025a65210dbc33823ec9ec5d547775f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 31 Aug 2020 19:58:13 +0200 Subject: [PATCH 01/33] patch 8.2.1552: warnings from asan with clang-11 Problem: Warnings from asan with clang-11. (James McCoy) Solution: Avoid using a NULL pointer. (issue #6811) --- src/fold.c | 34 +++++++++++++++++++++++----------- src/version.c | 2 ++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/fold.c b/src/fold.c index 043037fa64..e4ae9cbc0b 100644 --- a/src/fold.c +++ b/src/fold.c @@ -820,13 +820,16 @@ foldUpdate(win_T *wp, linenr_T top, linenr_T bot) return; #endif - // Mark all folds from top to bot as maybe-small. - (void)foldFind(&wp->w_folds, top, &fp); - while (fp < (fold_T *)wp->w_folds.ga_data + wp->w_folds.ga_len - && fp->fd_top < bot) + if (wp->w_folds.ga_len > 0) { - fp->fd_small = MAYBE; - ++fp; + // Mark all folds from top to bot as maybe-small. + (void)foldFind(&wp->w_folds, top, &fp); + while (fp < (fold_T *)wp->w_folds.ga_data + wp->w_folds.ga_len + && fp->fd_top < bot) + { + fp->fd_small = MAYBE; + ++fp; + } } if (foldmethodIsIndent(wp) @@ -1127,6 +1130,12 @@ foldFind(garray_T *gap, linenr_T lnum, fold_T **fpp) fold_T *fp; int i; + if (gap->ga_len == 0) + { + *fpp = NULL; + return FALSE; + } + /* * Perform a binary search. * "low" is lowest index of possible match. @@ -2500,14 +2509,14 @@ foldUpdateIEMSRecurse( // Find an existing fold to re-use. Preferably one that // includes startlnum, otherwise one that ends just before // startlnum or starts after it. - if (foldFind(gap, startlnum, &fp) + if (gap->ga_len > 0 && (foldFind(gap, startlnum, &fp) || (fp < ((fold_T *)gap->ga_data) + gap->ga_len && fp->fd_top <= firstlnum) || foldFind(gap, firstlnum - concat, &fp) || (fp < ((fold_T *)gap->ga_data) + gap->ga_len && ((lvl < level && fp->fd_top < flp->lnum) || (lvl >= level - && fp->fd_top <= flp->lnum_save)))) + && fp->fd_top <= flp->lnum_save))))) { if (fp->fd_top + fp->fd_len + concat > firstlnum) { @@ -2622,7 +2631,10 @@ foldUpdateIEMSRecurse( { // Insert new fold. Careful: ga_data may be NULL and it // may change! - i = (int)(fp - (fold_T *)gap->ga_data); + if (gap->ga_len == 0) + i = 0; + else + i = (int)(fp - (fold_T *)gap->ga_data); if (foldInsert(gap, i) != OK) return bot; fp = (fold_T *)gap->ga_data + i; @@ -2841,7 +2853,7 @@ foldInsert(garray_T *gap, int i) if (ga_grow(gap, 1) != OK) return FAIL; fp = (fold_T *)gap->ga_data + i; - if (i < gap->ga_len) + if (gap->ga_len > 0 && i < gap->ga_len) mch_memmove(fp + 1, fp, sizeof(fold_T) * (gap->ga_len - i)); ++gap->ga_len; ga_init2(&fp->fd_nested, (int)sizeof(fold_T), 10); @@ -2928,7 +2940,7 @@ foldRemove(garray_T *gap, linenr_T top, linenr_T bot) if (bot < top) return; // nothing to do - for (;;) + while (gap->ga_len > 0) { // Find fold that includes top or a following one. if (foldFind(gap, top, &fp) && fp->fd_top < top) diff --git a/src/version.c b/src/version.c index 901f540861..b709939f6a 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1552, /**/ 1551, /**/ From 2c93c685e3334c50d9a748ad699df727a4501b08 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 31 Aug 2020 21:15:02 +0200 Subject: [PATCH 02/33] patch 8.2.1553: crash in edit test Problem: Crash in edit test. Solution: Avoid using invalid pointer. --- src/fold.c | 48 +++++++++++++++++++++++++++--------------------- src/version.c | 2 ++ 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/fold.c b/src/fold.c index e4ae9cbc0b..90fafea636 100644 --- a/src/fold.c +++ b/src/fold.c @@ -608,35 +608,41 @@ foldCreate(linenr_T start, linenr_T end) // Find the place to insert the new fold. gap = &curwin->w_folds; - for (;;) + if (gap->ga_len == 0) + i = 0; + else { - if (!foldFind(gap, start_rel, &fp)) - break; - if (fp->fd_top + fp->fd_len > end_rel) + for (;;) { - // New fold is completely inside this fold: Go one level deeper. - gap = &fp->fd_nested; - start_rel -= fp->fd_top; - end_rel -= fp->fd_top; - if (use_level || fp->fd_flags == FD_LEVEL) + if (!foldFind(gap, start_rel, &fp)) + break; + if (fp->fd_top + fp->fd_len > end_rel) { - use_level = TRUE; - if (level >= curwin->w_p_fdl) + // New fold is completely inside this fold: Go one level + // deeper. + gap = &fp->fd_nested; + start_rel -= fp->fd_top; + end_rel -= fp->fd_top; + if (use_level || fp->fd_flags == FD_LEVEL) + { + use_level = TRUE; + if (level >= curwin->w_p_fdl) + closed = TRUE; + } + else if (fp->fd_flags == FD_CLOSED) closed = TRUE; + ++level; + } + else + { + // This fold and new fold overlap: Insert here and move some + // folds inside the new fold. + break; } - else if (fp->fd_flags == FD_CLOSED) - closed = TRUE; - ++level; - } - else - { - // This fold and new fold overlap: Insert here and move some folds - // inside the new fold. - break; } + i = (int)(fp - (fold_T *)gap->ga_data); } - i = (int)(fp - (fold_T *)gap->ga_data); if (ga_grow(gap, 1) == OK) { fp = (fold_T *)gap->ga_data + i; diff --git a/src/version.c b/src/version.c index b709939f6a..8155ffccb9 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1553, /**/ 1552, /**/ From 07e87e9eb5e7195d47d47c0ca752b6c8372a99ea Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 31 Aug 2020 21:22:40 +0200 Subject: [PATCH 03/33] patch 8.2.1554: crash in normal test Problem: Crash in normal test. Solution: Skip adjusting marks if there are no folds. --- src/fold.c | 3 +++ src/version.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/fold.c b/src/fold.c index 90fafea636..3c106d25cf 100644 --- a/src/fold.c +++ b/src/fold.c @@ -1515,6 +1515,9 @@ foldMarkAdjustRecurse( linenr_T last; linenr_T top; + if (gap->ga_len == 0) + return; + // In Insert mode an inserted line at the top of a fold is considered part // of the fold, otherwise it isn't. if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) diff --git a/src/version.c b/src/version.c index 8155ffccb9..92c533c883 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1554, /**/ 1553, /**/ From 7d6979608ee83b06ccfab2589da3047b143defae Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 31 Aug 2020 21:30:32 +0200 Subject: [PATCH 04/33] patch 8.2.1555: not all tests are executed on Github Actions Problem: Not all tests are executed on Github Actions. Solution: Copy "src" to "src2" earlier. Recognize "src2" in a couple more places. Add two tests to the list of flaky tests. (Ken Takata, closes #6798) --- .github/workflows/ci-windows.yaml | 9 +++++---- src/testdir/runtest.vim | 2 ++ src/testdir/test_python2.vim | 5 +++-- src/testdir/test_python3.vim | 5 +++-- src/version.c | 2 ++ 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-windows.yaml b/.github/workflows/ci-windows.yaml index d23beef414..0fef20da5b 100644 --- a/.github/workflows/ci-windows.yaml +++ b/.github/workflows/ci-windows.yaml @@ -127,6 +127,11 @@ jobs: ) goto :eof + - name: Copy src directory to src2 + shell: cmd + run: | + xcopy src src2\ /E > nul + - name: Build (MSVC) if: matrix.toolchain == 'msvc' shell: cmd @@ -196,10 +201,6 @@ jobs: echo %COL_GREEN%vim version:%COL_RESET% .\vim --version || exit 1 - mkdir ..\src2 - xcopy testdir ..\src2\testdir\ /E > nul || exit 1 - copy evalfunc.c ..\src2 > nul - echo %COL_GREEN%Start testing vim in background.%COL_RESET% start cmd /c "cd ..\src2\testdir & nmake -nologo -f Make_dos.mak VIMPROG=..\..\src\vim > nul & echo done>done.txt" diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index 99854042b2..1a83227b1f 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -382,7 +382,9 @@ endif " Names of flaky tests. let s:flaky_tests = [ + \ 'Test_BufWrite_lockmarks()', \ 'Test_autocmd_SafeState()', + \ 'Test_bufunload_all()', \ 'Test_client_server()', \ 'Test_close_and_exit_cb()', \ 'Test_close_output_buffer()', diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim index 8fa73401bd..fd8fe70e49 100644 --- a/src/testdir/test_python2.vim +++ b/src/testdir/test_python2.vim @@ -2412,7 +2412,7 @@ func Test_python_chdir() cb.append(vim.eval('@%')) os.chdir('..') path = fnamemodify('.', ':p:h:t') - if path != 'src': + if path != 'src' and path != 'src2': # Running tests from a shadow directory, so move up another level # This will result in @% looking like shadow/testdir/Xfile, hence the # extra fnamemodify @@ -2422,7 +2422,8 @@ func Test_python_chdir() os.chdir(path) del path else: - cb.append(fnamemodify('.', ':p:h:t')) + # Also accept running from src2/testdir/ for MS-Windows CI. + cb.append(fnamemodify('.', ':p:h:t').replace('src2', 'src')) cb.append(vim.eval('@%').replace(os.path.sep, '/')) os.chdir('testdir') cb.append(fnamemodify('.', ':p:h:t')) diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim index 0885c96988..1bdb4c1719 100644 --- a/src/testdir/test_python3.vim +++ b/src/testdir/test_python3.vim @@ -2591,7 +2591,7 @@ func Test_python3_chdir() cb.append(vim.eval('@%')) os.chdir('..') path = fnamemodify('.', ':p:h:t') - if path != b'src': + if path != b'src' and path != b'src2': # Running tests from a shadow directory, so move up another level # This will result in @% looking like shadow/testdir/Xfile, hence the # slicing to remove the leading path and path separator @@ -2600,7 +2600,8 @@ func Test_python3_chdir() cb.append(vim.eval('@%')[len(path)+1:].replace(os.path.sep, '/')) os.chdir(path) else: - cb.append(str(fnamemodify('.', ':p:h:t'))) + # Also accept running from src2/testdir/ for MS-Windows CI. + cb.append(str(fnamemodify('.', ':p:h:t').replace(b'src2', b'src'))) cb.append(vim.eval('@%').replace(os.path.sep, '/')) del path os.chdir('testdir') diff --git a/src/version.c b/src/version.c index 92c533c883..f5c83beca2 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1555, /**/ 1554, /**/ From 39f7aa3c3124065b50f182b1d2f7ac92a0918656 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 31 Aug 2020 22:00:05 +0200 Subject: [PATCH 05/33] patch 8.2.1556: cursorline highlighting always overrules sign highlighting Problem: Cursorline highlighting always overrules sign highlighting. Solution: Combine the highlighting, use the priority to decide how. (closes #6812) --- runtime/doc/sign.txt | 6 +++++- .../pack/dist/opt/termdebug/plugin/termdebug.vim | 4 ++-- src/drawline.c | 14 +++++++++++++- src/structs.h | 1 + src/testdir/dumps/Test_sign_cursor_5.dump | 6 ++++++ src/testdir/dumps/Test_sign_cursor_6.dump | 6 ++++++ src/testdir/test_signs.vim | 14 ++++++++++++++ src/version.c | 2 ++ 8 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 src/testdir/dumps/Test_sign_cursor_5.dump create mode 100644 src/testdir/dumps/Test_sign_cursor_6.dump diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 1e88a62ffa..46cb9b59c3 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -1,4 +1,4 @@ -*sign.txt* For Vim version 8.2. Last change: 2019 Nov 30 +*sign.txt* For Vim version 8.2. Last change: 2020 Aug 31 VIM REFERENCE MANUAL by Gordon Prieur @@ -85,6 +85,10 @@ When the line on which the sign is placed is deleted, the sign is moved to the next line (or the last line of the buffer, if there is no next line). When the delete is undone the sign does not move back. +When a sign with line highlighting and 'cursorline' highlighting are both +present, if the priority is 100 or more then the sign highlighting takes +precedence, otherwise the 'cursorline' highlighting. + ============================================================================== 2. Commands *sign-commands* *:sig* *:sign* diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 6680b48cce..832dcf584b 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -2,7 +2,7 @@ " " Author: Bram Moolenaar " Copyright: Vim license applies, see ":help license" -" Last Change: 2020 Jul 12 +" Last Change: 2020 Aug 31 " " WORK IN PROGRESS - Only the basics work " Note: On MS-Windows you need a recent version of gdb. The one included with @@ -937,7 +937,7 @@ func s:HandleCursor(msg) endif exe lnum exe 'sign unplace ' . s:pc_id - exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname + exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC priority=110 file=' . fname setlocal signcolumn=yes endif elseif !s:stopped || fname != '' diff --git a/src/drawline.c b/src/drawline.c index fa2596510a..2b72de6489 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -909,7 +909,19 @@ win_line( if (!cul_screenline) { cul_attr = HL_ATTR(HLF_CUL); - line_attr = cul_attr; +# ifdef FEAT_SIGNS + // Combine the 'cursorline' and sign highlighting, depending on + // the sign priority. + if (sign_present && sattr.sat_linehl > 0) + { + if (sattr.sat_priority >= 100) + line_attr = hl_combine_attr(cul_attr, line_attr); + else + line_attr = hl_combine_attr(line_attr, cul_attr); + } + else +# endif + line_attr = cul_attr; wp->w_last_cursorline = wp->w_cursor.lnum; } else diff --git a/src/structs.h b/src/structs.h index 38ebcf5746..528c247b14 100644 --- a/src/structs.h +++ b/src/structs.h @@ -817,6 +817,7 @@ typedef struct sign_attrs_S { char_u *sat_text; int sat_texthl; int sat_linehl; + int sat_priority; } sign_attrs_T; #if defined(FEAT_SIGNS) || defined(PROTO) diff --git a/src/testdir/dumps/Test_sign_cursor_5.dump b/src/testdir/dumps/Test_sign_cursor_5.dump new file mode 100644 index 0000000000..2f256a507f --- /dev/null +++ b/src/testdir/dumps/Test_sign_cursor_5.dump @@ -0,0 +1,6 @@ +| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@72 +| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@1| @70 +| +0#0000e05#a8a8a8255@1>m+8#0000001#40ff4011@3| @68 +| +0#0000e05#a8a8a8255@1|y+0#0000000#ffffff0@3| @68 +|~+0#4040ff13&| @73 +|:+0#0000000&| @55|2|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_sign_cursor_6.dump b/src/testdir/dumps/Test_sign_cursor_6.dump new file mode 100644 index 0000000000..efd9042a3e --- /dev/null +++ b/src/testdir/dumps/Test_sign_cursor_6.dump @@ -0,0 +1,6 @@ +| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@72 +| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@1| @70 +| +0#0000e05#a8a8a8255@1>m+8#0000001#ffd7ff255@3| @68 +| +0#0000e05#a8a8a8255@1|y+0#0000000#ffffff0@3| @68 +|~+0#4040ff13&| @73 +|:+0#0000000&| @55|2|,|1| @10|A|l@1| diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim index e8508b8d35..3ee2b49fa1 100644 --- a/src/testdir/test_signs.vim +++ b/src/testdir/test_signs.vim @@ -1762,6 +1762,20 @@ func Test_sign_cursor_position() call term_sendkeys(buf, ":sign unplace 10\") call VerifyScreenDump(buf, 'Test_sign_cursor_4', {}) + " 'cursorline' highlighting overrules sign + call term_sendkeys(buf, ":sign place 12 line=2 name=s2\") + call term_sendkeys(buf, ":set cursorline\") + call term_sendkeys(buf, ":hi CursorLine ctermbg=Green\") + call term_sendkeys(buf, "2G") + call term_sendkeys(buf, ":\") + call VerifyScreenDump(buf, 'Test_sign_cursor_5', {}) + + " sign highlighting overrules 'cursorline' + call term_sendkeys(buf, ":sign unplace 12\") + call term_sendkeys(buf, ":sign place 13 line=2 priority=100 name=s2\") + call term_sendkeys(buf, ":\") + call VerifyScreenDump(buf, 'Test_sign_cursor_6', {}) + " clean up call StopVimInTerminal(buf) call delete('XtestSigncolumn') diff --git a/src/version.c b/src/version.c index f5c83beca2..022c90acbf 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1556, /**/ 1555, /**/ From 997cd1a17f030d004b334d17cf1c1c57050c9906 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 31 Aug 2020 22:16:08 +0200 Subject: [PATCH 06/33] patch 8.2.1557: crash in :vimgrep when started as "vim -n" Problem: Crash in :vimgrep when started as "vim -n". (Raul Segura) Solution: Check mfp pointer. (Yegappan Lakshmanan, closes #6827) --- src/quickfix.c | 2 +- src/testdir/test_quickfix.vim | 15 +++++++++++++++ src/version.c | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/quickfix.c b/src/quickfix.c index 99b0169ea5..f8ff7765ed 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -6022,7 +6022,7 @@ vgr_process_args( static int existing_swapfile(buf_T *buf) { - if (buf->b_ml.ml_mfp != NULL) + if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL) { char_u *fname = buf->b_ml.ml_mfp->mf_fname; size_t len = STRLEN(fname); diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index c35b11c669..8faf69a318 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -2833,6 +2833,21 @@ func Test_vimgrep_with_no_last_search_pat() call delete('Xresult') endfunc +" Test vimgrep without swap file +func Test_vimgrep_without_swap_file() + let lines =<< trim [SCRIPT] + vimgrep grep test_c* + call writefile(['done'], 'Xresult') + qall! + [SCRIPT] + call writefile(lines, 'Xscript') + if RunVim([], [], '--clean -n -S Xscript Xscript') + call assert_equal(['done'], readfile('Xresult')) + endif + call delete('Xscript') + call delete('Xresult') +endfunc + func Test_vimgrep_existing_swapfile() call writefile(['match apple with apple'], 'Xapple') call writefile(['swapfile'], '.Xapple.swp') diff --git a/src/version.c b/src/version.c index 022c90acbf..214ee2a8ed 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1557, /**/ 1556, /**/ From 2f1228463aa9ff62814f9732561b1849e5f01f75 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 31 Aug 2020 23:18:00 +0200 Subject: [PATCH 07/33] patch 8.2.1558: signs test fails Problem: Signs test fails. Solution: Add missing change to sign.c. --- src/sign.c | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/sign.c b/src/sign.c index fb452b30c5..fd373b5c3e 100644 --- a/src/sign.c +++ b/src/sign.c @@ -517,6 +517,7 @@ buf_get_signattrs(win_T *wp, linenr_T lnum, sign_attrs_T *sattr) sattr->sat_texthl = syn_id2attr(sp->sn_text_hl); if (sp->sn_line_hl > 0) sattr->sat_linehl = syn_id2attr(sp->sn_line_hl); + sattr->sat_priority = sign->se_priority; // If there is another sign next with the same priority, may // combine the text and the line highlighting. diff --git a/src/version.c b/src/version.c index 214ee2a8ed..411a889d56 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1558, /**/ 1557, /**/ From ca563b9b948aec18463c26e9f87ae7933571b40e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 1 Sep 2020 17:50:51 +0200 Subject: [PATCH 08/33] patch 8.2.1559: s390x tests work again Problem: s390x tests work again. Solution: re-enable s390x tests. (James McCoy, closes #6829) --- .travis.yml | 13 ++++++------- src/version.c | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7f72e064e8..356a8c10c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -212,13 +212,12 @@ jobs: env: - *normal - *shadowopt - # Temporarily disabled, always fails - #- <<: *linux - # arch: s390x - # name: huge/gcc-s390x - # compiler: gcc - # env: *linux-huge - # services: [] + - <<: *linux + arch: s390x + name: huge/gcc-s390x + compiler: gcc + env: *linux-huge + services: [] - <<: *linux arch: arm64 name: huge/gcc-arm64 diff --git a/src/version.c b/src/version.c index 411a889d56..158f2a3472 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1559, /**/ 1558, /**/ From 9c2b06637b32742cac11bfd66b1a4e84583c6c2e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 1 Sep 2020 19:56:15 +0200 Subject: [PATCH 09/33] patch 8.2.1560: using NULL pointers in some code Problem: Using NULL pointers in some code. (James McCoy) Solution: Avoid adding to a NULL pointer. Use byte as unsigned. --- src/eval.c | 2 +- src/fold.c | 22 ++++++++++++---------- src/spellfile.c | 2 +- src/spellsuggest.c | 2 ++ src/version.c | 2 ++ src/vim9compile.c | 10 ++++++++-- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/eval.c b/src/eval.c index be3f4622cb..3eb4be46f0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -395,7 +395,7 @@ skip_expr_concatenate( typval_T rettv; int res; int vim9script = in_vim9script(); - garray_T *gap = &evalarg->eval_ga; + garray_T *gap = evalarg == NULL ? NULL : &evalarg->eval_ga; int save_flags = evalarg == NULL ? 0 : evalarg->eval_flags; int evaluate = evalarg == NULL ? FALSE : (evalarg->eval_flags & EVAL_EVALUATE); diff --git a/src/fold.c b/src/fold.c index 3c106d25cf..d95b46b5b4 100644 --- a/src/fold.c +++ b/src/fold.c @@ -1314,7 +1314,7 @@ setManualFoldWin( if (!foldFind(gap, lnum, &fp)) { // If there is a following fold, continue there next time. - if (fp < (fold_T *)gap->ga_data + gap->ga_len) + if (fp != NULL && fp < (fold_T *)gap->ga_data + gap->ga_len) next = fp->fd_top + off; break; } @@ -2905,18 +2905,20 @@ foldSplit( // any between top and bot, they have been removed by the caller. gap1 = &fp->fd_nested; gap2 = &fp[1].fd_nested; - (void)(foldFind(gap1, bot + 1 - fp->fd_top, &fp2)); - len = (int)((fold_T *)gap1->ga_data + gap1->ga_len - fp2); - if (len > 0 && ga_grow(gap2, len) == OK) + if (foldFind(gap1, bot + 1 - fp->fd_top, &fp2)) { - for (idx = 0; idx < len; ++idx) + len = (int)((fold_T *)gap1->ga_data + gap1->ga_len - fp2); + if (len > 0 && ga_grow(gap2, len) == OK) { - ((fold_T *)gap2->ga_data)[idx] = fp2[idx]; - ((fold_T *)gap2->ga_data)[idx].fd_top - -= fp[1].fd_top - fp->fd_top; + for (idx = 0; idx < len; ++idx) + { + ((fold_T *)gap2->ga_data)[idx] = fp2[idx]; + ((fold_T *)gap2->ga_data)[idx].fd_top + -= fp[1].fd_top - fp->fd_top; + } + gap2->ga_len = len; + gap1->ga_len -= len; } - gap2->ga_len = len; - gap1->ga_len -= len; } fp->fd_len = top - fp->fd_top; fold_changed = TRUE; diff --git a/src/spellfile.c b/src/spellfile.c index 6aeac86b85..d5ec3feadd 100644 --- a/src/spellfile.c +++ b/src/spellfile.c @@ -816,7 +816,7 @@ read_cnt_string(FILE *fd, int cnt_bytes, int *cntp) // read the length bytes, MSB first for (i = 0; i < cnt_bytes; ++i) - cnt = (cnt << 8) + getc(fd); + cnt = (cnt << 8) + (unsigned)getc(fd); if (cnt < 0) { *cntp = SP_TRUNCERROR; diff --git a/src/spellsuggest.c b/src/spellsuggest.c index 0821dc62cb..96e7bb634c 100644 --- a/src/spellsuggest.c +++ b/src/spellsuggest.c @@ -3606,6 +3606,8 @@ check_suggestions( int len; hlf_T attr; + if (gap->ga_len == 0) + return; stp = &SUG(*gap, 0); for (i = gap->ga_len - 1; i >= 0; --i) { diff --git a/src/version.c b/src/version.c index 158f2a3472..29f4363415 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1560, /**/ 1559, /**/ diff --git a/src/vim9compile.c b/src/vim9compile.c index 0c9f56f5a0..5893e5ac0b 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -1147,7 +1147,10 @@ generate_NEWLIST(cctx_T *cctx, int count) isn->isn_arg.number = count; // get the member type from all the items on the stack. - member = get_member_type_from_stack( + if (count == 0) + member = &t_void; + else + member = get_member_type_from_stack( ((type_T **)stack->ga_data) + stack->ga_len, count, 1, cctx->ctx_type_list); type = get_list_type(member, cctx->ctx_type_list); @@ -1180,7 +1183,10 @@ generate_NEWDICT(cctx_T *cctx, int count) return FAIL; isn->isn_arg.number = count; - member = get_member_type_from_stack( + if (count == 0) + member = &t_void; + else + member = get_member_type_from_stack( ((type_T **)stack->ga_data) + stack->ga_len, count, 2, cctx->ctx_type_list); type = get_dict_type(member, cctx->ctx_type_list); From 81fcb67fb32a12414512b72e691a1bbbff9f8511 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 1 Sep 2020 21:21:24 +0200 Subject: [PATCH 10/33] patch 8.2.1561: using NULL pointers in fold code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Using NULL pointers in fold code. Solution: Avoid using a NULL pointer. (Dominique Pellé, closes #6831, closes #6831) --- src/fold.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fold.c b/src/fold.c index d95b46b5b4..5c55b0777b 100644 --- a/src/fold.c +++ b/src/fold.c @@ -3059,7 +3059,7 @@ truncate_fold(fold_T *fp, linenr_T end) } #define fold_end(fp) ((fp)->fd_top + (fp)->fd_len - 1) -#define valid_fold(fp, gap) ((fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) +#define valid_fold(fp, gap) ((gap)->ga_len > 0 && (fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) #define fold_index(fp, gap) ((size_t)(fp - ((fold_T *)(gap)->ga_data))) void diff --git a/src/version.c b/src/version.c index 29f4363415..80c39982d3 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1561, /**/ 1560, /**/ From 3767e3a3302d745349eff8cfe45411f03e13de43 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 1 Sep 2020 23:06:01 +0200 Subject: [PATCH 11/33] patch 8.2.1562: Vim9: error when using "%" where a buffer is expected Problem: Vim9: error when using "%" where a buffer is expected. Solution: Add tv_get_buf_from_arg(). (closes #6814) --- src/evalbuffer.c | 34 +++++----------------------------- src/proto/typval.pro | 1 + src/testdir/test_vim9_func.vim | 5 +++++ src/typval.c | 19 +++++++++++++++++++ src/version.c | 2 ++ 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/evalbuffer.c b/src/evalbuffer.c index 5cf884a80c..300441551b 100644 --- a/src/evalbuffer.c +++ b/src/evalbuffer.c @@ -364,16 +364,7 @@ f_bufname(typval_T *argvars, typval_T *rettv) if (tv->v_type == VAR_UNKNOWN) buf = curbuf; else - { - ++emsg_off; - buf = tv_get_buf(tv, FALSE); - --emsg_off; - if (buf == NULL - && tv->v_type != VAR_NUMBER - && tv->v_type != VAR_STRING) - // issue errmsg for type error - (void)tv_get_number(tv); - } + buf = tv_get_buf_from_arg(tv); rettv->v_type = VAR_STRING; if (buf != NULL && buf->b_fname != NULL) rettv->vval.v_string = vim_strsave(buf->b_fname); @@ -394,13 +385,7 @@ f_bufnr(typval_T *argvars, typval_T *rettv) if (argvars[0].v_type == VAR_UNKNOWN) buf = curbuf; else - { - if (argvars[0].v_type != VAR_STRING) - (void)tv_get_number(&argvars[0]); // issue errmsg if type error - ++emsg_off; - buf = tv_get_buf(&argvars[0], FALSE); - --emsg_off; - } + buf = tv_get_buf_from_arg(&argvars[0]); // If the buffer isn't found and the second argument is not zero create a // new buffer. @@ -425,9 +410,7 @@ buf_win_common(typval_T *argvars, typval_T *rettv, int get_nr) int winnr = 0; buf_T *buf; - (void)tv_get_number(&argvars[0]); // issue errmsg if type error - ++emsg_off; - buf = tv_get_buf(&argvars[0], TRUE); + buf = tv_get_buf_from_arg(&argvars[0]); FOR_ALL_WINDOWS(wp) { ++winnr; @@ -435,7 +418,6 @@ buf_win_common(typval_T *argvars, typval_T *rettv, int get_nr) break; } rettv->vval.v_number = (wp != NULL ? (get_nr ? winnr : wp->w_id) : -1); - --emsg_off; } /* @@ -662,10 +644,7 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv) else if (argvars[0].v_type != VAR_UNKNOWN) { // Information about one buffer. Argument specifies the buffer - (void)tv_get_number(&argvars[0]); // issue errmsg if type error - ++emsg_off; - argbuf = tv_get_buf(&argvars[0], FALSE); - --emsg_off; + argbuf = tv_get_buf_from_arg(&argvars[0]); if (argbuf == NULL) return; } @@ -752,10 +731,7 @@ f_getbufline(typval_T *argvars, typval_T *rettv) linenr_T end; buf_T *buf; - (void)tv_get_number(&argvars[0]); // issue errmsg if type error - ++emsg_off; - buf = tv_get_buf(&argvars[0], FALSE); - --emsg_off; + buf = tv_get_buf_from_arg(&argvars[0]); lnum = tv_get_lnum_buf(&argvars[1], buf); if (argvars[2].v_type == VAR_UNKNOWN) diff --git a/src/proto/typval.pro b/src/proto/typval.pro index 25ad3e6737..9c57226da2 100644 --- a/src/proto/typval.pro +++ b/src/proto/typval.pro @@ -29,4 +29,5 @@ int eval_env_var(char_u **arg, typval_T *rettv, int evaluate); linenr_T tv_get_lnum(typval_T *argvars); linenr_T tv_get_lnum_buf(typval_T *argvars, buf_T *buf); buf_T *tv_get_buf(typval_T *tv, int curtab_only); +buf_T *tv_get_buf_from_arg(typval_T *tv); /* vim: set ft=c : */ diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 282d8dcec2..0575836443 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1443,6 +1443,11 @@ def Test_bufname() close enddef +def Test_gebufinfo() + let bufinfo = getbufinfo(bufnr()) + assert_equal(bufinfo, getbufinfo('%')) +enddef + def Fibonacci(n: number): number if n < 2 return n diff --git a/src/typval.c b/src/typval.c index d1732f2b7c..c7cfd41167 100644 --- a/src/typval.c +++ b/src/typval.c @@ -1562,4 +1562,23 @@ tv_get_buf(typval_T *tv, int curtab_only) return buf; } +/* + * Like tv_get_buf() but give an error message is the type is wrong. + */ + buf_T * +tv_get_buf_from_arg(typval_T *tv) +{ + buf_T *buf; + + ++emsg_off; + buf = tv_get_buf(tv, FALSE); + --emsg_off; + if (buf == NULL + && tv->v_type != VAR_NUMBER + && tv->v_type != VAR_STRING) + // issue errmsg for type error + (void)tv_get_number(tv); + return buf; +} + #endif // FEAT_EVAL diff --git a/src/version.c b/src/version.c index 80c39982d3..f2d89f6728 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1562, /**/ 1561, /**/ From 6f84b6db10ab86bca85e33f3fc6ee735eec8bbe5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 1 Sep 2020 23:16:32 +0200 Subject: [PATCH 12/33] patch 8.2.1563: Vim9: error when using '%" with setbufvar() r getbufvar() Problem: Vim9: error when using '%" with setbufvar() or getbufvar(). Solution: Use tv_get_buf_from_arg(). (closes #6816) --- src/evalvars.c | 9 ++------- src/testdir/test_vim9_func.vim | 3 +++ src/version.c | 2 ++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/evalvars.c b/src/evalvars.c index ecd0ce6bd5..efab6ab163 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -3662,10 +3662,8 @@ f_getbufvar(typval_T *argvars, typval_T *rettv) dictitem_T *v; int done = FALSE; - (void)tv_get_number(&argvars[0]); // issue errmsg if type error varname = tv_get_string_chk(&argvars[1]); - ++emsg_off; - buf = tv_get_buf(&argvars[0], FALSE); + buf = tv_get_buf_from_arg(&argvars[0]); rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; @@ -3717,8 +3715,6 @@ f_getbufvar(typval_T *argvars, typval_T *rettv) if (!done && argvars[2].v_type != VAR_UNKNOWN) // use the default value copy_tv(&argvars[2], rettv); - - --emsg_off; } /* @@ -3789,9 +3785,8 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED) if (check_secure()) return; - (void)tv_get_number(&argvars[0]); // issue errmsg if type error varname = tv_get_string_chk(&argvars[1]); - buf = tv_get_buf(&argvars[0], FALSE); + buf = tv_get_buf_from_arg(&argvars[0]); varp = &argvars[2]; if (buf != NULL && varname != NULL && varp != NULL) diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 0575836443..09c84576de 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1426,6 +1426,9 @@ def Test_setbufvar() settabwinvar(1, 1, '&ts', 15) assert_equal(15, &ts) setlocal ts=8 + + setbufvar('%', 'myvar', 123) + assert_equal(123, getbufvar('%', 'myvar')) enddef def Test_setreg() diff --git a/src/version.c b/src/version.c index f2d89f6728..d606f1ec92 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1563, /**/ 1562, /**/ From 4ad739fc053c1666d07ba1cf59be26cb1c3e52d7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 10:25:45 +0200 Subject: [PATCH 13/33] patch 8.2.1564: a few remaining errors from ubsan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: A few remaining errors from ubsan. Solution: Avoid the warnings. (Dominique Pellé, closes #6837) --- src/spellfile.c | 12 ++++++++---- src/spellsuggest.c | 6 +++--- src/version.c | 2 ++ src/viminfo.c | 3 ++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/spellfile.c b/src/spellfile.c index d5ec3feadd..12dedd6c57 100644 --- a/src/spellfile.c +++ b/src/spellfile.c @@ -816,11 +816,15 @@ read_cnt_string(FILE *fd, int cnt_bytes, int *cntp) // read the length bytes, MSB first for (i = 0; i < cnt_bytes; ++i) - cnt = (cnt << 8) + (unsigned)getc(fd); - if (cnt < 0) { - *cntp = SP_TRUNCERROR; - return NULL; + int c = getc(fd); + + if (c == EOF) + { + *cntp = SP_TRUNCERROR; + return NULL; + } + cnt = (cnt << 8) + (unsigned)c; } *cntp = cnt; if (cnt == 0) diff --git a/src/spellsuggest.c b/src/spellsuggest.c index 96e7bb634c..e2423cd98a 100644 --- a/src/spellsuggest.c +++ b/src/spellsuggest.c @@ -3731,9 +3731,6 @@ cleanup_suggestions( int maxscore, int keep) // nr of suggestions to keep { - suggest_T *stp = &SUG(*gap, 0); - int i; - if (gap->ga_len > 0) { // Sort the list. @@ -3744,6 +3741,9 @@ cleanup_suggestions( // displayed. if (gap->ga_len > keep) { + int i; + suggest_T *stp = &SUG(*gap, 0); + for (i = keep; i < gap->ga_len; ++i) vim_free(stp[i].st_word); gap->ga_len = keep; diff --git a/src/version.c b/src/version.c index d606f1ec92..03612aa067 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1564, /**/ 1563, /**/ diff --git a/src/viminfo.c b/src/viminfo.c index 74780c3d07..0ec9a13193 100644 --- a/src/viminfo.c +++ b/src/viminfo.c @@ -2183,7 +2183,8 @@ write_viminfo_filemarks(FILE *fp) xfmark_T *vi_fm; fm = idx >= 0 ? &curwin->w_jumplist[idx] : NULL; - vi_fm = vi_idx < vi_jumplist_len ? &vi_jumplist[vi_idx] : NULL; + vi_fm = (vi_jumplist != NULL && vi_idx < vi_jumplist_len) + ? &vi_jumplist[vi_idx] : NULL; if (fm == NULL && vi_fm == NULL) break; if (fm == NULL || (vi_fm != NULL && fm->time_set < vi_fm->time_set)) From e90d63ea904187ecbb09d0f7f21b71b302b30644 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 12:58:48 +0200 Subject: [PATCH 14/33] patch 8.2.1565: spellfile test sometimes fails Problem: Spellfile test sometimes fails. Solution: Check running into the end of the file. --- src/spellfile.c | 3 +-- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/spellfile.c b/src/spellfile.c index 12dedd6c57..869db7f3ff 100644 --- a/src/spellfile.c +++ b/src/spellfile.c @@ -3533,8 +3533,7 @@ spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile) spin->si_msg_count = 999999; // Read and ignore the first line: word count. - (void)vim_fgets(line, MAXLINELEN, fd); - if (!vim_isdigit(*skipwhite(line))) + if (vim_fgets(line, MAXLINELEN, fd) || !vim_isdigit(*skipwhite(line))) semsg(_("E760: No word count in %s"), fname); /* diff --git a/src/version.c b/src/version.c index 03612aa067..bbbb26e311 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1565, /**/ 1564, /**/ From 4488f5a545691ca4c8802bad0d70a5e750fc8844 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 17:08:59 +0200 Subject: [PATCH 15/33] patch 8.2.1566: not all Bazel files are recognized Problem: Not all Bazel files are recognized. Solution: Add *.bazel and *.BUILD. (closes #6836) --- runtime/filetype.vim | 6 +++--- src/testdir/test_filetype.vim | 2 ++ src/version.c | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index ae6dc6f1d3..5d4d77609a 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -240,10 +240,10 @@ au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml au BufNewFile,BufRead *bsd,*.bsdl setf bsdl " Bazel (http://bazel.io) -autocmd BufRead,BufNewFile *.bzl,WORKSPACE,BUILD.bazel setf bzl +autocmd BufRead,BufNewFile *.bzl,*.bazel,WORKSPACE setf bzl if has("fname_case") " There is another check for BUILD further below. - autocmd BufRead,BufNewFile BUILD setf bzl + autocmd BufRead,BufNewFile *.BUILD,BUILD setf bzl endif " C or lpc @@ -2042,7 +2042,7 @@ au BufNewFile,BufRead bzr_log.* setf bzr " Bazel build file if !has("fname_case") - au BufNewFile,BufRead BUILD setf bzl + au BufNewFile,BufRead *.BUILD,BUILD setf bzl endif " BIND zone diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 6957954a6e..5d37a866f2 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -75,6 +75,7 @@ let s:filename_checks = { \ 'ave': ['file.ave'], \ 'awk': ['file.awk', 'file.gawk'], \ 'b': ['file.mch', 'file.ref', 'file.imp'], + \ 'bzl': ['file.bazel', 'file.bzl', 'WORKSPACE'], \ 'bc': ['file.bc'], \ 'bdf': ['file.bdf'], \ 'bib': ['file.bib'], @@ -527,6 +528,7 @@ let s:filename_checks = { let s:filename_case_checks = { \ 'modula2': ['file.DEF', 'file.MOD'], + \ 'bzl': ['file.BUILD', 'BUILD'], \ } func CheckItems(checks) diff --git a/src/version.c b/src/version.c index bbbb26e311..b75c9fbc65 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1566, /**/ 1565, /**/ From 6efa46f4efd226f65634ba8eb6ddee54de1de563 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 19:23:06 +0200 Subject: [PATCH 16/33] patch 8.2.1567: no example to use ubsan with clang MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: No example to use ubsan with clang. Solution: Add example commands. (Dominique Pellé, issue #6811) --- src/Makefile | 14 +++++++++++--- src/version.c | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 10570d6d35..4d1439a5f2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -610,8 +610,9 @@ CClink = $(CC) # Use this with GCC to check for mistakes, unused arguments, etc. # Note: If you use -Wextra and get warnings in GTK code about function -# parameters, you can add -Wno-cast-function-type +# parameters, you can add -Wno-cast-function-type (but not with clang) #CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wunreachable-code -Wno-cast-function-type -Wno-deprecated-declarations -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 +#CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wunreachable-code -Wno-deprecated-declarations -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 # Add -Wpedantic to find // comments and other C99 constructs. # Better disable Perl and Python to avoid a lot of warnings. #CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wpedantic -Wunreachable-code -Wunused-result -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 @@ -690,8 +691,8 @@ LINT_OPTIONS = -beprxzF # Uncomment one of the next two lines to compile Vim with the -# address sanitizer (asan) or with the undefined sanitizer. Works with gcc and -# clang. May make Vim twice as slow. Errors reported on stderr. +# address sanitizer (asan) or with the undefined sanitizer. Works with gcc. +# May make Vim twice as slow. Errors are reported on stderr. # More at: https://code.google.com/p/address-sanitizer/ # Useful environment variables: # $ export ASAN_OPTIONS="print_stacktrace=1 log_path=asan" @@ -699,6 +700,13 @@ LINT_OPTIONS = -beprxzF # When running tests output can be found in testdir/asan.* #SANITIZER_CFLAGS = -g -O0 -fsanitize=address -fno-omit-frame-pointer #SANITIZER_CFLAGS = -g -O0 -fsanitize=undefined -fno-omit-frame-pointer + +# Similarly when compiling with clang and using ubsan. +# $ export UBSAN_OPTIONS="print_stacktrace=1 log_path=ubsan" +# $ export LSAN_OPTIONS="suppressions=`pwd`/testdir/lsan-suppress.txt" +# When running tests output can be found in testdir/ubsan.* +#SANITIZER_CFLAGS = -g -O0 -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer + SANITIZER_LIBS = $(SANITIZER_CFLAGS) # MEMORY LEAK DETECTION diff --git a/src/version.c b/src/version.c index b75c9fbc65..e1d3b12ca3 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1567, /**/ 1566, /**/ From 4da7a259f6b28a4f855a6fa7d0ede5e038600154 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 19:59:00 +0200 Subject: [PATCH 17/33] patch 8.2.1568: prop_find() skips properties in the same line Problem: prop_find() skips properties in the same line if "skipstart" is used. Solution: Use "continue" instead of "break". (closes #6840) --- src/testdir/test_textprop.vim | 16 ++++++++++++++++ src/textprop.c | 4 ++-- src/version.c | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 9db5275d52..5990fbf3f1 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -211,6 +211,22 @@ func Test_prop_find() call prop_clear(1,6) call prop_type_delete('prop_name') + + " Multiple props per line, start on the first, should find the second. + let expected = {'lnum': 1, 'id': 0, 'col': 14, 'end': 1, 'type': 'misspell', 'length': 2, 'start': 1} + eval ['the quikc bronw fox jumsp over the layz dog']->repeat(2)->setline(1) + call prop_type_add('misspell', #{highlight: 'ErrorMsg'}) + for lnum in [1, 2] + for col in [8, 14, 24, 38] + call prop_add(lnum, col, #{type: 'misspell', length: 2}) + endfor + endfor + call cursor(1, 8) + let result = prop_find(#{type: 'misspell', skipstart: 1}, 'f') + call assert_equal(expected, result) + + call prop_type_delete('misspell') + bwipe! endfunc func Test_prop_find_smaller_len_than_match_col() diff --git a/src/textprop.c b/src/textprop.c index 0645e1fd70..9dff6b869f 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -718,7 +718,7 @@ f_prop_find(typval_T *argvars, typval_T *rettv) // on a prop and we're not skipping. if (start_pos_has_prop && !skipstart) dir = -1; - break; + continue; } // If skipstart is true, skip the prop at start pos (even if @@ -726,7 +726,7 @@ f_prop_find(typval_T *argvars, typval_T *rettv) if (start_pos_has_prop && skipstart && !seen_end) { start_pos_has_prop = 0; - break; + continue; } prop_fill_dict(rettv->vval.v_dict, &prop, buf); diff --git a/src/version.c b/src/version.c index e1d3b12ca3..840c32535b 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1568, /**/ 1567, /**/ From a5d3841177e0b3545381c875d0b4b442f38784bd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 21:02:35 +0200 Subject: [PATCH 18/33] patch 8.2.1569: Vim9: fixes not tested; failure in getchangelist() Problem: Vim9: fixes for functions not tested; failure in getchangelist(). Solution: Add tests. (closes #6813, closes #6815, closes #6817) --- src/evalfunc.c | 7 +------ src/testdir/test_vim9_func.vim | 33 +++++++++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index fff7a89a9a..771e393db6 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3081,12 +3081,7 @@ f_getchangelist(typval_T *argvars, typval_T *rettv) if (argvars[0].v_type == VAR_UNKNOWN) buf = curbuf; else - { - (void)tv_get_number(&argvars[0]); // issue errmsg if type error - ++emsg_off; - buf = tv_get_buf(&argvars[0], FALSE); - --emsg_off; - } + buf = tv_get_buf_from_arg(&argvars[0]); if (buf == NULL) return; diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 09c84576de..480a9a5a7d 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1431,6 +1431,39 @@ def Test_setbufvar() assert_equal(123, getbufvar('%', 'myvar')) enddef +def Test_bufwinid() + let origwin = win_getid() + below split SomeFile + let SomeFileID = win_getid() + below split OtherFile + below split SomeFile + assert_equal(SomeFileID, bufwinid('SomeFile')) + + win_gotoid(origwin) + only + bwipe SomeFile + bwipe OtherFile +enddef + +def Test_getbufline() + e SomeFile + let buf = bufnr() + e # + let lines = ['aaa', 'bbb', 'ccc'] + setbufline(buf, 1, lines) + assert_equal(lines, getbufline('#', 1, '$')) + + bwipe! +enddef + +def Test_getchangelist() + new + setline(1, 'some text') + let changelist = bufnr()->getchangelist() + assert_equal(changelist, getchangelist('%')) + bwipe! +enddef + def Test_setreg() setreg('a', ['aaa', 'bbb', 'ccc']) let reginfo = getreginfo('a') diff --git a/src/version.c b/src/version.c index 840c32535b..6d97899c01 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1569, /**/ 1568, /**/ From 9d8bfae50fdaf5f5ec6307c60ebd1fad0927c6be Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 21:21:35 +0200 Subject: [PATCH 19/33] patch 8.2.1570: configure check for dirfd() does not work on HPUX Problem: Configure check for dirfd() does not work on HPUX. (Michael Osipov) Solution: Use AC_TRY_LINK instead of AC_TRY_COMPILE. (closes #6838) --- src/auto/configure | 10 ++++++---- src/configure.ac | 4 ++-- src/fileio.c | 5 +++++ src/globals.h | 3 ++- src/version.c | 2 ++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index c85dec9dac..e66162fd63 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -13771,7 +13771,7 @@ DIR * dir=opendir("dirname"); dirfd(dir); return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; }; $as_echo "#define HAVE_DIRFD 1" >>confdefs.h @@ -13779,7 +13779,8 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable" >&5 $as_echo "not usable" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock" >&5 $as_echo_n "checking for flock... " >&6; } @@ -13794,7 +13795,7 @@ flock(10, LOCK_SH); return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; }; $as_echo "#define HAVE_FLOCK 1" >>confdefs.h @@ -13802,7 +13803,8 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable" >&5 $as_echo "not usable" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysctl" >&5 $as_echo_n "checking for sysctl... " >&6; } diff --git a/src/configure.ac b/src/configure.ac index a2683a6b10..6176dc9ca5 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -4013,7 +4013,7 @@ AC_TRY_LINK([#include ], [rename("this", "that")], dnl check for dirfd() AC_MSG_CHECKING(for dirfd) -AC_TRY_COMPILE( +AC_TRY_LINK( [#include #include ], [DIR * dir=opendir("dirname"); dirfd(dir);], @@ -4021,7 +4021,7 @@ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DIRFD), AC_MSG_RESULT(not usable)) dnl check for flock() AC_MSG_CHECKING(for flock) -AC_TRY_COMPILE( +AC_TRY_LINK( [#include ], [flock(10, LOCK_SH);], AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOCK), AC_MSG_RESULT(not usable)) diff --git a/src/fileio.c b/src/fileio.c index 361109313b..aa6596df64 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -24,6 +24,11 @@ // Is there any system that doesn't have access()? #define USE_MCH_ACCESS +#if defined(__hpux) && !defined(HAVE_DIRFD) +# define dirfd(x) ((x)->__dd_fd) +# define HAVE_DIRFD +#endif + static char_u *next_fenc(char_u **pp, int *alloced); #ifdef FEAT_EVAL static char_u *readfile_charconvert(char_u *fname, char_u *fenc, int *fdp); diff --git a/src/globals.h b/src/globals.h index 1a764b5091..7dbc49e3ec 100644 --- a/src/globals.h +++ b/src/globals.h @@ -773,7 +773,8 @@ EXTERN int ru_wid; // 'rulerfmt' width of ruler when non-zero EXTERN int sc_col; // column for shown command #ifdef TEMPDIRNAMES -# if defined(UNIX) && defined(HAVE_FLOCK) && defined(HAVE_DIRFD) +# if defined(UNIX) && defined(HAVE_FLOCK) \ + && (defined(HAVE_DIRFD) || defined(__hpux)) EXTERN DIR *vim_tempdir_dp INIT(= NULL); // File descriptor of temp dir # endif EXTERN char_u *vim_tempdir INIT(= NULL); // Name of Vim's own temp dir. diff --git a/src/version.c b/src/version.c index 6d97899c01..6b4c1cd273 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1570, /**/ 1569, /**/ From 119f5572306c4abba91eaf446c0c52637db223e8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 21:31:22 +0200 Subject: [PATCH 20/33] patch 8.2.1571: Vim9: count() third argument cannot be "true" Problem: Vim9: count() third argument cannot be "true". Solution: use tv_get_bool_chk(). (closes #6818) --- src/list.c | 2 +- src/testdir/test_vim9_func.vim | 5 +++++ src/typval.c | 1 - src/version.c | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/list.c b/src/list.c index e7d288a2fb..e0c8c2e17d 100644 --- a/src/list.c +++ b/src/list.c @@ -2167,7 +2167,7 @@ f_count(typval_T *argvars, typval_T *rettv) int error = FALSE; if (argvars[2].v_type != VAR_UNKNOWN) - ic = (int)tv_get_number_chk(&argvars[2], &error); + ic = (int)tv_get_bool_chk(&argvars[2], &error); if (argvars[0].v_type == VAR_STRING) { diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 480a9a5a7d..8f4928ac0e 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1492,6 +1492,11 @@ def Fibonacci(n: number): number endif enddef +def Test_count() + assert_equal(3, count('ABC ABC ABC', 'b', true)) + assert_equal(0, count('ABC ABC ABC', 'b', false)) +enddef + def Test_recursive_call() assert_equal(6765, Fibonacci(20)) enddef diff --git a/src/typval.c b/src/typval.c index c7cfd41167..db52d59730 100644 --- a/src/typval.c +++ b/src/typval.c @@ -283,7 +283,6 @@ tv_get_bool(typval_T *varp) tv_get_bool_chk(typval_T *varp, int *denote) { return tv_get_bool_or_number_chk(varp, denote, TRUE); - } #ifdef FEAT_FLOAT diff --git a/src/version.c b/src/version.c index 6b4c1cd273..9399221cd5 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1571, /**/ 1570, /**/ From 551d25e76545df785a9f62df52f34bc1dd368bfb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 21:37:56 +0200 Subject: [PATCH 21/33] patch 8.2.1572: Vim9: expand() does not take "true" as argument Problem: Vim9: expand() does not take "true" as argument. Solution: Use tv_get_bool_chk(). (closes #6819) --- src/evalfunc.c | 4 ++-- src/testdir/test_vim9_func.vim | 6 ++++++ src/version.c | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index 771e393db6..69f7816329 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -2434,7 +2434,7 @@ f_expand(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN - && tv_get_number_chk(&argvars[2], &error) + && tv_get_bool_chk(&argvars[2], &error) && !error) rettv_list_set(rettv, NULL); @@ -2458,7 +2458,7 @@ f_expand(typval_T *argvars, typval_T *rettv) // When the optional second argument is non-zero, don't remove matches // for 'wildignore' and don't put matches for 'suffixes' at the end. if (argvars[1].v_type != VAR_UNKNOWN - && tv_get_number_chk(&argvars[1], &error)) + && tv_get_bool_chk(&argvars[1], &error)) options |= WILD_KEEP_ALL; if (!error) { diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 8f4928ac0e..cf48ba8660 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1497,6 +1497,12 @@ def Test_count() assert_equal(0, count('ABC ABC ABC', 'b', false)) enddef +def Test_expand() + split SomeFile + assert_equal(['SomeFile'], expand('%', true, true)) + close +enddef + def Test_recursive_call() assert_equal(6765, Fibonacci(20)) enddef diff --git a/src/version.c b/src/version.c index 9399221cd5..c674148ee1 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1572, /**/ 1571, /**/ From 67ff97ded70a87bc77f58d0bf9a261710ae88112 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 21:45:54 +0200 Subject: [PATCH 22/33] patch 8.2.1573: Vim9: getreg() does not take "true" as argument Problem: Vim9: getreg() does not take "true" as argument. Solution: Use tv_get_bool_chk(). (closes #6820) --- src/evalfunc.c | 4 ++-- src/testdir/test_vim9_func.vim | 6 ++++++ src/version.c | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index 69f7816329..340ecf0958 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3336,9 +3336,9 @@ f_getreg(typval_T *argvars, typval_T *rettv) error = strregname == NULL; if (argvars[1].v_type != VAR_UNKNOWN) { - arg2 = (int)tv_get_number_chk(&argvars[1], &error); + arg2 = (int)tv_get_bool_chk(&argvars[1], &error); if (!error && argvars[2].v_type != VAR_UNKNOWN) - return_list = (int)tv_get_number_chk(&argvars[2], &error); + return_list = (int)tv_get_bool_chk(&argvars[2], &error); } } else diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index cf48ba8660..8d8e0d48ea 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1503,6 +1503,12 @@ def Test_expand() close enddef +def Test_getreg() + let lines = ['aaa', 'bbb', 'ccc'] + setreg('a', lines) + assert_equal(lines, getreg('a', true, true)) +enddef + def Test_recursive_call() assert_equal(6765, Fibonacci(20)) enddef diff --git a/src/version.c b/src/version.c index c674148ee1..886cd4ef41 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1573, /**/ 1572, /**/ From 5892ea151197c8a6363c7ce2322d84277b97353e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 21:53:11 +0200 Subject: [PATCH 23/33] patch 8.2.1574: Vim9: glob() doesnot take "true" as argument Problem: Vim9: glob() doesnot take "true" as argument. Solution: Use tv_get_bool_chk(). (closes #6821) --- src/filepath.c | 6 +++--- src/testdir/test_vim9_func.vim | 4 ++++ src/version.c | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/filepath.c b/src/filepath.c index e4798d2a04..9f05434f5d 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -1174,14 +1174,14 @@ f_glob(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; if (argvars[1].v_type != VAR_UNKNOWN) { - if (tv_get_number_chk(&argvars[1], &error)) + if (tv_get_bool_chk(&argvars[1], &error)) options |= WILD_KEEP_ALL; if (argvars[2].v_type != VAR_UNKNOWN) { - if (tv_get_number_chk(&argvars[2], &error)) + if (tv_get_bool_chk(&argvars[2], &error)) rettv_list_set(rettv, NULL); if (argvars[3].v_type != VAR_UNKNOWN - && tv_get_number_chk(&argvars[3], &error)) + && tv_get_bool_chk(&argvars[3], &error)) options |= WILD_ALLLINKS; } } diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 8d8e0d48ea..ac676803f8 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1509,6 +1509,10 @@ def Test_getreg() assert_equal(lines, getreg('a', true, true)) enddef +def Test_glob() + assert_equal(['runtest.vim'], glob('runtest.vim', true, true, true)) +enddef + def Test_recursive_call() assert_equal(6765, Fibonacci(20)) enddef diff --git a/src/version.c b/src/version.c index 886cd4ef41..5761f832e5 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1574, /**/ 1573, /**/ From f966ce5ea24748eed10f708d4f828be44887a559 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 21:57:07 +0200 Subject: [PATCH 24/33] patch 8.2.1575: Vim9: globpath() doesnot take "true" as argument Problem: Vim9: globpath() doesnot take "true" as argument. Solution: Use tv_get_bool_chk(). (closes #6821) --- src/filepath.c | 6 +++--- src/testdir/test_vim9_func.vim | 4 ++++ src/version.c | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/filepath.c b/src/filepath.c index 9f05434f5d..bdd9098b80 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -1241,14 +1241,14 @@ f_globpath(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; if (argvars[2].v_type != VAR_UNKNOWN) { - if (tv_get_number_chk(&argvars[2], &error)) + if (tv_get_bool_chk(&argvars[2], &error)) flags |= WILD_KEEP_ALL; if (argvars[3].v_type != VAR_UNKNOWN) { - if (tv_get_number_chk(&argvars[3], &error)) + if (tv_get_bool_chk(&argvars[3], &error)) rettv_list_set(rettv, NULL); if (argvars[4].v_type != VAR_UNKNOWN - && tv_get_number_chk(&argvars[4], &error)) + && tv_get_bool_chk(&argvars[4], &error)) flags |= WILD_ALLLINKS; } } diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index ac676803f8..11a6ddd015 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1513,6 +1513,10 @@ def Test_glob() assert_equal(['runtest.vim'], glob('runtest.vim', true, true, true)) enddef +def Test_globpath() + assert_equal(['./runtest.vim'], globpath('.', 'runtest.vim', true, true, true)) +enddef + def Test_recursive_call() assert_equal(6765, Fibonacci(20)) enddef diff --git a/src/version.c b/src/version.c index 5761f832e5..2bf4914601 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1575, /**/ 1574, /**/ From 6c553f9c04a698ac2e19584f8ea8e2cb7cd98c80 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 22:10:34 +0200 Subject: [PATCH 25/33] patch 8.2.1576: Vim9: index() does not take "true" as argument Problem: Vim9: index() does not take "true" as argument. Solution: Use tv_get_bool_chk(). (closes #6823) --- src/evalfunc.c | 2 +- src/testdir/test_vim9_func.vim | 4 ++++ src/version.c | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index 340ecf0958..4f0bb5cea5 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4944,7 +4944,7 @@ f_index(typval_T *argvars, typval_T *rettv) item = list_find(l, (long)tv_get_number_chk(&argvars[2], &error)); idx = l->lv_u.mat.lv_idx; if (argvars[3].v_type != VAR_UNKNOWN) - ic = (int)tv_get_number_chk(&argvars[3], &error); + ic = (int)tv_get_bool_chk(&argvars[3], &error); if (error) item = NULL; } diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 11a6ddd015..04f8d7aa7e 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1497,6 +1497,10 @@ def Test_count() assert_equal(0, count('ABC ABC ABC', 'b', false)) enddef +def Test_index() + assert_equal(3, index(['a', 'b', 'a', 'B'], 'b', 2, true)) +enddef + def Test_expand() split SomeFile assert_equal(['SomeFile'], expand('%', true, true)) diff --git a/src/version.c b/src/version.c index 2bf4914601..388be57e3e 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1576, /**/ 1575, /**/ From 04d594b9c14299ed50da0774fb8d3a10fbc4076f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 22:25:35 +0200 Subject: [PATCH 26/33] patch 8.2.1577: Vim9: hasmapto()/mapcheck()/maparg() do nottake "true" arg Problem: Vim9: hasmapto(), mapcheck() and maparg() do not take "true" as argument. Solution: Use tv_get_bool(). (closes #6822, closes #6824) --- src/evalfunc.c | 2 +- src/map.c | 4 ++-- src/testdir/test_vim9_func.vim | 39 ++++++++++++++++++++++++++++++++++ src/version.c | 2 ++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index 4f0bb5cea5..91fbc675ce 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4808,7 +4808,7 @@ f_hasmapto(typval_T *argvars, typval_T *rettv) { mode = tv_get_string_buf(&argvars[1], buf); if (argvars[2].v_type != VAR_UNKNOWN) - abbr = (int)tv_get_number(&argvars[2]); + abbr = (int)tv_get_bool(&argvars[2]); } if (map_to_exists(name, mode, abbr)) diff --git a/src/map.c b/src/map.c index dd3139dcd5..eed3a55d04 100644 --- a/src/map.c +++ b/src/map.c @@ -2204,9 +2204,9 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact) which = tv_get_string_buf_chk(&argvars[1], buf); if (argvars[2].v_type != VAR_UNKNOWN) { - abbr = (int)tv_get_number(&argvars[2]); + abbr = (int)tv_get_bool(&argvars[2]); if (argvars[3].v_type != VAR_UNKNOWN) - get_dict = (int)tv_get_number(&argvars[3]); + get_dict = (int)tv_get_bool(&argvars[3]); } } else diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 04f8d7aa7e..f79c2e0bdb 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1521,6 +1521,45 @@ def Test_globpath() assert_equal(['./runtest.vim'], globpath('.', 'runtest.vim', true, true, true)) enddef +def Test_hasmapto() + assert_equal(0, hasmapto('foobar', 'i', true)) + iabbrev foo foobar + assert_equal(1, hasmapto('foobar', 'i', true)) + iunabbrev foo +enddef + +def SID(): number + return expand('') + ->matchstr('\zs\d\+\ze_$') + ->str2nr() +enddef + +def Test_maparg() + let lnum = str2nr(expand('')) + map foo bar + assert_equal(#{ + lnum: lnum + 1, + script: 0, + mode: ' ', + silent: 0, + noremap: 0, + lhs: 'foo', + lhsraw: 'foo', + nowait: 0, + expr: 0, + sid: SID(), + rhs: 'bar', + buffer: 0}, + maparg('foo', '', false, true)) + unmap foo +enddef + +def Test_mapcheck() + iabbrev foo foobar + assert_equal('foobar', mapcheck('foo', 'i', true)) + iunabbrev foo +enddef + def Test_recursive_call() assert_equal(6765, Fibonacci(20)) enddef diff --git a/src/version.c b/src/version.c index 388be57e3e..5232e8485c 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1577, /**/ 1576, /**/ From 62f93f4ec9db1deca088bab7783a35306e2ed4cb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 2 Sep 2020 22:33:24 +0200 Subject: [PATCH 27/33] patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument Problem: Vim9: popup_clear() does not take "true" as argument. Solution: Use tv_get_bool(). (closes #6826) --- src/popupwin.c | 2 +- src/testdir/test_popupwin.vim | 17 ++++++++++------- src/version.c | 2 ++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/popupwin.c b/src/popupwin.c index 053d6d3fd8..953e76cc7e 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -2125,7 +2125,7 @@ f_popup_clear(typval_T *argvars, typval_T *rettv UNUSED) int force = FALSE; if (argvars[0].v_type != VAR_UNKNOWN) - force = (int)tv_get_number(&argvars[0]); + force = (int)tv_get_bool(&argvars[0]); close_all_popups(force); } diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim index 1aebe058f7..9e35c7ffc7 100644 --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -2559,20 +2559,23 @@ endfunc func Test_popupwin_close_prevwin() CheckFeature terminal + call Popupwin_close_prevwin() +endfunc - call assert_equal(1, winnr('$')) +def Popupwin_close_prevwin() + assert_equal(1, winnr('$')) split wincmd b - call assert_equal(2, winnr()) + assert_equal(2, winnr()) let buf = term_start(&shell, #{hidden: 1}) - call popup_create(buf, {}) - call TermWait(buf, 100) - call popup_clear(1) - call assert_equal(2, winnr()) + popup_create(buf, {}) + TermWait(buf, 100) + popup_clear(true) + assert_equal(2, winnr()) quit exe 'bwipe! ' .. buf -endfunc +enddef func Test_popupwin_with_buffer_and_filter() new Xwithfilter diff --git a/src/version.c b/src/version.c index 5232e8485c..12d49bbcf0 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1578, /**/ 1577, /**/ From 5b5aa11801c75fac18a587bea02dc7a8b5b90c4b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 3 Sep 2020 16:05:04 +0200 Subject: [PATCH 28/33] patch 8.2.1579: reports from asan are not optimal Problem: Reports from asan are not optimal. Solution: Use clang with ubsan. (James McCoy, closes #6811) --- .travis.yml | 34 ++++++++++++++++++++++++++-------- src/version.c | 2 ++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 356a8c10c6..d3bb301922 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: c env: global: - - BUILD=yes TEST=test CONFOPT= LEAK_CFLAGS="-DEXITFREE" SHADOWOPT= SRCDIR=./src CHECK_AUTOCONF=no + - BUILD=yes TEST=test CONFOPT= LEAK_CFLAGS="-DEXITFREE" SHADOWOPT= SRCDIR=./src CHECK_AUTOCONF=no LOG_DIR="$TRAVIS_BUILD_DIR/logs" _anchors: envs: @@ -25,8 +25,8 @@ _anchors: - &coverage CFLAGS="--coverage -DUSE_GCOV_FLUSH" LDFLAGS=--coverage - &asan # ASAN build - SANITIZER_CFLAGS="-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize=address -fno-omit-frame-pointer" - ASAN_OPTIONS="print_stacktrace=1 log_path=asan" LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/src/testdir/lsan-suppress.txt" + SANITIZER_CFLAGS="-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" + ASAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/asan" UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan" LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/src/testdir/lsan-suppress.txt" - &shadowopt SHADOWOPT="-C src/shadow" SRCDIR=./src/shadow @@ -35,7 +35,7 @@ _anchors: dist: bionic addons: apt: - packages: + packages: &apt-packages - autoconf - clang - lcov @@ -108,13 +108,14 @@ _anchors: # Update pyenv to fix the error "/opt/pyenv/libexec/pyenv: line 43: cd: asan_symbolize-6.0: Not a directory". # https://github.com/pyenv/pyenv/issues/580 - (cd "${PYENV_ROOT}" && git fetch -p origin && git checkout "$(git rev-list --tags -n1)") &>/dev/null || true - - find . -type f -name 'asan.*' -size +0 2>/dev/null | xargs grep -l '^==[[:digit:]]*==ERROR:' | xargs -I{} -n1 -t asan_symbolize -l{} + - for f in $(grep -l '#[[:digit:]]* *0x[[:digit:]a-fA-F]*' "$LOG_DIR"/*); do asan_symbolize-11 -l "$f"; done branches: except: - /^v[0-9]/ script: + - mkdir -p "$LOG_DIR" - NPROC=$(getconf _NPROCESSORS_ONLN) - set -o errexit - echo -e "\\033[33;1mConfiguring Vim\\033[0m" && echo -en "travis_fold:start:configure\\r\\033[0K" @@ -135,7 +136,7 @@ script: # Append various warning flags to CFLAGS. # BSD sed needs backup extension specified. sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk - if [[ "${TRAVIS_OS_NAME}" = "osx" ]]; then + if [[ "${TRAVIS_OS_NAME}" = "osx" ]] || [[ "${CC}" = "clang-11" ]]; then # On macOS, the entity of gcc is clang. sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk else @@ -155,6 +156,15 @@ script: - echo -e "\\033[33;1mTesting Vim\\033[0m" && echo -en "travis_fold:start:test\\r\\033[0K" - do_test make ${SHADOWOPT} ${TEST} && FOLD_MARKER=travis_fold - echo -en "${FOLD_MARKER}:end:test\\r\\033[0K" + - | + # Not all sanitizers will cause the tests to fail. This helps since we can + # see all the failures instead of just the first one, but we still want the + # test phase to fail if any sanitizer issues are detected. + if [[ -n "${ASAN_OPTIONS}" ]]; then + if grep -q '#[[:digit:]]* *0x[[:digit:]a-fA-F]*' "$LOG_DIR"/*; then + false + fi + fi # Instead of using all environments with both compilers on both systems, # exclude some builds on mac os x and linux. @@ -241,8 +251,16 @@ jobs: - *coverage after_success: *eval-coverage - <<: *linux # ASAN - name: huge+asan/gcc - compiler: gcc + name: huge+asan/clang + compiler: clang-11 + addons: + apt: + sources: + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' + key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' + packages: + - *apt-packages + - clang-11 env: - *linux-huge - *asan diff --git a/src/version.c b/src/version.c index 12d49bbcf0..f9198c7e8e 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1579, /**/ 1578, /**/ From a60053b8f4cc7e135ba9496a8f4855d26aee09e7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 3 Sep 2020 16:50:13 +0200 Subject: [PATCH 29/33] patch 8.2.1580: wildmenu does not work properly Problem: Wildmenu does not work properly. Solution: Do not call may_do_incsearch_highlighting() if completion is in progress. --- src/ex_getln.c | 24 +++++++++++----------- src/testdir/dumps/Test_wildmenu_1.dump | 8 ++++++++ src/testdir/dumps/Test_wildmenu_2.dump | 8 ++++++++ src/testdir/dumps/Test_wildmenu_3.dump | 8 ++++++++ src/testdir/dumps/Test_wildmenu_4.dump | 8 ++++++++ src/testdir/test_cmdline.vim | 28 ++++++++++++++++++++++++++ src/version.c | 2 ++ 7 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 src/testdir/dumps/Test_wildmenu_1.dump create mode 100644 src/testdir/dumps/Test_wildmenu_2.dump create mode 100644 src/testdir/dumps/Test_wildmenu_3.dump create mode 100644 src/testdir/dumps/Test_wildmenu_4.dump diff --git a/src/ex_getln.c b/src/ex_getln.c index 60a8a0c712..bc193a209a 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -397,7 +397,8 @@ may_do_incsearch_highlighting( // NOTE: must call restore_last_search_pattern() before returning! save_last_search_pattern(); - if (!do_incsearch_highlighting(firstc, &search_delim, is_state, &skiplen, &patlen)) + if (!do_incsearch_highlighting(firstc, &search_delim, is_state, + &skiplen, &patlen)) { restore_last_search_pattern(); finish_incsearch_highlighting(FALSE, is_state, TRUE); @@ -1235,10 +1236,10 @@ getcmdline_int( if (has_mbyte) j -= (*mb_head_off)(ccline.cmdbuff, ccline.cmdbuff + j); if (vim_ispathsep(ccline.cmdbuff[j]) -#ifdef BACKSLASH_IN_FILENAME +# ifdef BACKSLASH_IN_FILENAME && vim_strchr((char_u *)" *?[{`$%#", ccline.cmdbuff[j + 1]) == NULL -#endif +# endif ) { if (found) @@ -1425,6 +1426,7 @@ getcmdline_int( if ((c == p_wc && !gotesc && KeyTyped) || c == p_wcm) { int options = WILD_NO_BEEP; + if (wim_flags[wim_index] & WIM_BUFLASTUSED) options |= WILD_BUFLASTUSED; if (xpc.xp_numfiles > 0) // typed p_wc at least twice @@ -1442,8 +1444,7 @@ getcmdline_int( res = nextwild(&xpc, WILD_LONGEST, options, firstc != '@'); else if (wim_flags[wim_index] & WIM_FULL) - res = nextwild(&xpc, WILD_NEXT, options, - firstc != '@'); + res = nextwild(&xpc, WILD_NEXT, options, firstc != '@'); else res = OK; // don't insert 'wildchar' now } @@ -1454,11 +1455,10 @@ getcmdline_int( // if 'wildmode' first contains "longest", get longest // common part if (wim_flags[0] & WIM_LONGEST) - res = nextwild(&xpc, WILD_LONGEST, options, - firstc != '@'); + res = nextwild(&xpc, WILD_LONGEST, options, firstc != '@'); else res = nextwild(&xpc, WILD_EXPAND_KEEP, options, - firstc != '@'); + firstc != '@'); // if interrupted while completing, behave like it failed if (got_int) @@ -1483,7 +1483,7 @@ getcmdline_int( wim_index = 1; if ((wim_flags[wim_index] & WIM_LIST) #ifdef FEAT_WILDMENU - || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0) + || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0) #endif ) { @@ -1511,8 +1511,7 @@ getcmdline_int( nextwild(&xpc, WILD_LONGEST, options, firstc != '@'); else if (wim_flags[wim_index] & WIM_FULL) - nextwild(&xpc, WILD_NEXT, options, - firstc != '@'); + nextwild(&xpc, WILD_NEXT, options, firstc != '@'); } else vim_beep(BO_WILD); @@ -2348,7 +2347,8 @@ cmdline_changed: trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED); #ifdef FEAT_SEARCH_EXTRA - may_do_incsearch_highlighting(firstc, count, &is_state); + if (xpc.xp_context == EXPAND_NOTHING) + may_do_incsearch_highlighting(firstc, count, &is_state); #endif #ifdef FEAT_RIGHTLEFT diff --git a/src/testdir/dumps/Test_wildmenu_1.dump b/src/testdir/dumps/Test_wildmenu_1.dump new file mode 100644 index 0000000000..a118969584 --- /dev/null +++ b/src/testdir/dumps/Test_wildmenu_1.dump @@ -0,0 +1,8 @@ +| +0&#ffffff0@74 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|v+0#0000001#ffff4012|i|m|9|s|c|r|i|p|t| +3#0000000#ffffff0@1|v|i|m|g|r|e|p| @1|v|i|m|g|r|e|p|a|d@1| @43 +|:+0&&|v|i|m|9|s|c|r|i|p|t> @63 diff --git a/src/testdir/dumps/Test_wildmenu_2.dump b/src/testdir/dumps/Test_wildmenu_2.dump new file mode 100644 index 0000000000..46b41ae075 --- /dev/null +++ b/src/testdir/dumps/Test_wildmenu_2.dump @@ -0,0 +1,8 @@ +| +0&#ffffff0@74 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v+0#0000001#ffff4012|i|m|g|r|e|p| +3#0000000#ffffff0@1|v|i|m|g|r|e|p|a|d@1| @43 +|:+0&&|v|i|m|g|r|e|p> @66 diff --git a/src/testdir/dumps/Test_wildmenu_3.dump b/src/testdir/dumps/Test_wildmenu_3.dump new file mode 100644 index 0000000000..44749367df --- /dev/null +++ b/src/testdir/dumps/Test_wildmenu_3.dump @@ -0,0 +1,8 @@ +| +0&#ffffff0@74 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v|i|m|g|r|e|p| @1|v+0#0000001#ffff4012|i|m|g|r|e|p|a|d@1| +3#0000000#ffffff0@43 +|:+0&&|v|i|m|g|r|e|p|a|d@1> @63 diff --git a/src/testdir/dumps/Test_wildmenu_4.dump b/src/testdir/dumps/Test_wildmenu_4.dump new file mode 100644 index 0000000000..3703fd5292 --- /dev/null +++ b/src/testdir/dumps/Test_wildmenu_4.dump @@ -0,0 +1,8 @@ +| +0&#ffffff0@74 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v|i|m|g|r|e|p| @1|v|i|m|g|r|e|p|a|d@1| @43 +|:+0&&|v|i|m> @70 diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index 266513ee9f..6ebfa31c86 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -84,6 +84,34 @@ func Test_complete_wildmenu() call delete('Xdir1', 'd') set nowildmenu endfunc +f +func Test_wildmenu_screendump() + CheckScreendump + + let lines =<< trim [SCRIPT] + set wildmenu hlsearch + [SCRIPT] + call writefile(lines, 'XTest_wildmenu') + + let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8}) + call term_sendkeys(buf, ":vim\") + call VerifyScreenDump(buf, 'Test_wildmenu_1', {}) + + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_2', {}) + + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_3', {}) + + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_4', {}) + call term_sendkeys(buf, "\") + + " clean up + call StopVimInTerminal(buf) + call delete('XTest_wildmenu') +endfunc + func Test_map_completion() CheckFeature cmdline_compl diff --git a/src/version.c b/src/version.c index f9198c7e8e..8d20b46bef 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1580, /**/ 1579, /**/ From 1f42f5a675fdab9ce5cdafbecea59c45e81f7ff8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 3 Sep 2020 18:52:24 +0200 Subject: [PATCH 30/33] patch 8.2.1581: using line() for global popup window doesn't work Problem: Using line() for global popup window doesn't work. Solution: Set tabpage to "curtab". (closes #6847) --- src/evalwindow.c | 2 +- src/testdir/test_popupwin.vim | 12 ++++++++++++ src/version.c | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/evalwindow.c b/src/evalwindow.c index b50776d74d..3ddd96bcbc 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -117,7 +117,7 @@ win_id2wp_tp(int id, tabpage_T **tpp) if (wp->w_id == id) { if (tpp != NULL) - *tpp = tp; + *tpp = curtab; // any tabpage would do return wp; } #endif diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim index 9e35c7ffc7..ec4898fa63 100644 --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -2239,6 +2239,18 @@ func Test_popup_settext() call delete('XtestPopupSetText') endfunc +func Test_popup_settext_getline() + let id = popup_create('', #{ tabpage: 0 }) + call popup_settext(id, ['a','b']) + call assert_equal(2, line('$', id)) " OK :) + call popup_close(id) + + let id = popup_create('', #{ tabpage: -1 }) + call popup_settext(id, ['a','b']) + call assert_equal(2, line('$', id)) " Fails :( + call popup_close(id) +endfunc + func Test_popup_hidden() new diff --git a/src/version.c b/src/version.c index 8d20b46bef..39e81bc9ad 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1581, /**/ 1580, /**/ From 7ca86fe8dc584141d6a73408acf3e90d8c88c7b9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 3 Sep 2020 19:25:11 +0200 Subject: [PATCH 31/33] patch 8.2.1582: the channel log does not show typed text Problem: The channel log does not show typed text. Solution: Add raw typed text to the log file. --- src/os_win32.c | 7 +++++++ src/ui.c | 7 +++++++ src/version.c | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/os_win32.c b/src/os_win32.c index 96af44364b..52573fe621 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -2065,6 +2065,13 @@ theend: buf[len++] = typeahead[0]; mch_memmove(typeahead, typeahead + 1, --typeaheadlen); } +# ifdef FEAT_JOB_CHANNEL + if (len > 0) + { + buf[len] = NUL; + ch_log(NULL, "raw key input: \"%s\"", buf); + } +# endif return len; #else // FEAT_GUI_MSWIN diff --git a/src/ui.c b/src/ui.c index fc24a01b4d..7c86675595 100644 --- a/src/ui.c +++ b/src/ui.c @@ -949,6 +949,13 @@ fill_input_buf(int exit_on_error UNUSED) # else len = read(read_cmd_fd, (char *)inbuf + inbufcount, readlen); # endif +# ifdef FEAT_JOB_CHANNEL + if (len > 0) + { + inbuf[inbufcount + len] = NUL; + ch_log(NULL, "raw key input: \"%s\"", inbuf + inbufcount); + } +# endif if (len > 0 || got_int) break; diff --git a/src/version.c b/src/version.c index 39e81bc9ad..9c5f37097d 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1582, /**/ 1581, /**/ From 18eedfa40b45b1de955d61417e9918ef7d6e83f9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 3 Sep 2020 19:50:05 +0200 Subject: [PATCH 32/33] patch 8.2.1583: MS-Windows: cannot easily measure code coverage Problem: MS-Windows: cannot easily measure code coverage. Solution: Add the COVERAGE option. (Ken Takata, closes #6842) --- src/Make_cyg_ming.mak | 11 +++++++++++ src/version.c | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index db0513f432..5fc08331da 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -38,6 +38,9 @@ DEBUG=no # set to yes to create a mapfile #MAP=yes +# set to yes to measure code coverage +COVERAGE=no + # set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization OPTIMIZE=MAXSPEED @@ -700,6 +703,11 @@ CFLAGS += -O2 LFLAGS += -s endif +ifeq ($(COVERAGE),yes) +CFLAGS += --coverage +LFLAGS += --coverage +endif + LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o CUIOBJ = $(OUTDIR)/iscygpty.o @@ -938,6 +946,9 @@ EXELFLAGS += -municode ifneq ($(DEBUG),yes) EXELFLAGS += -s endif + ifeq ($(COVERAGE),yes) +EXELFLAGS += --coverage + endif DEFINES += $(DEF_GUI) -DVIMDLL OBJ += $(GUIOBJ) $(CUIOBJ) OUTDIR = dobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) diff --git a/src/version.c b/src/version.c index 9c5f37097d..de956a642d 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1583, /**/ 1582, /**/ From eb24556df3b16a19009ee3ddee8ae94dc058a3b2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 3 Sep 2020 22:33:44 +0200 Subject: [PATCH 33/33] patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find() Problem: Vim9: cannot use "true" for "skipstart" in prop_find(). Solution: Use dict_get_bool() instead of tv_get_number(). (closes #6852) --- src/testdir/test_textprop.vim | 33 +++++++++++++++++++-------------- src/textprop.c | 4 +--- src/version.c | 2 ++ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 5990fbf3f1..bacb288c52 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -212,23 +212,28 @@ func Test_prop_find() call prop_clear(1,6) call prop_type_delete('prop_name') - " Multiple props per line, start on the first, should find the second. - let expected = {'lnum': 1, 'id': 0, 'col': 14, 'end': 1, 'type': 'misspell', 'length': 2, 'start': 1} - eval ['the quikc bronw fox jumsp over the layz dog']->repeat(2)->setline(1) - call prop_type_add('misspell', #{highlight: 'ErrorMsg'}) - for lnum in [1, 2] - for col in [8, 14, 24, 38] - call prop_add(lnum, col, #{type: 'misspell', length: 2}) - endfor - endfor - call cursor(1, 8) - let result = prop_find(#{type: 'misspell', skipstart: 1}, 'f') - call assert_equal(expected, result) - - call prop_type_delete('misspell') bwipe! endfunc +def Test_prop_find2() + # Multiple props per line, start on the first, should find the second. + new + ['the quikc bronw fox jumsp over the layz dog']->repeat(2)->setline(1) + prop_type_add('misspell', #{highlight: 'ErrorMsg'}) + for lnum in [1, 2] + for col in [8, 14, 24, 38] + prop_add(lnum, col, #{type: 'misspell', length: 2}) + endfor + endfor + cursor(1, 8) + let expected = {'lnum': 1, 'id': 0, 'col': 14, 'end': 1, 'type': 'misspell', 'length': 2, 'start': 1} + let result = prop_find(#{type: 'misspell', skipstart: true}, 'f') + assert_equal(expected, result) + + prop_type_delete('misspell') + bwipe! +enddef + func Test_prop_find_smaller_len_than_match_col() new call prop_type_add('test', {'highlight': 'ErrorMsg'}) diff --git a/src/textprop.c b/src/textprop.c index 9dff6b869f..beb9a273d0 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -645,9 +645,7 @@ f_prop_find(typval_T *argvars, typval_T *rettv) return; } - di = dict_find(dict, (char_u *)"skipstart", -1); - if (di != NULL) - skipstart = tv_get_number(&di->di_tv); + skipstart = dict_get_bool(dict, (char_u *)"skipstart", 0); if (dict_find(dict, (char_u *)"id", -1) != NULL) id = dict_get_number(dict, (char_u *)"id"); diff --git a/src/version.c b/src/version.c index de956a642d..116fab9d2b 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1584, /**/ 1583, /**/