From 3f1b5312e0fa0089f255bf9c0c3b27590552119e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 6 Feb 2024 10:43:36 +0100 Subject: [PATCH 001/426] patch 9.1.0077: Unnecessary call to redraw_for_cursorline() in nv_mousescroll() Problem: The call to redraw_for_cursorline() in nv_mousescroll() is unnecessary because redraw_for_cursorline() only sets redraw type to UPD_VALID, and all code paths in do_mousescroll() already set redraw type to at least UPD_VALID. Solution: Remove call to redraw_for_cursorline() in nv_mousescroll(). (zeertzjq) closes: #13979 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/mouse.c | 4 ---- src/move.c | 3 ++- src/proto/move.pro | 1 - src/version.c | 2 ++ 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mouse.c b/src/mouse.c index b0db60f11f..e5f06874f8 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -2224,10 +2224,6 @@ nv_mousescroll(cmdarg_T *cap) // Call the common mouse scroll function shared with other modes. do_mousescroll(cap); -#ifdef FEAT_SYN_HL - if (curwin != old_curwin && curwin->w_p_cul) - redraw_for_cursorline(curwin); -#endif curwin->w_redr_status = TRUE; curwin = old_curwin; curbuf = curwin->w_buffer; diff --git a/src/move.c b/src/move.c index 5d2fece63a..9ea24c8ed2 100644 --- a/src/move.c +++ b/src/move.c @@ -19,6 +19,7 @@ #include "vim.h" +static void redraw_for_cursorline(win_T *wp); static int scrolljump_value(void); static int check_top_offset(void); static void curs_rows(win_T *wp); @@ -155,7 +156,7 @@ comp_botline(win_T *wp) * Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is * set. */ - void + static void redraw_for_cursorline(win_T *wp) { if ((wp->w_p_rnu diff --git a/src/proto/move.pro b/src/proto/move.pro index b96b86d0fa..bc9c025635 100644 --- a/src/proto/move.pro +++ b/src/proto/move.pro @@ -1,6 +1,5 @@ /* move.c */ int adjust_plines_for_skipcol(win_T *wp); -void redraw_for_cursorline(win_T *wp); int sms_marker_overlap(win_T *wp, int extra2); void update_topline_redraw(void); void update_topline(void); diff --git a/src/version.c b/src/version.c index efde1b57f8..3e4102da9e 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 77, /**/ 76, /**/ From ea7f2f29afdbc7e506ed3e5211c76ee65448413f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:46:10 +0100 Subject: [PATCH 002/426] CI: Bump codecov/codecov-action from 3 to 4 (#13978) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Christian Brabandt --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69fb7a41de..49c9d3f1f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -286,7 +286,7 @@ jobs: - name: Codecov timeout-minutes: 20 if: matrix.coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }} @@ -677,7 +677,7 @@ jobs: - name: Codecov timeout-minutes: 20 if: matrix.coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: directory: src flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }} From 7f630e6f358275d0bce9fea2665a2763edbf6a0e Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:47:49 +0100 Subject: [PATCH 003/426] CI: skip apt upgrade on github runners (#13975) Revert: https://github.com/vim/vim/pull/13680 Fixed in: https://github.com/actions/runner-images/issues/9016 Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com> Signed-off-by: Christian Brabandt --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49c9d3f1f5..0d34658a7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,7 +124,7 @@ jobs: libattr1-dev ) fi - sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y "${PKGS[@]}" + sudo apt-get update && sudo apt-get install -y "${PKGS[@]}" - name: Install gcc-${{ env.GCC_VER }} if: matrix.compiler == 'gcc' From b1457d4cb9185b2b8d575b7736eff6d3a97d89eb Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Tue, 6 Feb 2024 10:49:14 +0100 Subject: [PATCH 004/426] patch 9.1.0078: GTK3: using wrong style for pre-edit area Problem: GTK3: using wrong style for pre-edit area Solution: remove the widget name, adjust css (lilydjwg) closes: #13972 Signed-off-by: lilydjwg Signed-off-by: Christian Brabandt --- src/gui_xim.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui_xim.c b/src/gui_xim.c index c124e8b71e..345b3a493f 100644 --- a/src/gui_xim.c +++ b/src/gui_xim.c @@ -325,7 +325,7 @@ im_preedit_window_open(void) #if GTK_CHECK_VERSION(3,16,0) { GtkStyleContext * const context - = gtk_widget_get_style_context(gui.drawarea); + = gtk_widget_get_style_context(preedit_label); GtkCssProvider * const provider = gtk_css_provider_new(); gchar *css = NULL; const char * const fontname @@ -349,7 +349,7 @@ im_preedit_window_open(void) fontsize_propval = g_strdup_printf("inherit"); css = g_strdup_printf( - "widget#vim-gui-preedit-area {\n" + "#vim-gui-preedit-area {\n" " font-family: %s,monospace;\n" " font-size: %s;\n" " color: #%.2lx%.2lx%.2lx;\n" diff --git a/src/version.c b/src/version.c index 3e4102da9e..99c74d0f8b 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 78, /**/ 77, /**/ From f7f33e3719c87279dfad109b874e2817007a1184 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Tue, 6 Feb 2024 10:56:26 +0100 Subject: [PATCH 005/426] runtime(dosbatch): improve '::' comment highlighting Added a syntax region for command blocks so that the highlighting of `::` comments in them can be controlled. The `dosbatch_colons_comment` variable now controls if all `::` comments in a code block are highlighted as comments or errors. A `::` comment at the end of a command block is always highlighted as an error. This re-enables the highlighting of `::` comments in `.bat` files as requested in #13666, while allowing control of highlighting them in command blocks requested in #11778 and first attempted in #11980. related: #11980 fixes: #13666 Co-authored-by: Mike Williams Signed-off-by: Mike Williams Signed-off-by: mevanlc Signed-off-by: Christian Brabandt --- runtime/doc/syntax.txt | 11 +++++++---- runtime/syntax/dosbatch.vim | 31 ++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 1c9f6f2b58..83285dd28b 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 9.1. Last change: 2024 Feb 05 +*syntax.txt* For Vim version 9.1. Last change: 2024 Feb 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1331,12 +1331,15 @@ Stack Overflow - https://stackoverflow.com/questions/12407800/which-comment-style-should-i-use-in-batch-files -To allow the use of the :: idiom for comments in the Windows Command -Interpreter or working with MS-DOS bat files, set the -dosbatch_colons_comment variable to anything: > +To allow the use of the :: idiom for comments in command blocks with the +Windows Command Interpreter set the dosbatch_colons_comment variable to +anything: > :let dosbatch_colons_comment = 1 +If this variable is set then a :: comment that is the last line in a command +block will be highlighted as an error. + There is an option that covers whether *.btm files should be detected as type "dosbatch" (MS-DOS batch files) or type "btm" (4DOS batch files). The latter is used by default. You may select the former with the following line: > diff --git a/runtime/syntax/dosbatch.vim b/runtime/syntax/dosbatch.vim index a75771bd2d..55601996ad 100644 --- a/runtime/syntax/dosbatch.vim +++ b/runtime/syntax/dosbatch.vim @@ -2,11 +2,11 @@ " Language: MS-DOS/Windows batch file (with NT command extensions) " Maintainer: Mike Williams " Filenames: *.bat -" Last Change: 12th February 2023 +" Last Change: 3rd February 2024 " " Options Flags: " dosbatch_cmdextversion - 1 = Windows NT, 2 = Windows 2000 [default] -" dosbatch_colons_comment - any value to treat :: as comment line +" dosbatch_colons_comment - any value to allow :: comments in code blocks " " quit when a syntax file was already loaded @@ -88,18 +88,22 @@ syn match dosbatchLabel "\"lc=4 syn match dosbatchLabel ":\h\w*\>" " Comments - usual rem but also two colons as first non-space is an idiom -syn match dosbatchComment "^rem\($\|\s.*$\)"lc=3 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell -syn match dosbatchComment "^@rem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell -syn match dosbatchComment "\srem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell -syn match dosbatchComment "\s@rem\($\|\s.*$\)"lc=5 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell +syn match dosbatchRemComment "^rem\($\|\s.*$\)"lc=3 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell +syn match dosbatchRemComment "^@rem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell +syn match dosbatchRemComment "\srem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell +syn match dosbatchRemComment "\s@rem\($\|\s.*$\)"lc=5 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell +syn match dosbatchColonComment "\s*:\s*:.*$" contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell + +" Commands code blocks +syn cluster dosbatchCodeBlockComment contains=dosbatchRemComment if exists("dosbatch_colons_comment") - syn match dosbatchComment "\s*:\s*:.*$" contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell + syn cluster dosbatchCodeBlockComment add=dosbatchColonComment else - syn match dosbatchError "\s*:\s*:.*$" + syn match dosbatchColonCommentErr contained "\s*:\s*:.*$" endif - -" Comments in ()'s - still to handle spaces before rem -syn match dosbatchComment "(rem\([^)]\|\^\@<=)\)*"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell +syn match dosbatchColonCommentErr contained "\s*:\s*:[^)]*\(\(\n\s*\)\?)\)\@=" +syn region dosbatchCodeBlock transparent start=+(+ end=+)+ contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator,@dosbatchCodeBlockComment,dosbatchColonCommentErr,dosbatchCodeBlock +syn match dosbatchCodeBlockErr ")" syn keyword dosbatchImplicit append assoc at attrib break cacls cd chcp chdir syn keyword dosbatchImplicit chkdsk chkntfs cls cmd color comp compact convert copy @@ -116,6 +120,8 @@ syn keyword dosbatchImplicit vol xcopy hi def link dosbatchTodo Todo hi def link dosbatchError Error +hi def link dosbatchCodeBlockErr dosbatchError +hi def link dosbatchColonCommentErr dosbatchError hi def link dosbatchStatement Statement hi def link dosbatchCommands dosbatchStatement @@ -140,6 +146,9 @@ hi def link dosbatchBinary dosbatchNumber hi def link dosbatchOctal dosbatchNumber hi def link dosbatchComment Comment +hi def link dosbatchRemComment dosbatchComment +hi def link dosbatchColonComment dosbatchComment + hi def link dosbatchImplicit Function hi def link dosbatchSwitch Special From ebfd856cfdf6ea0b16c8d115000961c998ce97da Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 6 Feb 2024 10:59:03 +0100 Subject: [PATCH 006/426] patch 9.1.0079: LineNrAbove/Below highlighting wrong on wrapped lines Problem: LineNrAbove and LineNrBelow background wrong on wrapped lines. Solution: Update number column also for wrapped part of a line. (zeertzjq) closes: #13974 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/drawline.c | 62 +++++++++++++------ src/drawscreen.c | 5 +- .../dumps/Test_relnr_colors_wrapped_1.dump | 20 ++++++ .../dumps/Test_relnr_colors_wrapped_2.dump | 20 ++++++ .../dumps/Test_relnr_colors_wrapped_3.dump | 20 ++++++ .../dumps/Test_relnr_colors_wrapped_4.dump | 20 ++++++ .../dumps/Test_relnr_colors_wrapped_5.dump | 20 ++++++ src/testdir/test_number.vim | 32 +++++++++- src/version.c | 2 + 9 files changed, 178 insertions(+), 23 deletions(-) create mode 100644 src/testdir/dumps/Test_relnr_colors_wrapped_1.dump create mode 100644 src/testdir/dumps/Test_relnr_colors_wrapped_2.dump create mode 100644 src/testdir/dumps/Test_relnr_colors_wrapped_3.dump create mode 100644 src/testdir/dumps/Test_relnr_colors_wrapped_4.dump create mode 100644 src/testdir/dumps/Test_relnr_colors_wrapped_5.dump diff --git a/src/drawline.c b/src/drawline.c index daf3fbe18f..f6c01d5973 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -1091,7 +1091,8 @@ apply_cursorline_highlight( /* * Display line "lnum" of window "wp" on the screen. * Start at row "startrow", stop when "endrow" is reached. - * When "number_only" is TRUE only update the number column. + * When only updating the number column, "number_only" is set to the height of + * the line, otherwise it is set to 0. * "spv" is used to store information for spell checking, kept between * sequential calls for the same window. * wp->w_virtcol needs to be valid. @@ -1273,7 +1274,7 @@ win_line( wlv.vcol_sbr = -1; #endif - if (!number_only) + if (number_only == 0) { // To speed up the loop below, set extra_check when there is linebreak, // trailing white space and/or syntax processing to be done. @@ -1486,7 +1487,7 @@ win_line( #endif #ifdef FEAT_SPELL - if (spv->spv_has_spell && !number_only) + if (spv->spv_has_spell && number_only == 0) { // Prepare for spell checking. extra_check = TRUE; @@ -1667,7 +1668,7 @@ win_line( } } - if (number_only) + if (number_only > 0) { // skip over rows only used for virtual text above wlv.row += wlv.text_prop_above_count; @@ -1679,7 +1680,7 @@ win_line( #if defined(FEAT_LINEBREAK) || defined(FEAT_PROP_POPUP) colnr_T vcol_first_char = 0; - if (wp->w_p_lbr && !number_only) + if (wp->w_p_lbr && number_only == 0) { chartabsize_T cts; init_chartabsize_arg(&cts, wp, lnum, 0, line, line); @@ -1695,7 +1696,7 @@ win_line( v = startrow == 0 ? wp->w_skipcol - skipcol_in_text_prop_above : 0; else v = wp->w_leftcol; - if (v > 0 && !number_only) + if (v > 0 && number_only == 0) { char_u *prev_ptr = ptr; chartabsize_T cts; @@ -1840,7 +1841,7 @@ win_line( } #ifdef FEAT_SEARCH_EXTRA - if (!number_only) + if (number_only == 0) { v = (long)(ptr - line); area_highlighting |= prepare_search_hl_line(wp, lnum, (colnr_T)v, @@ -1933,6 +1934,38 @@ win_line( wlv.draw_state = WL_NR; handle_lnum_col(wp, &wlv, sign_present, num_attr); } + + // When only displaying the (relative) line number and that's done, + // stop here. + if (number_only > 0 && wlv.draw_state == WL_NR && wlv.n_extra == 0) + { + wlv_screen_line(wp, &wlv, TRUE); + // Need to update more screen lines if: + // - LineNrAbove or LineNrBelow is used, or + // - still drawing filler lines. + if ((wlv.row + 1 - wlv.startrow < number_only + && (HL_ATTR(HLF_LNA) != 0 || HL_ATTR(HLF_LNB) != 0)) +#ifdef FEAT_DIFF + || wlv.filler_todo > 0 +#endif + ) + { + ++wlv.row; + ++wlv.screen_row; + if (wlv.row == endrow) + break; +#ifdef FEAT_DIFF + --wlv.filler_todo; + if (wlv.filler_todo == 0 && wp->w_botfill) + break; +#endif + win_line_start(wp, &wlv, TRUE); + continue; + } + else + break; + } + #ifdef FEAT_LINEBREAK // Check if 'breakindent' applies and show it. // May change wlv.draw_state to WL_BRI or WL_BRI - 1. @@ -1957,22 +1990,13 @@ win_line( if (wlv.cul_screenline && wlv.draw_state == WL_LINE && wlv.vcol >= left_curline_col && wlv.vcol < right_curline_col) - { apply_cursorline_highlight(&wlv, sign_present); - } #endif // When still displaying '$' of change command, stop at cursor. - // When only displaying the (relative) line number and that's done, - // stop here. - if (((dollar_vcol >= 0 && wp == curwin - && lnum == wp->w_cursor.lnum - && wlv.vcol >= (long)wp->w_virtcol) - || (number_only && wlv.draw_state > WL_NR)) -#ifdef FEAT_DIFF - && wlv.filler_todo <= 0 -#endif - ) + if (dollar_vcol >= 0 && wp == curwin + && lnum == wp->w_cursor.lnum + && wlv.vcol >= (long)wp->w_virtcol) { wlv_screen_line(wp, &wlv, TRUE); // Pretend we have finished updating the window. Except when diff --git a/src/drawscreen.c b/src/drawscreen.c index 5eb531db8e..960bd69118 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -2503,7 +2503,7 @@ win_update(win_T *wp) #endif // Display one line. - row = win_line(wp, lnum, srow, wp->w_height, FALSE, &spv); + row = win_line(wp, lnum, srow, wp->w_height, 0, &spv); #ifdef FEAT_FOLDING wp->w_lines[idx].wl_folded = FALSE; @@ -2550,7 +2550,8 @@ win_update(win_T *wp) fold_line(wp, fold_count, &win_foldinfo, lnum, row); else #endif - (void)win_line(wp, lnum, srow, wp->w_height, TRUE, &spv); + (void)win_line(wp, lnum, srow, wp->w_height, + wp->w_lines[idx].wl_size, &spv); } // This line does not need to be drawn, advance to the next one. diff --git a/src/testdir/dumps/Test_relnr_colors_wrapped_1.dump b/src/testdir/dumps/Test_relnr_colors_wrapped_1.dump new file mode 100644 index 0000000000..a0a269fdb5 --- /dev/null +++ b/src/testdir/dumps/Test_relnr_colors_wrapped_1.dump @@ -0,0 +1,20 @@ +| +0#0000001#4040ff13@1|2| |1+0#0000000#ffffff0|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0 +| +0#0000001#4040ff13@3|8+0#0000000#ffffff0|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8| @17 +| +0#0000001#4040ff13@1|1| |1+0#0000000#ffffff0|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0 +| +0#0000001#4040ff13@3|9+0#0000000#ffffff0|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9| @17 +|1+0#0000001#ff404010@2| >1+0#0000000#ffffff0@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1 +| +0#0000001#ff404010@3|1+0#0000000#ffffff0|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1 +| +0#0000001#ff404010@3|0+0#0000000#ffffff0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0| @17 +| +0#0000001#40ff4011@1|1| |1+0#0000000#ffffff0@45 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0@45 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0@27| @17 +| +0#0000001#40ff4011@1|2| |1+0#0000000#ffffff0@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1 +| +0#0000001#40ff4011@3|2+0#0000000#ffffff0|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2| @17 +| +0#0000001#40ff4011@1|3| |1+0#0000000#ffffff0@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1 +| +0#0000001#40ff4011@3|3+0#0000000#ffffff0|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3| @17 +| +0#0000001#40ff4011@1|4| |1+0#0000000#ffffff0@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1|@+0#4040ff13&@2 +| +0#0000000&@31|1@2|,|1| @8|5@1|%| diff --git a/src/testdir/dumps/Test_relnr_colors_wrapped_2.dump b/src/testdir/dumps/Test_relnr_colors_wrapped_2.dump new file mode 100644 index 0000000000..1f2df5e09b --- /dev/null +++ b/src/testdir/dumps/Test_relnr_colors_wrapped_2.dump @@ -0,0 +1,20 @@ +| +0#0000001#4040ff13@1|1| |1+0#0000000#ffffff0|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0 +| +0#0000001#4040ff13@3|8+0#0000000#ffffff0|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8| @17 +|1+0#0000001#ff404010@1|0| >1+0#0000000#ffffff0|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1 +| +0#0000001#ff404010@3|0+0#0000000#ffffff0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0 +| +0#0000001#ff404010@3|9+0#0000000#ffffff0|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9| @17 +| +0#0000001#40ff4011@1|1| |1+0#0000000#ffffff0@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1 +| +0#0000001#40ff4011@3|0+0#0000000#ffffff0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0| @17 +| +0#0000001#40ff4011@1|2| |1+0#0000000#ffffff0@45 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0@45 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0@27| @17 +| +0#0000001#40ff4011@1|3| |1+0#0000000#ffffff0@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1 +| +0#0000001#40ff4011@3|2+0#0000000#ffffff0|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2| @17 +| +0#0000001#40ff4011@1|4| |1+0#0000000#ffffff0@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1 +| +0#0000001#40ff4011@3|3+0#0000000#ffffff0|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3| @17 +| +0#0000001#40ff4011@1|5| |1+0#0000000#ffffff0@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1|@+0#4040ff13&@2 +| +0#0000000&@31|1@1|0|,|1| @8|5@1|%| diff --git a/src/testdir/dumps/Test_relnr_colors_wrapped_3.dump b/src/testdir/dumps/Test_relnr_colors_wrapped_3.dump new file mode 100644 index 0000000000..b6f6c606c8 --- /dev/null +++ b/src/testdir/dumps/Test_relnr_colors_wrapped_3.dump @@ -0,0 +1,20 @@ +| +0#0000001#4040ff13@1|3| |1+0#0000000#ffffff0|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0 +| +0#0000001#4040ff13@3|8+0#0000000#ffffff0|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8| @17 +| +0#0000001#4040ff13@1|2| |1+0#0000000#ffffff0|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0 +| +0#0000001#4040ff13@3|9+0#0000000#ffffff0|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9| @17 +| +0#0000001#4040ff13@1|1| |1+0#0000000#ffffff0@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1 +| +0#0000001#4040ff13@3|1+0#0000000#ffffff0|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0| @17 +|1+0#0000001#ff404010@1|2| >1+0#0000000#ffffff0@45 +| +0#0000001#ff404010@3|1+0#0000000#ffffff0@45 +| +0#0000001#ff404010@3|1+0#0000000#ffffff0@27| @17 +| +0#0000001#40ff4011@1|1| |1+0#0000000#ffffff0@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1 +| +0#0000001#40ff4011@3|2+0#0000000#ffffff0|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2| @17 +| +0#0000001#40ff4011@1|2| |1+0#0000000#ffffff0@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1 +| +0#0000001#40ff4011@3|3+0#0000000#ffffff0|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3| @17 +| +0#0000001#40ff4011@1|3| |1+0#0000000#ffffff0@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1|@+0#4040ff13&@2 +| +0#0000000&@31|1@1|2|,|1| @8|5@1|%| diff --git a/src/testdir/dumps/Test_relnr_colors_wrapped_4.dump b/src/testdir/dumps/Test_relnr_colors_wrapped_4.dump new file mode 100644 index 0000000000..b8389502dd --- /dev/null +++ b/src/testdir/dumps/Test_relnr_colors_wrapped_4.dump @@ -0,0 +1,20 @@ +| +0#0000001#4040ff13@1|5| |1+0#0000000#ffffff0|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0 +| +0#0000001#4040ff13@3|8+0#0000000#ffffff0|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8| @17 +| +0#0000001#4040ff13@1|4| |1+0#0000000#ffffff0|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0 +| +0#0000001#4040ff13@3|9+0#0000000#ffffff0|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9| @17 +| +0#0000001#4040ff13@1|3| |1+0#0000000#ffffff0@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1 +| +0#0000001#4040ff13@3|1+0#0000000#ffffff0|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0| @17 +| +0#0000001#4040ff13@1|2| |1+0#0000000#ffffff0@45 +| +0#0000001#4040ff13@3|1+0#0000000#ffffff0@45 +| +0#0000001#4040ff13@3|1+0#0000000#ffffff0@27| @17 +| +0#0000001#4040ff13@1|1| |1+0#0000000#ffffff0@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1 +| +0#0000001#4040ff13@3|1+0#0000000#ffffff0|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1 +| +0#0000001#4040ff13@3|2+0#0000000#ffffff0|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2| @17 +|1+0#0000001#ff404010@1|4| >1+0#0000000#ffffff0@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1 +| +0#0000001#ff404010@3|1+0#0000000#ffffff0|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1 +| +0#0000001#ff404010@3|3+0#0000000#ffffff0|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3| @17 +| +0#0000001#40ff4011@1|1| |1+0#0000000#ffffff0@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1|@+0#4040ff13&@2 +| +0#0000000&@31|1@1|4|,|1| @8|5@1|%| diff --git a/src/testdir/dumps/Test_relnr_colors_wrapped_5.dump b/src/testdir/dumps/Test_relnr_colors_wrapped_5.dump new file mode 100644 index 0000000000..549275a431 --- /dev/null +++ b/src/testdir/dumps/Test_relnr_colors_wrapped_5.dump @@ -0,0 +1,20 @@ +| +0#0000001#4040ff13@1|4| |1+0#0000000#ffffff0|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0 +| +0#0000001#4040ff13@3|8+0#0000000#ffffff0|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8|1|0|8| @17 +| +0#0000001#4040ff13@1|3| |1+0#0000000#ffffff0|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0 +| +0#0000001#4040ff13@3|9+0#0000000#ffffff0|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9|1|0|9| @17 +| +0#0000001#4040ff13@1|2| |1+0#0000000#ffffff0@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1 +| +0#0000001#4040ff13@3|1+0#0000000#ffffff0|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1 +| +0#0000001#4040ff13@3|0+0#0000000#ffffff0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0|1@1|0| @17 +| +0#0000001#4040ff13@1|1| |1+0#0000000#ffffff0@45 +| +0#0000001#4040ff13@3|1+0#0000000#ffffff0@45 +| +0#0000001#4040ff13@3|1+0#0000000#ffffff0@27| @17 +|1+0#0000001#ff404010@1|3| >1+0#0000000#ffffff0@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1 +| +0#0000001#ff404010@3|1+0#0000000#ffffff0|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1 +| +0#0000001#ff404010@3|2+0#0000000#ffffff0|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2|1@1|2| @17 +| +0#0000001#40ff4011@1|1| |1+0#0000000#ffffff0@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1 +| +0#0000001#40ff4011@3|1+0#0000000#ffffff0|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1 +| +0#0000001#40ff4011@3|3+0#0000000#ffffff0|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3|1@1|3| @17 +| +0#0000001#40ff4011@1|2| |1+0#0000000#ffffff0@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1@1|4|1|@+0#4040ff13&@2 +| +0#0000000&@31|1@1|3|,|1| @8|5@1|%| diff --git a/src/testdir/test_number.vim b/src/testdir/test_number.vim index 81f8f73013..6ac3c4cfe4 100644 --- a/src/testdir/test_number.vim +++ b/src/testdir/test_number.vim @@ -278,9 +278,7 @@ func Test_relativenumber_colors() [CODE] call writefile(lines, 'XTest_relnr', 'D') - " Check that the balloon shows up after a mouse move let buf = RunVimInTerminal('-S XTest_relnr', {'rows': 10, 'cols': 50}) - call TermWait(buf, 50) " Default colors call VerifyScreenDump(buf, 'Test_relnr_colors_1', {}) @@ -297,6 +295,36 @@ func Test_relativenumber_colors() call StopVimInTerminal(buf) endfunc +func Test_relativenumber_colors_wrapped() + CheckScreendump + + let lines =<< trim [CODE] + set display=lastline scrolloff=0 + call setline(1, range(200)->map('v:val->string()->repeat(40)')) + 111 + set number relativenumber + hi LineNr ctermbg=red ctermfg=black + hi LineNrAbove ctermbg=blue ctermfg=black + hi LineNrBelow ctermbg=green ctermfg=black + [CODE] + call writefile(lines, 'XTest_relnr_wrap', 'D') + + let buf = RunVimInTerminal('-S XTest_relnr_wrap', {'rows': 20, 'cols': 50}) + + call VerifyScreenDump(buf, 'Test_relnr_colors_wrapped_1', {}) + call term_sendkeys(buf, "k") + call VerifyScreenDump(buf, 'Test_relnr_colors_wrapped_2', {}) + call term_sendkeys(buf, "2j") + call VerifyScreenDump(buf, 'Test_relnr_colors_wrapped_3', {}) + call term_sendkeys(buf, "2j") + call VerifyScreenDump(buf, 'Test_relnr_colors_wrapped_4', {}) + call term_sendkeys(buf, "k") + call VerifyScreenDump(buf, 'Test_relnr_colors_wrapped_5', {}) + + " clean up + call StopVimInTerminal(buf) +endfunc + func Test_relativenumber_callback() CheckScreendump CheckFeature timers diff --git a/src/version.c b/src/version.c index 99c74d0f8b..3d99917a75 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 79, /**/ 78, /**/ From 1af35631f85d2fcdc83c5d457af8273697f5146a Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Tue, 6 Feb 2024 11:03:36 +0100 Subject: [PATCH 007/426] patch 9.1.0080: unexpected error for modifying final list using += Problem: unexpected error for modifying final list using += operator (Ernie Rael) Solution: Allow List value modification of a final variable using += operator (Yegappan Lakshmanan) fixes: #13745 fixes: #13959 closes: #13962 Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 4 +- runtime/doc/eval.txt | 14 ++++- src/eval.c | 2 +- src/evalvars.c | 15 ++++- src/testdir/test_vim9_assign.vim | 97 ++++++++++++++++++++++++++++++++ src/version.c | 2 + src/vim.h | 1 + 7 files changed, 129 insertions(+), 6 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 19b9bc9f65..062da08d6c 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2093,7 +2093,7 @@ diff({fromlist}, {tolist} [, {options}]) *diff()* Returns an empty List or String if {fromlist} and {tolist} are identical. - Examples: + Examples: > :echo diff(['abc'], ['xxx']) @@ -1 +1 @@ -abc @@ -2103,7 +2103,7 @@ diff({fromlist}, {tolist} [, {options}]) *diff()* [{'from_idx': 0, 'from_count': 1, 'to_idx': 0, 'to_count': 1}] :echo diff(readfile('oldfile'), readfile('newfile')) :echo diff(getbufline(5, 1, '$'), getbufline(6, 1, '$')) - +< For more examples, refer to |diff-func-examples| Can also be used as a |method|: > diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 574b9c9dd9..75ea2c7f42 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 9.1. Last change: 2024 Feb 05 +*eval.txt* For Vim version 9.1. Last change: 2024 Feb 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -425,6 +425,18 @@ To change part of a list you can specify the first and last item to be modified. The value must at least have the number of items in the range: > :let list[3:5] = [3, 4, 5] +To add items to a List in-place, you can use the |+=| operator: > + :let listA = [1, 2] + :let listA += [3, 4] +< +When two variables refer to the same List, changing one List in-place will +cause the referenced List to be changed in-place: > + :let listA = [1, 2] + :let listB = listA + :let listB += [3, 4] + :echo listA + [1, 2, 3, 4] +< Adding and removing items from a list is done with functions. Here are a few examples: > :call insert(list, 'a') " prepend item 'a' diff --git a/src/eval.c b/src/eval.c index bf053dfb69..fd44db6f7e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1901,7 +1901,7 @@ set_var_lval( && !tv_check_lock(&di->di_tv, lp->ll_name, FALSE))) && tv_op(&tv, rettv, op) == OK) set_var_const(lp->ll_name, lp->ll_sid, NULL, &tv, FALSE, - ASSIGN_NO_DECL, 0); + ASSIGN_NO_DECL | ASSIGN_COMPOUND_OP, 0); clear_tv(&tv); } } diff --git a/src/evalvars.c b/src/evalvars.c index cbcf2a707e..0a84afdaaf 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -3977,7 +3977,14 @@ set_var_const( if (check_typval_is_value(&di->di_tv) == FAIL) goto failed; - if (var_in_vim9script && (flags & ASSIGN_FOR_LOOP) == 0) + // List and Blob types can be modified in-place using the "+=" + // compound operator. For other types, this is not allowed. + int type_inplace_modifiable = + (di->di_tv.v_type == VAR_LIST || di->di_tv.v_type == VAR_BLOB); + + if (var_in_vim9script && (flags & ASSIGN_FOR_LOOP) == 0 + && ((flags & ASSIGN_COMPOUND_OP) == 0 + || !type_inplace_modifiable)) { where_T where = WHERE_INIT; svar_T *sv = find_typval_in_script(&di->di_tv, sid, TRUE); @@ -3998,7 +4005,11 @@ set_var_const( } } - if ((flags & ASSIGN_FOR_LOOP) == 0 + // Modifying a final variable with a List value using the "+=" + // operator is allowed. For other types, it is not allowed. + if (((flags & ASSIGN_FOR_LOOP) == 0 + && ((flags & ASSIGN_COMPOUND_OP) == 0 + || !type_inplace_modifiable)) ? var_check_permission(di, name) == FAIL : var_check_ro(di->di_flags, name, FALSE)) goto failed; diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index aef09c5f6b..4414f55c06 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -3484,4 +3484,101 @@ def Test_assign_type_to_list_dict() v9.CheckScriptFailure(lines, 'E1407: Cannot use a Typealias as a variable or value') enddef +" Test for modifying a final variable using a compound operator +def Test_final_var_modification_with_compound_op() + var lines =<< trim END + vim9script + + final i: number = 1000 + assert_fails('i += 2', 'E46: Cannot change read-only variable "i"') + assert_fails('i -= 2', 'E46: Cannot change read-only variable "i"') + assert_fails('i *= 2', 'E46: Cannot change read-only variable "i"') + assert_fails('i /= 2', 'E46: Cannot change read-only variable "i"') + assert_fails('i %= 2', 'E46: Cannot change read-only variable "i"') + assert_equal(1000, i) + + final f: float = 1000.0 + assert_fails('f += 2', 'E46: Cannot change read-only variable "f"') + assert_fails('f -= 2', 'E46: Cannot change read-only variable "f"') + assert_fails('f *= 2', 'E46: Cannot change read-only variable "f"') + assert_fails('f /= 2', 'E46: Cannot change read-only variable "f"') + assert_equal(1000.0, f) + + final s: string = 'abc' + assert_fails('s ..= "y"', 'E46: Cannot change read-only variable "s"') + assert_equal('abc', s) + END + v9.CheckScriptSuccess(lines) +enddef + +" Test for modifying a final variable with a List value +def Test_final_var_with_list_value() + var lines =<< trim END + vim9script + + final listA: list = [] + var listB = listA + + listB->add('a') + assert_true(listA is listB) + assert_equal(['a'], listA) + assert_equal(['a'], listB) + + listB += ['b'] + assert_true(listA is listB) + assert_equal(['a', 'b'], listA) + assert_equal(['a', 'b'], listB) + + listA->add('c') + assert_true(listA is listB) + assert_equal(['a', 'b', 'c'], listA) + assert_equal(['a', 'b', 'c'], listB) + + listA += ['d'] + assert_true(listA is listB) + assert_equal(['a', 'b', 'c', 'd'], listA) + assert_equal(['a', 'b', 'c', 'd'], listB) + END + v9.CheckScriptSuccess(lines) +enddef + +" Test for modifying a final variable with a List value using "+=" from a legacy +" function. +func Test_final_var_with_list_value_legacy() + vim9cmd final g:TestVar = ['a'] + vim9cmd g:TestVar += ['b'] + call assert_equal(['a', 'b'], g:TestVar) +endfunc + +" Test for modifying a final variable with a Blob value +def Test_final_var_with_blob_value() + var lines =<< trim END + vim9script + + final blobA: blob = 0z10 + var blobB = blobA + + blobB->add(32) + assert_true(blobA is blobB) + assert_equal(0z1020, blobA) + assert_equal(0z1020, blobB) + + blobB += 0z30 + assert_true(blobA is blobB) + assert_equal(0z102030, blobA) + assert_equal(0z102030, blobB) + + blobA->add(64) + assert_true(blobA is blobB) + assert_equal(0z10203040, blobA) + assert_equal(0z10203040, blobB) + + blobA += 0z50 + assert_true(blobA is blobB) + assert_equal(0z1020304050, blobA) + assert_equal(0z1020304050, blobB) + END + v9.CheckScriptSuccess(lines) +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/version.c b/src/version.c index 3d99917a75..36f9dc07ea 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 80, /**/ 79, /**/ diff --git a/src/vim.h b/src/vim.h index fe239581af..45cf8cad0d 100644 --- a/src/vim.h +++ b/src/vim.h @@ -2379,6 +2379,7 @@ typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char_u ***mat #define ASSIGN_FOR_LOOP 0x40 // assigning to loop variable #define ASSIGN_INIT 0x80 // not assigning a value, just a declaration #define ASSIGN_UPDATE_BLOCK_ID 0x100 // update sav_block_id +#define ASSIGN_COMPOUND_OP 0x200 // compound operator e.g. "+=" #include "ex_cmds.h" // Ex command defines #include "spell.h" // spell checking stuff From c9c2e2d2ff4429a6b5876ee919f15c1dc0018e86 Mon Sep 17 00:00:00 2001 From: qeatzy Date: Wed, 7 Feb 2024 17:52:25 +0100 Subject: [PATCH 008/426] runtime(doc): Clarify list-concatenation a bit more Make doc list-concatenation more clear as for += and extend(). 1. describe `+=` for list-concatenation more accurately 2. add `extend()` example for list-concatenation 3. Fix CI errors for missing helptags reference |+=| closes: #13983 Signed-off-by: qeatzy Signed-off-by: Christian Brabandt --- runtime/doc/eval.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 75ea2c7f42..3dbbbeafb2 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 9.1. Last change: 2024 Feb 06 +*eval.txt* For Vim version 9.1. Last change: 2024 Feb 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -303,7 +303,9 @@ List concatenation ~ *list-concatenation* Two lists can be concatenated with the "+" operator: > :let longlist = mylist + [5, 6] +A list can be concatenated with another one in place using the "+=" operator or |extend()|: > :let mylist += [7, 8] + :call extend(mylist, [7, 8]) To prepend or append an item, turn the item into a list by putting [] around it. To change a list in-place, refer to |list-modification| below. @@ -425,7 +427,8 @@ To change part of a list you can specify the first and last item to be modified. The value must at least have the number of items in the range: > :let list[3:5] = [3, 4, 5] -To add items to a List in-place, you can use the |+=| operator: > +To add items to a List in-place, you can use the += operator +|list-concatenation|: > :let listA = [1, 2] :let listA += [3, 4] < From 1efb1b08a142560af50f7e68c935f067944742a3 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Thu, 8 Feb 2024 11:04:21 +0100 Subject: [PATCH 009/426] patch 9.1.0081: X11 mouse-scrolling stutters Problem: X11 mouse-scrolling stutters (Ron Aaron, after 9.1.0064) Solution: Handle GDK_SCROLL_SMOOTH fractional distance events (lilydjwg) I don't know why, but with GDK_SMOOTH_SCROLL_MASK we get wheel events as GDK_SCROLL_SMOOTH. What's more, one wheel scroll is counted as 1.5 distance in Wayland but 1.0 in X11. I failed to find any docs on gtk.org about this. fixes: #13987 closes: #13991 Signed-off-by: lilydjwg Signed-off-by: Christian Brabandt --- src/gui_gtk_x11.c | 8 ++++---- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index dd0179ee05..98ab3d49b6 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -2105,25 +2105,25 @@ scroll_event(GtkWidget *widget, #if GTK_CHECK_VERSION(3,4,0) if (event->direction == GDK_SCROLL_SMOOTH) { - while (acc_x > 1.0) + while (acc_x >= 1.0) { // right acc_x = MAX(0.0, acc_x - 1.0); gui_send_mouse_event(MOUSE_6, (int)event->x, (int)event->y, FALSE, vim_modifiers); } - while (acc_x < -1.0) + while (acc_x <= -1.0) { // left acc_x = MIN(0.0, acc_x + 1.0); gui_send_mouse_event(MOUSE_7, (int)event->x, (int)event->y, FALSE, vim_modifiers); } - while (acc_y > 1.0) + while (acc_y >= 1.0) { // down acc_y = MAX(0.0, acc_y - 1.0); gui_send_mouse_event(MOUSE_5, (int)event->x, (int)event->y, FALSE, vim_modifiers); } - while (acc_y < -1.0) + while (acc_y <= -1.0) { // up acc_y = MIN(0.0, acc_y + 1.0); gui_send_mouse_event(MOUSE_4, (int)event->x, (int)event->y, diff --git a/src/version.c b/src/version.c index 36f9dc07ea..408dd37b93 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 81, /**/ 80, /**/ From b8170143c8f8a115b5be59a94d10f931d3cd567c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 8 Feb 2024 11:21:44 +0100 Subject: [PATCH 010/426] runtime(doc): further improve docs about List/Blob += operator closes: #13990 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- runtime/doc/eval.txt | 39 +++++++++++++++++++++++++++++---------- runtime/doc/tags | 1 + 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 3dbbbeafb2..e3a9f20136 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 9.1. Last change: 2024 Feb 07 +*eval.txt* For Vim version 9.1. Last change: 2024 Feb 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -303,12 +303,15 @@ List concatenation ~ *list-concatenation* Two lists can be concatenated with the "+" operator: > :let longlist = mylist + [5, 6] -A list can be concatenated with another one in place using the "+=" operator or |extend()|: > + :let longlist = [5, 6] + mylist +To prepend or append an item, turn it into a list by putting [] around it. + +A list can be concatenated with another one in-place using |:let+=| or +|extend()|: > :let mylist += [7, 8] :call extend(mylist, [7, 8]) - -To prepend or append an item, turn the item into a list by putting [] around -it. To change a list in-place, refer to |list-modification| below. +< +See |list-modification| below for more about changing a list in-place. Sublist ~ @@ -427,8 +430,7 @@ To change part of a list you can specify the first and last item to be modified. The value must at least have the number of items in the range: > :let list[3:5] = [3, 4, 5] -To add items to a List in-place, you can use the += operator -|list-concatenation|: > +To add items to a List in-place, you can use |:let+=| (|list-concatenation|): > :let listA = [1, 2] :let listA += [3, 4] < @@ -760,12 +762,15 @@ This calls Doit() with 0x11, 0x22 and 0x33. Blob concatenation ~ - + *blob-concatenation* Two blobs can be concatenated with the "+" operator: > :let longblob = myblob + 0z4455 + :let longblob = 0z4455 + myblob +< +A blob can be concatenated with another one in-place using |:let+=|: > :let myblob += 0z6677 - -To change a blob in-place see |blob-modification| below. +< +See |blob-modification| below for more about changing a blob in-place. Part of a blob ~ @@ -808,6 +813,18 @@ To change part of a blob you can specify the first and last byte to be modified. The value must have the same number of bytes in the range: > :let blob[3:5] = 0z334455 +To add items to a Blob in-place, you can use |:let+=| (|blob-concatenation|): > + :let blobA = 0z1122 + :let blobA += 0z3344 +< +When two variables refer to the same Blob, changing one Blob in-place will +cause the referenced Blob to be changed in-place: > + :let blobA = 0z1122 + :let blobB = blobA + :let blobB += 0z3344 + :echo blobA + 0z11223344 +< You can also use the functions |add()|, |remove()| and |insert()|. @@ -2824,6 +2841,8 @@ declarations and assignments do not use a command. |vim9-declaration| :let {var} ..= {expr1} Like ":let {var} = {var} .. {expr1}". These fail if {var} was not set yet and when the type of {var} and {expr1} don't fit the operator. + `+=` modifies a |List| or a |Blob| in-place instead of + creating a new one. `.=` is not supported with Vim script version 2 and later, see |vimscript-version|. diff --git a/runtime/doc/tags b/runtime/doc/tags index ebde436485..d5ccb99da0 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -6124,6 +6124,7 @@ binary-number eval.txt /*binary-number* bitwise-function usr_41.txt /*bitwise-function* bitwise-shift eval.txt /*bitwise-shift* blob eval.txt /*blob* +blob-concatenation eval.txt /*blob-concatenation* blob-functions usr_41.txt /*blob-functions* blob-identity eval.txt /*blob-identity* blob-index eval.txt /*blob-index* From 7ce34c9a947b17a8b5e81e7c2335a63552182d10 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 8 Feb 2024 11:34:55 +0100 Subject: [PATCH 011/426] patch 9.1.0082: Redrawing can be improved when deleting lines with 'cursorline' Problem: Redrawing can be improved when deleting lines with 'cursorline'. Solution: Use smarter invalidation and adjustment. Remove unnecessary UPD_VALID as it is already set at the top of the loop. Make the test for #4862 fail without the fix. (zeertzjq) closes: #13986 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/change.c | 22 ++++++++++------------ src/testdir/test_highlight.vim | 17 +++++++++-------- src/version.c | 2 ++ 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/change.c b/src/change.c index c0b8785ba1..0ea424f989 100644 --- a/src/change.c +++ b/src/change.c @@ -656,22 +656,20 @@ changed_common( set_topline(wp, wp->w_topline); #endif // If lines have been added or removed, relative numbering always - // requires a redraw. + // requires an update even if cursor didn't move. if (wp->w_p_rnu && xtra != 0) - { wp->w_last_cursor_lnum_rnu = 0; - redraw_win_later(wp, UPD_VALID); - } + #ifdef FEAT_SYN_HL - // Cursor line highlighting probably need to be updated with - // "UPD_VALID" if it's below the change. - // If the cursor line is inside the change we need to redraw more. - if (wp->w_p_cul) + if (wp->w_p_cul && wp->w_last_cursorline >= lnum) { - if (xtra == 0) - redraw_win_later(wp, UPD_VALID); - else if (lnum <= wp->w_last_cursorline) - redraw_win_later(wp, UPD_SOME_VALID); + if (wp->w_last_cursorline < lnume) + // If 'cursorline' was inside the change, it has already + // been invalidated in w_lines[] by the loop above. + wp->w_last_cursorline = 0; + else + // If 'cursorline' was below the change, adjust its lnum. + wp->w_last_cursorline += xtra; } #endif } diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim index b831878b40..d6c9f5005e 100644 --- a/src/testdir/test_highlight.vim +++ b/src/testdir/test_highlight.vim @@ -557,22 +557,23 @@ func Test_cursorline_after_yank() call StopVimInTerminal(buf) endfunc -" test for issue #4862 +" Test for issue #4862: pasting above 'cursorline' redraws properly. func Test_put_before_cursorline() new only! - call setline(1, 'A') + call setline(1, ['A', 'B', 'C']) + call cursor(2, 1) redraw - let std_attr = screenattr(1, 1) + let std_attr = screenattr(2, 1) set cursorline redraw - let cul_attr = screenattr(1, 1) + let cul_attr = screenattr(2, 1) normal yyP redraw - " Line 1 has cursor so it should be highlighted with CursorLine. - call assert_equal(cul_attr, screenattr(1, 1)) - " And CursorLine highlighting from the second line should be gone. - call assert_equal(std_attr, screenattr(2, 1)) + " Line 2 has cursor so it should be highlighted with CursorLine. + call assert_equal(cul_attr, screenattr(2, 1)) + " And CursorLine highlighting from line 3 should be gone. + call assert_equal(std_attr, screenattr(3, 1)) set nocursorline bwipe! endfunc diff --git a/src/version.c b/src/version.c index 408dd37b93..7e07e66f5e 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 82, /**/ 81, /**/ From ae07ebc04b0726e12b1af39d52e01d86ae79ef0a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 8 Feb 2024 11:37:40 +0100 Subject: [PATCH 012/426] patch 9.1.0083: Redrawing can be improved when deleting lines with 'number' Problem: Redrawing can be improved when inserting/deleting lines with 'number'. Solution: Only redraw the number column of lines below changed lines. Add a test as this wasn't previously tested. (zeertzjq) closes: #13985 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/drawscreen.c | 16 ++++----- .../Test_number_insert_delete_lines_1.dump | 8 +++++ .../Test_number_insert_delete_lines_2.dump | 8 +++++ .../Test_number_insert_delete_lines_3.dump | 8 +++++ src/testdir/test_number.vim | 33 ++++++++++++++++--- src/version.c | 2 ++ 6 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 src/testdir/dumps/Test_number_insert_delete_lines_1.dump create mode 100644 src/testdir/dumps/Test_number_insert_delete_lines_2.dump create mode 100644 src/testdir/dumps/Test_number_insert_delete_lines_3.dump diff --git a/src/drawscreen.c b/src/drawscreen.c index 960bd69118..d1773701da 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -1699,11 +1699,6 @@ win_update(win_T *wp) top_end = 1; #endif } - - // When line numbers are displayed need to redraw all lines below - // inserted/deleted lines. - if (mod_top != 0 && buf->b_mod_xlines != 0 && wp->w_p_nu) - mod_bot = MAXLNUM; } wp->w_redraw_top = 0; // reset for next time wp->w_redraw_bot = 0; @@ -2540,11 +2535,16 @@ win_update(win_T *wp) } else { - if (wp->w_p_rnu && wp->w_last_cursor_lnum_rnu != wp->w_cursor.lnum) + // If: + // - 'number' is set and below inserted/deleted lines, or + // - 'relativenumber' is set and cursor moved vertically, + // the text doesn't need to be redrawn, but the number column does. + if ((wp->w_p_nu && mod_top != 0 + && lnum >= mod_bot && buf->b_mod_xlines != 0) + || (wp->w_p_rnu + && wp->w_last_cursor_lnum_rnu != wp->w_cursor.lnum)) { #ifdef FEAT_FOLDING - // 'relativenumber' set and the cursor moved vertically: The - // text doesn't need to be drawn, but the number column does. fold_count = foldedCount(wp, lnum, &win_foldinfo); if (fold_count != 0) fold_line(wp, fold_count, &win_foldinfo, lnum, row); diff --git a/src/testdir/dumps/Test_number_insert_delete_lines_1.dump b/src/testdir/dumps/Test_number_insert_delete_lines_1.dump new file mode 100644 index 0000000000..5aecb46a38 --- /dev/null +++ b/src/testdir/dumps/Test_number_insert_delete_lines_1.dump @@ -0,0 +1,8 @@ +| +0#af5f00255#ffffff0@1|1| |1+0#0000000&| @69 +| +0#af5f00255&@1|2| >2+0#0000000&| @69 +| +0#af5f00255&@1|3| |3+0#0000000&| @69 +| +0#af5f00255&@1|4| |4+0#0000000&| @69 +| +0#af5f00255&@1|5| |5+0#0000000&| @69 +| +0#af5f00255&@1|6| |6+0#0000000&| @69 +| +0#af5f00255&@1|7| |7+0#0000000&| @69 +@57|2|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_number_insert_delete_lines_2.dump b/src/testdir/dumps/Test_number_insert_delete_lines_2.dump new file mode 100644 index 0000000000..dea68e8d04 --- /dev/null +++ b/src/testdir/dumps/Test_number_insert_delete_lines_2.dump @@ -0,0 +1,8 @@ +| +0#af5f00255#ffffff0@1|1| |1+0#0000000&| @69 +| +0#af5f00255&@1|2| >3+0#0000000&| @69 +| +0#af5f00255&@1|3| |4+0#0000000&| @69 +| +0#af5f00255&@1|4| |5+0#0000000&| @69 +| +0#af5f00255&@1|5| |6+0#0000000&| @69 +| +0#af5f00255&@1|6| |7+0#0000000&| @69 +|~+0#4040ff13&| @73 +| +0#0000000&@56|2|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_number_insert_delete_lines_3.dump b/src/testdir/dumps/Test_number_insert_delete_lines_3.dump new file mode 100644 index 0000000000..fff32971e8 --- /dev/null +++ b/src/testdir/dumps/Test_number_insert_delete_lines_3.dump @@ -0,0 +1,8 @@ +| +0#af5f00255#ffffff0@1|1| |1+0#0000000&| @69 +| +0#af5f00255&@1|2| >4+0#0000000&| @69 +| +0#af5f00255&@1|3| |5+0#0000000&| @69 +| +0#af5f00255&@1|4| |6+0#0000000&| @69 +| +0#af5f00255&@1|5| |7+0#0000000&| @69 +|~+0#4040ff13&| @73 +|~| @73 +| +0#0000000&@56|2|,|1| @10|A|l@1| diff --git a/src/testdir/test_number.vim b/src/testdir/test_number.vim index 6ac3c4cfe4..b57c1ed2c5 100644 --- a/src/testdir/test_number.vim +++ b/src/testdir/test_number.vim @@ -146,8 +146,7 @@ func Test_number_with_linewrap1() call s:close_windows() endfunc -" Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI -func XTest_number_with_linewrap2() +func Test_number_with_linewrap2() call s:test_windows(3, 20) normal! 61ia setl number wrap @@ -164,8 +163,7 @@ func XTest_number_with_linewrap2() call s:close_windows() endfunc -" Pending: https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI -func XTest_number_with_linewrap3() +func Test_number_with_linewrap3() call s:test_windows(4, 20) normal! 81ia setl number wrap @@ -174,7 +172,7 @@ func XTest_number_with_linewrap3() call s:validate_cursor() let lines = s:screen_lines(1, 4) let expect = [ -\ "aaaaaaaa", +\ "<< Date: Fri, 9 Feb 2024 18:14:12 +0100 Subject: [PATCH 013/426] patch 9.1.0084: Visual hl wrong when it ends before multibyte 'showbreak' Problem: Visual hl wrong when it ends before multibyte 'showbreak'. (lacygoil) Solution: Use vcol_sbr instead of adding n_extra. (zeertzjq) fixes: #11272 closes: #13996 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/drawline.c | 2 +- .../Test_visual_ends_before_showbreak.dump | 6 ++++++ src/testdir/test_listlbr_utf8.vim | 21 +++++++++++++++++++ src/version.c | 2 ++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/testdir/dumps/Test_visual_ends_before_showbreak.dump diff --git a/src/drawline.c b/src/drawline.c index f6c01d5973..0f3400f9da 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -589,7 +589,7 @@ handle_showbreak_and_filler(win_T *wp, winlinevars_T *wlv) // Correct end of highlighted area for 'showbreak', // required when 'linebreak' is also set. if (wlv->tocol == wlv->vcol) - wlv->tocol += wlv->n_extra; + wlv->tocol = wlv->vcol_sbr; // combine 'showbreak' with 'wincolor' wlv->char_attr = hl_combine_attr(wlv->win_attr, HL_ATTR(HLF_AT)); # ifdef FEAT_SYN_HL diff --git a/src/testdir/dumps/Test_visual_ends_before_showbreak.dump b/src/testdir/dumps/Test_visual_ends_before_showbreak.dump new file mode 100644 index 0000000000..ee809bab5e --- /dev/null +++ b/src/testdir/dumps/Test_visual_ends_before_showbreak.dump @@ -0,0 +1,6 @@ +|x+0&#ffffff0@4| @69 +|↪+0#4040ff13&| |y+0#0000001#a8a8a8255@68> +0#0000000#ffffff0| +0#0000001#a8a8a8255@2 +|↪+0#4040ff13#ffffff0| |z+0#0000000&@3| @68 +|~+0#4040ff13&| @73 +|~| @73 +|-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@34|7|0| @7|1|,|7|6|-|1|4|7| @5|A|l@1| diff --git a/src/testdir/test_listlbr_utf8.vim b/src/testdir/test_listlbr_utf8.vim index 1bbbd2d2ae..313ff30cc4 100644 --- a/src/testdir/test_listlbr_utf8.vim +++ b/src/testdir/test_listlbr_utf8.vim @@ -9,6 +9,7 @@ CheckFeature conceal CheckFeature signs source view_util.vim +source screendump.vim func s:screen_lines(lnum, width) abort return ScreenLines(a:lnum, a:width) @@ -358,4 +359,24 @@ func Test_unprintable_char_on_wrap_column() call s:close_windows() endfunc +" Test that Visual selection is drawn correctly when 'linebreak' is set and +" selection ends before multibyte 'showbreak'. +func Test_visual_ends_before_showbreak() + CheckScreendump + + let lines =<< trim END + vim9script + &wrap = true + &linebreak = true + &showbreak = '↪ ' + ['xxxxx ' .. 'y'->repeat(&columns - 6) .. ' zzzz']->setline(1) + normal! wvel + END + call writefile(lines, 'XvisualEndsBeforeShowbreak', 'D') + let buf = RunVimInTerminal('-S XvisualEndsBeforeShowbreak', #{rows: 6}) + call VerifyScreenDump(buf, 'Test_visual_ends_before_showbreak', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index e0f30f2322..d961085f66 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 84, /**/ 83, /**/ From bd2f45a6e530df91ad07d49967ff148eb8a1c1e1 Mon Sep 17 00:00:00 2001 From: "K.Takata" Date: Sat, 10 Feb 2024 02:18:11 +0900 Subject: [PATCH 014/426] CI: Add Codecov token (#13999) codecov-action@4 requires a token. Add it to the repository secrets. See: https://github.com/vim/vim/pull/13978#issuecomment-1935336624 Signed-off-by: Ken Takata Signed-off-by: Christian Brabandt --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d34658a7d..2746605d2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -289,6 +289,7 @@ jobs: uses: codecov/codecov-action@v4 with: flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }} + token: ${{ secrets.CODECOV_TOKEN }} - name: ASan logs if: contains(matrix.extra, 'asan') && !cancelled() @@ -681,3 +682,4 @@ jobs: with: directory: src flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }} + token: ${{ secrets.CODECOV_TOKEN }} From c4d4a1e041f41b1fb0ccd686c8c488ef0768667e Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Fri, 9 Feb 2024 19:13:12 +0100 Subject: [PATCH 015/426] patch 9.1.0085: X11 scroll size changes after accessing clipboard Problem: X11 scroll size changes after accessing clipboard (Ernie Rael) Solution: use GDK_SCROLL_MASK for X11 and GDK_SMOOTH_SCROLL_MASK for Wayland (lilydjwg) because GDK_SCROLL_SMOOTH events don't work well for x11 (see comments). fixes #13994 closes: #13997 Signed-off-by: lilydjwg Signed-off-by: Christian Brabandt --- src/gui_gtk_x11.c | 52 +++++++++++++++++++++++++++++++++++------------ src/version.c | 2 ++ 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 98ab3d49b6..a89a774293 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -2061,6 +2061,11 @@ scroll_event(GtkWidget *widget, #if GTK_CHECK_VERSION(3,4,0) static double acc_x, acc_y; static guint32 last_smooth_event_time; +#define DT_X11 1 +#define DT_WAYLAND 2 + static display_type; + if (!display_type) + display_type = gui_mch_get_display() ? DT_X11 : DT_WAYLAND; #endif if (gtk_socket_id != 0 && !gtk_widget_has_focus(widget)) @@ -2103,7 +2108,9 @@ scroll_event(GtkWidget *widget, vim_modifiers = modifiers_gdk2mouse(event->state); #if GTK_CHECK_VERSION(3,4,0) - if (event->direction == GDK_SCROLL_SMOOTH) + // on x11, despite not requested, when we copy into primary clipboard, + // we'll get smooth events. Unsmooth ones will also come along. + if (event->direction == GDK_SCROLL_SMOOTH && display_type == DT_WAYLAND) { while (acc_x >= 1.0) { // right @@ -2131,6 +2138,8 @@ scroll_event(GtkWidget *widget, } } else +#undef DT_X11 +#undef DT_WAYLAND #endif gui_send_mouse_event(button, (int)event->x, (int)event->y, FALSE, vim_modifiers); @@ -3998,20 +4007,37 @@ gui_mch_init(void) #endif // Determine which events we will filter. - gtk_widget_set_events(gui.drawarea, - GDK_EXPOSURE_MASK | - GDK_ENTER_NOTIFY_MASK | - GDK_LEAVE_NOTIFY_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_SCROLL_MASK | + gint event_mask = + GDK_EXPOSURE_MASK | + GDK_ENTER_NOTIFY_MASK | + GDK_LEAVE_NOTIFY_MASK | + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_KEY_PRESS_MASK | + GDK_KEY_RELEASE_MASK | + GDK_POINTER_MOTION_MASK | + GDK_POINTER_MOTION_HINT_MASK; #if GTK_CHECK_VERSION(3,4,0) - GDK_SMOOTH_SCROLL_MASK | + if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) + { + // for X11, if we were using smooth scroll events, we + // would get an scroll without deltas on the very first user scroll* and + // get both "unsmooth" scroll and smooth scroll events after + // copying into the primary selection + // + // *: https://bugzilla.gnome.org/show_bug.cgi?id=675959 + event_mask |= GDK_SCROLL_MASK; + } + else + { + // for Wayland, touchpads don't generate "unsmooth" scroll events. Both + // touchpads and wheels generate smooth scroll events expectedly. + event_mask |= GDK_SMOOTH_SCROLL_MASK; + } +#else + event_mask |= GDK_SCROLL_MASK; #endif - GDK_KEY_PRESS_MASK | - GDK_KEY_RELEASE_MASK | - GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK); + gtk_widget_set_events(gui.drawarea, event_mask); gtk_widget_show(gui.drawarea); gui_gtk_form_put(GTK_FORM(gui.formwin), gui.drawarea, 0, 0); diff --git a/src/version.c b/src/version.c index d961085f66..33325a664d 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 85, /**/ 84, /**/ From 725c7c31a4c7603e688511d769b0addaab442d07 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Fri, 9 Feb 2024 19:24:23 +0100 Subject: [PATCH 016/426] patch 9.1.0086: Problem when scrolling using slow touchpads scroll event Problem: Problem when scrolling using slow touchpads scroll event Solution: better ways to determine if a smooth scroll has ended (when available) (lilydjwg) related: #13997 Signed-off-by: lilydjwg Signed-off-by: Christian Brabandt --- src/gui_gtk_x11.c | 17 ++++++++++++++++- src/version.c | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index a89a774293..518edaf04f 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -2049,7 +2049,7 @@ button_press_event(GtkWidget *widget, } /* - * GTK+ 2 abstracts scrolling via the GdkEventScroll. + * GTK+ abstracts scrolling via the GdkEventScroll. */ static gboolean scroll_event(GtkWidget *widget, @@ -2060,7 +2060,9 @@ scroll_event(GtkWidget *widget, int_u vim_modifiers; #if GTK_CHECK_VERSION(3,4,0) static double acc_x, acc_y; +#if !GTK_CHECK_VERSION(3,22,0) static guint32 last_smooth_event_time; +#endif #define DT_X11 1 #define DT_WAYLAND 2 static display_type; @@ -2087,12 +2089,25 @@ scroll_event(GtkWidget *widget, break; #if GTK_CHECK_VERSION(3,4,0) case GDK_SCROLL_SMOOTH: + if (event->is_stop) + { + acc_x = acc_y = 0; + // this event tells us to stop, without an actual moving + return FALSE; + } +#if GTK_CHECK_VERSION(3,22,0) + if (gdk_device_get_axes(event->device) & GDK_AXIS_FLAG_WHEEL) + // this is from a wheel (as oppose to a touchpad / trackpoint) +#else if (event->time - last_smooth_event_time > 50) // reset our accumulations after 50ms of silence +#endif acc_x = acc_y = 0; acc_x += event->delta_x; acc_y += event->delta_y; +#if !GTK_CHECK_VERSION(3,22,0) last_smooth_event_time = event->time; +#endif break; #endif default: // This shouldn't happen diff --git a/src/version.c b/src/version.c index 33325a664d..8002c95b6d 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 86, /**/ 85, /**/ From 2975a54f285e5b4bf026c1dc706b5d90777d64e7 Mon Sep 17 00:00:00 2001 From: glepnir Date: Fri, 9 Feb 2024 19:30:26 +0100 Subject: [PATCH 017/426] patch 9.1.0087: Restoring lastused_tabpage too early in do_arg_all() Problem: Restore lastused_tabpage too early in do_arg_all() function it will change later in the function. Solution: Restore lastused_tabpage a bit later, when being done with tabpages (glepnir) closes: #13992 Signed-off-by: glepnir Signed-off-by: Christian Brabandt --- src/arglist.c | 9 +++++---- src/testdir/test_tabpage.vim | 7 +++++-- src/version.c | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/arglist.c b/src/arglist.c index 292af30a14..723133254a 100644 --- a/src/arglist.c +++ b/src/arglist.c @@ -1253,10 +1253,6 @@ do_arg_all( // When the ":tab" modifier was used do this for all tab pages. arg_all_close_unused_windows(&aall); - // Now set the last used tabpage to where we started. - if (valid_tabpage(new_lu_tp)) - lastused_tabpage = new_lu_tp; - // Open a window for files in the argument list that don't have one. // ARGCOUNT may change while doing this, because of autocommands. if (count > aall.opened_len || count <= 0) @@ -1291,6 +1287,11 @@ do_arg_all( // to window with first arg if (valid_tabpage(aall.new_curtab)) goto_tabpage_tp(aall.new_curtab, TRUE, TRUE); + + // Now set the last used tabpage to where we started. + if (valid_tabpage(new_lu_tp)) + lastused_tabpage = new_lu_tp; + if (win_valid(aall.new_curwin)) win_enter(aall.new_curwin, FALSE); diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim index 46aed221e4..94f695323f 100644 --- a/src/testdir/test_tabpage.vim +++ b/src/testdir/test_tabpage.vim @@ -156,10 +156,13 @@ func Test_tabpage_drop() tab split f3 normal! gt call assert_equal(1, tabpagenr()) + tab drop f4 + call assert_equal(1, tabpagenr('#')) tab drop f3 - call assert_equal(3, tabpagenr()) - call assert_equal(1, tabpagenr('#')) + call assert_equal(4, tabpagenr()) + call assert_equal(2, tabpagenr('#')) + bwipe! bwipe! bwipe! bwipe! diff --git a/src/version.c b/src/version.c index 8002c95b6d..08a78b6001 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 87, /**/ 86, /**/ From c9e79e52845d51f48f5ea3753a62ab3fe0e40184 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 9 Feb 2024 19:34:36 +0100 Subject: [PATCH 018/426] patch 9.1.0088: TextChanged not triggered for :norm! commands Problem: TextChanged not triggered for :norm! commands (machakann, after v9.0.2031) Solution: Only reset curbuf->b_last_changedtick if TextChangedI was triggered in insert mode (and not blocked) Note: for unknown reasons, the test fails on Windows (but seems to work fine when running interactively) fixes: #13967 closes: #13984 Signed-off-by: Christian Brabandt --- src/edit.c | 7 ++++++- src/testdir/test_autocmd.vim | 18 ++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/edit.c b/src/edit.c index e9a994f6b2..5760b06e86 100644 --- a/src/edit.c +++ b/src/edit.c @@ -843,7 +843,12 @@ edit( if (cmdchar != 'r' && cmdchar != 'v' && c != Ctrl_C) ins_apply_autocmds(EVENT_INSERTLEAVE); did_cursorhold = FALSE; - curbuf->b_last_changedtick = CHANGEDTICK(curbuf); + + // ins_redraw() triggers TextChangedI only when no characters + // are in the typeahead buffer, so only reset curbuf->b_last_changedtick + // if the TextChangedI was not blocked by char_avail() (e.g. using :norm!) + if (!char_avail()) + curbuf->b_last_changedtick = CHANGEDTICK(curbuf); return (c == Ctrl_O); } continue; diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index be73c18197..6e1223275f 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -2706,6 +2706,24 @@ func Test_TextChangedI_with_setline() bwipe! endfunc +func Test_TextChanged_with_norm() + " For unknown reason this fails on MS-Windows + CheckNotMSWindows + CheckFeature terminal + let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) + call assert_equal('running', term_getstatus(buf)) + call term_sendkeys(buf, ":let g:a=0\") + call term_wait(buf, 50) + call term_sendkeys(buf, ":au! TextChanged * :let g:a+=1\") + call term_wait(buf, 50) + call term_sendkeys(buf, ":norm! ia\") + call term_wait(buf, 50) + call term_sendkeys(buf, ":echo g:a\") + call term_wait(buf, 50) + call WaitForAssert({-> assert_match('^1.*$', term_getline(buf, 3))}) + bwipe! +endfunc + func Test_Changed_FirstTime() CheckFeature terminal CheckNotGui diff --git a/src/version.c b/src/version.c index 08a78b6001..1332f46baa 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 88, /**/ 87, /**/ From e06e43766500ecb4cd1031fa16cf9cbebdb222c1 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 9 Feb 2024 19:39:14 +0100 Subject: [PATCH 019/426] patch 9.1.0089: qsort() comparison functions should be transitive Problem: qsort() comparison functions should be transitive Solution: Do not subtract values, but rather use explicit comparisons Improve qsort() comparison functions There has been a recent report on qsort() causing out-of-bounds read & write in glibc for non transitive comparison functions https://www.qualys.com/2024/01/30/qsort.txt Even so the bug is in glibc's implementation of the qsort() algorithm, it's bad style to just use substraction for the comparison functions, which may cause overflow issues and as hinted at in OpenBSD's manual page for qsort(): "It is almost always an error to use subtraction to compute the return value of the comparison function." So check the qsort() comparison functions and change them to be safe. closes: #13980 Signed-off-by: Christian Brabandt --- src/ex_cmds.c | 2 +- src/mbyte.c | 3 ++- src/profiler.c | 8 +++++--- src/search.c | 16 ++++++++++++---- src/spellsuggest.c | 9 +++++++-- src/version.c | 2 ++ src/window.c | 12 +++++++++--- 7 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index e7f689b83f..720e918bb4 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -323,7 +323,7 @@ sort_compare(const void *s1, const void *s2) if (sort_nr) { if (l1.st_u.num.is_number != l2.st_u.num.is_number) - result = l1.st_u.num.is_number - l2.st_u.num.is_number; + result = l1.st_u.num.is_number > l2.st_u.num.is_number ? 1 : -1; else result = l1.st_u.num.value == l2.st_u.num.value ? 0 : l1.st_u.num.value > l2.st_u.num.value ? 1 : -1; diff --git a/src/mbyte.c b/src/mbyte.c index ee2834cf42..2d18a2796a 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -5613,7 +5613,8 @@ tv_nr_compare(const void *a1, const void *a2) listitem_T *li1 = *(listitem_T **)a1; listitem_T *li2 = *(listitem_T **)a2; - return li1->li_tv.vval.v_number - li2->li_tv.vval.v_number; + return li1->li_tv.vval.v_number == li2->li_tv.vval.v_number ? 0 : + li1->li_tv.vval.v_number > li2->li_tv.vval.v_number ? 1 : -1; } void diff --git a/src/profiler.c b/src/profiler.c index 780b958a91..504d713647 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -287,11 +287,13 @@ profile_equal(proftime_T *tm1, proftime_T *tm2) profile_cmp(const proftime_T *tm1, const proftime_T *tm2) { # ifdef MSWIN - return (int)(tm2->QuadPart - tm1->QuadPart); + return tm2->QuadPart == tm1->QuadPart ? 0 : + tm2->QuadPart > tm1->QuadPart ? 1 : -1; # else if (tm1->tv_sec == tm2->tv_sec) - return tm2->tv_fsec - tm1->tv_fsec; - return tm2->tv_sec - tm1->tv_sec; + return tm2->tv_fsec == tm1->tv_fsec ? 0 : + tm2->tv_fsec > tm1->tv_fsec ? 1 : -1; + return tm2->tv_sec > tm1->tv_sec ? 1 : -1; # endif } diff --git a/src/search.c b/src/search.c index d4baa9192c..eadbcd3d93 100644 --- a/src/search.c +++ b/src/search.c @@ -4908,7 +4908,10 @@ fuzzy_match_str_compare(const void *s1, const void *s2) int idx1 = ((fuzmatch_str_T *)s1)->idx; int idx2 = ((fuzmatch_str_T *)s2)->idx; - return v1 == v2 ? (idx1 - idx2) : v1 > v2 ? -1 : 1; + if (v1 == v2) + return idx1 == idx2 ? 0 : idx1 > idx2 ? 1 : -1; + else + return v1 > v2 ? -1 : 1; } /* @@ -4936,9 +4939,14 @@ fuzzy_match_func_compare(const void *s1, const void *s2) char_u *str1 = ((fuzmatch_str_T *)s1)->str; char_u *str2 = ((fuzmatch_str_T *)s2)->str; - if (*str1 != '<' && *str2 == '<') return -1; - if (*str1 == '<' && *str2 != '<') return 1; - return v1 == v2 ? (idx1 - idx2) : v1 > v2 ? -1 : 1; + if (*str1 != '<' && *str2 == '<') + return -1; + if (*str1 == '<' && *str2 != '<') + return 1; + if (v1 == v2) + return idx1 == idx2 ? 0 : idx1 > idx2 ? 1 : -1; + else + return v1 > v2 ? -1 : 1; } /* diff --git a/src/spellsuggest.c b/src/spellsuggest.c index ecc0a7403d..82499c0d19 100644 --- a/src/spellsuggest.c +++ b/src/spellsuggest.c @@ -3763,11 +3763,16 @@ sug_compare(const void *s1, const void *s2) { suggest_T *p1 = (suggest_T *)s1; suggest_T *p2 = (suggest_T *)s2; - int n = p1->st_score - p2->st_score; + int n; + + n = p1->st_score == p2->st_score ? 0 : + p1->st_score > p2->st_score ? 1 : -1; if (n == 0) { - n = p1->st_altscore - p2->st_altscore; + n = p1->st_altscore == p2->st_altscore ? 0 : + p1->st_altscore > p2->st_altscore ? 1 : -1; + if (n == 0) n = STRICMP(p1->st_word, p2->st_word); } diff --git a/src/version.c b/src/version.c index 1332f46baa..a4132dbebc 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 89, /**/ 88, /**/ diff --git a/src/window.c b/src/window.c index 5cb6c3cd9a..a7d9319bde 100644 --- a/src/window.c +++ b/src/window.c @@ -7753,9 +7753,15 @@ frame_check_width(frame_T *topfrp, int width) * Simple int comparison function for use with qsort() */ static int -int_cmp(const void *a, const void *b) -{ - return *(const int *)a - *(const int *)b; +int_cmp(const void *pa, const void *pb) +{ + const int a = *(const int *)pa; + const int b = *(const int *)pb; + if (a > b) + return 1; + if (a < b) + return -1; + return 0; } /* From 415a5a951ba6a827ecafc2e13bf341ed4e124ad6 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Fri, 9 Feb 2024 19:44:28 +0100 Subject: [PATCH 020/426] runtime(vim): Fix indent after line with literal dict closes: #13966 Signed-off-by: Andrew Radev Signed-off-by: Christian Brabandt --- runtime/autoload/dist/vimindent.vim | 5 ++++- runtime/indent/testdir/vim.in | 5 +++++ runtime/indent/testdir/vim.ok | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/runtime/autoload/dist/vimindent.vim b/runtime/autoload/dist/vimindent.vim index a5e04a5391..07b21538e1 100644 --- a/runtime/autoload/dist/vimindent.vim +++ b/runtime/autoload/dist/vimindent.vim @@ -3,6 +3,9 @@ vim9script # Language: Vim script # Maintainer: github user lacygoill # Last Change: 2023 Jun 29 +# +# Includes Changes from Vim: +# - 2024 Feb 09: Fix indent after literal Dict (A. Radev via #13966) # NOTE: Whenever you change the code, make sure the tests are still passing: # @@ -381,7 +384,7 @@ const LINE_CONTINUATION_AT_EOL: string = '\%(' # It can be the start of a dictionary or a block. # We only want to match the former. .. '\|' .. $'^\%({STARTS_CURLY_BLOCK}\)\@!.*\zs{{' - .. '\)\s*\%(\s#.*\)\=$' + .. '\)\s*\%(\s#[^{].*\)\=$' # }}}2 # SOL {{{2 # BACKSLASH_AT_SOL {{{3 diff --git a/runtime/indent/testdir/vim.in b/runtime/indent/testdir/vim.in index c2e149ab37..1ff2d0d000 100644 --- a/runtime/indent/testdir/vim.in +++ b/runtime/indent/testdir/vim.in @@ -946,3 +946,8 @@ Blue Black endenum " END_INDENT + +" START_INDENT +call prop_type_add('indent_after_literal_dict', #{ foo: 'bar' }) +call prop_type_delete('indent_after_literal_dict') +" END_INDENT diff --git a/runtime/indent/testdir/vim.ok b/runtime/indent/testdir/vim.ok index b10e081dd8..fa8869b61f 100644 --- a/runtime/indent/testdir/vim.ok +++ b/runtime/indent/testdir/vim.ok @@ -946,3 +946,8 @@ enum Color Black endenum " END_INDENT + +" START_INDENT +call prop_type_add('indent_after_literal_dict', #{ foo: 'bar' }) +call prop_type_delete('indent_after_literal_dict') +" END_INDENT From 45932c5c4a9ec01f7c2aa09b1574430853dafb4b Mon Sep 17 00:00:00 2001 From: Maxim Kim Date: Fri, 9 Feb 2024 23:11:54 +0100 Subject: [PATCH 021/426] patch 9.1.0090: Assigning wrong colors when parsing terminal OSC response Problem: Assigning wrong colors when parsing terminal OSC response Solution: Correctly assign Green and Blue from the terminal response (Maxim Kim) closes: #13981 Signed-off-by: Maxim Kim Signed-off-by: Christian Brabandt --- src/term.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/term.c b/src/term.c index 44d7443dd1..8aa86ce034 100644 --- a/src/term.c +++ b/src/term.c @@ -5768,8 +5768,8 @@ handle_osc(char_u *tp, char_u *argp, int len, char_u *key_name, int *slen) int rval, gval, bval; rval = hexhex2nr(tp_r); - gval = hexhex2nr(tp_b); - bval = hexhex2nr(tp_g); + gval = hexhex2nr(tp_g); + bval = hexhex2nr(tp_b); #endif if (is_bg) { diff --git a/src/version.c b/src/version.c index a4132dbebc..6beeabbd07 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 90, /**/ 89, /**/ From 627c950e5b30503a084bd0092f9cb2a5fe73fe87 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 10 Feb 2024 13:02:17 +0100 Subject: [PATCH 022/426] patch 9.1.0091: Syntax test fails when run with non C locale Problem: Syntax test fails when run with non C locale Solution: Run syntax tests with C locale, clean up Xtestscript file, strip environment variables from GetVimCommand() (h-east) closes: #14007 Co-authored-by: h-east Signed-off-by: h-east Signed-off-by: Christian Brabandt --- runtime/syntax/Makefile | 6 ++++-- runtime/syntax/testdir/runtest.vim | 7 ++++--- src/testdir/shared.vim | 3 ++- src/version.c | 2 ++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/runtime/syntax/Makefile b/runtime/syntax/Makefile index f3b578ce9b..945308fd7c 100644 --- a/runtime/syntax/Makefile +++ b/runtime/syntax/Makefile @@ -11,6 +11,8 @@ VIMRUNTIME = ../.. # VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=45 --log-file=valgrind.$* # ENVVARS = LC_ALL=C LANG=C LANGUAGE=C +# Run the syntax tests with a C locale +ENVVARS = LC_ALL=C RUN_VIMTEST = VIMRUNTIME=$(VIMRUNTIME) $(VALGRIND) $(ENVVARS) ../$(VIMPROG) -f $(GUI_FLAG) @@ -25,11 +27,11 @@ test: @# the "vimcmd" file is used by the screendump utils @echo "../$(VIMPROG)" > testdir/vimcmd @echo "$(RUN_VIMTEST)" >> testdir/vimcmd - VIMRUNTIME=$(VIMRUNTIME) $(VIMPROG) --clean --not-a-term $(DEBUGLOG) -u testdir/runtest.vim + VIMRUNTIME=$(VIMRUNTIME) $(ENVVARS) $(VIMPROG) --clean --not-a-term $(DEBUGLOG) -u testdir/runtest.vim @# FIXME: Temporarily show the whole file to find out what goes wrong @#if [ -f testdir/messages ]; then tail -n 6 testdir/messages; fi @if [ -f testdir/messages ]; then cat testdir/messages; fi clean testclean: - rm -f testdir/failed/* testdir/done/* testdir/vimcmd testdir/messages + rm -f testdir/failed/* testdir/done/* testdir/vimcmd testdir/messages testdir/Xtestscript diff --git a/runtime/syntax/testdir/runtest.vim b/runtime/syntax/testdir/runtest.vim index 80f1eff58a..d2ce3d19fa 100644 --- a/runtime/syntax/testdir/runtest.vim +++ b/runtime/syntax/testdir/runtest.vim @@ -237,11 +237,12 @@ call Message('FAILED: ' .. len(failed_tests) .. ': ' .. string(failed_tests)) call Message('skipped: ' .. skipped_count) call AppendMessages('== SUMMARY ==') -" Matching "if 1" at the start. -endif - if len(failed_tests) > 0 " have make report an error cquit endif + +" Matching "if 1" at the start. +endif + qall! diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim index 4d008a0bfc..9479efbdc0 100644 --- a/src/testdir/shared.vim +++ b/src/testdir/shared.vim @@ -300,7 +300,8 @@ func GetVimCommand(...) endif let cmd .= ' --not-a-term' let cmd .= ' --gui-dialog-file guidialogfile' - let cmd = substitute(cmd, 'VIMRUNTIME=\S\+', '', '') + " remove any environment variables + let cmd = substitute(cmd, '[A-Z_]*=\S\+ *', '', 'g') " If using valgrind, make sure every run uses a different log file. if cmd =~ 'valgrind.*--log-file=' diff --git a/src/version.c b/src/version.c index 6beeabbd07..91abfe113d 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 91, /**/ 90, /**/ From c908371aec920b8174e40a1adb73a50e326a5668 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 10 Feb 2024 13:17:16 +0100 Subject: [PATCH 023/426] patch 9.1.0092: Compiler warning for missing type in scroll_event() Problem: Compiler warning for missing type in scroll_event() (chdiza) Solution: Declare display_type explicitly as integer fixes: #14005 Signed-off-by: Christian Brabandt --- src/gui_gtk_x11.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 518edaf04f..d4a8b93648 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -2065,7 +2065,7 @@ scroll_event(GtkWidget *widget, #endif #define DT_X11 1 #define DT_WAYLAND 2 - static display_type; + static int display_type; if (!display_type) display_type = gui_mch_get_display() ? DT_X11 : DT_WAYLAND; #endif diff --git a/src/version.c b/src/version.c index 91abfe113d..86ed8b708d 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 92, /**/ 91, /**/ From 77078276bfe695070441a1bbdc02949d31de8922 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 10 Feb 2024 13:24:03 +0100 Subject: [PATCH 024/426] patch 9.1.0093: Still a qsort() comparison function that returns result of subtraction Problem: Still a qsort() comparison function fuzzy_match_item_compare() that returns result of subtraction (after 9.1.0089). Solution: Use an explicit comparison instead of subtraction. (zeertzjq) closes: #14004 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/search.c | 5 ++++- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/search.c b/src/search.c index eadbcd3d93..1d0542b658 100644 --- a/src/search.c +++ b/src/search.c @@ -4561,7 +4561,10 @@ fuzzy_match_item_compare(const void *s1, const void *s2) int idx1 = ((fuzzyItem_T *)s1)->idx; int idx2 = ((fuzzyItem_T *)s2)->idx; - return v1 == v2 ? (idx1 - idx2) : v1 > v2 ? -1 : 1; + if (v1 == v2) + return idx1 == idx2 ? 0 : idx1 > idx2 ? 1 : -1; + else + return v1 > v2 ? -1 : 1; } /* diff --git a/src/version.c b/src/version.c index 86ed8b708d..685f8b0df3 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 93, /**/ 92, /**/ From 00221487731ea1868c57259c7aa0eb713cd7ade7 Mon Sep 17 00:00:00 2001 From: Goffredo Baroncelli Date: Sat, 10 Feb 2024 13:31:06 +0100 Subject: [PATCH 025/426] patch 9.1.0094: xxd: buffer-overflow when writing color output Problem: xxd: buffer-overflow when writing color output Solution: properly account for the color escape sequences and adjust LLEN macro (Goffredo Baroncelli) xxd: crash with higer number of column xxd writes the data into a buffer before printing. Unfortunately the buffer doesn't consider the space consumed by the escape sequences used to change the color of the character. BEFORE: $ xxd -Ralways -c 256 /etc/passwd Segmentation fault (core dumped) AFTER: $ ./xxd -Ralways -c 256 /etc/passwd 00000000: 726f 6f74 3a78 3a30 3a30 3a72 6f6f 743a 2f72 [...] To solve this issue I had to increase the size of the buffer considering for each byte of data 11 further characters for the color escape sequence. closes: #14003 Signed-off-by: Goffredo Baroncelli Signed-off-by: Christian Brabandt --- src/version.c | 2 ++ src/xxd/xxd.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/version.c b/src/version.c index 685f8b0df3..598a957ad5 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 94, /**/ 93, /**/ diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index a5f5f04ade..cf8b4ea6a0 100644 --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -61,6 +61,7 @@ * 12.01.2024 disable auto-conversion for z/OS (MVS) * 17.01.2024 use size_t instead of usigned int for code-generation (-i), #13876 * 25.01.2024 revert the previous patch (size_t instead of unsigned int) + * 10.02.2024 fix buffer-overflow when writing color output to buffer, #14003 * * (c) 1990-1998 by Juergen Weigert (jnweiger@gmail.com) * @@ -141,7 +142,7 @@ extern void perror __P((char *)); # endif #endif -char version[] = "xxd 2024-01-25 by Juergen Weigert et al."; +char version[] = "xxd 2024-02-10 by Juergen Weigert et al."; #ifdef WIN32 char osver[] = " (Win32)"; #else @@ -200,7 +201,33 @@ char osver[] = ""; #define TRY_SEEK /* attempt to use lseek, or skip forward by reading */ #define COLS 256 /* change here, if you ever need more columns */ -#define LLEN ((2*(int)sizeof(unsigned long)) + 4 + (9*COLS-1) + COLS + 2) + +/* + * LLEN is the maximum length of a line; other than the visible characters + * we need to consider also the escape color sequence prologue/epilogue , + * (11 bytes for each character). The most larger format is the default one: + * addr + 1 word for each col/2 + 1 char for each col + * + * addr 1st group 2nd group + * +-------+ +-----------------+ +------+ + * 01234567: 1234 5678 9abc def0 12345678 + * + * - addr: typically 012345678: -> from 10 up to 18 bytes (including trailing + * space) + * - 1st group: 1234 5678 9abc ... -> each byte may be colored, so add 11 + * for each byte + * - space -> 1 byte + * - 2nd group: 12345678 -> each char may be colore so add 11 + * for each byte + * - new line -> 1 byte + * - zero (end line) -> 1 byte + */ +#define LLEN (2*(int)sizeof(unsigned long) + 2 + /* addr + ": " */ \ + (11 * 2 + 4 + 1) * (COLS / 2) + /* 1st group */ \ + 1 + /* space */ \ + (1 + 11) * COLS + /* 2nd group */ \ + 1 + /* new line */ \ + 1) /* zero */ char hexxa[] = "0123456789abcdef0123456789ABCDEF", *hexx = hexxa; From 52eb0b867704e43049cb396e64cadb5bd9a3ad0b Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 10 Feb 2024 13:50:54 +0100 Subject: [PATCH 026/426] patch 9.1.0095: tests: test_restricted() fails Problem: tests: test_restricted() fails (after: v9.1.0091) Solution: Add a space before the pipecmd and the actual Vim command to run Signed-off-by: Christian Brabandt --- src/testdir/shared.vim | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim index 9479efbdc0..47aeab3b16 100644 --- a/src/testdir/shared.vim +++ b/src/testdir/shared.vim @@ -364,7 +364,7 @@ func RunVimPiped(before, after, arguments, pipecmd) " Optionally run Vim under valgrind " let cmd = 'valgrind --tool=memcheck --leak-check=yes --num-callers=25 --log-file=valgrind ' . cmd - exe "silent !" . a:pipecmd . cmd . args . ' ' . a:arguments + exe "silent !" .. a:pipecmd .. ' ' .. cmd .. args .. ' ' .. a:arguments if len(a:before) > 0 call delete('Xbefore.vim') diff --git a/src/version.c b/src/version.c index 598a957ad5..ba44232e5e 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 95, /**/ 94, /**/ From be156a31c5400eb12025e480c477b1df88244801 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sun, 11 Feb 2024 17:08:29 +0100 Subject: [PATCH 027/426] patch 9.1.0096: diff() function uses 'diffexpr' Problem: diff() function uses 'diffexpr' (rickhowe) Solution: Make diff() always use internal diff(), add support for unified diff context length, sort diff() options in help (Yegappan Lakshmanan) fixes: #13989 closes: #14010 Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 16 +++++---- src/diff.c | 67 ++++++++++++++++++++++------------- src/testdir/test_diffmode.vim | 56 +++++++++++++++++++++-------- src/version.c | 2 ++ 4 files changed, 95 insertions(+), 46 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 062da08d6c..0dca4679e9 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 01 +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 11 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2074,20 +2074,22 @@ diff({fromlist}, {tolist} [, {options}]) *diff()* The {options} Dict argument also specifies diff options (similar to 'diffopt') and supports the following items: + algorithm Dict specifying the diff algorithm to + use. Supported boolean items are + "myers", "minimal", "patience" and + "histogram". + context unified diff context length. Default + is 1. iblank ignore changes where lines are all blank. icase ignore changes in case of text. + indent-heuristic use the indent heuristic for the + internal diff library. iwhite ignore changes in amount of white space. iwhiteall ignore all white space changes. iwhiteeol ignore white space changes at end of line. - indent-heuristic use the indent heuristic for the - internal diff library. - algorithm Dict specifying the diff algorithm to - use. Supported boolean items are - "myers", "minimal", "patience" and - "histogram". For more information about these options, refer to 'diffopt'. Returns an empty List or String if {fromlist} and {tolist} are diff --git a/src/diff.c b/src/diff.c index eedd76b133..a4f3f7e072 100644 --- a/src/diff.c +++ b/src/diff.c @@ -42,10 +42,6 @@ static int diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF; static long diff_algorithm = 0; -#define DIFF_INTERNAL_OUTPUT_UNIFIED 1 -#define DIFF_INTERNAL_OUTPUT_INDICES 2 -static int diff_internal_output_fmt = DIFF_INTERNAL_OUTPUT_INDICES; - #define LBUFLEN 50 // length of line in diff file static int diff_a_works = MAYBE; // TRUE when "diff -a" works, FALSE when it @@ -76,12 +72,19 @@ typedef struct { long count_new; } diffhunk_T; +typedef enum { + DIO_OUTPUT_INDICES = 0, // default + DIO_OUTPUT_UNIFIED = 1 // unified diff format +} dio_outfmt_T; + // two diff inputs and one result typedef struct { - diffin_T dio_orig; // original file input - diffin_T dio_new; // new file input - diffout_T dio_diff; // diff result - int dio_internal; // using internal diff + diffin_T dio_orig; // original file input + diffin_T dio_new; // new file input + diffout_T dio_diff; // diff result + int dio_internal; // using internal diff + dio_outfmt_T dio_outfmt; // internal diff output format + int dio_ctxlen; // unified diff context length } diffio_T; static int diff_buf_idx(buf_T *buf); @@ -1145,9 +1148,9 @@ diff_file_internal(diffio_T *diffio) if (diff_flags & DIFF_IBLANK) param.flags |= XDF_IGNORE_BLANK_LINES; - emit_cfg.ctxlen = 0; // don't need any diff_context here + emit_cfg.ctxlen = diffio->dio_ctxlen; emit_cb.priv = &diffio->dio_diff; - if (diff_internal_output_fmt == DIFF_INTERNAL_OUTPUT_INDICES) + if (diffio->dio_outfmt == DIO_OUTPUT_INDICES) emit_cfg.hunk_func = xdiff_out_indices; else emit_cb.out_line = xdiff_out_unified; @@ -3473,10 +3476,11 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) */ static int parse_diff_optarg( - typval_T *opts, - int *diffopts, - long *diffalgo, - int *diff_output_fmt) + typval_T *opts, + int *diffopts, + long *diffalgo, + dio_outfmt_T *diff_output_fmt, + int *diff_ctxlen) { dict_T *d = opts->vval.v_dict; @@ -3497,9 +3501,9 @@ parse_diff_optarg( if (output_fmt != NULL) { if (STRNCMP(output_fmt, "unified", 7) == 0) - *diff_output_fmt = DIFF_INTERNAL_OUTPUT_UNIFIED; + *diff_output_fmt = DIO_OUTPUT_UNIFIED; else if (STRNCMP(output_fmt, "indices", 7) == 0) - *diff_output_fmt = DIFF_INTERNAL_OUTPUT_INDICES; + *diff_output_fmt = DIO_OUTPUT_INDICES; else { semsg(_(e_unsupported_diff_output_format_str), output_fmt); @@ -3507,6 +3511,10 @@ parse_diff_optarg( } } + *diff_ctxlen = dict_get_number_def(d, "context", 1); + if (*diff_ctxlen < 0) + *diff_ctxlen = 1; + if (dict_get_bool(d, "iblank", FALSE)) *diffopts |= DIFF_IBLANK; if (dict_get_bool(d, "icase", FALSE)) @@ -3602,33 +3610,43 @@ f_diff(typval_T *argvars UNUSED, typval_T *rettv UNUSED) // Save the 'diffopt' option value and restore it after getting the diff. int save_diff_flags = diff_flags; long save_diff_algorithm = diff_algorithm; - long save_diff_output_fmt = diff_internal_output_fmt; diff_flags = DIFF_INTERNAL; diff_algorithm = 0; - diff_internal_output_fmt = DIFF_INTERNAL_OUTPUT_UNIFIED; + dio.dio_outfmt = DIO_OUTPUT_UNIFIED; if (argvars[2].v_type != VAR_UNKNOWN) if (parse_diff_optarg(&argvars[2], &diff_flags, &diff_algorithm, - &diff_internal_output_fmt) == FAIL) - { - diff_internal_output_fmt = save_diff_output_fmt; + &dio.dio_outfmt, &dio.dio_ctxlen) == FAIL) return; - } // Concatenate the List of strings into a single string using newline // separator. Internal diff library expects a single string. list_to_diffin(orig_list, &dio.dio_orig, diff_flags & DIFF_ICASE); list_to_diffin(new_list, &dio.dio_new, diff_flags & DIFF_ICASE); + // If 'diffexpr' is set, then the internal diff is not used. Set + // 'diffexpr' to an empty string temporarily. + int restore_diffexpr = FALSE; + char_u cc = *p_dex; + if (*p_dex != NUL) + { + restore_diffexpr = TRUE; + *p_dex = NUL; + } + // Compute the diff int diff_status = diff_file(&dio); + // restore 'diffexpr' + if (restore_diffexpr) + *p_dex = cc; + if (diff_status == FAIL) goto done; int hunk_idx = 0; dict_T *hunk_dict; - if (diff_internal_output_fmt == DIFF_INTERNAL_OUTPUT_INDICES) + if (dio.dio_outfmt == DIO_OUTPUT_INDICES) { if (rettv_list_alloc(rettv) != OK) goto done; @@ -3657,7 +3675,7 @@ f_diff(typval_T *argvars UNUSED, typval_T *rettv UNUSED) done: clear_diffin(&dio.dio_new); - if (diff_internal_output_fmt == DIFF_INTERNAL_OUTPUT_INDICES) + if (dio.dio_outfmt == DIO_OUTPUT_INDICES) clear_diffout(&dio.dio_diff); else ga_clear(&dio.dio_diff.dout_ga); @@ -3665,7 +3683,6 @@ f_diff(typval_T *argvars UNUSED, typval_T *rettv UNUSED) // Restore the 'diffopt' option value. diff_flags = save_diff_flags; diff_algorithm = save_diff_algorithm; - diff_internal_output_fmt = save_diff_output_fmt; # endif } diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim index 2211ba05a2..d37a9a28a5 100644 --- a/src/testdir/test_diffmode.vim +++ b/src/testdir/test_diffmode.vim @@ -1719,43 +1719,43 @@ endfunc " Test for the diff() function def Test_diff_func() # string is added/removed/modified at the beginning - assert_equal("@@ -0,0 +1 @@\n+abc\n", + assert_equal("@@ -1 +1,2 @@\n+abc\n def\n", diff(['def'], ['abc', 'def'], {output: 'unified'})) assert_equal([{from_idx: 0, from_count: 0, to_idx: 0, to_count: 1}], diff(['def'], ['abc', 'def'], {output: 'indices'})) - assert_equal("@@ -1 +0,0 @@\n-abc\n", + assert_equal("@@ -1,2 +1 @@\n-abc\n def\n", diff(['abc', 'def'], ['def'], {output: 'unified'})) assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 0}], diff(['abc', 'def'], ['def'], {output: 'indices'})) - assert_equal("@@ -1 +1 @@\n-abc\n+abx\n", + assert_equal("@@ -1,2 +1,2 @@\n-abc\n+abx\n def\n", diff(['abc', 'def'], ['abx', 'def'], {output: 'unified'})) assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}], diff(['abc', 'def'], ['abx', 'def'], {output: 'indices'})) # string is added/removed/modified at the end - assert_equal("@@ -1,0 +2 @@\n+def\n", + assert_equal("@@ -1 +1,2 @@\n abc\n+def\n", diff(['abc'], ['abc', 'def'], {output: 'unified'})) assert_equal([{from_idx: 1, from_count: 0, to_idx: 1, to_count: 1}], diff(['abc'], ['abc', 'def'], {output: 'indices'})) - assert_equal("@@ -2 +1,0 @@\n-def\n", + assert_equal("@@ -1,2 +1 @@\n abc\n-def\n", diff(['abc', 'def'], ['abc'], {output: 'unified'})) assert_equal([{from_idx: 1, from_count: 1, to_idx: 1, to_count: 0}], diff(['abc', 'def'], ['abc'], {output: 'indices'})) - assert_equal("@@ -2 +2 @@\n-def\n+xef\n", + assert_equal("@@ -1,2 +1,2 @@\n abc\n-def\n+xef\n", diff(['abc', 'def'], ['abc', 'xef'], {output: 'unified'})) assert_equal([{from_idx: 1, from_count: 1, to_idx: 1, to_count: 1}], diff(['abc', 'def'], ['abc', 'xef'], {output: 'indices'})) # string is added/removed/modified in the middle - assert_equal("@@ -2,0 +3 @@\n+xxx\n", + assert_equal("@@ -2,2 +2,3 @@\n 222\n+xxx\n 333\n", diff(['111', '222', '333'], ['111', '222', 'xxx', '333'], {output: 'unified'})) assert_equal([{from_idx: 2, from_count: 0, to_idx: 2, to_count: 1}], diff(['111', '222', '333'], ['111', '222', 'xxx', '333'], {output: 'indices'})) - assert_equal("@@ -3 +2,0 @@\n-333\n", + assert_equal("@@ -2,3 +2,2 @@\n 222\n-333\n 444\n", diff(['111', '222', '333', '444'], ['111', '222', '444'], {output: 'unified'})) assert_equal([{from_idx: 2, from_count: 1, to_idx: 2, to_count: 0}], diff(['111', '222', '333', '444'], ['111', '222', '444'], {output: 'indices'})) - assert_equal("@@ -3 +3 @@\n-333\n+xxx\n", + assert_equal("@@ -2,3 +2,3 @@\n 222\n-333\n+xxx\n 444\n", diff(['111', '222', '333', '444'], ['111', '222', 'xxx', '444'], {output: 'unified'})) assert_equal([{from_idx: 2, from_count: 1, to_idx: 2, to_count: 1}], diff(['111', '222', '333', '444'], ['111', '222', 'xxx', '444'], {output: 'indices'})) @@ -1825,18 +1825,17 @@ def Test_diff_func() three four five six END - assert_equal("@@ -1 +1 @@\n-one two\n+one abc two\n@@ -3 +3 @@\n-five abc six\n+five six\n", + assert_equal("@@ -1,3 +1,3 @@\n-one two\n+one abc two\n three four\n-five abc six\n+five six\n", diff(fromlist, tolist, {output: 'unified'})) - assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}, - {from_idx: 2, from_count: 1, to_idx: 2, to_count: 1}], + assert_equal([{from_idx: 0, from_count: 3, to_idx: 0, to_count: 3}], diff(fromlist, tolist, {output: 'indices'})) # add/remove blank lines - assert_equal("@@ -2,2 +1,0 @@\n-\n-\n", + assert_equal("@@ -1,4 +1,2 @@\n one\n-\n-\n two\n", diff(['one', '', '', 'two'], ['one', 'two'], {output: 'unified'})) assert_equal([{from_idx: 1, from_count: 2, to_idx: 1, to_count: 0}], diff(['one', '', '', 'two'], ['one', 'two'], {output: 'indices'})) - assert_equal("@@ -1,0 +2,2 @@\n+\n+\n", + assert_equal("@@ -1,2 +1,4 @@\n one\n+\n+\n two\n", diff(['one', 'two'], ['one', '', '', 'two'], {output: 'unified'})) assert_equal([{'from_idx': 1, 'from_count': 0, 'to_idx': 1, 'to_count': 2}], diff(['one', 'two'], ['one', '', '', 'two'], {output: 'indices'})) @@ -1887,11 +1886,40 @@ def Test_diff_func() assert_equal('', diff([], [], {output: 'unified'})) assert_equal([], diff([], [], {output: 'indices'})) + # If 'diffexpr' is set, it should not be used for diff() + def MyDiffExpr() + enddef + var save_diffexpr = &diffexpr + :set diffexpr=MyDiffExpr() + assert_equal("@@ -1 +1 @@\n-abc\n+\n", + diff(['abc'], [''], {output: 'unified'})) + assert_equal([{'from_idx': 0, 'from_count': 1, 'to_idx': 0, 'to_count': 1}], + diff(['abc'], [''], {output: 'indices'})) + assert_equal('MyDiffExpr()', &diffexpr) + &diffexpr = save_diffexpr + + # try different values for unified diff 'context' + assert_equal("@@ -0,0 +1 @@\n+x\n", + diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'])) + assert_equal("@@ -0,0 +1 @@\n+x\n", + diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 0})) + assert_equal("@@ -1 +1,2 @@\n+x\n a\n", + diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 1})) + assert_equal("@@ -1,2 +1,3 @@\n+x\n a\n b\n", + diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 2})) + assert_equal("@@ -1,3 +1,4 @@\n+x\n a\n b\n c\n", + diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 3})) + assert_equal("@@ -1,3 +1,4 @@\n+x\n a\n b\n c\n", + diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 4})) + assert_equal("@@ -1 +1,2 @@\n+x\n a\n", + diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: -1})) + # Error cases assert_fails('call diff({}, ["a"])', 'E1211:') assert_fails('call diff(["a"], {})', 'E1211:') assert_fails('call diff(["a"], ["a"], [])', 'E1206:') assert_fails('call diff(["a"], ["a"], {output: "xyz"})', 'E106: Unsupported diff output format: xyz') + assert_fails('call diff(["a"], ["a"], {context: []})', 'E745: Using a List as a Number') enddef " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index ba44232e5e..dbbb913051 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 96, /**/ 95, /**/ From b614b284ee06523511308f8381b47db34d921d39 Mon Sep 17 00:00:00 2001 From: dkearns Date: Mon, 12 Feb 2024 03:13:34 +1100 Subject: [PATCH 028/426] runtime(vim): Update syntax file (#14009) - allow comments after :highight commands - match the bang in a :highlight[!] command - highlight the bang in :map[!], :menu[!] and :unlet[!] with vimOper like all other commands Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/testdir/dumps/vim_map_00.dump | 20 +++++++++ runtime/syntax/testdir/dumps/vim_map_99.dump | 20 +++++++++ runtime/syntax/testdir/input/vim_map.vim | 9 ++++ runtime/syntax/vim.vim | 43 ++++++++++++-------- 4 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/vim_map_00.dump create mode 100644 runtime/syntax/testdir/dumps/vim_map_99.dump create mode 100644 runtime/syntax/testdir/input/vim_map.vim diff --git a/runtime/syntax/testdir/dumps/vim_map_00.dump b/runtime/syntax/testdir/dumps/vim_map_00.dump new file mode 100644 index 0000000000..d3a290e9b6 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_map_00.dump @@ -0,0 +1,20 @@ +>"+0#0000e05#ffffff0| |V|i|m| |m|a|p| |c|o|m@1|a|n|d|s| +0#0000000&@56 +@75 +|m+0#af5f00255&|a|p|!| +0#0000000&@70 +|m+0#af5f00255&|a|p|!| +0#0000000&|l|h|s| |r|h|s| @62 +|m+0#af5f00255&|a|p| +0#0000000&@71 +|m+0#af5f00255&|a|p| +0#0000000&|l|h|s| |r|h|s| @63 +@75 +|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@51 +|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p| +0#0000000&|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@50 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|m|a|p|.|v|i|m|"| |9|L|,| |1|0|5|B| @28|1|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/dumps/vim_map_99.dump b/runtime/syntax/testdir/dumps/vim_map_99.dump new file mode 100644 index 0000000000..f8710b9538 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_map_99.dump @@ -0,0 +1,20 @@ +|"+0#0000e05#ffffff0| |V|i|m| |m|a|p| |c|o|m@1|a|n|d|s| +0#0000000&@56 +@75 +|m+0#af5f00255&|a|p|!| +0#0000000&@70 +|m+0#af5f00255&|a|p|!| +0#0000000&|l|h|s| |r|h|s| @62 +|m+0#af5f00255&|a|p| +0#0000000&@71 +|m+0#af5f00255&|a|p| +0#0000000&|l|h|s| |r|h|s| @63 +@75 +|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@51 +>c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p| +0#0000000&|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@50 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|m|a|p|.|v|i|m|"| |9|L|,| |1|0|5|B| @28|9|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/input/vim_map.vim b/runtime/syntax/testdir/input/vim_map.vim new file mode 100644 index 0000000000..7c73b996f4 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_map.vim @@ -0,0 +1,9 @@ +" Vim map commands + +map! +map! lhs rhs +map +map lhs rhs + +call map(list, 'v:val') +call map (list, 'v:val') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index e9feb35b5b..983c2639a0 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -2,19 +2,22 @@ " Language: Vim 9.0 script " Maintainer: Charles E. Campbell " Last Change: May 09, 2023 -" 2023 Nov 12 by Vim Project (:let-heredoc improvements) -" 2023 Nov 20 by Vim Project (:loadkeymap improvements) -" 2023 Dec 06 by Vim Project (add missing assignment operators) -" 2023 Dec 10 by Vim Project (improve variable matching) -" 2023 Dec 21 by Vim Project (improve ex command matching) -" 2023 Dec 30 by Vim Project (:syntax improvements) -" 2024 Jan 14 by Vim Project (TermResponseAll autocommand) -" 2024 Jan 15 by Vim Project (:hi ctermfont attribute) -" 2024 Jan 23 by Vim Project (add :[23]match commands) -" 2024 Jan 25 by Vim Project (WinNewPre autocommand) -" 2024 Jan 27 by Vim Project (add foreach() function) -" 2024 Jan 28 by Vim Project (improve line-continuation matching & string interpolation) -" 2024 Feb 01 by Vim Project (improve special key matching) +" Vim Project changes: {{{1 +" 2023 Nov 12 (:let-heredoc improvements) +" 2023 Nov 20 (:loadkeymap improvements) +" 2023 Dec 06 (add missing assignment operators) +" 2023 Dec 10 (improve variable matching) +" 2023 Dec 21 (improve ex command matching) +" 2023 Dec 30 (:syntax improvements) +" 2024 Jan 14 (TermResponseAll autocommand) +" 2024 Jan 15 (:hi ctermfont attribute) +" 2024 Jan 23 (add :[23]match commands) +" 2024 Jan 25 (WinNewPre autocommand) +" 2024 Jan 27 (add foreach() function) +" 2024 Jan 28 (improve line-continuation matching & string interpolation) +" 2024 Feb 01 (improve special key matching) +" 2024 Feb 10 (improve :highlight and :map) +" }}} " Version: 9.0-25 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Automatically generated keyword lists: {{{1 @@ -481,7 +484,8 @@ syn case match " Maps: {{{2 " ==== -syn match vimMap "\!\=\ze\s*[^(]" skipwhite nextgroup=vimMapMod,vimMapLhs +syn match vimMap "\\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapLhs +syn match vimMap "\ Date: Sun, 11 Feb 2024 17:16:19 +0100 Subject: [PATCH 029/426] patch 9.1.0097: 'breakindent' behaves inconsistently with 'list' and splits Problem: 'breakindent' behaves inconsistently with 'list' and splits. Solution: Use 'listchars' from the correct window and handle caching properly. Move cheaper comparisons to the top. (zeertzjq) closes: #14008 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/indent.c | 64 +++++++++++++++++--------------- src/proto/indent.pro | 4 +- src/testdir/test_breakindent.vim | 50 ++++++++++++++++++++++++- src/version.c | 2 + 4 files changed, 87 insertions(+), 33 deletions(-) diff --git a/src/indent.c b/src/indent.c index 1858ecf8f3..34d31579bd 100644 --- a/src/indent.c +++ b/src/indent.c @@ -434,20 +434,17 @@ get_indent_buf(buf_T *buf, linenr_T lnum) get_indent_str( char_u *ptr, int ts, - int list) // if TRUE, count only screen size for tabs + int no_ts) // if TRUE, count a tab as ^I { int count = 0; for ( ; *ptr; ++ptr) { - if (*ptr == TAB) + if (*ptr == TAB) // count a tab for what it is worth { - if (!list || curwin->w_lcs_chars.tab1) - // count a tab for what it is worth + if (!no_ts) count += ts - (count % ts); else - // In list mode, when tab is not set, count screen char width - // for Tab, displays: ^I count += ptr2cells(ptr); } else if (*ptr == ' ') @@ -462,10 +459,10 @@ get_indent_str( /* * Count the size (in window cells) of the indent in line "ptr", using * variable tabstops. - * if "list" is TRUE, count only screen size for tabs. + * If "no_ts" is TRUE, count a tab as ^I. */ int -get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list) +get_indent_str_vtab(char_u *ptr, int ts, int *vts, int no_ts) { int count = 0; @@ -473,11 +470,9 @@ get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list) { if (*ptr == TAB) // count a tab for what it is worth { - if (!list || curwin->w_lcs_chars.tab1) + if (!no_ts) count += tabstop_padding(count, ts, vts); else - // In list mode, when tab is not set, count screen char width - // for Tab, displays: ^I count += ptr2cells(ptr); } else if (*ptr == ' ') @@ -925,14 +920,16 @@ get_breakindent_win( { static int prev_indent = 0; // cached indent value static long prev_ts = 0L; // cached tabstop value - static int prev_fnum = 0; // cached buffer number - static char_u *prev_line = NULL; // cached copy of "line" - static varnumber_T prev_tick = 0; // changedtick of cached value # ifdef FEAT_VARTABS static int *prev_vts = NULL; // cached vartabs values # endif - static int prev_list = 0; // cached list value + static int prev_fnum = 0; // cached buffer number + static char_u *prev_line = NULL; // cached copy of "line" + static varnumber_T prev_tick = 0; // changedtick of cached value + static int prev_list = 0; // cached list indent static int prev_listopt = 0; // cached w_p_briopt_list value + static int prev_no_ts = FALSE; // cached no_ts value + static unsigned prev_dy_uhex = 0; // cached 'display' "uhex" value // cached formatlistpat value static char_u *prev_flp = NULL; int bri = 0; @@ -942,44 +939,53 @@ get_breakindent_win( && (vim_strchr(p_cpo, CPO_NUMCOL) == NULL) ? number_width(wp) + 1 : 0); - // used cached indent, unless - // - buffer changed - // - 'tabstop' changed - // - buffer was changed - // - 'briopt_list changed' changed or - // - 'formatlistpattern' changed - // - line changed - // - 'vartabs' changed + // In list mode, if 'listchars' "tab" isn't set, a TAB is displayed as ^I. + int no_ts = wp->w_p_list && wp->w_lcs_chars.tab1 == NUL; + + // Used cached indent, unless + // - buffer changed, or + // - 'tabstop' changed, or + // - 'vartabstop' changed, or + // - buffer was changed, or + // - 'breakindentopt' "list" changed, or + // - 'list' or 'listchars' "tab" changed, or + // - 'display' "uhex" flag changed, or + // - 'formatlistpat' changed, or + // - line changed. if (prev_fnum != wp->w_buffer->b_fnum || prev_ts != wp->w_buffer->b_p_ts +# ifdef FEAT_VARTABS + || prev_vts != wp->w_buffer->b_p_vts_array +# endif || prev_tick != CHANGEDTICK(wp->w_buffer) || prev_listopt != wp->w_briopt_list + || prev_no_ts != no_ts + || prev_dy_uhex != (dy_flags & DY_UHEX) || prev_flp == NULL || STRCMP(prev_flp, get_flp_value(wp->w_buffer)) != 0 || prev_line == NULL || STRCMP(prev_line, line) != 0 -# ifdef FEAT_VARTABS - || prev_vts != wp->w_buffer->b_p_vts_array -# endif ) { prev_fnum = wp->w_buffer->b_fnum; vim_free(prev_line); prev_line = vim_strsave(line); prev_ts = wp->w_buffer->b_p_ts; - prev_tick = CHANGEDTICK(wp->w_buffer); # ifdef FEAT_VARTABS prev_vts = wp->w_buffer->b_p_vts_array; if (wp->w_briopt_vcol == 0) prev_indent = get_indent_str_vtab(line, (int)wp->w_buffer->b_p_ts, - wp->w_buffer->b_p_vts_array, wp->w_p_list); + wp->w_buffer->b_p_vts_array, no_ts); # else if (wp->w_briopt_vcol == 0) prev_indent = get_indent_str(line, - (int)wp->w_buffer->b_p_ts, wp->w_p_list); + (int)wp->w_buffer->b_p_ts, no_ts); # endif + prev_tick = CHANGEDTICK(wp->w_buffer); prev_listopt = wp->w_briopt_list; prev_list = 0; + prev_no_ts = no_ts; + prev_dy_uhex = (dy_flags & DY_UHEX); vim_free(prev_flp); prev_flp = vim_strsave(get_flp_value(wp->w_buffer)); // add additional indent for numbered lists diff --git a/src/proto/indent.pro b/src/proto/indent.pro index 5ab338dce2..bafcefc677 100644 --- a/src/proto/indent.pro +++ b/src/proto/indent.pro @@ -14,8 +14,8 @@ long get_sts_value(void); int get_indent(void); int get_indent_lnum(linenr_T lnum); int get_indent_buf(buf_T *buf, linenr_T lnum); -int get_indent_str(char_u *ptr, int ts, int list); -int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list); +int get_indent_str(char_u *ptr, int ts, int no_ts); +int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int no_ts); int set_indent(int size, int flags); int get_number_indent(linenr_T lnum); int briopt_check(win_T *wp); diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim index ee05548222..9fde0f31ac 100644 --- a/src/testdir/test_breakindent.vim +++ b/src/testdir/test_breakindent.vim @@ -424,7 +424,7 @@ func Test_breakindent12() \ "~ ", \ ] call s:compare_lines(expect, lines) - call s:close_windows('set nuw=4 listchars=') + call s:close_windows('set nuw=4 listchars&') endfunc func Test_breakindent12_vartabs() @@ -439,7 +439,7 @@ func Test_breakindent12_vartabs() \ "~ ", \ ] call s:compare_lines(expect, lines) - call s:close_windows('set nuw=4 listchars= vts&') + call s:close_windows('set nuw=4 listchars& vts&') endfunc func Test_breakindent13() @@ -1086,5 +1086,51 @@ func Test_linebreak_list() bwipe! endfunc +func Test_breakindent_change_display_uhex() + call s:test_windows('setl briopt=min:0 list listchars=eol:$') + redraw! + let lines = s:screen_lines(line('.'), 20) + let expect = [ + \ "^Iabcdefghijklmnopqr", + \ " stuvwxyzABCDEFGHIJ", + \ " KLMNOP$ " + \ ] + call s:compare_lines(expect, lines) + set display+=uhex + redraw! + let lines = s:screen_lines(line('.'), 20) + let expect = [ + \ "<09>abcdefghijklmnop", + \ " qrstuvwxyzABCDEF", + \ " GHIJKLMNOP$ " + \ ] + call s:compare_lines(expect, lines) + set display& + + call s:close_windows() +endfunc + +func Test_breakindent_list_split() + 10new + 61vsplit + setlocal tabstop=8 breakindent list listchars=tab:<->,eol:$ + put =s:input + 30vsplit + setlocal listchars=eol:$ + let expect = [ + \ "^IabcdefghijklmnopqrstuvwxyzAB|<------>abcdefghijklmnopqrstuv", + \ " CDEFGHIJKLMNOP$ | wxyzABCDEFGHIJKLMNOP$ ", + \ "~ |~ " + \ ] + redraw! + let lines = s:screen_lines(line('.'), 61) + call s:compare_lines(expect, lines) + wincmd p + redraw! + let lines = s:screen_lines(line('.'), 61) + call s:compare_lines(expect, lines) + + bwipe! +endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index dbbb913051..98cb8bc9bb 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 97, /**/ 96, /**/ From 0d3c0a66a39570cbc52b9536604c39e324b989b3 Mon Sep 17 00:00:00 2001 From: glepnir Date: Sun, 11 Feb 2024 17:52:40 +0100 Subject: [PATCH 030/426] patch 9.1.0098: CompletionChanged not triggered when new leader added without matches Problem: CompletionChanged not triggered when new leader added causing no matching item in the completion menu Solution: When completion is active but no items matched still trigger CompletChanged event (glepnir) closes: #13982 Signed-off-by: glepnir Signed-off-by: Christian Brabandt --- src/insexpand.c | 6 ++++++ src/testdir/test_popup.vim | 6 ++++++ src/version.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/insexpand.c b/src/insexpand.c index d712181bcd..68e970a71a 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -1350,7 +1350,13 @@ ins_compl_show_pum(void) } if (compl_match_array == NULL) + { +#ifdef FEAT_EVAL + if (compl_started && has_completechanged()) + trigger_complete_changed_event(cur); +#endif return; + } // In Replace mode when a $ is displayed at the end of the line only // part of the screen would be updated. We do need to redraw here. diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim index 879d1fa3e5..f5cb8b2a19 100644 --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -1139,6 +1139,10 @@ func Test_CompleteChanged() let g:event = copy(v:event) let g:item = get(v:event, 'completed_item', {}) let g:word = get(g:item, 'word', v:null) + let l:line = getline('.') + if g:word == v:null && l:line == "bc" + let g:word = l:line + endif endfunction augroup AAAAA_Group au! @@ -1158,6 +1162,8 @@ func Test_CompleteChanged() call assert_equal(v:null, g:word) call feedkeys("a\\\\\", 'tx') call assert_equal('foobar', g:word) + call feedkeys("S\bc", 'tx') + call assert_equal("bc", g:word) func Omni_test(findstart, base) if a:findstart diff --git a/src/version.c b/src/version.c index 98cb8bc9bb..7fd6982f3f 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 98, /**/ 97, /**/ From 6d91227267a5f7e21fc9b30443687618e92751bf Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sun, 11 Feb 2024 18:19:45 +0100 Subject: [PATCH 031/426] runtime(gpg): Mark dangerous use-embedded-filename with WarningMsg The syntax highlighter is likely to encourage people to use the listed commands. But `use-embedded-filename` is a dangerous option that can cause GnuPG to write arbitrary data to arbitrary files whenever GnuPG encounters malicious data. GnuPG upstream explicitly warns against using this option: https://dev.gnupg.org/T4500 https://dev.gnupg.org/T6972 However, since this is a valid option, we cannot just drop it from the syntax script. Instead, let's mark it with the WarningMsg highlighting to make it obvious, that this option is different (and should not be used for security reasons). closes: #13961 Co-authored-by: Daniel Kahn Gillmor Signed-off-by: Christian Brabandt --- runtime/syntax/gpg.vim | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/runtime/syntax/gpg.vim b/runtime/syntax/gpg.vim index c7f3584ff0..2728ecfccd 100644 --- a/runtime/syntax/gpg.vim +++ b/runtime/syntax/gpg.vim @@ -1,9 +1,13 @@ " Vim syntax file " Language: gpg(1) configuration file +" Maintainer: This file is looking for a maintainer! " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2010-10-14 -" Updated: 2023-01-23 @ObserverOfTime: added a couple of keywords +" Latest Revision: 2024-02-11 +" Updated: +" 2023-01-23 @ObserverOfTime: added a couple of keywords " 2023-03-21 Todd Zullinger : sync with gnupg-2.4.0 +" 2024-02-10 Daniel Kahn Gillmor : +" mark use-embedded-filename as warning for security reasons if exists("b:current_syntax") finish @@ -21,7 +25,7 @@ syn region gpgComment contained display oneline start='#' end='$' syn match gpgID contained display '\<\(0x\)\=\x\{8,}\>' -syn match gpgBegin display '^' skipwhite nextgroup=gpgComment,gpgOption,gpgCommand +syn match gpgBegin display '^' skipwhite nextgroup=gpgComment,gpgOption,gpgOptionDeprecated,gpgCommand syn keyword gpgCommand contained skipwhite nextgroup=gpgArg \ change-passphrase check-sig check-signatures @@ -41,6 +45,7 @@ syn keyword gpgCommand contained skipwhite nextgroup=gpgArg \ quick-set-expire quick-set-primary-uid quick-sign-key \ quick-update-pref receive-keys recv-keys refresh-keys \ search-keys show-key show-keys sign-key tofu-policy + syn keyword gpgCommand contained skipwhite nextgroup=gpgArgError \ card-edit card-status change-pin check-trustdb \ clear-sign clearsign dearmor dearmour decrypt @@ -97,6 +102,7 @@ syn keyword gpgOption contained skipwhite nextgroup=gpgArg \ trusted-key trust-model try-secret-key ttyname \ ttytype ungroup user verify-options weak-digest \ xauthority + syn keyword gpgOption contained skipwhite nextgroup=gpgArgError \ allow-freeform-uid allow-multiple-messages \ allow-multisig-verification allow-non-selfsigned-uid @@ -145,7 +151,7 @@ syn keyword gpgOption contained skipwhite nextgroup=gpgArgError \ no-sk-comments no-skip-hidden-recipients \ no-symkey-cache not-dash-escaped no-textmode \ no-throw-keyids no-tty no-use-agent - \ no-use-embedded-filename no-utf8-strings no-verbose + \ no-utf8-strings no-verbose \ no-version only-sign-text-ids openpgp \ override-compliance-check pgp6 pgp7 pgp8 \ preserve-permissions print-dane-records quiet @@ -155,7 +161,7 @@ syn keyword gpgOption contained skipwhite nextgroup=gpgArgError \ show-notation show-photos show-policy-url \ show-session-key sk-comments skip-hidden-recipients \ skip-verify textmode throw-keyids try-all-secrets - \ unwrap use-agent use-embedded-filename use-keyboxd + \ unwrap use-agent use-keyboxd \ use-only-openpgp-card utf8-strings verbose version \ warranty with-colons with-fingerprint \ with-icao-spelling with-key-data with-keygrip @@ -164,6 +170,10 @@ syn keyword gpgOption contained skipwhite nextgroup=gpgArgError \ with-subkey-fingerprints with-tofu-info with-wkd-hash \ yes +" depcrated for security reasons +syn keyword gpgOptionDeprecated contained skipwhite nextgroup=gpgArgError + \ use-embedded-filename no-use-embedded-filename + syn match gpgArg contained display '\S\+\(\s\+\S\+\)*' contains=gpgID syn match gpgArgError contained display '\S\+\(\s\+\S\+\)*' @@ -171,6 +181,7 @@ hi def link gpgComment Comment hi def link gpgTodo Todo hi def link gpgID Number hi def link gpgOption Keyword +hi def link gpgOptionDeprecated WarningMsg hi def link gpgCommand Error hi def link gpgArgError Error From a0010a186d93187d2b69b857d75db8a1e01049bb Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Mon, 12 Feb 2024 20:21:26 +0100 Subject: [PATCH 032/426] patch 9.1.0099: Not able to use diff() with 'diffexpr' Problem: Not able to use diff() with 'diffexpr' (rickhowe, after v9.1.0096) Solution: Use a default context length of 0, update diff() help text, add a test for using diff() with 'diffexpr' (Yegappan Lakshmanan) closes: #14013 Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 9 ++- runtime/doc/diff.txt | 7 +- src/diff.c | 4 +- src/evalfunc.c | 2 +- .../dumps/Test_difffunc_diffexpr_1.dump | 12 ++++ src/testdir/test_diffmode.vim | 65 ++++++++++++++----- src/version.c | 2 + 7 files changed, 77 insertions(+), 24 deletions(-) create mode 100644 src/testdir/dumps/Test_difffunc_diffexpr_1.dump diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 0dca4679e9..0b3d59e966 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 11 +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2078,8 +2078,7 @@ diff({fromlist}, {tolist} [, {options}]) *diff()* use. Supported boolean items are "myers", "minimal", "patience" and "histogram". - context unified diff context length. Default - is 1. + context diff context length. Default is 0. iblank ignore changes where lines are all blank. icase ignore changes in case of text. @@ -2092,6 +2091,10 @@ diff({fromlist}, {tolist} [, {options}]) *diff()* line. For more information about these options, refer to 'diffopt'. + To compute the unified diff, all the items in {fromlist} are + concatenated into a string using a newline separator and the + same for {tolist}. The unified diff output uses line numbers. + Returns an empty List or String if {fromlist} and {tolist} are identical. diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 05dd4a6be9..e3abbdeff5 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -510,9 +510,14 @@ between two Lists of strings are below. [{'from_idx': 1, 'from_count': 2, 'to_idx': 1, 'to_count': 0}] " disjointed changes - :echo diff(['ab', 'def', 'ghi', 'jkl'], ['abc', 'def', 'ghi', 'jk'], {'output': 'indices'}) + :echo diff(['ab', 'def', 'ghi', 'jkl'], ['abc', 'def', 'ghi', 'jk'], {'output': 'indices', 'context': 0}) [{'from_idx': 0, 'from_count': 1, 'to_idx': 0, 'to_count': 1}, {'from_idx': 3, 'from_count': 1, 'to_idx': 3, 'to_count': 1}] + + " disjointed changes with context length 1 + :echo diff(['ab', 'def', 'ghi', 'jkl'], ['abc', 'def', 'ghi', 'jk'], {'output': 'indices', 'context': 1}) + [{'from_idx': 0, 'from_count': 4, 'to_idx': 0, 'to_count': 4}] + < vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/src/diff.c b/src/diff.c index a4f3f7e072..d2089dc15e 100644 --- a/src/diff.c +++ b/src/diff.c @@ -3511,9 +3511,9 @@ parse_diff_optarg( } } - *diff_ctxlen = dict_get_number_def(d, "context", 1); + *diff_ctxlen = dict_get_number_def(d, "context", 0); if (*diff_ctxlen < 0) - *diff_ctxlen = 1; + *diff_ctxlen = 0; if (dict_get_bool(d, "iblank", FALSE)) *diffopts |= DIFF_IBLANK; diff --git a/src/evalfunc.c b/src/evalfunc.c index 67a14272b1..d13eb1c9f5 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1952,7 +1952,7 @@ static funcentry_T global_functions[] = {"did_filetype", 0, 0, 0, NULL, ret_number_bool, f_did_filetype}, {"diff", 2, 3, FEARG_1, arg3_diff, - ret_list_dict_any, f_diff}, + ret_any, f_diff}, {"diff_filler", 1, 1, FEARG_1, arg1_lnum, ret_number, f_diff_filler}, {"diff_hlID", 2, 2, FEARG_1, arg2_lnum_number, diff --git a/src/testdir/dumps/Test_difffunc_diffexpr_1.dump b/src/testdir/dumps/Test_difffunc_diffexpr_1.dump new file mode 100644 index 0000000000..b103cc8d29 --- /dev/null +++ b/src/testdir/dumps/Test_difffunc_diffexpr_1.dump @@ -0,0 +1,12 @@ +| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|z+0#0000000#5fd7ff255|e|r|o| @30 +| +0#0000e05#a8a8a8255@1>o+0#0000000#ffffff0|n|e| @31||+1&&| +0#0000e05#a8a8a8255@1|o+0#0000000#ffffff0|n|e| @31 +| +0#0000e05#a8a8a8255@1|t+0#0000000#ffd7ff255|w|o|x+2&#ff404010| +0&#ffd7ff255@30||+1&#ffffff0| +0#0000e05#a8a8a8255@1|t+0#0000000#ffd7ff255|w|o| @31 +| +0#0000e05#a8a8a8255@1|t+0#0000000#ffffff0|h|r|e@1| @29||+1&&| +0#0000e05#a8a8a8255@1|t+0#0000000#ffffff0|h|r|e@1| @29 +| +0#0000e05#a8a8a8255@1|f+0#0000000#5fd7ff255|o|u|r| @30||+1&#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34 +|~+0&#ffffff0| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|~| @35||+1#0000000&|~+0#4040ff13&| @35 +|X+3#0000000&|d|i|f@2|u|n|c|2|.|t|x|t| @4|1|,|1| @11|A|l@1| |X+1&&|d|i|f@2|u|n|c|1|.|t|x|t| @4|1|,|1| @11|A|l@1 +|"+0&&|X|d|i|f@2|u|n|c|2|.|t|x|t|"| |4|L|,| |2|0|B| @50 diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim index d37a9a28a5..8e7d5ce312 100644 --- a/src/testdir/test_diffmode.vim +++ b/src/testdir/test_diffmode.vim @@ -1719,43 +1719,43 @@ endfunc " Test for the diff() function def Test_diff_func() # string is added/removed/modified at the beginning - assert_equal("@@ -1 +1,2 @@\n+abc\n def\n", + assert_equal("@@ -0,0 +1 @@\n+abc\n", diff(['def'], ['abc', 'def'], {output: 'unified'})) assert_equal([{from_idx: 0, from_count: 0, to_idx: 0, to_count: 1}], diff(['def'], ['abc', 'def'], {output: 'indices'})) - assert_equal("@@ -1,2 +1 @@\n-abc\n def\n", + assert_equal("@@ -1 +0,0 @@\n-abc\n", diff(['abc', 'def'], ['def'], {output: 'unified'})) assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 0}], diff(['abc', 'def'], ['def'], {output: 'indices'})) - assert_equal("@@ -1,2 +1,2 @@\n-abc\n+abx\n def\n", + assert_equal("@@ -1 +1 @@\n-abc\n+abx\n", diff(['abc', 'def'], ['abx', 'def'], {output: 'unified'})) assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}], diff(['abc', 'def'], ['abx', 'def'], {output: 'indices'})) # string is added/removed/modified at the end - assert_equal("@@ -1 +1,2 @@\n abc\n+def\n", + assert_equal("@@ -1,0 +2 @@\n+def\n", diff(['abc'], ['abc', 'def'], {output: 'unified'})) assert_equal([{from_idx: 1, from_count: 0, to_idx: 1, to_count: 1}], diff(['abc'], ['abc', 'def'], {output: 'indices'})) - assert_equal("@@ -1,2 +1 @@\n abc\n-def\n", + assert_equal("@@ -2 +1,0 @@\n-def\n", diff(['abc', 'def'], ['abc'], {output: 'unified'})) assert_equal([{from_idx: 1, from_count: 1, to_idx: 1, to_count: 0}], diff(['abc', 'def'], ['abc'], {output: 'indices'})) - assert_equal("@@ -1,2 +1,2 @@\n abc\n-def\n+xef\n", + assert_equal("@@ -2 +2 @@\n-def\n+xef\n", diff(['abc', 'def'], ['abc', 'xef'], {output: 'unified'})) assert_equal([{from_idx: 1, from_count: 1, to_idx: 1, to_count: 1}], diff(['abc', 'def'], ['abc', 'xef'], {output: 'indices'})) # string is added/removed/modified in the middle - assert_equal("@@ -2,2 +2,3 @@\n 222\n+xxx\n 333\n", + assert_equal("@@ -2,0 +3 @@\n+xxx\n", diff(['111', '222', '333'], ['111', '222', 'xxx', '333'], {output: 'unified'})) assert_equal([{from_idx: 2, from_count: 0, to_idx: 2, to_count: 1}], diff(['111', '222', '333'], ['111', '222', 'xxx', '333'], {output: 'indices'})) - assert_equal("@@ -2,3 +2,2 @@\n 222\n-333\n 444\n", + assert_equal("@@ -3 +2,0 @@\n-333\n", diff(['111', '222', '333', '444'], ['111', '222', '444'], {output: 'unified'})) assert_equal([{from_idx: 2, from_count: 1, to_idx: 2, to_count: 0}], diff(['111', '222', '333', '444'], ['111', '222', '444'], {output: 'indices'})) - assert_equal("@@ -2,3 +2,3 @@\n 222\n-333\n+xxx\n 444\n", + assert_equal("@@ -3 +3 @@\n-333\n+xxx\n", diff(['111', '222', '333', '444'], ['111', '222', 'xxx', '444'], {output: 'unified'})) assert_equal([{from_idx: 2, from_count: 1, to_idx: 2, to_count: 1}], diff(['111', '222', '333', '444'], ['111', '222', 'xxx', '444'], {output: 'indices'})) @@ -1795,10 +1795,12 @@ def Test_diff_func() diff(['abcd'], ['abc'], {output: 'unified'})) assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}], diff(['abcd'], ['abc'], {output: 'indices'})) - assert_equal("@@ -1 +1 @@\n-abc\n+abx\n", - diff(['abc'], ['abx'], {output: 'unified'})) + var diff_unified: string = diff(['abc'], ['abx'], {output: 'unified'}) + assert_equal("@@ -1 +1 @@\n-abc\n+abx\n", diff_unified) + var diff_indices: list> = + diff(['abc'], ['abx'], {output: 'indices'}) assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}], - diff(['abc'], ['abx'], {output: 'indices'})) + diff_indices) # partial string modification at the start and at the end. var fromlist =<< trim END @@ -1825,17 +1827,18 @@ def Test_diff_func() three four five six END - assert_equal("@@ -1,3 +1,3 @@\n-one two\n+one abc two\n three four\n-five abc six\n+five six\n", + assert_equal("@@ -1 +1 @@\n-one two\n+one abc two\n@@ -3 +3 @@\n-five abc six\n+five six\n", diff(fromlist, tolist, {output: 'unified'})) - assert_equal([{from_idx: 0, from_count: 3, to_idx: 0, to_count: 3}], + assert_equal([{'from_count': 1, 'to_idx': 0, 'to_count': 1, 'from_idx': 0}, + {'from_count': 1, 'to_idx': 2, 'to_count': 1, 'from_idx': 2}], diff(fromlist, tolist, {output: 'indices'})) # add/remove blank lines - assert_equal("@@ -1,4 +1,2 @@\n one\n-\n-\n two\n", + assert_equal("@@ -2,2 +1,0 @@\n-\n-\n", diff(['one', '', '', 'two'], ['one', 'two'], {output: 'unified'})) assert_equal([{from_idx: 1, from_count: 2, to_idx: 1, to_count: 0}], diff(['one', '', '', 'two'], ['one', 'two'], {output: 'indices'})) - assert_equal("@@ -1,2 +1,4 @@\n one\n+\n+\n two\n", + assert_equal("@@ -1,0 +2,2 @@\n+\n+\n", diff(['one', 'two'], ['one', '', '', 'two'], {output: 'unified'})) assert_equal([{'from_idx': 1, 'from_count': 0, 'to_idx': 1, 'to_count': 2}], diff(['one', 'two'], ['one', '', '', 'two'], {output: 'indices'})) @@ -1911,7 +1914,7 @@ def Test_diff_func() diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 3})) assert_equal("@@ -1,3 +1,4 @@\n+x\n a\n b\n c\n", diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 4})) - assert_equal("@@ -1 +1,2 @@\n+x\n a\n", + assert_equal("@@ -0,0 +1 @@\n+x\n", diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: -1})) # Error cases @@ -1922,4 +1925,32 @@ def Test_diff_func() assert_fails('call diff(["a"], ["a"], {context: []})', 'E745: Using a List as a Number') enddef +" Test for using the diff() function with 'diffexpr' +func Test_diffexpr_with_diff_func() + CheckScreendump + + let lines =<< trim END + def DiffFuncExpr() + var in: list = readfile(v:fname_in) + var new: list = readfile(v:fname_new) + var out: string = diff(in, new) + writefile(split(out, "\n"), v:fname_out) + enddef + set diffexpr=DiffFuncExpr() + + edit Xdifffunc1.txt + diffthis + vert split Xdifffunc2.txt + diffthis + END + call writefile(lines, 'XsetupDiffFunc.vim', 'D') + + call writefile(['zero', 'one', 'two', 'three'], 'Xdifffunc1.txt', 'D') + call writefile(['one', 'twox', 'three', 'four'], 'Xdifffunc2.txt', 'D') + + let buf = RunVimInTerminal('-S XsetupDiffFunc.vim', {'rows': 12}) + call VerifyScreenDump(buf, 'Test_difffunc_diffexpr_1', {}) + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 7fd6982f3f..7a9172a667 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 99, /**/ 98, /**/ From f2d90a351159fd6843f450850f52004f42e00183 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Feb 2024 20:28:01 +0100 Subject: [PATCH 033/426] patch 9.1.0100: Redrawing can be improved with undo and 'spell' Problem: When undoing with 'spell', redrawWinline() is called after changed_lines(), while later win_update() sets redraw type to UPD_NOT_VALID, even though w_redraw_top and w_redraw_bot are still valid. Solution: Only set redraw type to UPD_NOT_VALID when inserting/deleting lines after parts of window has pending redraw, i.e., when changed_lines() is called after redrawWinline(). (zeertzjq) closes: #14019 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/change.c | 6 ++++++ src/drawscreen.c | 10 +--------- src/popupwin.c | 4 ++-- src/version.c | 2 ++ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/change.c b/src/change.c index 0ea424f989..42e6f7939c 100644 --- a/src/change.c +++ b/src/change.c @@ -559,6 +559,12 @@ changed_common( if (!redraw_not_allowed && wp->w_redr_type < UPD_VALID) wp->w_redr_type = UPD_VALID; + // When inserting/deleting lines and the window has specific lines + // to be redrawn, w_redraw_top and w_redraw_bot may now be invalid, + // so just redraw everything. + if (xtra != 0 && wp->w_redraw_top != 0) + redraw_win_later(wp, UPD_NOT_VALID); + // Reset "w_skipcol" if the topline length has become smaller to // such a degree that nothing will be visible anymore, accounting // for 'smoothscroll' <<< or 'listchars' "precedes" marker. diff --git a/src/drawscreen.c b/src/drawscreen.c index d1773701da..852d331826 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -1408,7 +1408,7 @@ fold_line( * - if wp->w_buffer->b_mod_set set, update lines between * b_mod_top and b_mod_bot. * - if wp->w_redraw_top non-zero, redraw lines between - * wp->w_redraw_top and wp->w_redr_bot. + * wp->w_redraw_top and wp->w_redraw_bot. * - continue redrawing when syntax status is invalid. * 4. if scrolled up, update lines at the bottom. * This results in three areas that may need updating: @@ -1567,14 +1567,6 @@ win_update(win_T *wp) else #endif - if (buf->b_mod_set && buf->b_mod_xlines != 0 && wp->w_redraw_top != 0) - { - // When there are both inserted/deleted lines and specific lines to be - // redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw - // everything (only happens when redrawing is off for while). - type = UPD_NOT_VALID; - } - else { // Set mod_top to the first line that needs displaying because of // changes. Set mod_bot to the first line after the changes. diff --git a/src/popupwin.c b/src/popupwin.c index 64bb0b5be8..bdf4ac7cfd 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -3899,8 +3899,8 @@ may_update_popup_mask(int type) // The screen position "line" / "col" needs to be // redrawn. Figure out what window that is and update - // w_redraw_top and w_redr_bot. Only needs to be done - // once for each window line. + // w_redraw_top and w_redraw_bot. Only needs to be + // done once for each window line. wp = mouse_find_win(&line_cp, &col_cp, IGNORE_POPUP); if (wp != NULL) { diff --git a/src/version.c b/src/version.c index 7a9172a667..602a2f96a8 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 100, /**/ 99, /**/ From bd1232a1faf56b614a1e74c4ce51bc6e0650ae00 Mon Sep 17 00:00:00 2001 From: glepnir Date: Mon, 12 Feb 2024 22:14:53 +0100 Subject: [PATCH 034/426] patch 9.1.0101: upper-case of German sharp s should be U+1E9E MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: upper-case of ß should be U+1E9E (CAPITAL LETTER SHARP S) (fenuks) Solution: Make gU, ~ and g~ convert the U+00DF LATIN SMALL LETTER SHARP S (ß) to U+1E9E LATIN CAPITAL LETTER SHARP S (ẞ), update tests (glepnir) This is part of Unicode 5.1.0 from April 2008, so should be fairly safe to use now and since 2017 is part of the German standard orthography, according to Wikipedia: https://en.wikipedia.org/wiki/Capital_%E1%BA%9E#cite_note-auto-12 There is however one exception: UnicodeData.txt for U+00DF LATIN SMALL LETTER SHARP S does NOT define U+1E9E LATIN CAPITAL LETTER SHARP S as its upper case version. Therefore, toupper() won't be able to convert from lower sharp s to upper case sharp s (the other way around however works, since U+00DF is considered the lower case character of U+1E9E and therefore tolower() works correctly for the upper case version). fixes: #5573 closes: #14018 Signed-off-by: glepnir Signed-off-by: Christian Brabandt --- src/mbyte.c | 2 ++ src/ops.c | 13 +++++----- src/testdir/test_normal.vim | 14 +++++------ src/testdir/test_utf8_comparisons.vim | 35 +++++++++++++++++++++++++++ src/testdir/test_visual.vim | 6 ++--- src/version.c | 2 ++ 6 files changed, 56 insertions(+), 16 deletions(-) diff --git a/src/mbyte.c b/src/mbyte.c index 2d18a2796a..0427f0ce3c 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -3454,6 +3454,8 @@ static convertStruct toLower[] = {0x1e900,0x1e921,1,34} }; +// Note: UnicodeData.txt does not define U+1E9E as being the corresponding upper +// case letter for U+00DF (ß), however it is part of the toLower table static convertStruct toUpper[] = { {0x61,0x7a,1,-32}, diff --git a/src/ops.c b/src/ops.c index f6d765bd71..3fefbc8a40 100644 --- a/src/ops.c +++ b/src/ops.c @@ -1431,18 +1431,19 @@ swapchar(int op_type, pos_T *pos) if (c >= 0x80 && op_type == OP_ROT13) return FALSE; - if (op_type == OP_UPPER && c == 0xdf - && (enc_latin1like || STRCMP(p_enc, "iso-8859-2") == 0)) + // ~ is OP_NOP, g~ is OP_TILDE, gU is OP_UPPER + if ((op_type == OP_UPPER || op_type == OP_NOP || op_type == OP_TILDE) + && c == 0xdf + && (enc_latin1like || STRCMP(p_enc, "iso-8859-2") == 0)) { pos_T sp = curwin->w_cursor; - // Special handling of German sharp s: change to "SS". + // Special handling for lowercase German sharp s (ß): convert to uppercase (ẞ). curwin->w_cursor = *pos; del_char(FALSE); - ins_char('S'); - ins_char('S'); + ins_char(0x1E9E); curwin->w_cursor = sp; - inc(pos); + return TRUE; } if (enc_dbcs != 0 && c >= 0x100) // No lower/uppercase letter diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim index fb9c3ded53..dc68a158a1 100644 --- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -2347,19 +2347,19 @@ func Test_normal30_changecase() norm! 1ggVu call assert_equal('this is a simple test: äüöß', getline('.')) norm! VU - call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖSS', getline('.')) + call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖẞ', getline('.')) norm! guu - call assert_equal('this is a simple test: äüöss', getline('.')) + call assert_equal('this is a simple test: äüöß', getline('.')) norm! gUgU - call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖSS', getline('.')) + call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖẞ', getline('.')) norm! gugu - call assert_equal('this is a simple test: äüöss', getline('.')) + call assert_equal('this is a simple test: äüöß', getline('.')) norm! gUU - call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖSS', getline('.')) + call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖẞ', getline('.')) norm! 010~ - call assert_equal('this is a SIMPLE TEST: ÄÜÖSS', getline('.')) + call assert_equal('this is a SIMPLE TEST: ÄÜÖẞ', getline('.')) norm! V~ - call assert_equal('THIS IS A simple test: äüöss', getline('.')) + call assert_equal('THIS IS A simple test: äüöß', getline('.')) call assert_beeps('norm! c~') %d call assert_beeps('norm! ~') diff --git a/src/testdir/test_utf8_comparisons.vim b/src/testdir/test_utf8_comparisons.vim index 3431226ada..20b5762c9d 100644 --- a/src/testdir/test_utf8_comparisons.vim +++ b/src/testdir/test_utf8_comparisons.vim @@ -93,4 +93,39 @@ func Test_gap() call assert_equal(["ABCD", "", "defg"], getline(1,3)) endfunc +" test that g~, ~ and gU correclty upper-cases ß +func Test_uppercase_sharp_ss() + new + call setline(1, repeat(['ß'], 4)) + + call cursor(1, 1) + norm! ~ + call assert_equal('ẞ', getline(line('.'))) + norm! ~ + call assert_equal('ß', getline(line('.'))) + + call cursor(2, 1) + norm! g~l + call assert_equal('ẞ', getline(line('.'))) + norm! g~l + call assert_equal('ß', getline(line('.'))) + + call cursor(3, 1) + norm! gUl + call assert_equal('ẞ', getline(line('.'))) + norm! vgU + call assert_equal('ẞ', getline(line('.'))) + norm! vgu + call assert_equal('ß', getline(line('.'))) + norm! gul + call assert_equal('ß', getline(line('.'))) + + call cursor(4, 1) + norm! vgU + call assert_equal('ẞ', getline(line('.'))) + norm! vgu + call assert_equal('ß', getline(line('.'))) + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index f0d8edcf84..066d7ebb25 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1020,9 +1020,9 @@ func Test_visual_change_case() exe "normal Oblah di\rdoh dut\VkUj\r" " Uppercase part of two lines exe "normal ddppi333\k0i222\fyllvjfuUk" - call assert_equal(['the YOUTUSSEUU end', '- yOUSSTUSSEXu -', - \ 'THE YOUTUSSEUU END', '111THE YOUTUSSEUU END', 'BLAH DI', 'DOH DUT', - \ '222the yoUTUSSEUU END', '333THE YOUTUßeuu end'], getline(2, '$')) + call assert_equal(['the YOUTUẞEUU end', '- yOUẞTUẞEXu -', + \ 'THE YOUTUẞEUU END', '111THE YOUTUẞEUU END', 'BLAH DI', 'DOH DUT', + \ '222the yoUTUẞEUU END', '333THE YOUTUßeuu end'], getline(2, '$')) bwipe! endfunc diff --git a/src/version.c b/src/version.c index 602a2f96a8..fec82525d5 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 101, /**/ 100, /**/ From b47fbb40837512cdd2d8c25eaf9952154836b99d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Feb 2024 22:50:26 +0100 Subject: [PATCH 035/426] patch 9.1.0102: settabvar() may change the last accessed tabpage Problem: settabvar() may change the last accessed tabpage. Solution: Save and restore lastused_tabpage. (zeertzjq) closes: #14017 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/evalvars.c | 8 +++++++- src/testdir/test_tabpage.vim | 17 +++++++++++++++++ src/version.c | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/evalvars.c b/src/evalvars.c index 0a84afdaaf..856e475118 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -4843,6 +4843,7 @@ f_settabvar(typval_T *argvars, typval_T *rettv UNUSED) { tabpage_T *save_curtab; tabpage_T *tp; + tabpage_T *save_lu_tp; char_u *varname, *tabvarname; typval_T *varp; @@ -4862,6 +4863,7 @@ f_settabvar(typval_T *argvars, typval_T *rettv UNUSED) return; save_curtab = curtab; + save_lu_tp = lastused_tabpage; goto_tabpage_tp(tp, FALSE, FALSE); tabvarname = alloc(STRLEN(varname) + 3); @@ -4873,9 +4875,13 @@ f_settabvar(typval_T *argvars, typval_T *rettv UNUSED) vim_free(tabvarname); } - // Restore current tabpage + // Restore current tabpage and last accessed tabpage. if (valid_tabpage(save_curtab)) + { goto_tabpage_tp(save_curtab, FALSE, FALSE); + if (valid_tabpage(save_lu_tp)) + lastused_tabpage = save_lu_tp; + } } /* diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim index 94f695323f..a531f19334 100644 --- a/src/testdir/test_tabpage.vim +++ b/src/testdir/test_tabpage.vim @@ -993,4 +993,21 @@ func Test_tabpage_drop_tabmove() bwipe! endfunc +" Test that settabvar() shouldn't change the last accessed tabpage. +func Test_lastused_tabpage_settabvar() + tabonly! + tabnew + tabnew + tabnew + call assert_equal(3, tabpagenr('#')) + + call settabvar(2, 'myvar', 'tabval') + call assert_equal('tabval', gettabvar(2, 'myvar')) + call assert_equal(3, tabpagenr('#')) + + bwipe! + bwipe! + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index fec82525d5..e20b4270a8 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 102, /**/ 101, /**/ From f0a9d65e0a1d693cdfa964aa72de5b93b4cacdea Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Feb 2024 22:53:20 +0100 Subject: [PATCH 036/426] patch 9.1.0103: 'breakindentopt' "min" not correct with 'signcolumn' Problem: 'breakindentopt' "min" works incorrectly with 'signcolumn'. Solution: Use win_col_off() and win_col_off2(). (zeertzjq) closes: #14014 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/indent.c | 4 +--- src/testdir/test_breakindent.vim | 34 +++++++++++++++++++++++++++++++- src/testdir/test_diffmode.vim | 2 +- src/version.c | 2 ++ 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/indent.c b/src/indent.c index 34d31579bd..1087bad3ee 100644 --- a/src/indent.c +++ b/src/indent.c @@ -935,9 +935,7 @@ get_breakindent_win( int bri = 0; // window width minus window margin space, i.e. what rests for text const int eff_wwidth = wp->w_width - - ((wp->w_p_nu || wp->w_p_rnu) - && (vim_strchr(p_cpo, CPO_NUMCOL) == NULL) - ? number_width(wp) + 1 : 0); + - win_col_off(wp) + win_col_off2(wp); // In list mode, if 'listchars' "tab" isn't set, a TAB is displayed as ^I. int no_ts = wp->w_p_list && wp->w_lcs_chars.tab1 == NUL; diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim index 9fde0f31ac..96d91c949c 100644 --- a/src/testdir/test_breakindent.vim +++ b/src/testdir/test_breakindent.vim @@ -733,7 +733,7 @@ func Test_breakindent20_list() \ "shall make no law ", \ ] call s:compare_lines(expect, lines) - " set minimum indent + " set minimum text width setl briopt=min:5 redraw! let lines = s:screen_lines2(1, 6, 20) @@ -1133,4 +1133,36 @@ func Test_breakindent_list_split() bwipe! endfunc +func Test_breakindent_min_with_signcol() + call s:test_windows('setl briopt=min:15 signcolumn=yes') + redraw! + let expect = [ + \ " abcdefghijklmn", + \ " opqrstuvwxyzABC", + \ " DEFGHIJKLMNOP " + \ ] + let lines = s:screen_lines(line('.'), 20) + call s:compare_lines(expect, lines) + setl briopt=min:17 + redraw! + let expect = [ + \ " abcdefghijklmn", + \ " opqrstuvwxyzABCDE", + \ " FGHIJKLMNOP " + \ ] + let lines = s:screen_lines(line('.'), 20) + call s:compare_lines(expect, lines) + setl briopt=min:19 + redraw! + let expect = [ + \ " abcdefghijklmn", + \ " opqrstuvwxyzABCDEF", + \ " GHIJKLMNOP " + \ ] + let lines = s:screen_lines(line('.'), 20) + call s:compare_lines(expect, lines) + + call s:close_windows() +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim index 8e7d5ce312..bae94f6a87 100644 --- a/src/testdir/test_diffmode.vim +++ b/src/testdir/test_diffmode.vim @@ -1133,7 +1133,7 @@ func Test_diff_breakindent_after_filler() CheckScreendump let lines =<< trim END - set laststatus=0 diffopt+=followwrap breakindent + set laststatus=0 diffopt+=followwrap breakindent breakindentopt=min:0 call setline(1, ['a', ' ' .. repeat('c', 50)]) vnew call setline(1, ['a', 'b', ' ' .. repeat('c', 50)]) diff --git a/src/version.c b/src/version.c index e20b4270a8..e28a326950 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 103, /**/ 102, /**/ From 2f9aef42af94f6d68f37f6e9b8cb878e88ed12bf Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Mon, 12 Feb 2024 23:12:26 +0100 Subject: [PATCH 037/426] patch 9.1.0104: Linking fails with -lto because of PERL_CFLAGS Problem: Linking fails with -lto because of PERL_CFLAGS (Zoltan Toth) Solution: Filter out -flto argument from Perl CFLAGS. fixes: #14012 Signed-off-by: Christian Brabandt --- src/auto/configure | 6 +++++- src/configure.ac | 4 +++- src/version.c | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index 70ebb33c4d..5c14648353 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -6494,10 +6494,11 @@ printf "%s\n" "$vi_cv_perl_xsubpp" >&6; } fi - perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ + perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//' \ -e 's/-fdebug-prefix-map[^ ]*//g' \ -e 's/-pipe //' \ + -e 's/-flto\(=auto\)\? //' \ -e 's/-W[^ ]*//g' \ -e 's/-D_FORTIFY_SOURCE=.//g'` perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \ @@ -10402,9 +10403,12 @@ system ("touch conf.gtktest"); tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); + g_free(tmp_version); exit(1); } +g_free(tmp_version); + if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && diff --git a/src/configure.ac b/src/configure.ac index ebe0d08f6e..664f219405 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -1163,11 +1163,13 @@ if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then dnl Remove "-fno-something", it breaks using cproto. dnl Remove "-fdebug-prefix-map", it isn't supported by clang. dnl Remove "FORTIFY_SOURCE", it will be defined twice. - dnl remove -pipe and -Wxxx, it confuses cproto + dnl Remove -pipe and -Wxxx, it confuses cproto + dnl Remove -flto[=auto], it causes link failures for clang perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \ -e 's/-fdebug-prefix-map[[^ ]]*//g' \ -e 's/-pipe //' \ + -e 's/-flto\(=auto\)\? //' \ -e 's/-W[[^ ]]*//g' \ -e 's/-D_FORTIFY_SOURCE=.//g'` dnl Remove "-lc", it breaks on FreeBSD when using "-pthread". diff --git a/src/version.c b/src/version.c index e28a326950..17a789948a 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 104, /**/ 103, /**/ From e71022082d6a8bd8ec3d7b9dadf3f9ce46ef339c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 13 Feb 2024 20:32:04 +0100 Subject: [PATCH 038/426] patch 9.1.0105: Style: typos found Problem: Style: typos found Solution: correct them (zeertzjq) closes: #14023 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/regexp.c | 3 +-- src/testdir/test_mapping.vim | 2 +- src/testdir/test_utf8_comparisons.vim | 2 +- src/testdir/test_vim9_class.vim | 4 ++-- src/testdir/test_vim9_typealias.vim | 4 ++-- src/testdir/test_visual.vim | 2 +- src/version.c | 2 ++ 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/regexp.c b/src/regexp.c index 73552015e9..4373ae0cfa 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -1318,8 +1318,7 @@ reg_match_visual(void) top = curbuf->b_visual.vi_end; bot = curbuf->b_visual.vi_start; } - // a substitue command may have - // removed some lines + // a substitute command may have removed some lines if (bot.lnum > curbuf->b_ml.ml_line_count) bot.lnum = curbuf->b_ml.ml_line_count; mode = curbuf->b_visual.vi_mode; diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim index e361f3e65d..71d90468ba 100644 --- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -120,7 +120,7 @@ func Test_map_langmap() unmap x bwipe! - " 'langnoremap' follows 'langremap' and vise versa + " 'langnoremap' follows 'langremap' and vice versa set langremap set langnoremap call assert_equal(0, &langremap) diff --git a/src/testdir/test_utf8_comparisons.vim b/src/testdir/test_utf8_comparisons.vim index 20b5762c9d..2c1972b087 100644 --- a/src/testdir/test_utf8_comparisons.vim +++ b/src/testdir/test_utf8_comparisons.vim @@ -93,7 +93,7 @@ func Test_gap() call assert_equal(["ABCD", "", "defg"], getline(1,3)) endfunc -" test that g~, ~ and gU correclty upper-cases ß +" test that g~, ~ and gU correctly upper-cases ß func Test_uppercase_sharp_ss() new call setline(1, repeat(['ß'], 4)) diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index 62a6d043d9..0bf7e9ceb6 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -67,7 +67,7 @@ def Test_class_basic() END v9.CheckSourceFailure(lines, "E488: Trailing characters: | echo 'done'", 3) - # Use old "this." prefixed member variable declaration syntax (without intialization) + # Use old "this." prefixed member variable declaration syntax (without initialization) lines =<< trim END vim9script class Something @@ -76,7 +76,7 @@ def Test_class_basic() END v9.CheckSourceFailure(lines, 'E1318: Not a valid command in a class: this.count: number', 3) - # Use old "this." prefixed member variable declaration syntax (with intialization) + # Use old "this." prefixed member variable declaration syntax (with initialization) lines =<< trim END vim9script class Something diff --git a/src/testdir/test_vim9_typealias.vim b/src/testdir/test_vim9_typealias.vim index 41557445cd..998079cf6f 100644 --- a/src/testdir/test_vim9_typealias.vim +++ b/src/testdir/test_vim9_typealias.vim @@ -641,7 +641,7 @@ def Test_type_as_func_argument_or_return_value() END v9.CheckScriptFailure(lines, 'E1407: Cannot use a Typealias as a variable or value', 1) - # check defered function using typealias as arg + # check deferred function using typealias as arg lines =<< trim END vim9script type A = number @@ -764,7 +764,7 @@ def Test_class_as_func_argument_or_return_value() END v9.CheckScriptFailure(lines, 'E1405: Class "C" cannot be used as a value', 1) - # check defered function using class typealias as arg + # check deferred function using class typealias as arg lines =<< trim END vim9script class C diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 066d7ebb25..17f0fd0687 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1008,7 +1008,7 @@ endfunc " Test for changing case func Test_visual_change_case() new - " gUe must uppercase a whole word, also when ß changes to SS + " gUe must uppercase a whole word, also when ß changes to ẞ exe "normal Gothe youtußeuu end\Ypk0wgUe\r" " gUfx must uppercase until x, inclusive. exe "normal O- youßtußexu -\0fogUfx\r" diff --git a/src/version.c b/src/version.c index 17a789948a..65b653099f 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 105, /**/ 104, /**/ From 9b53c052d58f73f2078c61a74622687306e51c17 Mon Sep 17 00:00:00 2001 From: h-east Date: Tue, 13 Feb 2024 21:09:22 +0100 Subject: [PATCH 039/426] runtime(vim): include Vim Syntax generator fixes: #13939 closes: #14021 related: vim-jp/syntax-vim-ex#28 Signed-off-by: h-east Signed-off-by: Christian Brabandt --- .gitignore | 5 + Filelist | 5 + nsis/gvim.nsi | 2 +- runtime/syntax/generator/Makefile | 44 + runtime/syntax/generator/README.md | 26 + runtime/syntax/generator/gen_syntax_vim.vim | 694 ++++++++++++ runtime/syntax/generator/update_date.vim | 14 + runtime/syntax/generator/vim.vim.base | 1110 +++++++++++++++++++ runtime/syntax/vim.vim | 152 +-- 9 files changed, 1981 insertions(+), 71 deletions(-) create mode 100644 runtime/syntax/generator/Makefile create mode 100644 runtime/syntax/generator/README.md create mode 100644 runtime/syntax/generator/gen_syntax_vim.vim create mode 100644 runtime/syntax/generator/update_date.vim create mode 100644 runtime/syntax/generator/vim.vim.base diff --git a/.gitignore b/.gitignore index 3a55d25b18..52444475ef 100644 --- a/.gitignore +++ b/.gitignore @@ -97,6 +97,11 @@ src/kword_test # Generated by "make install" runtime/doc/doctags +# Temporarily generated by "runtime/syntax/generator/make" +runtime/syntax/generator/generator.err +runtime/syntax/generator/sanity_check.err +runtime/syntax/generator/vim.vim.rc + # Generated by "make shadow". The directory names could be anything but we # restrict them to shadow (the default) or shadow-* src/shadow diff --git a/Filelist b/Filelist index 237923e879..acc9318225 100644 --- a/Filelist +++ b/Filelist @@ -827,6 +827,11 @@ RT_SCRIPTS = \ runtime/syntax/testdir/runtest.vim \ runtime/syntax/testdir/input/*.* \ runtime/syntax/testdir/dumps/*.dump \ + runtime/syntax/generator/Makefile \ + runtime/syntax/generator/README.md \ + runtime/syntax/generator/gen_syntax_vim.vim \ + runtime/syntax/generator/update_date.vim \ + runtime/syntax/generator/vim.vim.base \ # Unix runtime RT_UNIX = \ diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi index 72252527c7..cb0aef9c32 100644 --- a/nsis/gvim.nsi +++ b/nsis/gvim.nsi @@ -419,7 +419,7 @@ Section "$(str_section_exe)" id_section_exe File ${VIMSRC}\vim.ico SetOutPath $0\syntax - File /r /x testdir ${VIMRT}\syntax\*.* + File /r /x testdir /x generator ${VIMRT}\syntax\*.* SetOutPath $0\spell File ${VIMRT}\spell\*.txt diff --git a/runtime/syntax/generator/Makefile b/runtime/syntax/generator/Makefile new file mode 100644 index 0000000000..33dcfbc2b1 --- /dev/null +++ b/runtime/syntax/generator/Makefile @@ -0,0 +1,44 @@ +VIM_SRCDIR = ../../../src +RUN_VIM = $(VIM_SRCDIR)/vim -N -u NONE -i NONE -n +REVISION ?= $(shell date +%Y-%m-%dT%H:%M:%S%:z) + +SRC = $(VIM_SRCDIR)/eval.c $(VIM_SRCDIR)/ex_cmds.h $(VIM_SRCDIR)/ex_docmd.c \ + $(VIM_SRCDIR)/fileio.c $(VIM_SRCDIR)/option.c $(VIM_SRCDIR)/syntax.c + +export VIM_SRCDIR + +.PHONY: generate clean +all: generate + +generate: vim.vim + +vim.vim: vim.vim.rc update_date.vim + @echo "Generating vim.vim ..." + @cp -f vim.vim.rc ../vim.vim + @$(RUN_VIM) -S update_date.vim + @sed -i -e 's/__REVISION__/$(REVISION)/' ../vim.vim + @echo "done." + +vim.vim.rc: gen_syntax_vim.vim vim.vim.base $(SRC) + @echo "Generating vim.vim.rc ..." + @rm -f sanity_check.err generator.err + @$(RUN_VIM) -S gen_syntax_vim.vim + @if test -f sanity_check.err ; then \ + echo ; \ + echo "Sanity errors:" ; \ + cat sanity_check.err ; \ + exit 1 ; \ + fi + @if test -f generator.err ; then \ + echo ; \ + echo "Generator errors:" ; \ + cat generator.err ; \ + echo ; \ + exit 1 ; \ + fi + @echo "done." + +clean: + rm -f vim.vim.rc + rm -f vim.vim + rm -f sanity_check.err generator.err diff --git a/runtime/syntax/generator/README.md b/runtime/syntax/generator/README.md new file mode 100644 index 0000000000..83acedabe4 --- /dev/null +++ b/runtime/syntax/generator/README.md @@ -0,0 +1,26 @@ +# Generator of Vim Script Syntax File + +This directory contains a Vim Script generator, that will parse the Vim source file and +generate a vim.vim syntax file. + +Files in this directory where copied from https://github.com/vim-jp/syntax-vim-ex/ +and included here on Feb, 13th, 2024 for the Vim Project. + +- Maintainer: Hirohito Higashi +- License: Vim License + +## How to generate + + $ make + +This will generate `../vim.vim` + +## Files + +Name |Description +---------------------|------------------------------------------------------ +`Makefile` |Makefile to generate ../vim.vim +`README.md` |This file +`gen_syntax_vim.vim` |Script to generate vim.vim +`update_date.vim` |Script to update "Last Change:" +`vim.vim.base` |Template for vim.vim diff --git a/runtime/syntax/generator/gen_syntax_vim.vim b/runtime/syntax/generator/gen_syntax_vim.vim new file mode 100644 index 0000000000..85f0945524 --- /dev/null +++ b/runtime/syntax/generator/gen_syntax_vim.vim @@ -0,0 +1,694 @@ +" Vim syntax file generator +" Language: Vim script +" Maintainer: Hirohito Higashi (h_east) +" URL: https://github.com/vim-jp/syntax-vim-ex +" Last Change: Feb 11, 2024 +" Version: 2.0.0 + +let s:keepcpo= &cpo +set cpo&vim + +language C + +function! s:parse_vim_option(opt, missing_opt, term_out_code) + try + let file_name = $VIM_SRCDIR . '/optiondefs.h' + let item = {} + + new + exec 'read ' . file_name + norm! gg + exec '/^.*\s*options\[\]\s*=\s*$/+1;/^\s*#\s*define\s*p_term(/-1yank a' + exec '/^#define\s\+p_term(/+1;/^};$/-1yank b' + %delete _ + + put a + " workaround for 'shortname' + g/^#\s*ifdef\s*SHORT_FNAME\>/j + g/^#/d + g/^\s*{\s*"\w\+"\%(\s*,\s*[^,]*\)\{2}[^,]$/j + g/^\s*{\s*"\w\+"\s*,.*$/j + g!/^\s*{\s*"\w\+"\s*,.*$/d + + for line in getline(1, line('$')) + let list = matchlist(line, '^\s*{\s*"\(\w\+\)"\s*,\s*\%("\(\w\+\)"\|NULL\)\s*,\s*\%([^,]*\(P_BOOL\)[^,]*\|[^,]*\)\s*,\s*\([^,]*NULL\)\?.*') + let item.name = list[1] + let item.short_name = list[2] + let item.is_bool = empty(list[3]) ? 0 : 1 + if empty(list[4]) + call add(a:opt, copy(item)) + else + call add(a:missing_opt, copy(item)) + endif + endfor + if empty(a:opt) + throw 'opt is empty' + endif + if empty(a:missing_opt) + throw 'missing_opt is empty' + endif + + %delete _ + put b + g!/^\s*p_term(\s*"\w\+"\s*,.*$/d + + for line in getline(1, line('$')) + let list = matchlist(line, '^\s*p_term(\s*"\(\w\+\)"\s*,') + let item.name = list[1] + call add(a:term_out_code, copy(item)) + endfor + quit! + if empty(a:term_out_code) + throw 'term_out_code is empty' + endif + catch /.*/ + call s:err_gen('') + throw 'exit' + endtry +endfunc + +function! s:append_syn_vimopt(lnum, str_info, opt_list, prefix, bool_only) + let ret_lnum = a:lnum + let str = a:str_info.start + + for o in a:opt_list + if !a:bool_only || o.is_bool + if !empty(o.short_name) + let str .= ' ' . a:prefix . o.short_name + endif + let str .= ' ' . a:prefix . o.name + if len(str) > s:line_break_len + if !empty(a:str_info.end) + let str .= ' ' . a:str_info.end + endif + call append(ret_lnum, str) + let str = a:str_info.start + let ret_lnum += 1 + endif + endif + endfor + if str !=# a:str_info.start + if !empty(a:str_info.end) + let str .= ' ' . a:str_info.end + endif + call append(ret_lnum, str) + let ret_lnum += 1 + endif + return ret_lnum +endfunc + +" ------------------------------------------------------------------------------ +function! s:parse_vim_command(cmd) + try + let file_name = $VIM_SRCDIR . '/ex_cmds.h' + let item = {} + + new + exec 'read ' . file_name + norm! gg + exec '/^}\?\s*cmdnames\[\]\s*=\s*$/+1;/^};/-1yank' + %delete _ + put + g!/^EXCMD(/d + + let lcmd = {} + for key in range(char2nr('a'), char2nr('z')) + let lcmd[nr2char(key)] = [] + endfor + let lcmd['~'] = [] + + for line in getline(1, line('$')) + let list = matchlist(line, '^EXCMD(\w\+\s*,\s*"\(\a\w*\)"\s*,') + if !empty(list) + " Small ascii character or other. + let key = (list[1][:0] =~# '\l') ? list[1][:0] : '~' + call add(lcmd[key], list[1]) + endif + endfor + quit! + + for key in sort(keys(lcmd)) + for my in range(len(lcmd[key])) + let omit_idx = 0 + if my > 0 + let omit_idx = (key =~# '\l') ? 1 : 0 + for idx in range(1, strlen(lcmd[key][my])) + let spec=0 + if lcmd[key][my] ==# 'ex' + let spec=1 + echo "cmd name:" lcmd[key][my] + endif + let matched = 0 + for pre in range(my - 1, 0, -1) + if spec + echo "pre:" pre ", my:" my + endif + if pre == my + if spec + echo "continue" + endif + continue + endif + " for weird abbreviations for delete. (See :help :d) + " And k{char} is used as mark. (See :help :k) + if lcmd[key][my][:idx] ==# lcmd[key][pre][:idx] || + \ (key ==# 'd' && + \ lcmd[key][my][:idx] =~# '^d\%[elete][lp]$') + \ || (key ==# 'k' && + \ lcmd[key][my][:idx] =~# '^k[a-zA-Z]$') + let matched = 1 + let omit_idx = idx + 1 + if spec + echo "match. break. omit_idx:" omit_idx + endif + break + endif + endfor + if !matched + if spec + echo "not match. break" + endif + break + endif + endfor + endif + + let item.name = lcmd[key][my] + let item.type = s:get_vim_command_type(item.name) + if omit_idx + 1 < strlen(item.name) + let item.omit_idx = omit_idx + let item.syn_str = item.name[:omit_idx] . '[' . + \ item.name[omit_idx+1:] . ']' + else + let item.omit_idx = -1 + let item.syn_str = item.name + endif + call add(a:cmd, copy(item)) + endfor + endfor + + " Check exists in the help. (Usually it does not check...) + let doc_dir = './vim/runtime/doc' + if 0 + for vimcmd in a:cmd + let find_ptn = '^|:' . vimcmd.name . '|\s\+' + exec "silent! vimgrep /" . find_ptn . "/gj " . doc_dir . "/index.txt" + let li = getqflist() + if empty(li) + call s:err_sanity(printf('Ex-cmd `:%s` is not found in doc/index.txt.', vimcmd.name)) + elseif len(li) > 1 + call s:err_sanity(printf('Ex-cmd `:%s` is duplicated in doc/index.txt.', vimcmd.name)) + else + let doc_syn_str = substitute(li[0].text, find_ptn . '\(\S\+\)\s\+.*', '\1', '') + if doc_syn_str ==# vimcmd.syn_str + call s:err_sanity(printf('Ex-cmd `%s` short name differ in doc/index.txt. code: `%s`, document: `%s`', vimcmd.name, vimcmd.syn_str, doc_syn_str)) + endif + endif + + if 1 + for i in range(2) + if i || vimcmd.omit_idx >= 0 + if !i + let base_ptn = vimcmd.name[:vimcmd.omit_idx] + else + let base_ptn = vimcmd.name + endif + let find_ptn = '\*:' . base_ptn . '\*' + exec "silent! vimgrep /" . find_ptn . "/gj " . doc_dir . "/*.txt" + let li = getqflist() + if empty(li) + call s:err_sanity(printf('Ex-cmd `:%s`%s is not found in the help tag.', base_ptn, !i ? ' (short name of `:' . vimcmd.name . '`)' : '')) + elseif len(li) > 1 + call s:err_sanity(printf('Ex-cmd `:%s`%s is duplicated in the help tag.', base_ptn, !i ? ' (short name of `:' . vimcmd.name . '`)' : '')) + endif + endif + endfor + endif + endfor + endif + + " Add weird abbreviations for delete. (See :help :d) + for i in ['l', 'p'] + let str = 'delete' + let item.name = str . i + let item.type = s:get_vim_command_type(item.name) + let item.omit_idx = -1 + for x in range(strlen(str)) + let item.syn_str = str[:x] . i + if item.syn_str !=# "del" + call add(a:cmd, copy(item)) + endif + endfor + endfor + + " Required for original behavior + let item.name = 'a' " append + let item.type = 0 + let item.omit_idx = -1 + let item.syn_str = item.name + call add(a:cmd, copy(item)) + let item.name = 'i' " insert + call add(a:cmd, copy(item)) + + if empty(a:cmd) + throw 'cmd is empty' + endif + catch /.*/ + call s:err_gen('') + throw 'exit' + endtry +endfunc + +function! s:get_vim_command_type(cmd_name) + " Return value: + " 0: normal + " 1: (Reserved) + " 2: abbrev (without un) + " 3: menu + " 4: map + " 5: mapclear + " 6: unmap + " 99: (Exclude registration of "syn keyword") + let menu_prefix = '^\%([acinosvx]\?\|tl\)' + let map_prefix = '^[acilnostvx]\?' + let exclude_list = [ + \ 'map', + \ 'substitute', 'smagic', 'snomagic', + \ 'setlocal', 'setglobal', 'set', 'var', + \ 'autocmd', 'doautocmd', 'doautoall', + \ 'echo', 'echohl', 'execute', + \ 'behave', 'augroup', 'normal', 'syntax', + \ 'append', 'insert', + \ 'Next', 'Print', 'X', + \ ] + " Required for original behavior + " \ 'global', 'vglobal' + + if index(exclude_list, a:cmd_name) != -1 + let ret = 99 + elseif a:cmd_name =~# '^\%(abbreviate\|noreabbrev\|\l\%(nore\)\?abbrev\)$' + let ret = 2 + elseif a:cmd_name =~# menu_prefix . '\%(nore\|un\)\?menu$' + let ret = 3 + elseif a:cmd_name =~# map_prefix . '\%(nore\)\?map$' + let ret = 4 + elseif a:cmd_name =~# map_prefix . 'mapclear$' + let ret = 5 + elseif a:cmd_name =~# map_prefix . 'unmap$' + let ret = 6 + else + let ret = 0 + endif + return ret +endfunc + +function! s:append_syn_vimcmd(lnum, str_info, cmd_list, type) + let ret_lnum = a:lnum + let str = a:str_info.start + + for o in a:cmd_list + if o.type == a:type + let str .= ' ' . o.syn_str + if len(str) > s:line_break_len + if !empty(a:str_info.end) + let str .= ' ' . a:str_info.end + endif + call append(ret_lnum, str) + let str = a:str_info.start + let ret_lnum += 1 + endif + endif + endfor + if str !=# a:str_info.start + if !empty(a:str_info.end) + let str .= ' ' . a:str_info.end + endif + call append(ret_lnum, str) + let ret_lnum += 1 + endif + return ret_lnum +endfunc + +" ------------------------------------------------------------------------------ +function! s:parse_vim_event(li) + try + let file_name = $VIM_SRCDIR . '/autocmd.c' + let item = {} + + new + exec 'read ' . file_name + norm! gg + exec '/^}\s*event_names\[\]\s*=\s*$/+1;/^};/-1yank' + %delete _ + + put + g!/^\s*{\s*"\w\+"\s*,.*$/d + + for line in getline(1, line('$')) + let list = matchlist(line, '^\s*{\s*"\(\w\+\)"\s*,') + let item.name = list[1] + call add(a:li, copy(item)) + endfor + + quit! + + if empty(a:li) + throw 'event is empty' + endif + catch /.*/ + call s:err_gen('') + throw 'exit' + endtry +endfunc + +" ------------------------------------------------------------------------------ +function! s:parse_vim_function(li) + try + let file_name = $VIM_SRCDIR . '/evalfunc.c' + let item = {} + + new + exec 'read ' . file_name + norm! gg + exec '/^static\s\+funcentry_T\s\+global_functions\[\]\s*=\s*$/+1;/^};/-1yank' + %delete _ + + put + g!/^\s*{\s*"\w\+"\s*,.*$/d + g/^\s*{\s*"test"\s*,.*$/d + g@//\s*obsolete@d + g@/\*\s*obsolete\s*\*/@d + + for line in getline(1, line('$')) + let list = matchlist(line, '^\s*{\s*"\(\w\+\)"\s*,') + let item.name = list[1] + call add(a:li, copy(item)) + endfor + + quit! + + if empty(a:li) + throw 'function is empty' + endif + catch /.*/ + call s:err_gen('') + throw 'exit' + endtry +endfunc + +" ------------------------------------------------------------------------------ +function! s:parse_vim_hlgroup(li) + try + let file_name = $VIM_SRCDIR . '/highlight.c' + let item = {} + + new + exec 'read ' . file_name + call cursor(1, 1) + exec '/^static\s\+char\s\+\*(highlight_init_both\[\])\s*=\%(\s*{\)\?$/+1;/^\s*};/-1yank a' + exec '/^static\s\+char\s\+\*(highlight_init_light\[\])\s*=\%(\s*{\)\?$/+1;/^\s*};/-1yank b' + exec '/^set_normal_colors(\%(void\)\?)$/+1;/^}$/-1yank d' + %delete _ + put a + for line in getline(1, line('$')) + let list = matchlist(line, '^\s*\%(CENT(\)\?"\%(default\s\+link\s\+\)\?\(\a\+\).*",.*') + if !empty(list) + let item.name = list[1] + let item.type = 'both' + call add(a:li, copy(item)) + endif + endfor + + %delete _ + put b + for line in getline(1, line('$')) + let list = matchlist(line, '^\s*\%(CENT(\)\?"\%(default\s\+link\s\+\)\?\(\a\+\).*",.*') + if !empty(list) + let item.name = list[1] + let item.type = 'light' + call add(a:li, copy(item)) + endif + endfor + + %delete _ + put d + for line in getline(1, line('$')) + let list = matchlist(line, '^\s*if\s*(set_group_colors(.*"\(\a\+\)",') + if !empty(list) && list[1] !=# 'Normal' + let item.name = list[1] + let item.type = 'gui' + call add(a:li, copy(item)) + endif + endfor + + let item.name = 'CursorIM' + let item.type = 'gui' + call add(a:li, copy(item)) + + quit! + + if empty(a:li) + throw 'hlgroup is empty' + endif + catch /.*/ + call s:err_gen('') + throw 'exit' + endtry +endfunc + +" ------------------------------------------------------------------------------ +function! s:parse_vim_complete_name(li) + try + let file_name = $VIM_SRCDIR . '/usercmd.c' + let item = {} + + new + exec 'read ' . file_name + norm! gg + exec '/^}\s*command_complete\[\]\s*=\s*$/+1;/^};/-1yank' + %delete _ + + put + g!/^\s*{.*"\w\+"\s*}\s*,.*$/d + g/"custom\(list\)\?"/d + + for line in getline(1, line('$')) + let list = matchlist(line, '^\s*{.*"\(\w\+\)"\s*}\s*,') + let item.name = list[1] + call add(a:li, copy(item)) + endfor + + quit! + + if empty(a:li) + throw 'complete_name is empty' + endif + catch /.*/ + call s:err_gen('') + throw 'exit' + endtry +endfunc + +" ------------------------------------------------------------------------------ +function! s:append_syn_any(lnum, str_info, li) + let ret_lnum = a:lnum + let str = a:str_info.start + + for o in a:li + let str .= ' ' . o.name + if len(str) > s:line_break_len + if !empty(a:str_info.end) + let str .= ' ' . a:str_info.end + endif + call append(ret_lnum, str) + let str = a:str_info.start + let ret_lnum += 1 + endif + endfor + if str !=# a:str_info.start + if !empty(a:str_info.end) + let str .= ' ' . a:str_info.end + endif + call append(ret_lnum, str) + let ret_lnum += 1 + endif + return ret_lnum +endfunc + +function! s:update_syntax_vim_file(vim_info) + try + function! s:search_and_check(kword, base_fname, str_info) + let a:str_info.start = '' + let a:str_info.end = '' + + let pattern = '^" GEN_SYN_VIM: ' . a:kword . '\s*,' + let lnum = search(pattern) + if lnum == 0 + throw 'Search pattern ''' . pattern . ''' not found in ' . + \ a:base_fname + endif + let li = matchlist(getline(lnum), pattern . '\s*START_STR\s*=\s*''\(.\{-}\)''\s*,\s*END_STR\s*=\s*''\(.\{-}\)''') + if empty(li) + throw 'Bad str_info line:' . getline(lnum) + endif + let a:str_info.start = li[1] + let a:str_info.end = li[2] + return lnum + endfunc + + let target_fname = 'vim.vim.rc' + let base_fname = 'vim.vim.base' + let str_info = {} + let str_info.start = '' + let str_info.end = '' + + new + exec 'edit ' . target_fname + %d _ + exec 'read ' . base_fname + 1delete _ + call cursor(1, 1) + + " vimCommand + let li = a:vim_info.cmd + " vimCommand - normal + let lnum = s:search_and_check('vimCommand normal', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 0) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3) " menu + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 4) " map + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 5) " mapclear + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 6) " unmap + + " vimOption + let kword = 'vimOption' + let li = a:vim_info.opt + " vimOption - normal + let lnum = s:search_and_check(kword . ' normal', base_fname, str_info) + let lnum = s:append_syn_vimopt(lnum, str_info, li, '', 0) + " vimOption - turn-off + let lnum = s:search_and_check(kword . ' turn-off', base_fname, str_info) + let lnum = s:append_syn_vimopt(lnum, str_info, li, 'no', 1) + " vimOption - invertible + let lnum = s:search_and_check(kword . ' invertible', base_fname, str_info) + let lnum = s:append_syn_vimopt(lnum, str_info, li, 'inv', 1) + " vimOption - term output code + let li = a:vim_info.term_out_code + let lnum = s:search_and_check(kword . ' term output code', base_fname, str_info) + let lnum = s:append_syn_any(lnum, str_info, li) + + " Missing vimOption + let li = a:vim_info.missing_opt + let lnum = s:search_and_check('Missing vimOption', base_fname, str_info) + let lnum = s:append_syn_vimopt(lnum, str_info, li, '', 0) + let lnum = s:append_syn_vimopt(lnum, str_info, li, 'no', 1) + let lnum = s:append_syn_vimopt(lnum, str_info, li, 'inv', 1) + + " vimAutoEvent + let li = a:vim_info.event + let lnum = s:search_and_check('vimAutoEvent', base_fname, str_info) + let lnum = s:append_syn_any(lnum, str_info, li) + + " vimHLGroup + let li = a:vim_info.hlgroup + let lnum = s:search_and_check('vimHLGroup', base_fname, str_info) + let lnum = s:append_syn_any(lnum, str_info, li) + + " vimFuncName + let li = a:vim_info.func + let lnum = s:search_and_check('vimFuncName', base_fname, str_info) + let lnum = s:append_syn_any(lnum, str_info, li) + + " vimUserAttrbCmplt + let li = a:vim_info.compl_name + let lnum = s:search_and_check('vimUserAttrbCmplt', base_fname, str_info) + let lnum = s:append_syn_any(lnum, str_info, li) + + " vimCommand - abbrev + let kword = 'vimCommand' + let li = a:vim_info.cmd + let lnum = s:search_and_check(kword . ' abbrev', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 2) + " vimCommand - map + let lnum = s:search_and_check(kword . ' map', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 4) + let lnum = s:search_and_check(kword . ' mapclear', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 5) + let lnum = s:search_and_check(kword . ' unmap', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 6) + " vimCommand - menu + let lnum = s:search_and_check(kword . ' menu', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3) + + update + quit! + + catch /.*/ + call s:err_gen('') + throw 'exit' + endtry +endfunc + +" ------------------------------------------------------------------------------ +function! s:err_gen(arg) + call s:write_error(a:arg, 'generator.err') +endfunc + +function! s:err_sanity(arg) + call s:write_error(a:arg, 'sanity_check.err') +endfunc + +function! s:write_error(arg, fname) + let li = [] + if !empty(v:throwpoint) + call add(li, v:throwpoint) + endif + if !empty(v:exception) + call add(li, v:exception) + endif + if type(a:arg) == type([]) + call extend(li, a:arg) + elseif type(a:arg) == type("") + if !empty(a:arg) + call add(li, a:arg) + endif + endif + if !empty(li) + call writefile(li, a:fname, 'a') + else + call writefile(['UNKNOWN'], a:fname, 'a') + endif +endfunc + +" ------------------------------------------------------------------------------ +try + let s:line_break_len = 768 + let s:vim_info = {} + let s:vim_info.opt = [] + let s:vim_info.missing_opt = [] + let s:vim_info.term_out_code = [] + let s:vim_info.cmd = [] + let s:vim_info.event = [] + let s:vim_info.func = [] + let s:vim_info.hlgroup = [] + let s:vim_info.compl_name = [] + + set lazyredraw + silent call s:parse_vim_option(s:vim_info.opt, s:vim_info.missing_opt, + \ s:vim_info.term_out_code) + silent call s:parse_vim_command(s:vim_info.cmd) + silent call s:parse_vim_event(s:vim_info.event) + silent call s:parse_vim_function(s:vim_info.func) + silent call s:parse_vim_hlgroup(s:vim_info.hlgroup) + silent call s:parse_vim_complete_name(s:vim_info.compl_name) + + call s:update_syntax_vim_file(s:vim_info) + set nolazyredraw + +finally + quitall! +endtry + +" --------------------------------------------------------------------- +let &cpo = s:keepcpo +unlet s:keepcpo +" vim:ts=2 sw=2 diff --git a/runtime/syntax/generator/update_date.vim b/runtime/syntax/generator/update_date.vim new file mode 100644 index 0000000000..662e5054b7 --- /dev/null +++ b/runtime/syntax/generator/update_date.vim @@ -0,0 +1,14 @@ +" Update the date of following line in vim.vim.rc. +" '" Last Change: ' +" +language C +silent new vim.vim +normal gg +let pat = '^"\s*Last\s*Change:\s\+' +let lnum = search(pat, 'We', 10) +if lnum > 0 + exec 'norm! lD"=strftime("%b %d, %Y")' . "\rp" + silent update +endif +quitall! +" vim:ts=4 sw=4 et diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base new file mode 100644 index 0000000000..7c8373727c --- /dev/null +++ b/runtime/syntax/generator/vim.vim.base @@ -0,0 +1,1110 @@ +" Vim syntax file +" Language: Vim script +" Maintainer: Hirohito Higashi +" URL: https://github.com/vim-jp/syntax-vim-ex +" Former Maintainer: Charles E. Campbell +" Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM +" Base File Version: 9.0-25 +" Base File Date: May 09, 2023 + +" DO NOT CHANGE DIRECTLY. +" THIS FILE PARTLY GENERATED BY gen_syntax_vim.vim. +" (Search string "GEN_SYN_VIM:" in this file) + +" Automatically generated keyword lists: {{{1 + +" Quit when a syntax file was already loaded {{{2 +if exists("b:current_syntax") + finish +endif +let b:loaded_syntax_vim_ex="__REVISION__" +let s:keepcpo= &cpo +set cpo&vim + +" vimTodo: contains common special-notices for comments {{{2 +" Use the vimCommentGroup cluster to add your own. +syn keyword vimTodo contained COMBAK FIXME TODO XXX +syn cluster vimCommentGroup contains=vimTodo,@Spell + +" regular vim commands {{{2 +" GEN_SYN_VIM: vimCommand normal, START_STR='syn keyword vimCommand contained', END_STR='' + +syn keyword vimCommand contained 2mat[ch] 3mat[ch] + +syn match vimCommand contained "\" +syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man Over Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Until Winbar XMLent XMLns + +" vimOptions are caught only when contained in a vimSet {{{2 +" GEN_SYN_VIM: vimOption normal, START_STR='syn keyword vimOption contained', END_STR='' + +" vimOptions: These are the turn-off setting variants {{{2 +" GEN_SYN_VIM: vimOption turn-off, START_STR='syn keyword vimOption contained', END_STR='' + +" vimOptions: These are the invertible variants {{{2 +" GEN_SYN_VIM: vimOption invertible, START_STR='syn keyword vimOption contained', END_STR='' + +" termcap codes (which can also be set) {{{2 +" GEN_SYN_VIM: vimOption term output code, START_STR='syn keyword vimOption contained', END_STR='' +" term key codes +syn keyword vimOption contained t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ku +syn match vimOption contained "t_%1" +syn match vimOption contained "t_#2" +syn match vimOption contained "t_#4" +syn match vimOption contained "t_@7" +syn match vimOption contained "t_*7" +syn match vimOption contained "t_&8" +syn match vimOption contained "t_%i" +syn match vimOption contained "t_k;" + +" unsupported settings: some were supported by vi but don't do anything in vim {{{2 +" GEN_SYN_VIM: Missing vimOption, START_STR='syn keyword vimErrSetting contained', END_STR='' + +" AutoCmd Events {{{2 +syn case ignore +" GEN_SYN_VIM: vimAutoEvent, START_STR='syn keyword vimAutoEvent contained', END_STR='' + +" Highlight commonly used Groupnames {{{2 +syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo + +" Default highlighting groups {{{2 +" GEN_SYN_VIM: vimHLGroup, START_STR='syn keyword vimHLGroup contained', END_STR='' +syn case match + +" Function Names {{{2 +" GEN_SYN_VIM: vimFuncName, START_STR='syn keyword vimFuncName contained', END_STR='' + +"--- syntax here and above generated by mkvimvim --- +" Special Vim Highlighting (not automatic) {{{1 + +" Set up folding commands for this syntax highlighting file {{{2 +if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[afhlmpPrt]' + if g:vimsyn_folding =~# 'a' + com! -nargs=* VimFolda fold + else + com! -nargs=* VimFolda + endif + if g:vimsyn_folding =~# 'f' + com! -nargs=* VimFoldf fold + else + com! -nargs=* VimFoldf + endif + if g:vimsyn_folding =~# 'h' + com! -nargs=* VimFoldh fold + else + com! -nargs=* VimFoldh + endif + if g:vimsyn_folding =~# 'l' + com! -nargs=* VimFoldl fold + else + com! -nargs=* VimFoldl + endif + if g:vimsyn_folding =~# 'm' + com! -nargs=* VimFoldm fold + else + com! -nargs=* VimFoldm + endif + if g:vimsyn_folding =~# 'p' + com! -nargs=* VimFoldp fold + else + com! -nargs=* VimFoldp + endif + if g:vimsyn_folding =~# 'P' + com! -nargs=* VimFoldP fold + else + com! -nargs=* VimFoldP + endif + if g:vimsyn_folding =~# 'r' + com! -nargs=* VimFoldr fold + else + com! -nargs=* VimFoldr + endif + if g:vimsyn_folding =~# 't' + com! -nargs=* VimFoldt fold + else + com! -nargs=* VimFoldt + endif +else + com! -nargs=* VimFolda + com! -nargs=* VimFoldf + com! -nargs=* VimFoldh + com! -nargs=* VimFoldl + com! -nargs=* VimFoldm + com! -nargs=* VimFoldp + com! -nargs=* VimFoldP + com! -nargs=* VimFoldr + com! -nargs=* VimFoldt +endif + +" Deprecated variable options {{{2 +if exists("g:vim_minlines") + let g:vimsyn_minlines= g:vim_minlines +endif +if exists("g:vim_maxlines") + let g:vimsyn_maxlines= g:vim_maxlines +endif +if exists("g:vimsyntax_noerror") + let g:vimsyn_noerror= g:vimsyntax_noerror +endif + +" Variable options {{{2 +if exists("g:vim_maxlines") + let s:vimsyn_maxlines= g:vim_maxlines +else + let s:vimsyn_maxlines= 60 +endif + +" Numbers {{{2 +" ======= +syn match vimNumber '\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment +syn match vimNumber '-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment +syn match vimNumber '\<0[xX]\x\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment +syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment +syn match vimNumber '\<0[zZ][a-zA-Z0-9.]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment +syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment +syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment + +" All vimCommands are contained by vimIsCommand. {{{2 +syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFilter,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd +syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand +syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" +syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" +syn match vimVar "\s\zs&\%([lg]:\)\=\a\+\>" +syn match vimVar "\s\zs&t_\S[a-zA-Z0-9]\>" +syn match vimVar "\s\zs&t_k;" +syn match vimFBVar contained "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" +syn keyword vimCommand contained in + +" Insertions And Appends: insert append {{{2 +" (buftype != nofile test avoids having append, change, insert show up in the command window) +" ======================= +if &buftype != 'nofile' + syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=a\%[ppend]$" matchgroup=vimCommand end="^\.$"" + syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=c\%[hange]$" matchgroup=vimCommand end="^\.$"" + syn region vimInsert matchgroup=vimCommand start="^[: \t]*\(\d\+\(,\d\+\)\=\)\=i\%[nsert]$" matchgroup=vimCommand end="^\.$"" +endif + +" Behave! {{{2 +" ======= +syn match vimBehave "\" skipwhite nextgroup=vimBehaveModel,vimBehaveError +syn keyword vimBehaveModel contained mswin xterm +if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nobehaveerror") + syn match vimBehaveError contained "[^ ]\+" +endif + +" Filetypes {{{2 +" ========= +syn match vimFiletype "\\s\+[eE][nN][dD]\>" +endif +syn keyword vimAugroupKey contained aug[roup] + +" Operators: {{{2 +" ========= +syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,@vimContinue,vim9Comment,vimVar +syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile +syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile +syn match vimOper "\(\" skipwhite nextgroup=vimString,vimSpecFile +syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=vimoperStar,@vimOperGroup +syn region vimOperParen matchgroup=vimSep start="#\={" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar +if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror") + syn match vimOperError ")" +endif + +" Functions : Tag is provided for those who wish to highlight tagged functions {{{2 +" ========= +syn cluster vimFuncList contains=vimCommand,vimFunctionError,vimFuncKey,Tag,vimFuncSID +syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,vimComment,vim9Comment,vimContinue,vimCtrlChar,vimEcho,vimEchoHL,vimEnvvar,vimExecute,vimIsCommand,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimGlobal,vimHighlight,vimIsCommand,vimLet,vimLetHereDoc,vimLineComment,vimMap,vimMark,vimNorm,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSet,vimSpecFile,vimString,vimSubst,vimSynLine,vimUnmap,vimUserCommand +syn match vimFunction "\<\(fu\%[nction]\)!\=\s\+\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody +syn match vimFunction "\\|\" + +" Keymaps: (Vim Project Addition) {{{2 +" ======= + +" TODO: autogenerated vimCommand keyword list does not handle all abbreviations +" : handle Vim9 script comments when something like #13104 is merged +syn match vimKeymapStart "^" contained skipwhite nextgroup=vimKeymapLhs,vimKeymapLineComment +syn match vimKeymapLhs "\S\+" contained skipwhite nextgroup=vimKeymapRhs contains=vimNotation +syn match vimKeymapRhs "\S\+" contained skipwhite nextgroup=vimKeymapTailComment contains=vimNotation +syn match vimKeymapTailComment "\S.*" contained +syn match vimKeymapLineComment +".*+ contained contains=@vimCommentGroup,vimCommentString,vimCommentTitle + +syn region vimKeymap matchgroup=vimCommand start="\" end="\%$" contains=vimKeymapStart + +" Special Filenames, Modifiers, Extension Removal: {{{2 +" =============================================== +syn match vimSpecFile "" nextgroup=vimSpecFileMod,vimSubst +syn match vimSpecFile "<\([acs]file\|amatch\|abuf\)>" nextgroup=vimSpecFileMod,vimSubst +syn match vimSpecFile "\s%[ \t:]"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst +syn match vimSpecFile "\s%$"ms=s+1 nextgroup=vimSpecFileMod,vimSubst +syn match vimSpecFile "\s%<"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst +syn match vimSpecFile "#\d\+\|[#%]<\>" nextgroup=vimSpecFileMod,vimSubst +syn match vimSpecFileMod "\(:[phtre]\)\+" contained + +" User-Specified Commands: {{{2 +" ======================= +syn cluster vimUserCmdList contains=vimAddress,vimSyntax,vimHighlight,vimAutoCmd,vimCmplxRepeat,vimComment,vim9Comment,vimCtrlChar,vimEscapeBrace,vimFunc,vimFuncName,vimFunction,vimFunctionError,vimIsCommand,vimMark,vimNotation,vimNumber,vimOper,vimRegion,vimRegister,vimLet,vimSet,vimSetEqual,vimSetString,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange,vimSynLine +syn keyword vimUserCommand contained com[mand] +syn match vimUserCmd "\.*$" contains=vimUserAttrb,vimUserAttrbError,vimUserCommand,@vimUserCmdList,vimComFilter +syn match vimUserAttrbError contained "-\a\+\ze\s" +syn match vimUserAttrb contained "-nargs=[01*?+]" contains=vimUserAttrbKey,vimOper +syn match vimUserAttrb contained "-complete=" contains=vimUserAttrbKey,vimOper nextgroup=vimUserAttrbCmplt,vimUserCmdError +syn match vimUserAttrb contained "-range\(=%\|=\d\+\)\=" contains=vimNumber,vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-count\(=\d\+\)\=" contains=vimNumber,vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-bang\>" contains=vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-bar\>" contains=vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-buffer\>" contains=vimOper,vimUserAttrbKey +syn match vimUserAttrb contained "-register\>" contains=vimOper,vimUserAttrbKey +if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nousercmderror") + syn match vimUserCmdError contained "\S\+\>" +endif +syn case ignore +syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister] +" GEN_SYN_VIM: vimUserAttrbCmplt, START_STR='syn keyword vimUserAttrbCmplt contained', END_STR='' +syn keyword vimUserAttrbCmplt contained custom customlist nextgroup=vimUserAttrbCmpltFunc,vimUserCmdError +syn match vimUserAttrbCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%([.#]\h\w*\)\+\|\h\w*\)"hs=s+1 nextgroup=vimUserCmdError + +syn case match +syn match vimUserAttrbCmplt contained "custom,\u\w*" + +" Lower Priority Comments: after some vim commands... {{{2 +" ======================= +syn match vimComment excludenl +\s"[^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString +syn match vimComment +\!\\@]"+lc=1 skip=+\\\\\|\\"+ matchgroup=vimStringEnd end=+"+ contains=@vimStringGroup +syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]'+lc=1 end=+'+ +syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup +syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup +"syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup " see tst45.vim +syn match vimString contained +"[^"]*\\$+ skipnl nextgroup=vimStringCont +syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+ +syn match vimEscape contained "\\." +" syn match vimEscape contained +\\[befnrt\"]+ +syn match vimEscape contained "\\\o\{1,3}\|\\[xX]\x\{1,2}\|\\u\x\{1,4}\|\\U\x\{1,8}" +syn match vimEscape contained "\\<" contains=vimNotation +syn match vimEscape contained "\\<\*[^>]*>\=>" + +syn region vimString start=+$'+ end=+'+ skip=+''+ oneline contains=vimStringInterpolationBrace,vimStringInterpolationExpr +syn region vimString start=+$"+ end=+"+ oneline contains=@vimStringGroup,vimStringInterpolationBrace,vimStringInterpolationExpr +syn region vimStringInterpolationExpr matchgroup=vimSep start=+{+ end=+}+ oneline contains=vimFunc,vimFuncVar,vimOper,vimOperParen,vimNotation,vimNumber,vimString,vimVar +syn match vimStringInterpolationBrace "{{" +syn match vimStringInterpolationBrace "}}" + +" Substitutions: {{{2 +" ============= +syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation +syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation +syn cluster vimSubstList add=vimCollection +syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(\\|\\|\\)[:#[:alpha:]]\@!" nextgroup=vimSubstPat +"syn match vimSubst "\%(^\|[^\\]\)\[:#[:alpha:]]\@!" nextgroup=vimSubstPat contained +syn match vimSubst "\%(^\|[^\\\"']\)\[:#[:alpha:]\"']\@!" nextgroup=vimSubstPat contained +syn match vimSubst "/\zs\\ze/" nextgroup=vimSubstPat +syn match vimSubst "\(:\+\s*\|^\s*\)s\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat +syn match vimSubst1 contained "\" nextgroup=vimSubstPat +syn match vimSubst2 contained "s\%[ubstitute]\>" nextgroup=vimSubstPat +syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([^a-zA-Z( \t[\]&]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline +syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline +syn region vimCollection contained transparent start="\\\@]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst +syn match vimMark ",\zs'[<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst +syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst +syn match vimMark "\'lc=1 +syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\>\)' + +" Set command and associated set-options (vimOptions) with comment {{{2 +syn region vimSet matchgroup=vimCommand start="\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skip="\%(\\\\\)*\\.\n\@!" end="$" end="|" matchgroup=vimNotation end="<[cC][rR]>" keepend contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vim9Comment,vimSetString,vimSetMod +syn region vimSetEqual contained start="[=:]\|[-+^]=" skip="\\\\\|\\\s" end="[| \t]"me=e-1 end="$" contains=vimCtrlChar,vimSetSep,vimNotation,vimEnvvar +syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar +syn match vimSetSep contained "[,:]" +syn match vimSetMod contained "&vim\=\|[!&?<]\|all&" + +" Let And Var: {{{2 +" =========== +syn keyword vimLet let skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc,vimLetRegister,vimVarList +syn keyword vimConst cons[t] skipwhite nextgroup=vimVar,vimLetHereDoc,vimVarList +syn region vimVarList contained start="\[" end="]" contains=vimVar,vimContinue + +syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars +syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars +syn region vimUnletVars contained start="$\I\|\h" skip="\n\s*\\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber + +VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$' +syn keyword vimLet var skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc + +" For: {{{2 +" === +syn keyword vimFor for skipwhite nextgroup=vimVar,vimVarList +" Abbreviations: {{{2 +" ============= +" GEN_SYN_VIM: vimCommand abbrev, START_STR='syn keyword vimAbb', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs' + +" Autocmd: {{{2 +" ======= +syn match vimAutoEventList contained "\(!\s\+\)\=\(\a\+,\)*\a\+" contains=vimAutoEvent nextgroup=vimAutoCmdSpace +syn match vimAutoCmdSpace contained "\s\+" nextgroup=vimAutoCmdSfxList +syn match vimAutoCmdSfxList contained "\S*" skipwhite nextgroup=vimAutoCmdMod +syn keyword vimAutoCmd au[tocmd] do[autocmd] doautoa[ll] skipwhite nextgroup=vimAutoEventList +syn match vimAutoCmdMod "\(++\)\=\(once\|nested\)" + +" Echo And Execute: -- prefer strings! {{{2 +" ================ +syn region vimEcho oneline excludenl matchgroup=vimCommand start="\" skip="\(\\\\\)*\\|" end="$\||" contains=vimFunc,vimFuncVar,vimString,vimVar +syn region vimExecute oneline excludenl matchgroup=vimCommand start="\" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar +syn match vimEchoHL "echohl\=" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone +syn case ignore +syn keyword vimEchoHLNone none +syn case match + +" Maps: {{{2 +" ==== +syn match vimMap "\\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapLhs +syn match vimMap "\" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs +syn match vimMapRhs contained ".*" contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend +syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimContinue +syn case ignore +syn keyword vimMapModKey contained buffer expr leader localleader nowait plug script sid silent unique +syn case match + +" Menus: {{{2 +" ===== +syn cluster vimMenuList contains=vimMenuBang,vimMenuPriority,vimMenuName,vimMenuMod +" GEN_SYN_VIM: vimCommand menu, START_STR='syn keyword vimCommand', END_STR='skipwhite nextgroup=@vimMenuList' +syn match vimMenuName "[^ \t\\<]\+" contained nextgroup=vimMenuNameMore,vimMenuMap +syn match vimMenuPriority "\d\+\(\.\d\+\)*" contained skipwhite nextgroup=vimMenuName +syn match vimMenuNameMore "\c\\\s\|\|\\\." contained nextgroup=vimMenuName,vimMenuNameMore contains=vimNotation +syn match vimMenuMod contained "\c<\(script\|silent\)\+>" skipwhite contains=vimMapModKey,vimMapModErr nextgroup=@vimMenuList +syn match vimMenuMap "\s" contained skipwhite nextgroup=vimMenuRhs +syn match vimMenuRhs ".*$" contained contains=vimString,vimComment,vim9Comment,vimIsCommand +syn match vimMenuBang "!" contained skipwhite nextgroup=@vimMenuList + +" Angle-Bracket Notation: (tnx to Michael Geddes) {{{2 +" ====================== +syn case ignore +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([scamd]-\)\{0,4}x\=\%(f\d\{1,2}\|[^ \t:]\|space\|bar\|bslash\|nl\|newline\|lf\|linefeed\|cr\|retu\%[rn]\|enter\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|csi\|right\|paste\%(start\|end\)\|left\|help\|undo\|k\=insert\|ins\|mouse\|[kz]\=home\|[kz]\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|kpoint\|space\|k\=\%(page\)\=\%(\|down\|up\|k\d\>\)\)>" contains=vimBracket + +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([scamd2-4]-\)\{0,4}\%(net\|dec\|jsb\|pterm\|urxvt\|sgr\)mouse>" contains=vimBracket +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([scamd2-4]-\)\{0,4}\%(left\|middle\|right\)\%(mouse\|drag\|release\)>" contains=vimBracket +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([scamd2-4]-\)\{0,4}left\%(mouse\|release\)nm>" contains=vimBracket +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([scamd2-4]-\)\{0,4}x[12]\%(mouse\|drag\|release\)>" contains=vimBracket +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([scamd2-4]-\)\{0,4}sgrmouserelease>" contains=vimBracket +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([scamd2-4]-\)\{0,4}mouse\%(up\|down\|move\)>" contains=vimBracket +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([scamd2-4]-\)\{0,4}scrollwheel\%(up\|down\|right\|left\)>" contains=vimBracket + +syn match vimNotation "\%#=1\%(\\\|\)\=<\%(sid\|nop\|nul\|lt\|drop\)>" contains=vimBracket +syn match vimNotation "\%#=1\%(\\\|\)\=<\%(snr\|plug\|cursorhold\|ignore\|cmd\|scriptcmd\|focus\%(gained\|lost\)\)>" contains=vimBracket +syn match vimNotation '\%(\\\|\)\=[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket +syn match vimNotation '\%#=1\%(\\\|\)\=<\%(q-\)\=\%(line[12]\|count\|bang\|reg\|args\|mods\|f-args\|f-mods\|lt\)>' contains=vimBracket +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([cas]file\|abuf\|amatch\|cexpr\|cword\|cWORD\|client\|stack\|script\|sf\=lnum\)>" contains=vimBracket +syn match vimNotation "\%#=1\%(\\\|\)\=<\%([scamd]-\)\{0,4}char-\%(\d\+\|0\o\+\|0x\x\+\)>" contains=vimBracket + +syn match vimBracket contained "[\\<>]" +syn case match + +" User Function Highlighting: {{{2 +" (following Gautam Iyer's suggestion) +" ========================== +syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncEcho,vimFuncName,vimUserFunc,vimExecute +syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\" contains=vimNotation +syn keyword vimFuncEcho contained ec ech echo + +" User Command Highlighting: {{{2 +syn match vimUsrCmd '^\s*\zs\u\%(\w*\)\@>\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!' + +" Errors And Warnings: {{{2 +" ==================== +if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror") + syn match vimFunctionError "\s\zs[a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank + syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\d\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank + syn match vimElseIfErr "\" + syn match vimBufnrWarn /\\|\\|\\|\" skipwhite nextgroup=vimOper,vimOperParen,vimVar,vimFunc,vimNotation + +" Norm: {{{2 +" ==== +syn match vimNorm "\" +syn cluster vimFuncBodyList add=vimSynType + +" Syntax: match {{{2 +syn cluster vimSynMtchGroup contains=@vimContinue,vimSynCchar,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation,vimMtchComment +syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion +syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|\|$" contains=@vimSynMtchGroup +syn match vimSynMtchOpt contained "\%#=1\<\(conceal\|transparent\|contained\|excludenl\|keepend\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>" +syn cluster vimFuncBodyList add=vimSynMtchGroup + +" Syntax: off and on {{{2 +syn keyword vimSynType contained enable list manual off on reset + +" Syntax: region {{{2 +syn cluster vimSynRegPatGroup contains=@vimContinue,vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation +syn cluster vimSynRegGroup contains=@vimContinue,vimSynCchar,vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp +syn keyword vimSynType contained region skipwhite nextgroup=vimSynRegion +syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip=+\\\\\|\\\|\n\s*\\\|\n\s*"\\ + end="|\|$" contains=@vimSynRegGroup +syn match vimSynRegOpt contained "\%#=1\<\(conceal\(ends\)\=\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|keepend\|oneline\|extend\|skipnl\|fold\)\>" +syn match vimSynReg contained "\<\%(start\|skip\|end\)=" nextgroup=vimSynRegPat +syn match vimSynMtchGrp contained "matchgroup=" nextgroup=vimGroup,vimHLGroup +syn region vimSynRegPat contained extend start="\z([-`~!@#$%^&*_=+;:'",./?]\)" skip=/\\\\\|\\\z1\|\n\s*\\\|\n\s*"\\ / end="\z1" contains=@vimSynRegPatGroup skipwhite nextgroup=vimSynPatMod,vimSynReg +syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=" +syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=," nextgroup=vimSynPatMod +syn match vimSynPatMod contained "lc=\d\+" +syn match vimSynPatMod contained "lc=\d\+," nextgroup=vimSynPatMod +syn region vimSynPatRange contained start="\[" skip="\\\\\|\\]" end="]" +syn match vimSynNotPatRange contained "\\\\\|\\\[" +syn match vimMtchComment contained '"[^"]\+$' +syn cluster vimFuncBodyList add=vimSynType + +" Syntax: sync {{{2 +" ============ +syn keyword vimSynType contained sync skipwhite nextgroup=vimSyncC,vimSyncLines,vimSyncMatch,vimSyncError,vimSyncLinebreak,vimSyncLinecont,vimSyncRegion +if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsyncerror") + syn match vimSyncError contained "\i\+" +endif +syn keyword vimSyncC contained ccomment clear fromstart +syn keyword vimSyncMatch contained match skipwhite nextgroup=vimSyncGroupName +syn keyword vimSyncRegion contained region skipwhite nextgroup=vimSynReg +syn match vimSyncLinebreak contained "\" skipwhite nextgroup=vimSyncGroup +syn match vimSyncGroup contained "\h\w*" skipwhite nextgroup=vimSynRegPat,vimSyncNone +syn keyword vimSyncNone contained NONE + +" Additional IsCommand: here by reasons of precedence {{{2 +" ==================== +syn match vimIsCommand "\s*\a\+" transparent contains=vimCommand,vimNotation + +" Highlighting: {{{2 +" ============ +syn cluster vimHighlightCluster contains=vimHiLink,vimHiClear,vimHiKeyList,vimComment,vim9Comment +if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimhictermerror") + syn match vimHiCtermError contained "\D\i*" +endif +syn match vimHighlight "\" skipwhite nextgroup=vimHiBang,@vimHighlightCluster +syn match vimHiBang contained "!" skipwhite nextgroup=@vimHighlightCluster + +syn match vimHiGroup contained "\i\+" +syn case ignore +syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl underdashed underdotted underdouble +syn keyword vimFgBgAttrib contained none bg background fg foreground +syn case match +syn match vimHiAttribList contained "\i\+" contains=vimHiAttrib +syn match vimHiAttribList contained "\i\+,"he=e-1 contains=vimHiAttrib nextgroup=vimHiAttribList +syn case ignore +syn keyword vimHiCtermColor contained black blue brown cyan darkblue darkcyan darkgray darkgreen darkgrey darkmagenta darkred darkyellow gray green grey grey40 grey50 grey90 lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightred lightyellow magenta red seagreen white yellow +syn match vimHiCtermColor contained "\" + +syn case match +syn match vimHiFontname contained "[a-zA-Z\-*]\+" +syn match vimHiGuiFontname contained "'[a-zA-Z\-* ]\+'" +syn match vimHiGuiRgb contained "#\x\{6}" + +" Highlighting: hi group key=arg ... {{{2 +syn cluster vimHiCluster contains=vimGroup,vimHiGroup,vimHiTerm,vimHiCTerm,vimHiStartStop,vimHiCtermFgBg,vimHiCtermul,vimHiCtermfont,vimHiGui,vimHiGuiFont,vimHiGuiFgBg,vimHiKeyError,vimNotation,vimComment,vim9comment +syn region vimHiKeyList contained oneline start="\i\+" skip="\\\\\|\\|" end="$\||" contains=@vimHiCluster +if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_vimhikeyerror") + syn match vimHiKeyError contained "\i\+="he=e-1 +endif +syn match vimHiTerm contained "\cterm="he=e-1 nextgroup=vimHiAttribList +syn match vimHiStartStop contained "\c\(start\|stop\)="he=e-1 nextgroup=vimHiTermcap,vimOption +syn match vimHiCTerm contained "\ccterm="he=e-1 nextgroup=vimHiAttribList +syn match vimHiCtermFgBg contained "\ccterm[fb]g="he=e-1 nextgroup=vimHiNmbr,vimHiCtermColor,vimFgBgAttrib,vimHiCtermError +syn match vimHiCtermul contained "\cctermul="he=e-1 nextgroup=vimHiNmbr,vimHiCtermColor,vimFgBgAttrib,vimHiCtermError +syn match vimHiCtermfont contained "\cctermfont="he=e-1 nextgroup=vimHiNmbr,vimHiCtermColor,vimFgBgAttrib,vimHiCtermError +syn match vimHiGui contained "\cgui="he=e-1 nextgroup=vimHiAttribList +syn match vimHiGuiFont contained "\cfont="he=e-1 nextgroup=vimHiFontname +syn match vimHiGuiFgBg contained "\cgui\%([fb]g\|sp\)="he=e-1 nextgroup=vimHiGroup,vimHiGuiFontname,vimHiGuiRgb,vimFgBgAttrib +syn match vimHiTermcap contained "\S\+" contains=vimNotation +syn match vimHiNmbr contained '\d\+' + +" Highlight: clear {{{2 +syn keyword vimHiClear contained clear nextgroup=vimHiGroup + +" Highlight: link {{{2 +" see tst24 (hi def vs hi) (Jul 06, 2018) +"syn region vimHiLink contained oneline matchgroup=vimCommand start="\(\\|\\)" end="$" contains=vimHiGroup,vimGroup,vimHLGroup,vimNotation +syn region vimHiLink contained oneline matchgroup=vimCommand start="\(\\|\\)" end="$" contains=@vimHiCluster +syn cluster vimFuncBodyList add=vimHiLink + +" Control Characters: {{{2 +" ================== +syn match vimCtrlChar "[- -]" + +" Beginners - Patterns that involve ^ {{{2 +" ========= +syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle,vimComment +syn match vimLineComment +^[ \t:]*"\("[^"]*"\|[^"]\)*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle +syn match vim9LineComment +^[ \t:]\+#.*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle +syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup +" Note: Look-behind to work around nextgroup skipnl consuming leading whitespace and preventing a match +syn match vimContinue "^\s*\zs\\" +syn match vimContinueComment '^\s*\zs["#]\\ .*' contained +syn cluster vimContinue contains=vimContinue,vimContinueComment +syn region vimString start="^\s*\\\z(['"]\)" skip='\\\\\|\\\z1' end="\z1" oneline keepend contains=@vimStringGroup,vimContinue +syn match vimCommentTitleLeader '"\s\+'ms=s+1 contained + +" Searches And Globals: {{{2 +" ==================== +syn match vimSearch '^\s*[/?].*' contains=vimSearchDelim +syn match vimSearchDelim '^\s*\zs[/?]\|[/?]$' contained +syn region vimGlobal matchgroup=Statement start='\:p:h")."/lua.vim") +if !filereadable(s:luapath) + for s:luapath in split(globpath(&rtp,"syntax/lua.vim"),"\n") + if filereadable(fnameescape(s:luapath)) + let s:luapath= fnameescape(s:luapath) + break + endif + endfor +endif +if (g:vimsyn_embed =~# 'l' && has("lua")) && filereadable(s:luapath) + unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimLuaRegion + exe "syn include @vimLuaScript ".s:luapath + VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimLuaScript + VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript + syn cluster vimFuncBodyList add=vimLuaRegion +else + syn region vimEmbedError start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+lua\s*<<\s*$+ end=+\.$+ +endif +unlet s:luapath + +" [-- perl --] {{{3 +let s:perlpath= fnameescape(expand(":p:h")."/perl.vim") +if !filereadable(s:perlpath) + for s:perlpath in split(globpath(&rtp,"syntax/perl.vim"),"\n") + if filereadable(fnameescape(s:perlpath)) + let s:perlpath= fnameescape(s:perlpath) + break + endif + endfor +endif +if (g:vimsyn_embed =~# 'p' && has("perl")) && filereadable(s:perlpath) + unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimPerlRegion + exe "syn include @vimPerlScript ".s:perlpath + VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(\S*\)\ze\(\s*["#].*\)\=$+ end=+^\z1\ze\(\s*[#"].*\)\=$+ contains=@vimPerlScript + VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript + syn cluster vimFuncBodyList add=vimPerlRegion +else + syn region vimEmbedError start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ +endif +unlet s:perlpath + +" [-- ruby --] {{{3 +let s:rubypath= fnameescape(expand(":p:h")."/ruby.vim") +if !filereadable(s:rubypath) + for s:rubypath in split(globpath(&rtp,"syntax/ruby.vim"),"\n") + if filereadable(fnameescape(s:rubypath)) + let s:rubypath= fnameescape(s:rubypath) + break + endif + endfor +endif +if (g:vimsyn_embed =~# 'r' && has("ruby")) && filereadable(s:rubypath) + syn cluster vimFuncBodyList add=vimRubyRegion + unlet! b:current_syntax + exe "syn include @vimRubyScript ".s:rubypath + VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimRubyScript + syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*$+ end=+\.$+ contains=@vimRubyScript + syn cluster vimFuncBodyList add=vimRubyRegion +else + syn region vimEmbedError start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+rub[y]\s*<<\s*$+ end=+\.$+ +endif +unlet s:rubypath + +" [-- python --] {{{3 +let s:pythonpath= fnameescape(expand(":p:h")."/python.vim") +if !filereadable(s:pythonpath) + for s:pythonpath in split(globpath(&rtp,"syntax/python.vim"),"\n") + if filereadable(fnameescape(s:pythonpath)) + let s:pythonpath= fnameescape(s:pythonpath) + break + endif + endfor +endif +if g:vimsyn_embed =~# 'P' && has("pythonx") && filereadable(s:pythonpath) + unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimPythonRegion + exe "syn include @vimPythonScript ".s:pythonpath + VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*\%(trim\s*\)\=\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimPythonScript + VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*\%(trim\s*\)\=$+ end=+\.$+ contains=@vimPythonScript + VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\%(trim\s*\)\=\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimPythonScript + VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\=\s*<<\s*\%(trim\s*\)\=$+ end=+\.$+ contains=@vimPythonScript + syn cluster vimFuncBodyList add=vimPythonRegion +else + syn region vimEmbedError start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ +endif +unlet s:pythonpath + +" [-- tcl --] {{{3 +if has("win32") || has("win95") || has("win64") || has("win16") + " apparently has("tcl") has been hanging vim on some windows systems with cygwin + let s:trytcl= (&shell !~ '\<\%(bash\>\|4[nN][tT]\|\\%(\.exe\)\=$') +else + let s:trytcl= 1 +endif +if s:trytcl + let s:tclpath= fnameescape(expand(":p:h")."/tcl.vim") + if !filereadable(s:tclpath) + for s:tclpath in split(globpath(&rtp,"syntax/tcl.vim"),"\n") + if filereadable(fnameescape(s:tclpath)) + let s:tclpath= fnameescape(s:tclpath) + break + endif + endfor + endif + if (g:vimsyn_embed =~# 't' && has("tcl")) && filereadable(s:tclpath) + unlet! b:current_syntax + syn cluster vimFuncBodyList add=vimTclRegion + exe "syn include @vimTclScript ".s:tclpath + VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimTclScript + VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*$+ end=+\.$+ contains=@vimTclScript + syn cluster vimFuncBodyList add=vimTclScript + else + syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+ + endif + unlet s:tclpath +else + syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+ +endif +unlet s:trytcl + +" [-- mzscheme --] {{{3 +let s:mzschemepath= fnameescape(expand(":p:h")."/scheme.vim") +if !filereadable(s:mzschemepath) + for s:mzschemepath in split(globpath(&rtp,"syntax/mzscheme.vim"),"\n") + if filereadable(fnameescape(s:mzschemepath)) + let s:mzschemepath= fnameescape(s:mzschemepath) + break + endif + endfor +endif +if (g:vimsyn_embed =~# 'm' && has("mzscheme")) && filereadable(s:mzschemepath) + unlet! b:current_syntax + let s:iskKeep= &isk + syn cluster vimFuncBodyList add=vimMzSchemeRegion + exe "syn include @vimMzSchemeScript ".s:mzschemepath + let &isk= s:iskKeep + unlet s:iskKeep + VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript + VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript + syn cluster vimFuncBodyList add=vimMzSchemeRegion +else + syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ + syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ +endif +unlet s:mzschemepath + +" Synchronize (speed) {{{2 +"============ +if exists("g:vimsyn_minlines") + exe "syn sync minlines=".g:vimsyn_minlines +endif +exe "syn sync maxlines=".s:vimsyn_maxlines +syn sync linecont "^\s\+\\" +syn sync match vimAugroupSyncA groupthere NONE "\\s\+[eE][nN][dD]" + +" ==================== +" Highlighting Settings {{{2 +" ==================== + +if !exists("skip_vim_syntax_inits") + if !exists("g:vimsyn_noerror") + hi def link vimBehaveError vimError + hi def link vimCollClassErr vimError + hi def link vimErrSetting vimError + hi def link vimEmbedError vimError + hi def link vimFTError vimError + hi def link vimFunctionError vimError + hi def link vimFunc vimError + hi def link vimHiAttribList vimError + hi def link vimHiCtermError vimError + hi def link vimHiKeyError vimError + hi def link vimKeyCodeError vimError + hi def link vimMapModErr vimError + hi def link vimSubstFlagErr vimError + hi def link vimSynCaseError vimError + hi def link vimSynFoldMethodError vimError + hi def link vimBufnrWarn vimWarn + endif + + hi def link vimAbb vimCommand + hi def link vimAddress vimMark + hi def link vimAugroupError vimError + hi def link vimAugroupKey vimCommand + hi def link vimAuHighlight vimHighlight + hi def link vimAutoCmdOpt vimOption + hi def link vimAutoCmd vimCommand + hi def link vimAutoEvent Type + hi def link vimAutoCmdMod Special + hi def link vimAutoSet vimCommand + hi def link vimBang vimOper + hi def link vimBehaveModel vimBehave + hi def link vimBehave vimCommand + hi def link vimBracket Delimiter + hi def link vimCmplxRepeat SpecialChar + hi def link vimCommand Statement + hi def link vimComment Comment + hi def link vim9Comment Comment + hi def link vimCommentString vimString + hi def link vimCommentTitle PreProc + hi def link vimCondHL vimCommand + hi def link vimConst vimCommand + hi def link vimContinue Special + hi def link vimContinueComment vimComment + hi def link vimCtrlChar SpecialChar + hi def link vimEchoHLNone vimGroup + hi def link vimEchoHL vimCommand + hi def link vimElseIfErr Error + hi def link vimElseif vimCondHL + hi def link vimEnvvar PreProc + hi def link vimError Error + hi def link vimEscape Special + hi def link vimFBVar vimVar + hi def link vimFgBgAttrib vimHiAttrib + hi def link vimFuncEcho vimCommand + hi def link vimHiCtermul vimHiTerm + hi def link vimHiCtermfont vimHiTerm + hi def link vimFold Folded + hi def link vimFor vimCommand + hi def link vimFTCmd vimCommand + hi def link vimFTOption vimSynType + hi def link vimFuncKey vimCommand + hi def link vimFuncName Function + hi def link vimFuncSID Special + hi def link vimFuncVar Identifier + hi def link vimGroupAdd vimSynOption + hi def link vimGroupName vimGroup + hi def link vimGroupRem vimSynOption + hi def link vimGroupSpecial Special + hi def link vimGroup Type + hi def link vimHiAttrib PreProc + hi def link vimHiBang vimBang + hi def link vimHiClear vimHighlight + hi def link vimHiCtermFgBg vimHiTerm + hi def link vimHiCTerm vimHiTerm + hi def link vimHighlight vimCommand + hi def link vimHiGroup vimGroupName + hi def link vimHiGuiFgBg vimHiTerm + hi def link vimHiGuiFont vimHiTerm + hi def link vimHiGuiRgb vimNumber + hi def link vimHiGui vimHiTerm + hi def link vimHiNmbr Number + hi def link vimHiStartStop vimHiTerm + hi def link vimHiTerm Type + hi def link vimHLGroup vimGroup + hi def link vimHLMod PreProc + hi def link vimInsert vimString + hi def link vimIskSep Delimiter + hi def link vimKeyCode vimSpecFile + hi def link vimKeymapLineComment vimComment + hi def link vimKeymapTailComment vimComment + hi def link vimKeyword Statement + hi def link vimLet vimCommand + hi def link vimLetHereDoc vimString + hi def link vimLetHereDocStart Special + hi def link vimLetHereDocStop Special + hi def link vimLetRegister Special + hi def link vimLineComment vimComment + hi def link vim9LineComment vimComment + hi def link vimMapBang vimBang + hi def link vimMapModKey vimFuncSID + hi def link vimMapMod vimBracket + hi def link vimMap vimCommand + hi def link vimMark Number + hi def link vimMarkNumber vimNumber + hi def link vimMenuBang vimBang + hi def link vimMenuMod vimMapMod + hi def link vimMenuNameMore vimMenuName + hi def link vimMenuName PreProc + hi def link vimMtchComment vimComment + hi def link vimNorm vimCommand + hi def link vimNotation Special + hi def link vimNotFunc vimCommand + hi def link vimNotPatSep vimString + hi def link vimNumber Number + hi def link vimOperError Error + hi def link vimOper Operator + hi def link vimOperStar vimOper + hi def link vimOption PreProc + hi def link vimParenSep Delimiter + hi def link vimPatSepErr vimError + hi def link vimPatSepR vimPatSep + hi def link vimPatSep SpecialChar + hi def link vimPatSepZone vimString + hi def link vimPatSepZ vimPatSep + hi def link vimPattern Type + hi def link vimPlainMark vimMark + hi def link vimPlainRegister vimRegister + hi def link vimRegister SpecialChar + hi def link vimScriptDelim Comment + hi def link vimSearchDelim Statement + hi def link vimSearch vimString + hi def link vimSep Delimiter + hi def link vimSetMod vimOption + hi def link vimSetSep Statement + hi def link vimSetString vimString + hi def link vimSpecFile Identifier + hi def link vimSpecFileMod vimSpecFile + hi def link vimSpecial Type + hi def link vimStatement Statement + hi def link vimStringCont vimString + hi def link vimString String + hi def link vimStringEnd vimString + hi def link vimStringInterpolationBrace vimEscape + hi def link vimSubst1 vimSubst + hi def link vimSubstDelim Delimiter + hi def link vimSubstFlags Special + hi def link vimSubstSubstr SpecialChar + hi def link vimSubstTwoBS vimString + hi def link vimSubst vimCommand + hi def link vimSynCaseError Error + hi def link vimSynCase Type + hi def link vimSyncC Type + hi def link vimSyncError Error + hi def link vimSyncGroupName vimGroupName + hi def link vimSyncGroup vimGroupName + hi def link vimSyncKey Type + hi def link vimSyncNone Type + hi def link vimSynContains vimSynOption + hi def link vimSynError Error + hi def link vimSynFoldMethodError Error + hi def link vimSynFoldMethod Type + hi def link vimSynKeyContainedin vimSynContains + hi def link vimSynKeyOpt vimSynOption + hi def link vimSynCchar vimSynOption + hi def link vimSynCcharValue Character + hi def link vimSynMtchGrp vimSynOption + hi def link vimSynMtchOpt vimSynOption + hi def link vimSynNextgroup vimSynOption + hi def link vimSynNotPatRange vimSynRegPat + hi def link vimSynOption Special + hi def link vimSynPatRange vimString + hi def link vimSynRegOpt vimSynOption + hi def link vimSynRegPat vimString + hi def link vimSynReg Type + hi def link vimSyntax vimCommand + hi def link vimSynType vimSpecial + hi def link vimTodo Todo + hi def link vimType Type + hi def link vimUnlet vimCommand + hi def link vimUnletBang vimBang + hi def link vimUnmap vimMap + hi def link vimUserAttrbCmpltFunc Special + hi def link vimUserAttrbCmplt vimSpecial + hi def link vimUserAttrbKey vimOption + hi def link vimUserAttrb vimSpecial + hi def link vimUserAttrbError Error + hi def link vimUserCmdError Error + hi def link vimUserCommand vimCommand + hi def link vimUserFunc Normal + hi def link vimVar Identifier + hi def link vimWarn WarningMsg +endif + +" Current Syntax Variable: {{{2 +let b:current_syntax = "vim" + +" --------------------------------------------------------------------- +" Cleanup: {{{1 +delc VimFolda +delc VimFoldf +delc VimFoldl +delc VimFoldm +delc VimFoldp +delc VimFoldP +delc VimFoldr +delc VimFoldt +let &cpo = s:keepcpo +unlet s:keepcpo +" vim:ts=18 fdm=marker diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 983c2639a0..1d97c85868 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,31 +1,23 @@ " Vim syntax file -" Language: Vim 9.0 script -" Maintainer: Charles E. Campbell -" Last Change: May 09, 2023 -" Vim Project changes: {{{1 -" 2023 Nov 12 (:let-heredoc improvements) -" 2023 Nov 20 (:loadkeymap improvements) -" 2023 Dec 06 (add missing assignment operators) -" 2023 Dec 10 (improve variable matching) -" 2023 Dec 21 (improve ex command matching) -" 2023 Dec 30 (:syntax improvements) -" 2024 Jan 14 (TermResponseAll autocommand) -" 2024 Jan 15 (:hi ctermfont attribute) -" 2024 Jan 23 (add :[23]match commands) -" 2024 Jan 25 (WinNewPre autocommand) -" 2024 Jan 27 (add foreach() function) -" 2024 Jan 28 (improve line-continuation matching & string interpolation) -" 2024 Feb 01 (improve special key matching) -" 2024 Feb 10 (improve :highlight and :map) -" }}} -" Version: 9.0-25 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM +" Language: Vim script +" Maintainer: Hirohito Higashi +" URL: https://github.com/vim-jp/syntax-vim-ex +" Former Maintainer: Charles E. Campbell +" Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM +" Base File Version: 9.0-25 +" Base File Date: May 09, 2023 + +" DO NOT CHANGE DIRECTLY. +" THIS FILE PARTLY GENERATED BY gen_syntax_vim.vim. +" (Search string "GEN_SYN_VIM:" in this file) + " Automatically generated keyword lists: {{{1 " Quit when a syntax file was already loaded {{{2 if exists("b:current_syntax") finish endif +let b:loaded_syntax_vim_ex="2024-02-13T21:07:41+01:00" let s:keepcpo= &cpo set cpo&vim @@ -35,39 +27,54 @@ syn keyword vimTodo contained COMBAK FIXME TODO XXX syn cluster vimCommentGroup contains=vimTodo,@Spell " regular vim commands {{{2 -syn keyword vimCommand contained a ar[gs] argl[ocal] bad[d] bn[ext] breakd[el] bw[ipeout] cabo[ve] cat[ch] ccl[ose] cfdo chd[ir] class cnf[ile] comc[lear] cp[revious] cstag debugg[reedy] delep dell diffg[et] dig[raphs] do dsp[lit] echoe[rr] em[enu] endfo[r] eval f[ile] fina[lly] foldd[oopen] gr[ep] helpc[lose] his[tory] ij[ump] inor j[oin] keepj[umps] lab[ove] lat lc[d] le[ft] lfir[st] lh[elpgrep] lmak[e] loadk lp[revious] luado ma[rk] mk[exrc] mz[scheme] new nore on[ly] pc[lose] pp[op] promptf[ind] ptj[ump] pu[t] py3f[ile] pyx r[ead] redrawt[abline] ri[ght] rundo sIl sal[l] sbf[irst] sc scp se[t] sg sgn sie sip sme snoremenu spelli[nfo] spr[evious] sri star[tinsert] sts[elect] sus[pend] syncbind tabN[ext] tabl[ast] tabr[ewind] tcld[o] tj[ump] tlu tno[remap] tu[nmenu] undol[ist] v vim9[cmd] vs[plit] win[size] wq xmapc[lear] xr[estore] -syn keyword vimCommand contained ab arga[dd] argu[ment] balt bo[tright] breakl[ist] cN[ext] cad[dbuffer] cb[uffer] cd cfir[st] che[ckpath] cle[arjumps] cnor comp[iler] cpf[ile] cun def deletel delm[arks] diffo[ff] dir doau e[dit] echom[sg] en[dif] endinterface ex files fini[sh] folddoc[losed] grepa[dd] helpf[ind] hor[izontal] il[ist] interface ju[mps] keepp[atterns] lad[dexpr] later lch[dir] lefta[bove] lg[etfile] lhi[story] lmapc[lear] loadkeymap lpf[ile] luafile mak[e] mks[ession] mzf[ile] nmapc[lear] nos[wapfile] opt[ions] pe[rl] pre[serve] promptr[epl] ptl[ast] public py[thon] pyxdo rec[over] reg[isters] rightb[elow] rv[iminfo] sIn san[dbox] sbl[ast] scI scr[iptnames] setf[iletype] sgI sgp sig sir smenu so[urce] spellr[are] sr srl startg[replace] substitutepattern sv[iew] syntime tabc[lose] tabm[ove] tabs tclf[ile] tl[ast] tlunmenu to[pleft] tunma[p] unh[ide] ve[rsion] vim9s[cript] wN[ext] winc[md] wqa[ll] xme xunme -syn keyword vimCommand contained abc[lear] argd[elete] as[cii] bd[elete] bp[revious] bro[wse] cNf[ile] cadde[xpr] cbe[fore] cdo cg[etfile] checkt[ime] clo[se] co[py] con[tinue] cq[uit] cuna[bbrev] defc[ompile] deletep delp diffp[atch] disa[ssemble] doaut ea echon endclass endt[ry] exi[t] filet fir[st] foldo[pen] gui helpg[rep] i imapc[lear] intro k lN[ext] laddb[uffer] lb[uffer] lcl[ose] leg[acy] lgetb[uffer] ll lne[xt] loc[kmarks] lr[ewind] lv[imgrep] marks mksp[ell] n[ext] noa nu[mber] ownsyntax ped[it] prev[ious] ps[earch] ptn[ext] pw[d] pydo pyxfile red[o] res[ize] ru[ntime] sI sIp sav[eas] sbm[odified] sce scripte[ncoding] setg[lobal] sgc sgr sign sl[eep] smile sor[t] spellr[epall] srI srn startr[eplace] substituterepeat sw[apname] t tabd[o] tabn[ext] tags te[aroff] tlm tm[enu] tp[revious] type unl verb[ose] vim[grep] w[rite] windo wundo xmenu xunmenu -syn keyword vimCommand contained abo[veleft] argded[upe] au bel[owright] br[ewind] bufdo c[hange] caddf[ile] cbel[ow] ce[nter] cgetb[uffer] chi[story] cmapc[lear] col[der] conf[irm] cr[ewind] cw[indow] defer deletl dep diffpu[t] dj[ump] dp earlier echow[indow] enddef endw[hile] exp filetype fix[del] for gvim helpt[ags] ia imp is[earch] kee[pmarks] lNf[ile] laddf[ile] lbe[fore] lcs lex[pr] lgete[xpr] lla[st] lnew[er] lockv[ar] ls lvimgrepa[dd] mat[ch] mkv[imrc] nb[key] noautocmd o[pen] p[rint] perld[o] pro ptN[ext] ptp[revious] py3 pyf[ile] q[uit] redi[r] ret[ab] rub[y] sIc sIr sbN[ext] sbn[ext] scg scriptv[ersion] setl[ocal] sge sh[ell] sil[ent] sla[st] sn[ext] sp[lit] spellr[rare] src srp static sun[hide] sy tN[ext] tabe[dit] tabnew tc[d] ter[minal] tlmenu tma[p] tr[ewind] u[ndo] unlo[ckvar] vert[ical] vimgrepa[dd] wa[ll] winp[os] wv[iminfo] xnoreme xwininfo -syn keyword vimCommand contained abstract argdo bN[ext] bf[irst] brea[k] buffers ca caf[ter] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cn[ext] colo[rscheme] cons[t] cs d[elete] delc[ommand] deletp di[splay] diffs[plit] dl dr[op] ec el[se] endenum ene[w] export filt[er] fo[ld] fu[nction] h[elp] hi iabc[lear] import isp[lit] keepa l[ist] laf[ter] lbel[ow] lcscope lf[ile] lgr[ep] lli[st] lnf[ile] lol[der] lt[ag] lw[indow] menut[ranslate] mkvie[w] nbc[lose] noh[lsearch] ol[dfiles] pa[ckadd] po[p] prof[ile] pta[g] ptr[ewind] py3do python3 qa[ll] redr[aw] retu[rn] rubyd[o] sIe sN[ext] sb[uffer] sbp[revious] sci scs sf[ind] sgi si sim[alt] sm[agic] sno[magic] spe[llgood] spellu[ndo] sre[wind] st[op] stj[ump] sunme syn ta[g] tabf[ind] tabo[nly] tch[dir] tf[irst] tln tmapc[lear] try una[bbreviate] uns[ilent] vi[sual] viu[sage] wh[ile] wn[ext] x[it] xnoremenu y[ank] -syn keyword vimCommand contained addd arge[dit] b[uffer] bl[ast] breaka[dd] bun[load] cabc[lear] cal[l] cc cf[ile] changes cla[st] cnew[er] com cope[n] cscope debug delel delf[unction] dif[fupdate] difft[his] dli[st] ds[earch] echoc[onsole] elsei[f] endf[unction] enum exu[sage] fin[d] foldc[lose] go[to] ha[rdcopy] hid[e] if in iuna[bbrev] keepalt la[st] lan[guage] lbo[ttom] ld[o] lfdo lgrepa[dd] lma lo[adview] lop[en] lua m[ove] mes[sages] mod[e] nbs[tart] nor omapc[lear] packl[oadall] popu[p] profd[el] ptf[irst] pts[elect] py3f[ile] pythonx quita[ll] redraws[tatus] rew[ind] rubyf[ile] sIg sa[rgument] sba[ll] sbr[ewind] scl scscope sfir[st] sgl sic sin sm[ap] snoreme spelld[ump] spellw[rong] srg sta[g] stopi[nsert] sunmenu sync tab tabfir[st] tabp[revious] tcl th[row] tlnoremenu tn[ext] ts[elect] undoj[oin] up[date] vie[w] vne[w] wi wp[revious] xa[ll] xprop z[^.=] -syn keyword vimCommand contained al[l] argg[lobal] ba[ll] bm[odified] +" GEN_SYN_VIM: vimCommand normal, START_STR='syn keyword vimCommand contained', END_STR='' +syn keyword vimCommand contained abc[lear] abo[veleft] abs[tract] al[l] ar[gs] arga[dd] argd[elete] argdo argded[upe] arge[dit] argg[lobal] argl[ocal] argu[ment] as[cii] b[uffer] bN[ext] ba[ll] bad[d] balt bd[elete] bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bo[tright] bp[revious] br[ewind] brea[k] breaka[dd] breakd[el] breakl[ist] bro[wse] buffers bufd[o] bun[load] bw[ipeout] c[hange] cN[ext] cNf[ile] cabc[lear] cabo[ve] cad[dbuffer] cadde[xpr] caddf[ile] caf[ter] cal[l] cat[ch] cb[uffer] cbe[fore] cbel[ow] cbo[ttom] cc ccl[ose] cd cdo ce[nter] cex[pr] cf[ile] cfd[o] cfir[st] cg[etfile] cgetb[uffer] cgete[xpr] chd[ir] changes che[ckpath] checkt[ime] chi[story] cl[ist] cla[st] class clo[se] cle[arjumps] cn[ext] cnew[er] cnf[ile] co[py] col[der] colo[rscheme] +syn keyword vimCommand contained com[mand] comc[lear] comp[iler] con[tinue] conf[irm] cons[t] cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cuna[bbrev] cw[indow] d[elete] delm[arks] deb[ug] debugg[reedy] def defc[ompile] defe[r] delc[ommand] delf[unction] di[splay] dif[fupdate] diffg[et] diffo[ff] diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] echoe[rr] echom[sg] echoc[onsole] echon echow[indow] el[se] elsei[f] em[enu] en[dif] endin[terface] endc[lass] endd[ef] ende[num] endf[unction] endfo[r] endt[ry] endw[hile] ene[w] enu[m] ev[al] ex exi[t] exp[ort] exu[sage] f[ile] files filet[ype] filt[er] fin[d] fina[l] finall[y] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] +syn keyword vimCommand contained foldd[oopen] folddoc[losed] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] gu[i] gv[im] h[elp] helpc[lose] helpf[ind] helpg[rep] helpt[ags] ha[rdcopy] hi[ghlight] hid[e] his[tory] ho[rizontal] iabc[lear] if ij[ump] il[ist] imp[ort] int[ro] inte[rface] is[earch] isp[lit] iuna[bbrev] j[oin] ju[mps] k kee[pmarks] keepj[umps] keepp[atterns] keepa[lt] l[ist] lN[ext] lNf[ile] la[st] lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lc[d] lch[dir] lcl[ose] lcs[cope] ld[o] le[ft] lefta[bove] let lex[pr] leg[acy] lf[ile] lfd[o] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lgr[ep] lgrepa[dd] lh[elpgrep] lhi[story] ll lla[st] lli[st] lmak[e] lne[xt] lnew[er] lnf[ile] +syn keyword vimCommand contained lo[adview] loadk[eymap] loc[kmarks] lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks mat[ch] menut[ranslate] mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] new noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] popu[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] +syn keyword vimCommand contained python3 py3f[ile] pyx pyxd[o] pythonx pyxf[ile] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redi[r] redr[aw] redraws[tatus] redrawt[abline] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] ru[ntime] rub[y] rubyd[o] rubyf[ile] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] san[dbox] sav[eas] sb[uffer] sbN[ext] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] sc[riptnames] scripte[ncoding] scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] si[malt] sig[n] sil[ent] sl[eep] sla[st] sn[ext] so[urce] sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sr[ewind] st[op] sta[g] star[tinsert] startg[replace] startr[eplace] +syn keyword vimCommand contained stat[ic] stopi[nsert] stj[ump] sts[elect] sun[hide] sus[pend] sv[iew] sw[apname] synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tab tabc[lose] tabd[o] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] tabp[revious] tabN[ext] tabr[ewind] tabs tc[d] tch[dir] tcl tcld[o] tclf[ile] te[aroff] ter[minal] tf[irst] th[row] thi[s] tj[ump] tl[ast] tm[enu] tn[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu[nmenu] ty[pe] u[ndo] undoj[oin] undol[ist] una[bbreviate] unh[ide] unl[et] unlo[ckvar] uns[ilent] up[date] v[global] ve[rsion] verb[ose] vert[ical] vi[sual] vie[w] vim[grep] vimgrepa[dd] vim9[cmd] vim9s[cript] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wh[ile] wi[nsize] winc[md] wind[o] winp[os] +syn keyword vimCommand contained wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep deletp deletep a a +syn keyword vimCommand contained am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] sme[nu] snoreme[nu] sunme[nu] tlm[enu] tln[oremenu] tlu[nmenu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] xme[nu] xnoreme[nu] xunme[nu] +syn keyword vimCommand contained cm[ap] cno[remap] im[ap] ino[remap] lm[ap] ln[oremap] nm[ap] nn[oremap] no[remap] om[ap] ono[remap] smap snor[emap] tma[p] tno[remap] vm[ap] vn[oremap] xm[ap] xn[oremap] +syn keyword vimCommand contained cmapc[lear] imapc[lear] lmapc[lear] mapc[lear] nmapc[lear] omapc[lear] smapc[lear] tmapc[lear] vmapc[lear] xmapc[lear] +syn keyword vimCommand contained cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] tunma[p] unm[ap] vu[nmap] xu[nmap] + +syn keyword vimCommand contained 2mat[ch] 3mat[ch] + syn match vimCommand contained "\" -syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man N[ext] Over P[rint] Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Until Winbar XMLent XMLns +syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man Over Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Until Winbar XMLent XMLns " vimOptions are caught only when contained in a vimSet {{{2 -syn keyword vimOption contained acd ambw arshape aw backupskip beval bk bri bufhidden cdh ci cinsd cms commentstring conceallevel cpt cscopetagorder csto cursorlineopt dg dir ed enc equalprg expandtab fdls fex fileignorecase fml foldlevel formatexpr gcr gli guifont guitabtooltip hidden hlg imactivatefunc imi inc inex isident keymap langmap linebreak lm lsp makeencoding maxmem mh mmp more mousemoveevent mzq numberwidth opfunc patchexpr pfn pp printfont pumwidth pythonthreehome re restorescreen ro rulerformat scl scs sft shellslash shortmess showtabline slm smoothscroll spell spl srr statusline sw sxq tag tal tenc termwintype tgst titleold tpm ttm tw udir ur verbose viminfofile warn wfh wildchar wim winminheight wmh write -syn keyword vimOption contained ai anti asd awa balloondelay bevalterm bkc briopt buflisted cdhome cin cinw co compatible confirm crb cscopeverbose csverb cwh dict directory edcompatible encoding errorbells exrc fdm ff filetype fmr foldlevelstart formatlistpat gd go guifontset helpfile highlight hls imactivatekey iminsert include inf isk keymodel langmenu lines lmap luadll makeprg maxmempattern mis mmt mouse mouses mzquantum nuw osfiletype patchmode ph preserveindent printheader pvh pyx readonly revins rop runtimepath scr sect sh shelltemp shortname shq sloc sms spellcapcheck splitbelow ss stl swapfile syn tagbsearch tb term terse thesaurus titlestring tr tty twk ul ut verbosefile virtualedit wb wfw wildcharm winaltkeys winminwidth wmnu writeany -syn keyword vimOption contained akm antialias autochdir background ballooneval bex bl brk buftype cdpath cindent cinwords cocu complete copyindent cryptmethod csl cuc debug dictionary display ef endoffile errorfile fcl fdn ffs fillchars fo foldmarker formatoptions gdefault gp guifontwide helpheight history hlsearch imaf ims includeexpr infercase iskeyword keyprotocol langnoremap linespace lnr lw mat maxmemtot mkspellmem mod mousef mouseshape mzschemedll odev pa path pheader previewheight printmbcharset pvp pyxversion redrawtime ri rs sb scroll sections shcf shelltype showbreak si sm sn spellfile splitkeep ssl stmp swapsync synmaxcol tagcase tbi termbidi textauto thesaurusfunc tl ts ttybuiltin tws undodir varsofttabstop vfile visualbell wc wh wildignore wincolor winptydll wmw writebackup -syn keyword vimOption contained al ar autoindent backspace balloonevalterm bexpr bo browsedir casemap cedit cink clipboard cole completefunc cot cscopepathcomp cspc cul deco diff dy efm endofline errorformat fcs fdo fic fixendofline foldclose foldmethod formatprg gfm grepformat guiheadroom helplang hk ic imak imsearch incsearch insertmode isp keywordprg langremap lisp loadplugins lz matchpairs mco ml modeline mousefocus mouset mzschemegcdll oft packpath pdev pi previewpopup printmbfont pvw qe regexpengine rightleft rtp sbo scrollbind secure shell shellxescape showcmd sidescroll smartcase so spelllang splitright ssop sts swb syntax tagfunc tbidi termencoding textmode tildeop tm tsl ttyfast twsl undofile vartabstop vi vop wcm whichwrap wildignorecase window winwidth wop writedelay -syn keyword vimOption contained aleph arab autoread backup balloonexpr bg bomb bs cb cf cinkeys cm colorcolumn completeopt cp cscopeprg csprg culopt def diffexpr ea ei eof esckeys fdc fdt fileencoding fixeol foldcolumn foldminlines fp gfn grepprg guiligatures hf hkmap icon imc imsf inde is isprint km laststatus lispoptions lop ma matchtime mef mle modelineexpr mousehide mousetime nf ofu para penc pm previewwindow printoptions pw qftf relativenumber rightleftcmd ru sbr scrollfocus sel shellcmdflag shellxquote showcmdloc sidescrolloff smartindent softtabstop spelloptions spo st su swf ta taglength tbis termguicolors textwidth timeout to tsr ttym twt undolevels vb viewdir vsts wcr wi wildmenu winfixheight wiv wrap ws -syn keyword vimOption contained allowrevins arabic autoshelldir backupcopy bdir bh breakat bsdir cc cfu cino cmdheight columns completepopup cpo cscopequickfix csqf cursorbind define diffopt ead ek eol et fde fen fileencodings fk foldenable foldnestmax fs gfs gtl guioptions hh hkmapp iconstring imcmdline imst indentexpr isf joinspaces jumpoptions kmp lazyredraw lispwords lpl macatsui maxcombine menc mls modelines mousem mp nrformats omnifunc paragraphs perldll pmbcs printdevice prompt pythondll quickfixtextfunc remap rl rubydll sc scrolljump selection shellpipe shiftround showfulltag signcolumn smarttab sol spellsuggest spr sta sua switchbuf tabline tagrelative tbs termwinkey tf timeoutlen toolbar tsrfu ttymouse tx undoreload vbs viewoptions vts wd wic wildmode winfixwidth wiw wrapmargin ww -syn keyword vimOption contained altkeymap arabicshape autowrite backupdir bdlay bin breakindent bsk ccv ch cinoptions cmdwinheight com completeslash cpoptions cscoperelative csre cursorcolumn delcombine digraph eadirection emo ep eventignore fdi fenc fileformat fkmap foldexpr foldopen fsync gfw gtt guipty hi hkp ignorecase imd imstatusfunc indentkeys isfname js jop kp lbr list lrm magic maxfuncdepth menuitems mm modifiable mousemev mps nu opendevice paste pex pmbfn printencoding pt pythonhome quoteescape renderoptions rlc ruf scb scrolloff selectmode shellquote shiftwidth showmatch siso smc sp spf sps stal suffixes sws tabpagemax tags tc termwinscroll tfu title toolbariconsize ttimeout ttyscroll uc updatecount vdir vif wa weirdinvert wig wildoptions winheight wm wrapscan xtermcodes -syn keyword vimOption contained ambiwidth ari autowriteall backupext belloff binary breakindentopt bt cd charconvert cinscopedecls cmp comments concealcursor cpp cscopetag cst cursorline dex dip eb emoji equalalways ex fdl fencs fileformats flp foldignore foldtext ft ghr guicursor guitablabel hid hl im imdisable imstyle indk isi key kpc lcs listchars ls makeef maxmapdepth mfd mmd modified mousemodel msm number operatorfunc pastetoggle pexpr popt printexpr pumheight pythonthreedll rdt report rnu ruler scf scrollopt sessionoptions shellredir shm showmode sj smd spc spk sr startofline suffixesadd sxe tabstop tagstack tcldll termwinsize tgc titlelen top ttimeoutlen ttytype udf updatetime ve viminfo wak +" GEN_SYN_VIM: vimOption normal, START_STR='syn keyword vimOption contained', END_STR='' +syn keyword vimOption contained al aleph ari allowrevins ambw ambiwidth arab arabic arshape arabicshape acd autochdir ai autoindent ar autoread asd autoshelldir aw autowrite awa autowriteall bg background bs backspace bk backup bkc backupcopy bdir backupdir bex backupext bsk backupskip bdlay balloondelay beval ballooneval bevalterm balloonevalterm bexpr balloonexpr bo belloff bin binary bomb brk breakat bri breakindent briopt breakindentopt bsdir browsedir bh bufhidden bl buflisted bt buftype cmp casemap cdh cdhome cd cdpath cedit ccv charconvert cin cindent cink cinkeys cino cinoptions cinsd cinscopedecls cinw cinwords cb clipboard ch cmdheight cwh cmdwinheight cc colorcolumn co columns com comments cms commentstring cp compatible cpt complete cfu completefunc +syn keyword vimOption contained cot completeopt cpp completepopup csl completeslash cocu concealcursor cole conceallevel cf confirm ci copyindent cpo cpoptions cm cryptmethod cspc cscopepathcomp csprg cscopeprg csqf cscopequickfix csre cscoperelative cst cscopetag csto cscopetagorder csverb cscopeverbose crb cursorbind cuc cursorcolumn cul cursorline culopt cursorlineopt debug def define deco delcombine dict dictionary diff dex diffexpr dip diffopt dg digraph dir directory dy display ead eadirection ed edcompatible emo emoji enc encoding eof endoffile eol endofline ea equalalways ep equalprg eb errorbells ef errorfile efm errorformat ek esckeys ei eventignore et expandtab ex exrc fenc fileencoding fencs fileencodings ff fileformat ffs fileformats fic fileignorecase +syn keyword vimOption contained ft filetype fcs fillchars fixeol fixendofline fcl foldclose fdc foldcolumn fen foldenable fde foldexpr fdi foldignore fdl foldlevel fdls foldlevelstart fmr foldmarker fdm foldmethod fml foldminlines fdn foldnestmax fdo foldopen fdt foldtext fex formatexpr flp formatlistpat fo formatoptions fp formatprg fs fsync gd gdefault gfm grepformat gp grepprg gcr guicursor gfn guifont gfs guifontset gfw guifontwide ghr guiheadroom gli guiligatures go guioptions guipty gtl guitablabel gtt guitabtooltip hf helpfile hh helpheight hlg helplang hid hidden hl highlight hi history hk hkmap hkp hkmapp hls hlsearch icon iconstring ic ignorecase imaf imactivatefunc imak imactivatekey imc imcmdline imd imdisable imi iminsert ims imsearch imsf imstatusfunc +syn keyword vimOption contained imst imstyle inc include inex includeexpr is incsearch inde indentexpr indk indentkeys inf infercase im insertmode isf isfname isi isident isk iskeyword isp isprint js joinspaces jop jumpoptions key kmp keymap km keymodel kpc keyprotocol kp keywordprg lmap langmap lm langmenu lnr langnoremap lrm langremap ls laststatus lz lazyredraw lbr linebreak lines lsp linespace lisp lop lispoptions lw lispwords list lcs listchars lpl loadplugins luadll magic mef makeef menc makeencoding mp makeprg mps matchpairs mat matchtime mco maxcombine mfd maxfuncdepth mmd maxmapdepth mm maxmem mmp maxmempattern mmt maxmemtot mis menuitems msm mkspellmem ml modeline mle modelineexpr mls modelines ma modifiable mod modified more mouse mousef mousefocus +syn keyword vimOption contained mh mousehide mousem mousemodel mousemev mousemoveevent mouses mouseshape mouset mousetime mzq mzquantum mzschemedll mzschemegcdll nf nrformats nu number nuw numberwidth ofu omnifunc odev opendevice opfunc operatorfunc pp packpath para paragraphs paste pt pastetoggle pex patchexpr pm patchmode pa path perldll pi preserveindent pvh previewheight pvp previewpopup pvw previewwindow pdev printdevice penc printencoding pexpr printexpr pfn printfont pheader printheader pmbcs printmbcharset pmbfn printmbfont popt printoptions prompt ph pumheight pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions +syn keyword vimOption contained report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw shiftwidth shm shortmess sn shortname sbr showbreak sc showcmd sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl spelllang +syn keyword vimOption contained spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr splitright sol startofline stl statusline su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tal tabline tpm tabpagemax ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors twk termwinkey twsl termwinscroll tws termwinsize twt termwintype terse ta textauto tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir +syn keyword vimOption contained udf undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim wildmode wop wildoptions wak winaltkeys wcr wincolor wi window wfh winfixheight wfw winfixwidth wh winheight wmh winminheight wmw winminwidth winptydll wiw winwidth wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes " vimOptions: These are the turn-off setting variants {{{2 -syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoindent noautowrite noawa noballoonevalterm nobin nobl nobri nocdhome nocin noconfirm nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek noendoffile noeol noesckeys noexpandtab nofic nofixeol nofoldenable nogd nohid nohkmap nohls noicon noimc noimdisable noinfercase nojoinspaces nolangremap nolinebreak nolnr nolrm nomacatsui noml nomodeline nomodified nomousefocus nomousemoveevent noodev nopi noprompt norelativenumber norevins norl nors noruler nosc noscf noscrollfocus nosecure noshellslash noshiftround noshowcmd noshowmatch nosi nosmartcase nosmarttab nosmoothscroll nosn nospell nosplitright nosr nosta nostmp noswf notagbsearch notagstack notbidi notermbidi noterse notextmode notgc notildeop notitle notop nottimeout nottyfast noudf novb nowa nowb nowfh nowic nowildmenu nowinfixwidth nowmnu nowrapscan nowriteany nows -syn keyword vimOption contained noai noaltkeymap noar noarabicshape noasd noautoread noautowriteall nobackup nobeval nobinary nobomb nobuflisted nocf nocindent nocopyindent nocscoperelative nocsre nocuc nocursorcolumn nodelcombine nodigraph noed noemo noendofline noequalalways noet noexrc nofileignorecase nofk nofs nogdefault nohidden nohkmapp nohlsearch noignorecase noimcmdline noincsearch noinsertmode nojs nolazyredraw nolisp noloadplugins nolz nomagic nomle nomodelineexpr nomore nomousehide nonu noopendevice nopreserveindent nopvw noremap nori nornu noru nosb noscb noscrollbind noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosms nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs notermguicolors notextauto notf notgst notimeout noto notr nottybuiltin notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup noxtermcodes -syn keyword vimOption contained noakm noanti noarab noari noautochdir noautoshelldir noaw noballooneval nobevalterm nobk nobreakindent nocdh noci nocompatible nocp nocscopetag nocst nocul nocursorline nodg noea noedcompatible noemoji noeof noerrorbells noex nofen nofixendofline nofkmap nofsync noguipty nohk nohkp noic noim noimd noinf nois nolangnoremap nolbr nolist nolpl noma nomh nomod nomodifiable nomousef nomousemev nonumber nopaste nopreviewwindow noreadonly norestorescreen norightleft noro +" GEN_SYN_VIM: vimOption turn-off, START_STR='syn keyword vimOption contained', END_STR='' +syn keyword vimOption contained noari noallowrevins noarab noarabic noarshape noarabicshape noacd noautochdir noai noautoindent noar noautoread noasd noautoshelldir noaw noautowrite noawa noautowriteall nobk nobackup nobeval noballooneval nobevalterm noballoonevalterm nobin nobinary nobomb nobri nobreakindent nobl nobuflisted nocdh nocdhome nocin nocindent nocp nocompatible nocf noconfirm noci nocopyindent nocsre nocscoperelative nocst nocscopetag nocsverb nocscopeverbose nocrb nocursorbind nocuc nocursorcolumn nocul nocursorline nodeco nodelcombine nodiff nodg nodigraph noed noedcompatible noemo noemoji noeof noendoffile noeol noendofline noea noequalalways noeb noerrorbells noek noesckeys noet noexpandtab noex noexrc nofic nofileignorecase nofixeol nofixendofline +syn keyword vimOption contained nofen nofoldenable nofs nofsync nogd nogdefault noguipty nohid nohidden nohk nohkmap nohkp nohkmapp nohls nohlsearch noicon noic noignorecase noimc noimcmdline noimd noimdisable nois noincsearch noinf noinfercase noim noinsertmode nojs nojoinspaces nolnr nolangnoremap nolrm nolangremap nolz nolazyredraw nolbr nolinebreak nolisp nolist nolpl noloadplugins nomagic noml nomodeline nomle nomodelineexpr noma nomodifiable nomod nomodified nomore nomousef nomousefocus nomh nomousehide nomousemev nomousemoveevent nonu nonumber noodev noopendevice nopaste nopi nopreserveindent nopvw nopreviewwindow noprompt noro noreadonly nornu norelativenumber noremap nors norestorescreen nori norevins norl norightleft noru noruler noscb noscrollbind noscf noscrollfocus +syn keyword vimOption contained nosecure nossl noshellslash nostmp noshelltemp nosr noshiftround nosn noshortname nosc noshowcmd nosft noshowfulltag nosm noshowmatch nosmd noshowmode noscs nosmartcase nosi nosmartindent nosta nosmarttab nosms nosmoothscroll nospell nosb nosplitbelow nospr nosplitright nosol nostartofline noswf noswapfile notbs notagbsearch notr notagrelative notgst notagstack notbidi notermbidi notgc notermguicolors noterse nota notextauto notx notextmode notop notildeop noto notimeout notitle nottimeout notbi nottybuiltin notf nottyfast noudf noundofile novb novisualbell nowarn nowiv noweirdinvert nowic nowildignorecase nowmnu nowildmenu nowfh nowinfixheight nowfw nowinfixwidth nowrap nows nowrapscan nowrite nowa nowriteany nowb nowritebackup +syn keyword vimOption contained noxtermcodes " vimOptions: These are the invertible variants {{{2 -syn keyword vimOption contained invacd invallowrevins invantialias invarabic invarshape invautoindent invautowrite invawa invballoonevalterm invbin invbl invbri invcdhome invcin invconfirm invcrb invcscopeverbose invcsverb invcursorbind invdeco invdiff inveb invek invendoffile inveol invesckeys invexpandtab invfic invfixeol invfoldenable invgd invhid invhkmap invhls invicon invimc invimdisable invinfercase invjoinspaces invlangremap invlinebreak invlnr invlrm invmacatsui invml invmodeline invmodified invmousefocus invmousemoveevent invodev invpi invprompt invrelativenumber invrevins invrl invrs invruler invsc invscf invscrollfocus invsecure invshellslash invshiftround invshowcmd invshowmatch invsi invsmartcase invsmarttab invsmoothscroll invsn invspell invsplitright invsr invsta invstmp invswf invtagbsearch invtagstack invtbidi invtermbidi invterse invtextmode invtgc invtildeop invtitle invtop invttimeout invttyfast invudf invvb invwa invwb invwfh invwic invwildmenu invwinfixwidth invwmnu invwrapscan invwriteany invws -syn keyword vimOption contained invai invaltkeymap invar invarabicshape invasd invautoread invautowriteall invbackup invbeval invbinary invbomb invbuflisted invcf invcindent invcopyindent invcscoperelative invcsre invcuc invcursorcolumn invdelcombine invdigraph inved invemo invendofline invequalalways invet invexrc invfileignorecase invfk invfs invgdefault invhidden invhkmapp invhlsearch invignorecase invimcmdline invincsearch invinsertmode invjs invlazyredraw invlisp invloadplugins invlz invmagic invmle invmodelineexpr invmore invmousehide invnu invopendevice invpreserveindent invpvw invremap invri invrnu invru invsb invscb invscrollbind invscs invsft invshelltemp invshortname invshowfulltag invshowmode invsm invsmartindent invsmd invsms invsol invsplitbelow invspr invssl invstartofline invswapfile invta invtagrelative invtbi invtbs invtermguicolors invtextauto invtf invtgst invtimeout invto invtr invttybuiltin invtx invundofile invvisualbell invwarn invweirdinvert invwfw invwildignorecase invwinfixheight invwiv invwrap invwrite invwritebackup invxtermcodes -syn keyword vimOption contained invakm invanti invarab invari invautochdir invautoshelldir invaw invballooneval invbevalterm invbk invbreakindent invcdh invci invcompatible invcp invcscopetag invcst invcul invcursorline invdg invea invedcompatible invemoji inveof inverrorbells invex invfen invfixendofline invfkmap invfsync invguipty invhk invhkp invic invim invimd invinf invis invlangnoremap invlbr invlist invlpl invma invmh invmod invmodifiable invmousef invmousemev invnumber invpaste invpreviewwindow invreadonly invrestorescreen invrightleft invro +" GEN_SYN_VIM: vimOption invertible, START_STR='syn keyword vimOption contained', END_STR='' +syn keyword vimOption contained invari invallowrevins invarab invarabic invarshape invarabicshape invacd invautochdir invai invautoindent invar invautoread invasd invautoshelldir invaw invautowrite invawa invautowriteall invbk invbackup invbeval invballooneval invbevalterm invballoonevalterm invbin invbinary invbomb invbri invbreakindent invbl invbuflisted invcdh invcdhome invcin invcindent invcp invcompatible invcf invconfirm invci invcopyindent invcsre invcscoperelative invcst invcscopetag invcsverb invcscopeverbose invcrb invcursorbind invcuc invcursorcolumn invcul invcursorline invdeco invdelcombine invdiff invdg invdigraph inved invedcompatible invemo invemoji inveof invendoffile inveol invendofline invea invequalalways inveb inverrorbells invek invesckeys +syn keyword vimOption contained invet invexpandtab invex invexrc invfic invfileignorecase invfixeol invfixendofline invfen invfoldenable invfs invfsync invgd invgdefault invguipty invhid invhidden invhk invhkmap invhkp invhkmapp invhls invhlsearch invicon invic invignorecase invimc invimcmdline invimd invimdisable invis invincsearch invinf invinfercase invim invinsertmode invjs invjoinspaces invlnr invlangnoremap invlrm invlangremap invlz invlazyredraw invlbr invlinebreak invlisp invlist invlpl invloadplugins invmagic invml invmodeline invmle invmodelineexpr invma invmodifiable invmod invmodified invmore invmousef invmousefocus invmh invmousehide invmousemev invmousemoveevent invnu invnumber invodev invopendevice invpaste invpi invpreserveindent invpvw invpreviewwindow +syn keyword vimOption contained invprompt invro invreadonly invrnu invrelativenumber invremap invrs invrestorescreen invri invrevins invrl invrightleft invru invruler invscb invscrollbind invscf invscrollfocus invsecure invssl invshellslash invstmp invshelltemp invsr invshiftround invsn invshortname invsc invshowcmd invsft invshowfulltag invsm invshowmatch invsmd invshowmode invscs invsmartcase invsi invsmartindent invsta invsmarttab invsms invsmoothscroll invspell invsb invsplitbelow invspr invsplitright invsol invstartofline invswf invswapfile invtbs invtagbsearch invtr invtagrelative invtgst invtagstack invtbidi invtermbidi invtgc invtermguicolors invterse invta invtextauto invtx invtextmode invtop invtildeop invto invtimeout invtitle invttimeout invtbi invttybuiltin +syn keyword vimOption contained invtf invttyfast invudf invundofile invvb invvisualbell invwarn invwiv invweirdinvert invwic invwildignorecase invwmnu invwildmenu invwfh invwinfixheight invwfw invwinfixwidth invwrap invws invwrapscan invwrite invwa invwriteany invwb invwritebackup invxtermcodes " termcap codes (which can also be set) {{{2 -syn keyword vimOption contained t_8b t_8u t_AF t_AL t_bc t_BE t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_Ds t_EI t_F2 t_F4 t_F6 t_F8 t_fd t_fs t_IE t_k1 t_k2 t_K3 t_K4 t_K5 t_K6 t_K7 t_K8 t_K9 t_kb t_KB t_kd t_KD t_KE t_KG t_KH t_KI t_KK t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_PE t_PS t_RB t_RC t_RF t_Ri t_RI t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH t_Si t_SI t_so t_sr t_SR t_ST t_te t_Te t_TE t_ti t_TI t_ts t_Ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_vs t_VS t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR -syn keyword vimOption contained t_8f t_AB t_al t_AU t_BD t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_ds t_EC t_F1 t_F3 t_F5 t_F7 t_F9 t_fe t_GP t_IS t_K1 t_k3 t_k4 t_k5 t_k6 t_k7 t_k8 t_k9 t_KA t_kB t_KC t_kD t_ke t_KF t_kh t_kI t_KJ t_kl +" GEN_SYN_VIM: vimOption term output code, START_STR='syn keyword vimOption contained', END_STR='' +syn keyword vimOption contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD t_cd t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds t_Ds t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f t_8b t_8u +" term key codes +syn keyword vimOption contained t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ku syn match vimOption contained "t_%1" syn match vimOption contained "t_#2" syn match vimOption contained "t_#4" @@ -78,35 +85,37 @@ syn match vimOption contained "t_%i" syn match vimOption contained "t_k;" " unsupported settings: some were supported by vi but don't do anything in vim {{{2 -" others have been dropped along with msdos support -syn keyword vimErrSetting contained bioskey biosk conskey consk autoprint beautify flash graphic hardtabs mesg novice open op optimize redraw slow slowopen sourceany w300 w1200 w9600 hardtabs ht nobioskey nobiosk noconskey noconsk noautoprint nobeautify noflash nographic nohardtabs nomesg nonovice noopen noop nooptimize noredraw noslow noslowopen nosourceany now300 now1200 now9600 w1200 w300 w9600 +" GEN_SYN_VIM: Missing vimOption, START_STR='syn keyword vimErrSetting contained', END_STR='' +syn keyword vimErrSetting contained akm altkeymap anti antialias ap autoprint bf beautify biosk bioskey consk conskey fk fkmap fl flash gr graphic ht hardtabs macatsui mesg novice open opt optimize oft osfiletype redraw slow slowopen sourceany w1200 w300 w9600 +syn keyword vimErrSetting contained noakm noaltkeymap noanti noantialias noap noautoprint nobf nobeautify nobiosk nobioskey noconsk noconskey nofk nofkmap nofl noflash nogr nographic nomacatsui nomesg nonovice noopen noopt nooptimize noredraw noslow noslowopen nosourceany +syn keyword vimErrSetting contained invakm invaltkeymap invanti invantialias invap invautoprint invbf invbeautify invbiosk invbioskey invconsk invconskey invfk invfkmap invfl invflash invgr invgraphic invmacatsui invmesg invnovice invopen invopt invoptimize invredraw invslow invslowopen invsourceany " AutoCmd Events {{{2 syn case ignore -syn keyword vimAutoEvent contained BufAdd BufDelete BufFilePost BufHidden BufNew BufRead BufReadPost BufUnload BufWinLeave BufWrite BufWritePost CmdlineChanged CmdlineLeave CmdwinEnter ColorScheme CompleteChanged CompleteDonePre CursorHoldI CursorMovedI DiffUpdated DirChanged DirChangedPre EncodingChanged ExitPre FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileChangedShellPost FileEncoding FileExplorer FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter GUIFailed InsertChange InsertCharPre InsertEnter InsertLeave InsertLeavePre MenuPopup ModeChanged OptionSet QuickFixCmdPost QuickFixCmdPre QuitPre RemoteReply SafeState SafeStateAgain SessionLoadPost ShellCmdPost ShellFilterPost SigUSR1 SourceCmd SourcePost SourcePre SpellFileMissing StdinReadPost StdinReadPre SwapExists Syntax TabClosed TabEnter TabLeave TabNew TermChanged TerminalOpen TerminalWinOpen TermResponse TermResponseAll TextChanged TextChangedI TextChangedP TextChangedT TextYankPost User VimEnter VimLeave VimLeavePre VimResized VimResume VimSuspend WinClosed WinEnter WinLeave WinNewPre WinNew WinResized WinScrolled -syn keyword vimAutoEvent contained BufCreate BufEnter BufFilePre BufLeave BufNewFile BufReadCmd BufReadPre BufWinEnter BufWipeout BufWriteCmd BufWritePre CmdlineEnter CmdUndefined CmdwinLeave ColorSchemePre CompleteDone CursorHold CursorMoved +" GEN_SYN_VIM: vimAutoEvent, START_STR='syn keyword vimAutoEvent contained', END_STR='' +syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWritePost BufWritePre BufWriteCmd CmdlineChanged CmdlineEnter CmdlineLeave CmdwinEnter CmdwinLeave CmdUndefined ColorScheme ColorSchemePre CompleteChanged CompleteDone CompleteDonePre CursorHold CursorHoldI CursorMoved CursorMovedI DiffUpdated DirChanged DirChangedPre EncodingChanged ExitPre FileEncoding FileAppendPost FileAppendPre FileAppendCmd FileChangedShell FileChangedShellPost FileChangedRO FileReadPost FileReadPre FileReadCmd FileType FileWritePost FileWritePre FileWriteCmd FilterReadPost FilterReadPre FilterWritePost FilterWritePre +syn keyword vimAutoEvent contained FocusGained FocusLost FuncUndefined GUIEnter GUIFailed InsertChange InsertEnter InsertLeave InsertLeavePre InsertCharPre MenuPopup ModeChanged OptionSet QuickFixCmdPost QuickFixCmdPre QuitPre RemoteReply SafeState SafeStateAgain SessionLoadPost ShellCmdPost ShellFilterPost SigUSR1 SourceCmd SourcePre SourcePost SpellFileMissing StdinReadPost StdinReadPre SwapExists Syntax TabNew TabClosed TabEnter TabLeave TermChanged TerminalOpen TerminalWinOpen TermResponse TermResponseAll TextChanged TextChangedI TextChangedP TextChangedT User VimEnter VimLeave VimLeavePre WinNewPre WinNew WinClosed WinEnter WinLeave WinResized WinScrolled VimResized TextYankPost VimSuspend VimResume " Highlight commonly used Groupnames {{{2 syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo " Default highlighting groups {{{2 -syn keyword vimHLGroup contained ColorColumn CurSearch Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr LineNrAbove LineNrBelow MatchParen Menu MessageWindow ModeMsg MoreMsg NonText Normal Pmenu PmenuExtra PmenuExtraSel PmenuKind PmenuKindSel PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC StatusLineTerm StatusLineTermNC TabLine TabLineFill TabLineSel Terminal Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu -syn match vimHLGroup contained "Conceal" +" GEN_SYN_VIM: vimHLGroup, START_STR='syn keyword vimHLGroup contained', END_STR='' +syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit VisualNOS DiffText PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuExtra PmenuExtraSel Normal Directory LineNr CursorLineNr MoreMsg Question Search SpellBad SpellCap SpellRare SpellLocal PmenuThumb Pmenu PmenuSel SpecialKey Title WarningMsg WildMenu Folded FoldColumn SignColumn Visual DiffAdd DiffChange DiffDelete TabLine CursorColumn CursorLine ColorColumn Conceal MatchParen StatusLineTerm StatusLineTermNC ToolbarLine ToolbarButton Menu Tooltip Scrollbar CursorIM syn case match " Function Names {{{2 -syn keyword vimFuncName contained abs argc assert_equal assert_match atan balloon_show bufexists bufwinid ceil ch_canread ch_getbufnr ch_read ch_status complete_check count deletebufline digraph_set eval exists_compiled extendnew findfile fnameescape foldtextresult get getchangelist getcmdcompltype getcompletion getfperm getline getpid getscriptinfo getwininfo glob2regpat histadd hlID indexof inputsecret isinf job_setoptions js_encode libcall list2str log10 mapnew matchdelete matchstrpos mzeval popup_atcursor popup_filter_menu popup_getpos popup_move pow prompt_setinterrupt prop_find prop_type_delete py3eval readblob reg_executing remote_expr remote_startserver reverse screenchars search searchpos setcellwidths setcursorcharpos setmatches settabwinvar shiftwidth sign_place simplify sound_clear spellbadword state strcharpart stridx strridx substitute synID systemlist taglist term_dumpload term_getcursor term_getstatus term_scrape term_setrestore test_autochdir test_gui_event test_null_dict test_null_string test_settime timer_pause toupper typename values winbufnr win_getid win_id2win winnr win_splitmove -syn keyword vimFuncName contained acos argidx assert_equalfile assert_nobeep atan2 balloon_split buflisted bufwinnr changenr ch_close ch_getjob ch_readblob cindent complete_info cscope_connection did_filetype digraph_setlist eventhandler exp feedkeys flatten fnamemodify foreground getbufinfo getchar getcmdline getcurpos getfsize getloclist getpos gettabinfo getwinpos globpath histdel hlset input insert islocked job_start json_decode libcallnr listener_add luaeval mapset matchend max nextnonblank popup_beval popup_filter_yesno popup_hide popup_notification prevnonblank prompt_setprompt prop_list prop_type_get pyeval readdir reg_recording remote_foreground remove round screencol searchcount server2client setcharpos setenv setpos settagstack sign_define sign_placelist sin soundfold spellsuggest str2float strchars string strtrans swapfilelist synIDattr tabpagebuflist tan term_dumpwrite term_getjob term_gettitle term_sendkeys term_setsize test_feedinput test_ignore_error test_null_function test_option_not_set test_srand_seed timer_start tr undofile virtcol wincol win_gettype winlayout winrestcmd winwidth -syn keyword vimFuncName contained add arglistid assert_exception assert_notequal autocmd_add blob2list bufload byte2line char2nr ch_close_in ch_info ch_readraw clearmatches confirm cursor diff_filler echoraw executable expand filereadable flattennew foldclosed fullcommand getbufline getcharmod getcmdpos getcursorcharpos getftime getmarklist getqflist gettabvar getwinposx has histget hostname inputdialog interrupt isnan job_status json_encode line listener_flush map match matchfuzzy menu_info nr2char popup_clear popup_findecho popup_list popup_setoptions printf prop_add prop_remove prop_type_list pyxeval readdirex reltime remote_peek rename rubyeval screenpos searchdecl serverlist setcharsearch setfperm setqflist setwinvar sign_getdefined sign_undefine sinh sound_playevent split str2list strdisplaywidth strlen strutf16len swapinfo synIDtrans tabpagenr tanh term_getaltscreen term_getline term_gettty term_setansicolors term_start test_garbagecollect_now test_mswin_event test_null_job test_override test_unknown timer_stop trim undotree virtcol2col windowsversion win_gotoid winline winrestview wordcount -syn keyword vimFuncName contained and argv assert_fails assert_notmatch autocmd_delete browse bufloaded byteidx charclass chdir ch_log ch_sendexpr col copy debugbreak diff_hlID empty execute expandcmd filewritable float2nr foldclosedend funcref getbufoneline getcharpos getcmdscreenpos getcwd getftype getmatches getreg gettabwinvar getwinposy has_key histnr iconv inputlist invert items job_stop keys line2byte listener_remove maparg matchadd matchfuzzypos min or popup_close popup_findinfo popup_locate popup_settext prompt_getprompt prop_add_list prop_type_add pum_getpos rand readfile reltimefloat remote_read repeat screenattr screenrow searchpair setbufline setcmdline setline setreg sha256 sign_getplaced sign_unplace slice sound_playfile sqrt str2nr strftime strpart strwidth swapname synstack tabpagewinnr tempname term_getansicolors term_getscrolled terminalprops term_setapi term_wait test_garbagecollect_soon test_null_blob test_null_list test_refcount test_void timer_stopall trunc uniq visualmode win_execute winheight win_move_separator winsaveview writefile -syn keyword vimFuncName contained append asin assert_false assert_report autocmd_get browsedir bufname byteidxcomp charcol ch_evalexpr ch_logfile ch_sendraw complete cos deepcopy digraph_get environ exepath expr10 filter floor foldlevel function getbufvar getcharsearch getcmdtype getenv getimstatus getmousepos getreginfo gettagstack getwinvar haslocaldir hlexists indent inputrestore isabsolutepath job_getchannel join keytrans lispindent localtime mapcheck matchaddpos matchlist mkdir pathshorten popup_create popup_findpreview popup_menu popup_show prompt_setcallback prop_clear prop_type_change pumvisible range reduce reltimestr remote_send resolve screenchar screenstring searchpairpos setbufvar setcmdpos setloclist settabvar shellescape sign_jump sign_unplacelist sort sound_stop srand strcharlen strgetchar strptime submatch synconcealed system tagfiles term_dumpdiff term_getattr term_getsize term_list term_setkill test_alloc_fail test_getvalue test_null_channel test_null_partial test_setmouse timer_info tolower type utf16idx wildmenumode win_findbuf win_id2tabwin win_move_statusline win_screenpos xor -syn keyword vimFuncName contained appendbufline assert_beeps assert_inrange assert_true balloon_gettext bufadd bufnr call charidx ch_evalraw ch_open ch_setoptions complete_add cosh delete digraph_getlist escape exists extend finddir fmod foldtext garbagecollect getcellwidths getcharstr getcmdwintype getfontname getjumplist getmouseshape getregtype gettext glob hasmapto hlget index inputsave isdirectory job_info js_decode len list2blob log maplist matcharg matchstr mode perleval popup_dialog popup_getoptions +" GEN_SYN_VIM: vimFuncName, START_STR='syn keyword vimFuncName contained', END_STR='' +syn keyword vimFuncName contained abs acos add and append appendbufline argc argidx arglistid argv asin assert_beeps assert_equal assert_equalfile assert_exception assert_fails assert_false assert_inrange assert_match assert_nobeep assert_notequal assert_notmatch assert_report assert_true atan atan2 autocmd_add autocmd_delete autocmd_get balloon_gettext balloon_show balloon_split blob2list browse browsedir bufadd bufexists buflisted bufload bufloaded bufname bufnr bufwinid bufwinnr byte2line byteidx byteidxcomp call ceil ch_canread ch_close ch_close_in ch_evalexpr ch_evalraw ch_getbufnr ch_getjob ch_info ch_log ch_logfile ch_open ch_read ch_readblob ch_readraw ch_sendexpr ch_sendraw ch_setoptions ch_status changenr char2nr charclass charcol charidx chdir cindent +syn keyword vimFuncName contained clearmatches col complete complete_add complete_check complete_info confirm copy cos cosh count cscope_connection cursor debugbreak deepcopy delete deletebufline did_filetype diff diff_filler diff_hlID digraph_get digraph_getlist digraph_set digraph_setlist echoraw empty environ err_teapot escape eval eventhandler executable execute exepath exists exists_compiled exp expand expandcmd extend extendnew feedkeys filereadable filewritable filter finddir findfile flatten flattennew float2nr floor fmod fnameescape fnamemodify foldclosed foldclosedend foldlevel foldtext foldtextresult foreach foreground fullcommand funcref function garbagecollect get getbufinfo getbufline getbufoneline getbufvar getcellwidths getchangelist getchar getcharmod +syn keyword vimFuncName contained getcharpos getcharsearch getcharstr getcmdcompltype getcmdline getcmdpos getcmdscreenpos getcmdtype getcmdwintype getcompletion getcurpos getcursorcharpos getcwd getenv getfontname getfperm getfsize getftime getftype getimstatus getjumplist getline getloclist getmarklist getmatches getmousepos getmouseshape getpid getpos getqflist getreg getreginfo getregtype getscriptinfo gettabinfo gettabvar gettabwinvar gettagstack gettext getwininfo getwinpos getwinposx getwinposy getwinvar glob glob2regpat globpath has has_key haslocaldir hasmapto histadd histdel histget histnr hlID hlexists hlget hlset hostname iconv indent index indexof input inputdialog inputlist inputrestore inputsave inputsecret insert instanceof interrupt invert isabsolutepath +syn keyword vimFuncName contained isdirectory isinf islocked isnan items job_getchannel job_info job_setoptions job_start job_status job_stop join js_decode js_encode json_decode json_encode keys keytrans len libcall libcallnr line line2byte lispindent list2blob list2str listener_add listener_flush listener_remove localtime log log10 luaeval map maparg mapcheck maplist mapnew mapset match matchadd matchaddpos matcharg matchbufline matchdelete matchend matchfuzzy matchfuzzypos matchlist matchstr matchstrlist matchstrpos max menu_info min mkdir mode mzeval nextnonblank nr2char or pathshorten perleval popup_atcursor popup_beval popup_clear popup_close popup_create popup_dialog popup_filter_menu popup_filter_yesno popup_findecho popup_findinfo popup_findpreview popup_getoptions +syn keyword vimFuncName contained popup_getpos popup_hide popup_list popup_locate popup_menu popup_move popup_notification popup_setoptions popup_settext popup_show pow prevnonblank printf prompt_getprompt prompt_setcallback prompt_setinterrupt prompt_setprompt prop_add prop_add_list prop_clear prop_find prop_list prop_remove prop_type_add prop_type_change prop_type_delete prop_type_get prop_type_list pum_getpos pumvisible py3eval pyeval pyxeval rand range readblob readdir readdirex readfile reduce reg_executing reg_recording reltime reltimefloat reltimestr remote_expr remote_foreground remote_peek remote_read remote_send remote_startserver remove rename repeat resolve reverse round rubyeval screenattr screenchar screenchars screencol screenpos screenrow screenstring +syn keyword vimFuncName contained search searchcount searchdecl searchpair searchpairpos searchpos server2client serverlist setbufline setbufvar setcellwidths setcharpos setcharsearch setcmdline setcmdpos setcursorcharpos setenv setfperm setline setloclist setmatches setpos setqflist setreg settabvar settabwinvar settagstack setwinvar sha256 shellescape shiftwidth sign_define sign_getdefined sign_getplaced sign_jump sign_place sign_placelist sign_undefine sign_unplace sign_unplacelist simplify sin sinh slice sort sound_clear sound_playevent sound_playfile sound_stop soundfold spellbadword spellsuggest split sqrt srand state str2float str2list str2nr strcharlen strcharpart strchars strdisplaywidth strftime strgetchar stridx string strlen strpart strptime strridx +syn keyword vimFuncName contained strtrans strutf16len strwidth submatch substitute swapfilelist swapinfo swapname synID synIDattr synIDtrans synconcealed synstack system systemlist tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan tanh tempname term_dumpdiff term_dumpload term_dumpwrite term_getaltscreen term_getansicolors term_getattr term_getcursor term_getjob term_getline term_getscrolled term_getsize term_getstatus term_gettitle term_gettty term_list term_scrape term_sendkeys term_setansicolors term_setapi term_setkill term_setrestore term_setsize term_start term_wait terminalprops test_alloc_fail test_autochdir test_feedinput test_garbagecollect_now test_garbagecollect_soon test_getvalue test_gui_event test_ignore_error test_mswin_event test_null_blob +syn keyword vimFuncName contained test_null_channel test_null_dict test_null_function test_null_job test_null_list test_null_partial test_null_string test_option_not_set test_override test_refcount test_setmouse test_settime test_srand_seed test_unknown test_void timer_info timer_pause timer_start timer_stop timer_stopall tolower toupper tr trim trunc type typename undofile undotree uniq utf16idx values virtcol virtcol2col visualmode wildmenumode win_execute win_findbuf win_getid win_gettype win_gotoid win_id2tabwin win_id2win win_move_separator win_move_statusline win_screenpos win_splitmove winbufnr wincol windowsversion winheight winlayout winline winnr winrestcmd winrestview winsaveview winwidth wordcount writefile xor "--- syntax here and above generated by mkvimvim --- - -syn keyword vimCommand contained 2mat[ch] 3mat[ch] -syn keyword vimFuncName contained foreach - " Special Vim Highlighting (not automatic) {{{1 " Set up folding commands for this syntax highlighting file {{{2 @@ -168,9 +177,6 @@ else com! -nargs=* VimFoldt endif -" commands not picked up by the generator (due to non-standard format) {{{2 -syn keyword vimCommand contained py3 - " Deprecated variable options {{{2 if exists("g:vim_minlines") let g:vimsyn_minlines= g:vim_minlines @@ -328,7 +334,8 @@ if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nousercmderror") endif syn case ignore syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister] -syn keyword vimUserAttrbCmplt contained augroup buffer behave color command compiler cscope dir environment event expression file file_in_path filetype function help highlight history locale mapping menu option packadd shellcmd sign syntax syntime tag tag_listfiles user var +" GEN_SYN_VIM: vimUserAttrbCmplt, START_STR='syn keyword vimUserAttrbCmplt contained', END_STR='' +syn keyword vimUserAttrbCmplt contained arglist augroup behave buffer color command compiler cscope diff_buffer dir environment event expression file file_in_path filetype function help highlight history keymap locale mapclear mapping menu messages syntax syntime option packadd runtime shellcmd sign tag tag_listfiles user var breakpoint scriptnames syn keyword vimUserAttrbCmplt contained custom customlist nextgroup=vimUserAttrbCmpltFunc,vimUserCmdError syn match vimUserAttrbCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%([.#]\h\w*\)\+\|\h\w*\)"hs=s+1 nextgroup=vimUserCmdError @@ -463,7 +470,8 @@ syn keyword vimLet var skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc syn keyword vimFor for skipwhite nextgroup=vimVar,vimVarList " Abbreviations: {{{2 " ============= -syn keyword vimAbb ab[breviate] ca[bbrev] inorea[bbrev] cnorea[bbrev] norea[bbrev] ia[bbrev] skipwhite nextgroup=vimMapMod,vimMapLhs +" GEN_SYN_VIM: vimCommand abbrev, START_STR='syn keyword vimAbb', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs' +syn keyword vimAbb ab[breviate] ca[bbrev] cnorea[bbrev] ia[bbrev] inorea[bbrev] norea[bbrev] skipwhite nextgroup=vimMapMod,vimMapLhs " Autocmd: {{{2 " ======= @@ -486,9 +494,12 @@ syn case match " ==== syn match vimMap "\\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMap "\" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs @@ -501,7 +512,8 @@ syn case match " Menus: {{{2 " ===== syn cluster vimMenuList contains=vimMenuBang,vimMenuPriority,vimMenuName,vimMenuMod -syn keyword vimCommand am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] skipwhite nextgroup=@vimMenuList +" GEN_SYN_VIM: vimCommand menu, START_STR='syn keyword vimCommand', END_STR='skipwhite nextgroup=@vimMenuList' +syn keyword vimCommand am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] sme[nu] snoreme[nu] sunme[nu] tlm[enu] tln[oremenu] tlu[nmenu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] xme[nu] xnoreme[nu] xunme[nu] skipwhite nextgroup=@vimMenuList syn match vimMenuName "[^ \t\\<]\+" contained nextgroup=vimMenuNameMore,vimMenuMap syn match vimMenuPriority "\d\+\(\.\d\+\)*" contained skipwhite nextgroup=vimMenuName syn match vimMenuNameMore "\c\\\s\|\|\\\." contained nextgroup=vimMenuName,vimMenuNameMore contains=vimNotation From 34e4a05d02a016fe230495be8f6c60ddd56f9567 Mon Sep 17 00:00:00 2001 From: Maxim Kim Date: Wed, 14 Feb 2024 20:28:17 +0100 Subject: [PATCH 040/426] patch 9.1.0106: Visual highlight hard to read with 'termguicolors' Problem: Visual highlight hard to read with 'termguicolors' (Maxim Kim) Solution: Set Visual GUI foreground to black (with background=light) and lightgrey (with background=dark) (Maxim Kim) fixes: #14024 closes: #14025 Signed-off-by: Maxim Kim Signed-off-by: Christian Brabandt --- src/highlight.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/highlight.c b/src/highlight.c index 7fbeeb72a8..9b3b072446 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -222,7 +222,7 @@ static char *(highlight_init_light[]) = { "SignColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue"), #endif CENT("Visual ctermbg=Grey ctermfg=Black", - "Visual ctermbg=Grey ctermfg=Black guibg=LightGrey"), + "Visual ctermbg=Grey ctermfg=Black guibg=LightGrey guifg=Black"), #ifdef FEAT_DIFF CENT("DiffAdd term=bold ctermbg=LightBlue", "DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue"), @@ -311,7 +311,7 @@ static char *(highlight_init_dark[]) = { "SignColumn term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan"), #endif CENT("Visual ctermbg=Grey ctermfg=Black", - "Visual ctermbg=Grey ctermfg=Black guibg=#575757"), + "Visual ctermbg=Grey ctermfg=Black guibg=#575757 guifg=LightGrey"), #ifdef FEAT_DIFF CENT("DiffAdd term=bold ctermbg=DarkBlue", "DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue"), diff --git a/src/version.c b/src/version.c index 65b653099f..c79fd6b1b7 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 106, /**/ 105, /**/ From 49f2ba6d41d3c6142deaa4a50b0b16e03969a904 Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Wed, 14 Feb 2024 20:34:58 +0100 Subject: [PATCH 041/426] patch 9.1.0107: CI: Fix MacOS-14 tests Problem: CI: Fix MacOS-14 tests (after 9.1.0070) Solution: Re-enable sound tests by granting Mic access, disable Test_diff_screen because of buggy MacOS diff (non GNU version), re-enable Test_term_gettitle() (Yee Cheng Chin) macos-14 runner was turned on in #13943, but it had to turn off a few tests in order for CI to run. Re-enable them and fix the underlying issues. * `Test_diff_screen`: The test failure is due to a bug in Apple's diff utility. Apple introduced a new diff tool based on FreeBSD in macOS 13 and it has buggy behaviors when using unified diff (`-U0`) and the diff is on the first line of the file. Simply disable this test for now if we detect Apple diff (instead of the old GNU diff). Can re-enable this in the future if Apple fixes the issue. * `Test_play_event` / `Test_play_silent`: GitHub Actions currently has an issue with playing sound in CI in macos-14 runners. It for some reason triggers a microphone permission dialog popup which blocks the CI action (see https://github.com/actions/runner-images/issues/9330). To fix this, add a temporary step in macos-14 to manually allow microphone permissions in the runner. * `Test_term_gettitle`: I could not reproduce the failure, so I just turned it on and it seems to run just fine. Maybe it's a timing issue and whatnot but either way that should be fixed when we can reproduce the issue. closes: #14032 Signed-off-by: Yee Cheng Chin Signed-off-by: Christian Brabandt --- .github/workflows/ci.yml | 16 ++++++++-------- src/testdir/test_diffmode.vim | 4 ++-- src/testdir/test_sound.vim | 7 ------- src/testdir/test_terminal2.vim | 4 ---- src/version.c | 2 ++ 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2746605d2b..677630baa2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -319,17 +319,17 @@ jobs: - name: Checkout repository from github uses: actions/checkout@v4 - - name: Install packages on Intel Mac - if: matrix.features == 'huge' && matrix.runner == 'macos-latest' + - name: Install packages + if: matrix.features == 'huge' run: | - brew install lua - echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV + brew install lua libtool + echo "LUA_PREFIX=$(brew --prefix)" >> $GITHUB_ENV - - name: Install packages on M1 Mac - if: matrix.features == 'huge' && matrix.runner == 'macos-14' + - name: Grant microphone access for macos-14 + if: matrix.runner == 'macos-14' run: | - brew install lua libtool - echo "LUA_PREFIX=/opt/homebrew" >> $GITHUB_ENV + # Temporary fix to fix microphone permission issues for macos-14 when playing sound. + sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);" - name: Set up environment run: | diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim index bae94f6a87..b44879f71e 100644 --- a/src/testdir/test_diffmode.vim +++ b/src/testdir/test_diffmode.vim @@ -871,8 +871,8 @@ func VerifyInternal(buf, dumpfile, extra) endfunc func Test_diff_screen() - if has('osx') && !empty($CI) && system('uname -m') =~# 'arm64' - throw 'Skipped: FIXME: This test fails on M1 Mac on GitHub Actions' + if has('osxdarwin') && system('diff --version') =~ '^Apple diff' + throw 'Skipped: unified diff does not work properly on this macOS version' endif let g:test_is_flaky = 1 diff --git a/src/testdir/test_sound.vim b/src/testdir/test_sound.vim index 020d458912..e97ac6198b 100644 --- a/src/testdir/test_sound.vim +++ b/src/testdir/test_sound.vim @@ -15,9 +15,6 @@ func Test_play_event() if has('win32') throw 'Skipped: Playing event with callback is not supported on Windows' endif - if has('osx') && !empty($CI) && system('uname -m') =~# 'arm64' - throw 'Skipped: FIXME: Running this test on M1 Mac hangs on GitHub Actions' - endif let g:playcallback_count = 0 let g:id = 0 let event_name = 'bell' @@ -38,10 +35,6 @@ func Test_play_event() endfunc func Test_play_silent() - if has('osx') && !empty($CI) && system('uname -m') =~# 'arm64' - throw 'Skipped: FIXME: Running this test on M1 Mac hangs on GitHub Actions' - endif - let fname = fnamemodify('silent.wav', '%p') let g:playcallback_count = 0 diff --git a/src/testdir/test_terminal2.vim b/src/testdir/test_terminal2.vim index c7d1a9a7bd..9798c51940 100644 --- a/src/testdir/test_terminal2.vim +++ b/src/testdir/test_terminal2.vim @@ -536,10 +536,6 @@ endfunc " Test for term_gettitle() func Test_term_gettitle() - if has('osx') && !empty($CI) && system('uname -m') =~# 'arm64' - throw 'Skipped: FIXME: Title got on M1 Mac is broken on GitHub Actions' - endif - " term_gettitle() returns an empty string for a non-terminal buffer " and for a non-existing buffer. call assert_equal('', bufnr('%')->term_gettitle()) diff --git a/src/version.c b/src/version.c index c79fd6b1b7..96f1a556af 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 107, /**/ 106, /**/ From b1700fb33fe02838d679b9215e501455cf4c1156 Mon Sep 17 00:00:00 2001 From: Markus Schneider-Pargmann Date: Wed, 14 Feb 2024 20:44:28 +0100 Subject: [PATCH 042/426] patch 9.1.0108: filetype: no support for dtso files Problem: filetype: no support for dtso files Solution: Add detection for *.dtso files as dts file type (Markus Schneider-Pargmann) *.dtso files are devicetree overlay files which have the same syntax as dts or dtsi files. closes: #14026 Signed-off-by: Markus Schneider-Pargmann Signed-off-by: Christian Brabandt --- runtime/filetype.vim | 4 ++-- src/testdir/test_filetype.vim | 2 +- src/version.c | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 17fe86d7b4..8a29621430 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -646,8 +646,8 @@ au BufNewFile,BufRead *.dsl " DTD (Document Type Definition for XML) au BufNewFile,BufRead *.dtd setf dtd -" DTS/DSTI (device tree files) -au BufNewFile,BufRead *.dts,*.dtsi setf dts +" DTS/DSTI/DTSO (device tree files) +au BufNewFile,BufRead *.dts,*.dtsi,*.dtso setf dts " EDIF (*.edf,*.edif,*.edn,*.edo) or edn au BufNewFile,BufRead *.ed\(f\|if\|o\) setf edif diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 544557afb0..b38b28f38a 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -214,7 +214,7 @@ def s:GetFilenameChecks(): dict> dracula: ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'], dtd: ['file.dtd'], dtrace: ['/usr/lib/dtrace/io.d'], - dts: ['file.dts', 'file.dtsi'], + dts: ['file.dts', 'file.dtsi', 'file.dtso'], dune: ['jbuild', 'dune', 'dune-project', 'dune-workspace'], dylan: ['file.dylan'], dylanintr: ['file.intr'], diff --git a/src/version.c b/src/version.c index 96f1a556af..cacfec5f43 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 108, /**/ 107, /**/ From 5c3855bcab425be39e2934fede14d1124466c55a Mon Sep 17 00:00:00 2001 From: h-east Date: Wed, 14 Feb 2024 21:00:01 +0100 Subject: [PATCH 043/426] runtime(vim): update Vim Syntax generator - Add missing "Last Change:" line. - The date on this line in vim.vim is updated by update_date.vim at Make time. (I made a mistake in the file path) - Remove unnecessary "b:loaded_syntax_vim_ex". - Remove "Base File Date:" line in vim.vim.base - Add Doug Kearns as Maintainer closes: #14031 Signed-off-by: h-east Signed-off-by: Christian Brabandt --- runtime/syntax/generator/Makefile | 1 - runtime/syntax/generator/gen_syntax_vim.vim | 11 +++++++++++ runtime/syntax/generator/update_date.vim | 2 +- runtime/syntax/generator/vim.vim.base | 4 ++-- runtime/syntax/vim.vim | 8 ++++---- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/runtime/syntax/generator/Makefile b/runtime/syntax/generator/Makefile index 33dcfbc2b1..3cf4b953df 100644 --- a/runtime/syntax/generator/Makefile +++ b/runtime/syntax/generator/Makefile @@ -16,7 +16,6 @@ vim.vim: vim.vim.rc update_date.vim @echo "Generating vim.vim ..." @cp -f vim.vim.rc ../vim.vim @$(RUN_VIM) -S update_date.vim - @sed -i -e 's/__REVISION__/$(REVISION)/' ../vim.vim @echo "done." vim.vim.rc: gen_syntax_vim.vim vim.vim.base $(SRC) diff --git a/runtime/syntax/generator/gen_syntax_vim.vim b/runtime/syntax/generator/gen_syntax_vim.vim index 85f0945524..2b4e4e2dc4 100644 --- a/runtime/syntax/generator/gen_syntax_vim.vim +++ b/runtime/syntax/generator/gen_syntax_vim.vim @@ -248,6 +248,7 @@ function! s:parse_vim_command(cmd) let item.syn_str = item.name call add(a:cmd, copy(item)) let item.name = 'i' " insert + let item.syn_str = item.name call add(a:cmd, copy(item)) if empty(a:cmd) @@ -445,6 +446,16 @@ function! s:parse_vim_hlgroup(li) let item.type = 'gui' call add(a:li, copy(item)) + " The following highlight groups cannot be extracted from highlight.c + " (TODO: extract from HIGHLIGHT_INIT ?) + let item.name = 'LineNrAbove' + let item.type = 'both' + call add(a:li, copy(item)) + + let item.name = 'LineNrBelow' + let item.type = 'both' + call add(a:li, copy(item)) + quit! if empty(a:li) diff --git a/runtime/syntax/generator/update_date.vim b/runtime/syntax/generator/update_date.vim index 662e5054b7..54eb4edb42 100644 --- a/runtime/syntax/generator/update_date.vim +++ b/runtime/syntax/generator/update_date.vim @@ -2,7 +2,7 @@ " '" Last Change: ' " language C -silent new vim.vim +silent new ../vim.vim normal gg let pat = '^"\s*Last\s*Change:\s\+' let lnum = search(pat, 'We', 10) diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index 7c8373727c..5ef471dc49 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -1,11 +1,12 @@ " Vim syntax file " Language: Vim script " Maintainer: Hirohito Higashi +" Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex +" Last Change: Feb 13, 2024 " Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 -" Base File Date: May 09, 2023 " DO NOT CHANGE DIRECTLY. " THIS FILE PARTLY GENERATED BY gen_syntax_vim.vim. @@ -17,7 +18,6 @@ if exists("b:current_syntax") finish endif -let b:loaded_syntax_vim_ex="__REVISION__" let s:keepcpo= &cpo set cpo&vim diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 1d97c85868..8a63898cf9 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,11 +1,12 @@ " Vim syntax file " Language: Vim script " Maintainer: Hirohito Higashi +" Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex +" Last Change: Feb 14, 2024 " Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 -" Base File Date: May 09, 2023 " DO NOT CHANGE DIRECTLY. " THIS FILE PARTLY GENERATED BY gen_syntax_vim.vim. @@ -17,7 +18,6 @@ if exists("b:current_syntax") finish endif -let b:loaded_syntax_vim_ex="2024-02-13T21:07:41+01:00" let s:keepcpo= &cpo set cpo&vim @@ -34,7 +34,7 @@ syn keyword vimCommand contained foldd[oopen] folddoc[losed] foldo[pen] for fu[n syn keyword vimCommand contained lo[adview] loadk[eymap] loc[kmarks] lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks mat[ch] menut[ranslate] mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] new noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] popu[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] syn keyword vimCommand contained python3 py3f[ile] pyx pyxd[o] pythonx pyxf[ile] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redi[r] redr[aw] redraws[tatus] redrawt[abline] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] ru[ntime] rub[y] rubyd[o] rubyf[ile] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] san[dbox] sav[eas] sb[uffer] sbN[ext] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] sc[riptnames] scripte[ncoding] scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] si[malt] sig[n] sil[ent] sl[eep] sla[st] sn[ext] so[urce] sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sr[ewind] st[op] sta[g] star[tinsert] startg[replace] startr[eplace] syn keyword vimCommand contained stat[ic] stopi[nsert] stj[ump] sts[elect] sun[hide] sus[pend] sv[iew] sw[apname] synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tab tabc[lose] tabd[o] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] tabp[revious] tabN[ext] tabr[ewind] tabs tc[d] tch[dir] tcl tcld[o] tclf[ile] te[aroff] ter[minal] tf[irst] th[row] thi[s] tj[ump] tl[ast] tm[enu] tn[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu[nmenu] ty[pe] u[ndo] undoj[oin] undol[ist] una[bbreviate] unh[ide] unl[et] unlo[ckvar] uns[ilent] up[date] v[global] ve[rsion] verb[ose] vert[ical] vi[sual] vie[w] vim[grep] vimgrepa[dd] vim9[cmd] vim9s[cript] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wh[ile] wi[nsize] winc[md] wind[o] winp[os] -syn keyword vimCommand contained wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep deletp deletep a a +syn keyword vimCommand contained wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep deletp deletep a i syn keyword vimCommand contained am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] sme[nu] snoreme[nu] sunme[nu] tlm[enu] tln[oremenu] tlu[nmenu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] xme[nu] xnoreme[nu] xunme[nu] syn keyword vimCommand contained cm[ap] cno[remap] im[ap] ino[remap] lm[ap] ln[oremap] nm[ap] nn[oremap] no[remap] om[ap] ono[remap] smap snor[emap] tma[p] tno[remap] vm[ap] vn[oremap] xm[ap] xn[oremap] syn keyword vimCommand contained cmapc[lear] imapc[lear] lmapc[lear] mapc[lear] nmapc[lear] omapc[lear] smapc[lear] tmapc[lear] vmapc[lear] xmapc[lear] @@ -101,7 +101,7 @@ syn keyword vimGroup contained Comment Constant String Character Number Boolean " Default highlighting groups {{{2 " GEN_SYN_VIM: vimHLGroup, START_STR='syn keyword vimHLGroup contained', END_STR='' -syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit VisualNOS DiffText PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuExtra PmenuExtraSel Normal Directory LineNr CursorLineNr MoreMsg Question Search SpellBad SpellCap SpellRare SpellLocal PmenuThumb Pmenu PmenuSel SpecialKey Title WarningMsg WildMenu Folded FoldColumn SignColumn Visual DiffAdd DiffChange DiffDelete TabLine CursorColumn CursorLine ColorColumn Conceal MatchParen StatusLineTerm StatusLineTermNC ToolbarLine ToolbarButton Menu Tooltip Scrollbar CursorIM +syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit VisualNOS DiffText PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuExtra PmenuExtraSel Normal Directory LineNr CursorLineNr MoreMsg Question Search SpellBad SpellCap SpellRare SpellLocal PmenuThumb Pmenu PmenuSel SpecialKey Title WarningMsg WildMenu Folded FoldColumn SignColumn Visual DiffAdd DiffChange DiffDelete TabLine CursorColumn CursorLine ColorColumn Conceal MatchParen StatusLineTerm StatusLineTermNC ToolbarLine ToolbarButton Menu Tooltip Scrollbar CursorIM LineNrAbove LineNrBelow syn case match " Function Names {{{2 From fe6d5b0ae47e8a178c156be7189903c91b765584 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 14 Feb 2024 21:17:43 +0100 Subject: [PATCH 044/426] runtime(vim): Update base-syntax, fix :behave highlighting closes: #14036 Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/generator/vim.vim.base | 7 +++++-- .../testdir/dumps/vim_ex_behave_00.dump | 20 +++++++++++++++++++ .../testdir/dumps/vim_ex_behave_99.dump | 20 +++++++++++++++++++ .../syntax/testdir/input/vim_ex_behave.vim | 7 +++++++ runtime/syntax/vim.vim | 7 +++++-- 5 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/vim_ex_behave_00.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_behave_99.dump create mode 100644 runtime/syntax/testdir/input/vim_ex_behave.vim diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index 5ef471dc49..37bc03a5c6 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -185,12 +185,14 @@ endif " Behave! {{{2 " ======= -syn match vimBehave "\" skipwhite nextgroup=vimBehaveModel,vimBehaveError -syn keyword vimBehaveModel contained mswin xterm if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nobehaveerror") syn match vimBehaveError contained "[^ ]\+" endif +syn match vimBehave "\" nextgroup=vimBehaveBang,vimBehaveModel,vimBehaveError skipwhite +syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite +syn keyword vimBehaveModel contained mswin xterm +hi def link vimBehaveBang vimBang " Filetypes {{{2 " ========= syn match vimFiletype "\"+0#0000e05#ffffff0| |V|i|m| |b|e|h|a|v|e| |c|o|m@1|a|n|d| +0#0000000&@54 +@75 +|b+0#af5f00255&|e|h|a|v|e| +0#0000000&|m+0#af5f00255&|s|w|i|n| +0#0000000&@62 +|b+0#af5f00255&|e|h|a|v|e| +0#0000000&|x+0#af5f00255&|t|e|r|m| +0#0000000&@62 +@75 +|b+0#af5f00255&|e|h|a|v|e|!| +0#0000000&|m+0#af5f00255&|s|w|i|n| +0#0000000&@61 +|b+0#af5f00255&|e|h|a|v|e|!| +0#0000000&|x+0#af5f00255&|t|e|r|m| +0#0000000&@61 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|e|x|_|b|e|h|a|v|e|.|v|i|m|"| |7|L|,| |7@1|B| @23|1|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/dumps/vim_ex_behave_99.dump b/runtime/syntax/testdir/dumps/vim_ex_behave_99.dump new file mode 100644 index 0000000000..a0a0e188c8 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_behave_99.dump @@ -0,0 +1,20 @@ +|"+0#0000e05#ffffff0| |V|i|m| |b|e|h|a|v|e| |c|o|m@1|a|n|d| +0#0000000&@54 +@75 +|b+0#af5f00255&|e|h|a|v|e| +0#0000000&|m+0#af5f00255&|s|w|i|n| +0#0000000&@62 +|b+0#af5f00255&|e|h|a|v|e| +0#0000000&|x+0#af5f00255&|t|e|r|m| +0#0000000&@62 +@75 +|b+0#af5f00255&|e|h|a|v|e|!| +0#0000000&|m+0#af5f00255&|s|w|i|n| +0#0000000&@61 +>b+0#af5f00255&|e|h|a|v|e|!| +0#0000000&|x+0#af5f00255&|t|e|r|m| +0#0000000&@61 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|e|x|_|b|e|h|a|v|e|.|v|i|m|"| |7|L|,| |7@1|B| @23|7|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/input/vim_ex_behave.vim b/runtime/syntax/testdir/input/vim_ex_behave.vim new file mode 100644 index 0000000000..a1e99f0d8a --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_behave.vim @@ -0,0 +1,7 @@ +" Vim behave command + +behave mswin +behave xterm + +behave! mswin +behave! xterm diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 8a63898cf9..a69dedc66c 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -227,12 +227,14 @@ endif " Behave! {{{2 " ======= -syn match vimBehave "\" skipwhite nextgroup=vimBehaveModel,vimBehaveError -syn keyword vimBehaveModel contained mswin xterm if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nobehaveerror") syn match vimBehaveError contained "[^ ]\+" endif +syn match vimBehave "\" nextgroup=vimBehaveBang,vimBehaveModel,vimBehaveError skipwhite +syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite +syn keyword vimBehaveModel contained mswin xterm +hi def link vimBehaveBang vimBang " Filetypes {{{2 " ========= syn match vimFiletype "\ Date: Wed, 14 Feb 2024 21:28:44 +0100 Subject: [PATCH 045/426] runtime(vim): Update base-syntax, remove unused vimString region These were included with the initial release of the syntax file for Vim 5 and were probably intended to allow for syn-region start/skip/end patterns with a '!' or '+' delimiter. However, these cases are currently handled by the vimSynRegPat group. The removed patterns never match anywhere in the distributed runtime files and it is believed that this is generally true. closes: #14035 Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/generator/vim.vim.base | 2 -- runtime/syntax/vim.vim | 2 -- 2 files changed, 4 deletions(-) diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index 37bc03a5c6..cf4aedd9df 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -333,8 +333,6 @@ syn match vimNotPatSep contained "\\\\" syn cluster vimStringGroup contains=vimEscape,vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ matchgroup=vimStringEnd end=+"+ contains=@vimStringGroup syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]'+lc=1 end=+'+ -syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup -syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup "syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup " see tst45.vim syn match vimString contained +"[^"]*\\$+ skipnl nextgroup=vimStringCont syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+ diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index a69dedc66c..33cb7cc031 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -376,8 +376,6 @@ syn match vimNotPatSep contained "\\\\" syn cluster vimStringGroup contains=vimEscape,vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ matchgroup=vimStringEnd end=+"+ contains=@vimStringGroup syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]'+lc=1 end=+'+ -syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup -syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup "syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup " see tst45.vim syn match vimString contained +"[^"]*\\$+ skipnl nextgroup=vimStringCont syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+ From cf1d65e060e32ba8a0ba99fc299dc192fe4aa961 Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Wed, 14 Feb 2024 21:31:47 +0100 Subject: [PATCH 046/426] patch 9.1.0109: filetype: no support for its files Problem: filetype: no support for its files Solution: Add detection for *.its files as dts file type (Brandon Maier) The '*.its' file type is for U-Boot Flattened Image Trees (FIT) which use the flattened devicetree format. See https://github.com/u-boot/u-boot/blob/master/doc/usage/fit/source_file_format.rst#terminology closes: #14037 Signed-off-by: Brandon Maier Signed-off-by: Christian Brabandt --- runtime/filetype.vim | 2 +- src/testdir/test_filetype.vim | 2 +- src/version.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 8a29621430..708ce5adfe 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -647,7 +647,7 @@ au BufNewFile,BufRead *.dsl au BufNewFile,BufRead *.dtd setf dtd " DTS/DSTI/DTSO (device tree files) -au BufNewFile,BufRead *.dts,*.dtsi,*.dtso setf dts +au BufNewFile,BufRead *.dts,*.dtsi,*.dtso,*.its setf dts " EDIF (*.edf,*.edif,*.edn,*.edo) or edn au BufNewFile,BufRead *.ed\(f\|if\|o\) setf edif diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index b38b28f38a..05d4754e5b 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -214,7 +214,7 @@ def s:GetFilenameChecks(): dict> dracula: ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'], dtd: ['file.dtd'], dtrace: ['/usr/lib/dtrace/io.d'], - dts: ['file.dts', 'file.dtsi', 'file.dtso'], + dts: ['file.dts', 'file.dtsi', 'file.dtso', 'file.its'], dune: ['jbuild', 'dune', 'dune-project', 'dune-workspace'], dylan: ['file.dylan'], dylanintr: ['file.intr'], diff --git a/src/version.c b/src/version.c index cacfec5f43..c347e9de01 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 109, /**/ 108, /**/ From 1da0e85816718a1d45ca60b3581c62df4e352c91 Mon Sep 17 00:00:00 2001 From: Luca Saccarola Date: Wed, 14 Feb 2024 22:25:41 +0100 Subject: [PATCH 047/426] runtime(asciidoc): include basic ftplugin closes: #13873 Signed-off-by: Luca Saccarola Signed-off-by: Christian Brabandt --- runtime/doc/filetype.txt | 14 +++++++- runtime/doc/tags | 1 + runtime/ftplugin/asciidoc.vim | 67 +++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 runtime/ftplugin/asciidoc.vim diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 4876e3d754..b56a3d3fa7 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 9.1. Last change: 2024 Jan 04 +*filetype.txt* For Vim version 9.1. Last change: 2024 Feb 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -564,6 +564,18 @@ under it. If not found, a new entry and item is prepended to the beginning of the Changelog. +ASCIIDOC *ft-asciidoc-plugin* + +To enable |folding| use this: > + let g:asciidoc_folding = 1 + +To disable nesting of folded headers use this: > + let g:asciidoc_foldnested = 0 + +To disable folding everything under the title use this: > + let asciidoc_fold_under_title = 0 + + FORTRAN *ft-fortran-plugin* Options: diff --git a/runtime/doc/tags b/runtime/doc/tags index d5ccb99da0..e457180d29 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -7191,6 +7191,7 @@ ft-ada-syntax ft_ada.txt /*ft-ada-syntax* ft-ada-variables ft_ada.txt /*ft-ada-variables* ft-ant-syntax syntax.txt /*ft-ant-syntax* ft-apache-syntax syntax.txt /*ft-apache-syntax* +ft-asciidoc-plugin filetype.txt /*ft-asciidoc-plugin* ft-asm-syntax syntax.txt /*ft-asm-syntax* ft-asm68k-syntax syntax.txt /*ft-asm68k-syntax* ft-asmh8300-syntax syntax.txt /*ft-asmh8300-syntax* diff --git a/runtime/ftplugin/asciidoc.vim b/runtime/ftplugin/asciidoc.vim new file mode 100644 index 0000000000..5974e28dc2 --- /dev/null +++ b/runtime/ftplugin/asciidoc.vim @@ -0,0 +1,67 @@ +" Vim filetype plugin file +" Original Author: Maxim Kim +" Language: asciidoc +" Maintainer: Luca Saccarola +" Last Change: 2024 Jan 16 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= "|setl cms< com< fo< flp< inex< efm< cfu< fde< fdm<" +else + let b:undo_ftplugin = "setl cms< com< fo< flp< inex< efm< cfu< fde< fdm<" +endif + +" gf to open include::file.ext[] and link:file.ext[] files +setlocal includeexpr=substitute(v:fname,'\\(link:\\\|include::\\)\\(.\\{-}\\)\\[.*','\\2','g') + +setlocal comments= +setlocal commentstring=//\ %s + +setlocal formatoptions+=cqn +setlocal formatlistpat=^\\s*[\\[({]\\?\\([0-9]\\+ +setlocal formatlistpat+=\\\|[a-zA-Z]\\)[\\]:.)}]\\s\\+ +setlocal formatlistpat+=\\\|^\\s*-\\s\\+ +setlocal formatlistpat+=\\\|^\\s*[*]\\+\\s\\+ +setlocal formatlistpat+=\\\|^\\s*[.]\\+\\s\\+ + +function AsciidocFold() + let line = getline(v:lnum) + + if (v:lnum == 1) && (line =~ '^----*$') + return ">1" + endif + + let nested = get(g:, "asciidoc_foldnested", 1) + + " Regular headers + let depth = match(line, '\(^=\+\)\@<=\( .*$\)\@=') + + " Do not fold nested regular headers + if depth > 1 && !nested + let depth = 1 + endif + + if depth > 0 + " fold all sections under title + if depth > 1 && !get(g:, "asciidoc_fold_under_title", 1) + let depth -= 1 + endif + " check syntax, it should be asciidocTitle or asciidocH + let syncode = synstack(v:lnum, 1) + if len(syncode) > 0 && synIDattr(syncode[0], 'name') =~ 'asciidoc\%(H[1-6]\)\|Title' + return ">" . depth + endif + endif + + return "=" +endfunction + +if has("folding") && get(g:, 'asciidoc_folding', 0) + setlocal foldexpr=AsciidocFold() + setlocal foldmethod=expr + let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<" +endif From 5f20f050efed3431beaf85739f0113e9ef0abd8e Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Wed, 14 Feb 2024 22:30:06 +0100 Subject: [PATCH 048/426] patch 9.1.0110: filetype: add 'Config.in' filetype detection The 'Config.in' file type is for Buildroot configuration files. Buildroot Config.in files use the same Kconfig backend as the Linux kernel's Kconfig files. Buildroot also has other filename variants that follow "Config.in.*", they are used to distinguish multiple Config.in files in the same directory. See https://buildroot.org/downloads/manual/manual.html#_literal_config_in_literal_file closes: #14038 Signed-off-by: Brandon Maier Signed-off-by: Christian Brabandt --- runtime/filetype.vim | 4 ++-- src/testdir/test_filetype.vim | 2 +- src/version.c | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 708ce5adfe..5ae632be99 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1141,7 +1141,7 @@ au BufNewFile,BufRead *.kt,*.ktm,*.kts setf kotlin au BufNewFile,BufRead *.ks setf kscript " Kconfig -au BufNewFile,BufRead Kconfig,Kconfig.debug setf kconfig +au BufNewFile,BufRead Kconfig,Kconfig.debug,Config.in setf kconfig " Lace (ISE) au BufNewFile,BufRead *.ace,*.ACE setf lace @@ -2780,7 +2780,7 @@ au! BufNewFile,BufRead *jarg* au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties') " Kconfig -au BufNewFile,BufRead Kconfig.* call s:StarSetf('kconfig') +au BufNewFile,BufRead Kconfig.*,Config.in.* call s:StarSetf('kconfig') " Lilo: Linux loader au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo') diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 05d4754e5b..f13c99dac2 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -357,7 +357,7 @@ def s:GetFilenameChecks(): dict> jsp: ['file.jsp'], julia: ['file.jl'], just: ['justfile', 'Justfile', '.justfile', 'config.just'], - kconfig: ['Kconfig', 'Kconfig.debug', 'Kconfig.file'], + kconfig: ['Kconfig', 'Kconfig.debug', 'Kconfig.file', 'Config.in', 'Config.in.host'], kdl: ['file.kdl'], kivy: ['file.kv'], kix: ['file.kix'], diff --git a/src/version.c b/src/version.c index c347e9de01..a8e7488ee9 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 110, /**/ 109, /**/ From d00fb4b3a237b375de5a1f453c8453b8b3797d51 Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Thu, 15 Feb 2024 00:16:02 +0100 Subject: [PATCH 049/426] patch 9.1.0111: filetype: no support for bats files The '*.bats' file type is for Bash Automated Testing System (BATS) scripts. BATS scripts are Bash with a special '@test' extension but they otherwise work with Vim's bash filetype. See https://github.com/bats-core/bats-core closes: #14039 Signed-off-by: Brandon Maier Signed-off-by: Christian Brabandt --- runtime/filetype.vim | 2 +- src/testdir/test_filetype.vim | 2 +- src/version.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 5ae632be99..aa8f4da772 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -2008,7 +2008,7 @@ au BufNewFile,BufRead catalog setf catalog " Gentoo ebuilds, Arch Linux PKGBUILDs and Alpine Linux APKBUILDs are actually " bash scripts. " NOTE: Patterns ending in a star are further down, these have lower priority. -au BufNewFile,BufRead .bashrc,bashrc,bash.bashrc,.bash[_-]profile,.bash[_-]logout,.bash[_-]aliases,bash-fc[-.],*.ebuild,*.bash,*.eclass,PKGBUILD,APKBUILD call dist#ft#SetFileTypeSH("bash") +au BufNewFile,BufRead .bashrc,bashrc,bash.bashrc,.bash[_-]profile,.bash[_-]logout,.bash[_-]aliases,bash-fc[-.],*.ebuild,*.bash,*.eclass,PKGBUILD,APKBUILD,*.bats call dist#ft#SetFileTypeSH("bash") au BufNewFile,BufRead .kshrc,*.ksh call dist#ft#SetFileTypeSH("ksh") au BufNewFile,BufRead */etc/profile,.profile,*.sh,*.env call dist#ft#SetFileTypeSH(getline(1)) diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index f13c99dac2..2a9ca8278a 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -621,7 +621,7 @@ def s:GetFilenameChecks(): dict> services: ['/etc/services', 'any/etc/services'], setserial: ['/etc/serial.conf', 'any/etc/serial.conf'], sexplib: ['file.sexp'], - sh: ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'APKBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf'], + sh: ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'APKBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats'], sieve: ['file.siv', 'file.sieve'], sil: ['file.sil'], simula: ['file.sim'], diff --git a/src/version.c b/src/version.c index a8e7488ee9..72495c2f91 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 111, /**/ 110, /**/ From f0d3d4a42657dca996e790aa829de3c6be7fdb63 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 15 Feb 2024 20:15:04 +0100 Subject: [PATCH 050/426] patch 9.1.0112: Remove undo information, when cleaning quickfix buffer Problem: When the quickfix buffer has been modified an autocommand may invalidate the undo stack (kawarimidoll) Solution: When clearing the quickfix buffer, also wipe the undo stack fixes: #13905 closes: #13928 Signed-off-by: Christian Brabandt --- src/quickfix.c | 10 ++++++++++ src/testdir/test_autocmd.vim | 28 ++++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 40 insertions(+) diff --git a/src/quickfix.c b/src/quickfix.c index dd681ca239..3e2d3dfcc0 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -4829,8 +4829,18 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid) } // delete all existing lines + // + // Note: we cannot store undo information, because + // qf buffer is usually not allowed to be modified. + // + // So we need to clean up undo information + // otherwise autocommands may invalidate the undo stack while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) (void)ml_delete((linenr_T)1); + + // Remove all undo information + u_blockfree(curbuf); + u_clearall(curbuf); } // Check if there is anything to display diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 6e1223275f..90dc3c1d32 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -4413,4 +4413,32 @@ func Test_autocmd_shortmess() delfunc SetupVimTest_shm endfunc +func Test_autocmd_invalidates_undo_on_textchanged() + CheckRunVimInTerminal + let script =<< trim END + set hidden + " create quickfix list (at least 2 lines to move line) + vimgrep /u/j % + + " enter quickfix window + cwindow + + " set modifiable + setlocal modifiable + + " set autocmd to clear quickfix list + + autocmd! TextChanged call setqflist([]) + " move line + move+1 + END + call writefile(script, 'XTest_autocmd_invalidates_undo_on_textchanged', 'D') + let buf = RunVimInTerminal('XTest_autocmd_invalidates_undo_on_textchanged', {'rows': 20}) + call term_sendkeys(buf, ":so %\") + call term_sendkeys(buf, "G") + call WaitForAssert({-> assert_match('^XTest_autocmd_invalidates_undo_on_textchanged\s*$', term_getline(buf, 20))}, 1000) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 72495c2f91..d23c9ce5af 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 112, /**/ 111, /**/ From 9071ed8107244e0c56a16b77d1c28e975cb21dd2 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 15 Feb 2024 20:17:37 +0100 Subject: [PATCH 051/426] patch 9.1.0113: duplicate code when cleaning undo stack Problem: duplicate code when cleaning undo stack Solution: refactor undo cleanup into a single public function related: #13928 Signed-off-by: Christian Brabandt --- src/buffer.c | 7 +++---- src/fileio.c | 5 +---- src/netbeans.c | 6 ++---- src/proto/undo.pro | 3 +-- src/quickfix.c | 3 +-- src/undo.c | 38 ++++++++++++++++++++++++++------------ src/version.c | 2 ++ 7 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 62c396a531..4a39329c5c 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -919,10 +919,9 @@ buf_freeall(buf_T *buf, int flags) ml_close(buf, TRUE); // close and delete the memline/memfile buf->b_ml.ml_line_count = 0; // no lines in buffer if ((flags & BFA_KEEP_UNDO) == 0) - { - u_blockfree(buf); // free the memory allocated for undo - u_clearall(buf); // reset all undo information - } + // free the memory allocated for undo + // and reset all undo information + u_clearallandblockfree(buf); #ifdef FEAT_SYN_HL syntax_clear(&buf->b_s); // reset syntax info #endif diff --git a/src/fileio.c b/src/fileio.c index 180fe3906c..d293d713d3 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4514,10 +4514,7 @@ buf_reload(buf_T *buf, int orig_mode, int reload_options) // Mark the buffer as unmodified and free undo info. unchanged(buf, TRUE, TRUE); if ((flags & READ_KEEP_UNDO) == 0) - { - u_blockfree(buf); - u_clearall(buf); - } + u_clearallandblockfree(buf); else { // Mark all undo states as changed. diff --git a/src/netbeans.c b/src/netbeans.c index ebdf3a44fa..d542b58868 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -1285,8 +1285,7 @@ nb_do_cmd( netbeansFireChanges = oldFire; netbeansSuppressNoLines = oldSuppress; - u_blockfree(buf->bufp); - u_clearall(buf->bufp); + u_clearallandblockfree(buf->bufp); } nb_reply_nil(cmdno); // ===================================================================== @@ -1456,8 +1455,7 @@ nb_do_cmd( netbeansFireChanges = oldFire; // Undo info is invalid now... - u_blockfree(curbuf); - u_clearall(curbuf); + u_clearallandblockfree(curbuf); } vim_free(to_free); nb_reply_nil(cmdno); // or !error diff --git a/src/proto/undo.pro b/src/proto/undo.pro index 851d281f30..619ad70234 100644 --- a/src/proto/undo.pro +++ b/src/proto/undo.pro @@ -18,10 +18,9 @@ void ex_undojoin(exarg_T *eap); void u_unchanged(buf_T *buf); void u_find_first_changed(void); void u_update_save_nr(buf_T *buf); -void u_clearall(buf_T *buf); void u_clearline(void); void u_undoline(void); -void u_blockfree(buf_T *buf); +void u_clearallandblockfree(buf_T *buf); int bufIsChanged(buf_T *buf); int anyBufIsChanged(void); int bufIsChangedNotTerm(buf_T *buf); diff --git a/src/quickfix.c b/src/quickfix.c index 3e2d3dfcc0..d8bcc1232a 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -4839,8 +4839,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid) (void)ml_delete((linenr_T)1); // Remove all undo information - u_blockfree(curbuf); - u_clearall(curbuf); + u_clearallandblockfree(curbuf); } // Check if there is anything to display diff --git a/src/undo.c b/src/undo.c index b2c4e9a568..1cd8912823 100644 --- a/src/undo.c +++ b/src/undo.c @@ -123,6 +123,7 @@ static void serialize_visualinfo(bufinfo_T *bi, visualinfo_T *info); static void unserialize_visualinfo(bufinfo_T *bi, visualinfo_T *info); #endif static void u_saveline(linenr_T lnum); +static void u_blockfree(buf_T *buf); #define U_ALLOC_LINE(size) lalloc(size, FALSE) @@ -3472,7 +3473,7 @@ u_freeentry(u_entry_T *uep, long n) /* * invalidate the undo buffer; called when storage has already been released */ - void + static void u_clearall(buf_T *buf) { buf->b_u_newhead = buf->b_u_oldhead = buf->b_u_curhead = NULL; @@ -3483,6 +3484,30 @@ u_clearall(buf_T *buf) buf->b_u_line_lnum = 0; } +/* + * Free all allocated memory blocks for the buffer 'buf'. + */ + static void +u_blockfree(buf_T *buf) +{ + while (buf->b_u_oldhead != NULL) + u_freeheader(buf, buf->b_u_oldhead, NULL); + vim_free(buf->b_u_line_ptr.ul_line); +} + +/* + * Free all allocated memory blocks for the buffer 'buf'. + * and invalidate the undo buffer + */ + void +u_clearallandblockfree(buf_T *buf) +{ + u_blockfree(buf); + u_clearall(buf); +} + + + /* * Save the line "lnum" for the "U" command. */ @@ -3562,17 +3587,6 @@ u_undoline(void) check_cursor_col(); } -/* - * Free all allocated memory blocks for the buffer 'buf'. - */ - void -u_blockfree(buf_T *buf) -{ - while (buf->b_u_oldhead != NULL) - u_freeheader(buf, buf->b_u_oldhead, NULL); - vim_free(buf->b_u_line_ptr.ul_line); -} - /* * Check if the 'modified' flag is set, or 'ff' has changed (only need to * check the first character, because it can only be "dos", "unix" or "mac"). diff --git a/src/version.c b/src/version.c index d23c9ce5af..25fff8382d 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 113, /**/ 112, /**/ From 103f1dfb7df350650a5d7caadb0364bd79e9d25b Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 15 Feb 2024 21:44:05 +0100 Subject: [PATCH 052/426] runtime(less): reset readonly setting when disabling less mode While at it, also do the unmap only if a specific key has been mapped. There are some keys that are only selectively mapped and it would cause an error if we are trying to unmap such a key (e.g. z when your foldmethod is not manual). fixes: #14040 Signed-off-by: Christian Brabandt --- runtime/macros/less.vim | 230 ++++++++++++++++++++++++++++++---------- 1 file changed, 172 insertions(+), 58 deletions(-) diff --git a/runtime/macros/less.vim b/runtime/macros/less.vim index 95a4127961..9ee6689e25 100644 --- a/runtime/macros/less.vim +++ b/runtime/macros/less.vim @@ -227,67 +227,181 @@ noremap q :q " Switch to editing (switch off less mode) map v :silent call End() fun! s:End() - set ma + set modifiable noreadonly if exists('s:lz') let &lz = s:lz endif - unmap h - unmap H - unmap - unmap - unmap f - unmap - unmap z - unmap - unmap F - unmap d - unmap - unmap - unmap - unmap e - unmap - unmap j - unmap - unmap b - unmap - unmap w - unmap v - unmap u - unmap - unmap k - unmap y - unmap - unmap - unmap - unmap r - unmap - unmap R - unmap g - unmap < - unmap < - unmap G - unmap > - unmap > - unmap % - unmap p - unmap n - unmap N - unmap q - unmap v - unmap / - unmap ? - unmap - unmap - unmap - unmap - unmap - unmap - unmap - unmap - unmap - unmap - unmap - unmap + if !empty(maparg('h')) + unmap h + endif + if !empty(maparg('H')) + unmap H + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('f')) + unmap f + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('z')) + unmap z + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('F')) + unmap F + endif + if !empty(maparg('d')) + unmap d + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('e')) + unmap e + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('j')) + unmap j + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('b')) + unmap b + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('w')) + unmap w + endif + if !empty(maparg('v')) + unmap v + endif + if !empty(maparg('u')) + unmap u + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('k')) + unmap k + endif + if !empty(maparg('y')) + unmap y + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('r')) + unmap r + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('R')) + unmap R + endif + if !empty(maparg('g')) + unmap g + endif + if !empty(maparg('<')) + unmap < + endif + if !empty(maparg('<')) + unmap < + endif + if !empty(maparg('G')) + unmap G + endif + if !empty(maparg('>')) + unmap > + endif + if !empty(maparg('>')) + unmap > + endif + if !empty(maparg('%')) + unmap % + endif + if !empty(maparg('p')) + unmap p + endif + if !empty(maparg('n')) + unmap n + endif + if !empty(maparg('N')) + unmap N + endif + if !empty(maparg('q')) + unmap q + endif + if !empty(maparg('v')) + unmap v + endif + if !empty(maparg('/')) + unmap / + endif + if !empty(maparg('?')) + unmap ? + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif + if !empty(maparg('')) + unmap + endif endfun " vim: sw=2 From 79230f027a25ff12eb7c7b64e1c063297876aae2 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 15 Feb 2024 22:14:01 +0100 Subject: [PATCH 053/426] runtime(less): update "Last Change:" header Commit 103f1dfb7df350650a5d7caadb0364bd79e9d25b forgot to update the "Last Change:" header. So update it now. Signed-off-by: Christian Brabandt --- runtime/macros/less.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/macros/less.vim b/runtime/macros/less.vim index 9ee6689e25..03a0e90941 100644 --- a/runtime/macros/less.vim +++ b/runtime/macros/less.vim @@ -1,6 +1,6 @@ " Vim script to work like "less" " Maintainer: The Vim Project -" Last Change: 2023 Aug 10 +" Last Change: 2024 Feb 15 " Former Maintainer: Bram Moolenaar " Avoid loading this file twice, allow the user to define his own script. From fcaed6a70faf73bff3e5405ada556d726024f866 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 18 Feb 2024 09:33:54 +0100 Subject: [PATCH 054/426] patch 9.1.0114: Setting some options may change curswant Problem: Setting some options changes curswant unnecessarily. Solution: Add a P_HLONLY flag that prevents changing curswant. (zeertzjq) closes: #14044 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/option.c | 18 +++++++++++++----- src/option.h | 6 +++--- src/optiondefs.h | 22 +++++++++++----------- src/optionstr.c | 3 ++- src/testdir/test_goto.vim | 13 +++++++++---- src/version.c | 2 ++ 6 files changed, 40 insertions(+), 24 deletions(-) diff --git a/src/option.c b/src/option.c index f0e77270a4..dd3542f895 100644 --- a/src/option.c +++ b/src/option.c @@ -4596,8 +4596,10 @@ set_bool_option( #endif comp_col(); // in case 'ruler' or 'showcmd' changed + if (curwin->w_curswant != MAXCOL - && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) + && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0 + && (options[opt_idx].flags & P_HLONLY) == 0) curwin->w_set_curswant = TRUE; if ((opt_flags & OPT_NO_REDRAW) == 0) @@ -4839,9 +4841,12 @@ set_num_option( #endif comp_col(); // in case 'columns' or 'ls' changed + if (curwin->w_curswant != MAXCOL - && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) + && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0 + && (options[opt_idx].flags & P_HLONLY) == 0) curwin->w_set_curswant = TRUE; + if ((opt_flags & OPT_NO_REDRAW) == 0) check_redraw(options[opt_idx].flags); @@ -4862,11 +4867,14 @@ check_redraw(long_u flags) status_redraw_all(); if ((flags & P_RBUF) || (flags & P_RWIN) || all) - changed_window_setting(); + { + if (flags & P_HLONLY) + redraw_later(UPD_NOT_VALID); + else + changed_window_setting(); + } if (flags & P_RBUF) redraw_curbuf_later(UPD_NOT_VALID); - if (flags & P_RWINONLY) - redraw_later(UPD_NOT_VALID); if (doclear) redraw_all_later(UPD_CLEAR); else if (all) diff --git a/src/option.h b/src/option.h index 0cf6a8cf6d..28a4a96b41 100644 --- a/src/option.h +++ b/src/option.h @@ -38,8 +38,8 @@ #define P_RSTAT 0x1000 // redraw status lines #define P_RWIN 0x2000 // redraw current window and recompute text #define P_RBUF 0x4000 // redraw current buffer and recompute text -#define P_RALL 0x6000 // redraw all windows -#define P_RCLR 0x7000 // clear and redraw all +#define P_RALL 0x6000 // redraw all windows and recompute text +#define P_RCLR 0x7000 // clear and redraw all and recompute text #define P_COMMA 0x8000 // comma separated list #define P_ONECOMMA 0x18000L // P_COMMA and cannot have two consecutive @@ -58,7 +58,7 @@ #define P_CURSWANT 0x4000000L // update curswant required; not needed when // there is a redraw flag #define P_NDNAME 0x8000000L // only normal dir name chars allowed -#define P_RWINONLY 0x10000000L // only redraw current window +#define P_HLONLY 0x10000000L // option only changes highlight, not text #define P_MLE 0x20000000L // under control of 'modelineexpr' #define P_FUNC 0x40000000L // accept a function reference or a lambda #define P_COLON 0x80000000L // values use colons to create sublists diff --git a/src/optiondefs.h b/src/optiondefs.h index 5fa8f37e2b..776858804d 100644 --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -402,7 +402,7 @@ static struct vimoption options[] = {"autowriteall","awa", P_BOOL|P_VI_DEF, (char_u *)&p_awa, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"background", "bg", P_STRING|P_VI_DEF|P_RCLR, + {"background", "bg", P_STRING|P_VI_DEF|P_RCLR|P_HLONLY, (char_u *)&p_bg, PV_NONE, did_set_background, expand_set_background, { #if (defined(MSWIN)) && !defined(FEAT_GUI) @@ -609,7 +609,7 @@ static struct vimoption options[] = {"cmdwinheight", "cwh", P_NUM|P_VI_DEF, (char_u *)&p_cwh, PV_NONE, NULL, NULL, {(char_u *)7L, (char_u *)0L} SCTX_INIT}, - {"colorcolumn", "cc", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_RWIN, + {"colorcolumn", "cc", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP|P_RWIN|P_HLONLY, #ifdef FEAT_SYN_HL (char_u *)VAR_WIN, PV_CC, did_set_colorcolumn, NULL, #else @@ -774,21 +774,21 @@ static struct vimoption options[] = {"cursorbind", "crb", P_BOOL|P_VI_DEF, (char_u *)VAR_WIN, PV_CRBIND, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"cursorcolumn", "cuc", P_BOOL|P_VI_DEF|P_RWINONLY, + {"cursorcolumn", "cuc", P_BOOL|P_VI_DEF|P_RWIN|P_HLONLY, #ifdef FEAT_SYN_HL (char_u *)VAR_WIN, PV_CUC, NULL, NULL, #else (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"cursorline", "cul", P_BOOL|P_VI_DEF|P_RWINONLY, + {"cursorline", "cul", P_BOOL|P_VI_DEF|P_RWIN|P_HLONLY, #ifdef FEAT_SYN_HL (char_u *)VAR_WIN, PV_CUL, NULL, NULL, #else (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"cursorlineopt", "culopt", P_STRING|P_VI_DEF|P_RWIN|P_ONECOMMA|P_NODUP, + {"cursorlineopt", "culopt", P_STRING|P_VI_DEF|P_RWIN|P_HLONLY|P_ONECOMMA|P_NODUP, #ifdef FEAT_SYN_HL (char_u *)VAR_WIN, PV_CULOPT, did_set_cursorlineopt, expand_set_cursorlineopt, @@ -1304,7 +1304,7 @@ static struct vimoption options[] = (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"hlsearch", "hls", P_BOOL|P_VI_DEF|P_VIM|P_RALL, + {"hlsearch", "hls", P_BOOL|P_VI_DEF|P_VIM|P_RALL|P_HLONLY, #if defined(FEAT_SEARCH_EXTRA) (char_u *)&p_hls, PV_NONE, did_set_hlsearch, NULL, #else @@ -2350,14 +2350,14 @@ static struct vimoption options[] = {"sourceany", NULL, P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"spell", NULL, P_BOOL|P_VI_DEF|P_RWIN, + {"spell", NULL, P_BOOL|P_VI_DEF|P_RWIN|P_HLONLY, #ifdef FEAT_SPELL (char_u *)VAR_WIN, PV_SPELL, did_set_spell, NULL, #else (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"spellcapcheck", "spc", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF, + {"spellcapcheck", "spc", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_HLONLY, #ifdef FEAT_SPELL (char_u *)&p_spc, PV_SPC, did_set_spellcapcheck, NULL, {(char_u *)"[.?!]\\_[\\])'\" ]\\+", (char_u *)0L} @@ -2377,7 +2377,7 @@ static struct vimoption options[] = #endif SCTX_INIT}, {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA - |P_RBUF|P_EXPAND, + |P_RBUF|P_HLONLY|P_EXPAND, #ifdef FEAT_SPELL (char_u *)&p_spl, PV_SPL, did_set_spelllang, NULL, {(char_u *)"en", (char_u *)0L} @@ -2387,7 +2387,7 @@ static struct vimoption options[] = #endif SCTX_INIT}, {"spelloptions", "spo", P_STRING|P_ALLOCED|P_VI_DEF - |P_ONECOMMA|P_NODUP|P_RBUF, + |P_ONECOMMA|P_NODUP|P_RBUF|P_HLONLY, #ifdef FEAT_SPELL (char_u *)&p_spo, PV_SPO, did_set_spelloptions, expand_set_spelloptions, {(char_u *)"", (char_u *)0L} @@ -2596,7 +2596,7 @@ static struct vimoption options[] = (char_u *)FALSE, #endif (char_u *)0L} SCTX_INIT}, - {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM|P_RBUF, + {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM|P_RBUF|P_HLONLY, (char_u *)&p_tw, PV_TW, did_set_textwidth, NULL, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, {"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME, diff --git a/src/optionstr.c b/src/optionstr.c index c049b3b6fc..8b000abbb4 100644 --- a/src/optionstr.c +++ b/src/optionstr.c @@ -4510,7 +4510,8 @@ did_set_string_option( #endif if (curwin->w_curswant != MAXCOL - && (get_option_flags(opt_idx) & (P_CURSWANT | P_RALL)) != 0) + && (get_option_flags(opt_idx) & (P_CURSWANT | P_RALL)) != 0 + && (get_option_flags(opt_idx) & P_HLONLY) == 0) curwin->w_set_curswant = TRUE; if ((opt_flags & OPT_NO_REDRAW) == 0) diff --git a/src/testdir/test_goto.vim b/src/testdir/test_goto.vim index 85c156ac7a..357a8d27c8 100644 --- a/src/testdir/test_goto.vim +++ b/src/testdir/test_goto.vim @@ -312,18 +312,23 @@ func Test_gd_string_only() call XTest_goto_decl('gd', lines, 5, 10) endfunc -" Check that setting 'cursorline' does not change curswant -func Test_cursorline_keep_col() +" Check that setting some options does not change curswant +func Test_set_options_keep_col() new call setline(1, ['long long long line', 'short line']) normal ggfi let pos = getcurpos() normal j - set cursorline + set invhlsearch spell spelllang=en,cjk spelloptions=camel textwidth=80 + set cursorline cursorcolumn cursorlineopt=line colorcolumn=+1 + set background=dark + set background=light normal k call assert_equal(pos, getcurpos()) bwipe! - set nocursorline + set hlsearch& spell& spelllang& spelloptions& textwidth& + set cursorline& cursorcolumn& cursorlineopt& colorcolumn& + set background& endfunc func Test_gd_local_block() diff --git a/src/version.c b/src/version.c index 25fff8382d..bcb1d7c9cc 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 114, /**/ 113, /**/ From 026b17404aa3b6e01c4ee5f14a174f33c53f4401 Mon Sep 17 00:00:00 2001 From: h_east Date: Mon, 19 Feb 2024 02:51:46 +0900 Subject: [PATCH 055/426] runtime(doc): Fix typo in testing.txt (#14054) Signed-off-by: h-east Signed-off-by: Christian Brabandt --- runtime/doc/testing.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index 442285dc86..fcd402c025 100644 --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -235,7 +235,7 @@ test_mswin_event({event}, {args}) *test_mswin_event()* "mouse" mouse event. "key" keyboard event. "set_keycode_trans_strategy" - Change the key transation method + Change the key translation method. "mouse": Inject either a mouse button click, or a mouse move, event. @@ -294,7 +294,8 @@ test_mswin_event({event}, {args}) *test_mswin_event()* "set_keycode_trans_strategy": |w32-experimental-keycode-trans-strategy| - Switch the keycode translation method. The supported methods are: + Switch the keycode translation method. The supported methods + are: experimental: The method used after Patch v8.2.4807 using ToUnicode() Win API call. classic: The method used pre Patch v8.2.4807 From c86bff1771ed9c340f8f4433ae5530fd6de97980 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 18 Feb 2024 18:53:08 +0100 Subject: [PATCH 056/426] patch 9.1.0115: Using freed memory with full tag stack and user data Problem: Using freed memory with full tag stack and user data (Konstantin Khlebnikov) Solution: Clear the user data pointer of the newest entry. (zeertzjq, Konstantin Khlebnikov) fixes: neovim/neovim#27498 closes: #14053 Co-authored-by: Konstantin Khlebnikov koct9i@gmail.com Signed-off-by: zeertzjq Signed-off-by: Konstantin Khlebnikov koct9i@gmail.com Signed-off-by: Christian Brabandt --- runtime/doc/testing.txt | 2 +- src/tag.c | 2 +- src/testdir/test_tagjump.vim | 29 ++++++++++++++++++++++------- src/version.c | 2 ++ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index fcd402c025..356d74e390 100644 --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -1,4 +1,4 @@ -*testing.txt* For Vim version 9.1. Last change: 2024 Jan 23 +*testing.txt* For Vim version 9.1. Last change: 2024 Feb 18 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/src/tag.c b/src/tag.c index 893415f699..3df767d192 100644 --- a/src/tag.c +++ b/src/tag.c @@ -395,7 +395,7 @@ do_tag( tagstack_clear_entry(&tagstack[0]); for (i = 1; i < tagstacklen; ++i) tagstack[i - 1] = tagstack[i]; - --tagstackidx; + tagstack[--tagstackidx].user_data = NULL; } /* diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim index 8b85bd62fe..2abf1f6595 100644 --- a/src/testdir/test_tagjump.vim +++ b/src/testdir/test_tagjump.vim @@ -900,18 +900,33 @@ func Test_tag_stack() endfor call writefile(l, 'Xfoo', 'D') - " Jump to a tag when the tag stack is full. Oldest entry should be removed. enew + " Jump to a tag when the tag stack is full. Oldest entry should be removed. for i in range(10, 30) exe "tag var" .. i endfor - let l = gettagstack() - call assert_equal(20, l.length) - call assert_equal('var11', l.items[0].tagname) + let t = gettagstack() + call assert_equal(20, t.length) + call assert_equal('var11', t.items[0].tagname) + let full = deepcopy(t.items) + tag var31 + let t = gettagstack() + call assert_equal('var12', t.items[0].tagname) + call assert_equal('var31', t.items[19].tagname) + + " Jump to a tag when the tag stack is full, but with user data this time. + call foreach(full, {i, item -> extend(item, {'user_data': $'udata{i}'})}) + call settagstack(0, {'items': full}) + let t = gettagstack() + call assert_equal(20, t.length) + call assert_equal('var11', t.items[0].tagname) + call assert_equal('udata0', t.items[0].user_data) tag var31 - let l = gettagstack() - call assert_equal('var12', l.items[0].tagname) - call assert_equal('var31', l.items[19].tagname) + let t = gettagstack() + call assert_equal('var12', t.items[0].tagname) + call assert_equal('udata1', t.items[0].user_data) + call assert_equal('var31', t.items[19].tagname) + call assert_false(has_key(t.items[19], 'user_data')) " Use tnext with a single match call assert_fails('tnext', 'E427:') diff --git a/src/version.c b/src/version.c index bcb1d7c9cc..80cdfbcf3c 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 115, /**/ 114, /**/ From dfcef890cbdd3ec26de040b2e26d77444dc46862 Mon Sep 17 00:00:00 2001 From: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com> Date: Sun, 18 Feb 2024 21:02:14 +0300 Subject: [PATCH 057/426] runtime(vim): Distinguish Vim9 constructor definitions from the :new ex command (#14050) With the arrival of Vim9 classes, the syntax must allow for _new_ constructors; multiple constructor definitions are supported for a class, provided distinct suffix-names are used. Currently, the defined constructors match either vimCommand or vimFunctionError (for any newBar). For example: ------------------------------------------------------------ vim9script class Foo def new() enddef def newBar() enddef endclass ------------------------------------------------------------ Since every constructor is required to bear a lower-cased _new_ prefix name, it should suffice to distinguish them from functions, and so there are no new highlight or syntax groups introduced. Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com> Signed-off-by: h-east Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/generator/gen_syntax_vim.vim | 5 +++-- runtime/syntax/generator/vim.vim.base | 8 ++++++-- runtime/syntax/testdir/dumps/vim_new_00.dump | 20 ++++++++++++++++++++ runtime/syntax/testdir/dumps/vim_new_99.dump | 20 ++++++++++++++++++++ runtime/syntax/testdir/input/vim_new.vim | 17 +++++++++++++++++ runtime/syntax/vim.vim | 10 +++++++--- 6 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/vim_new_00.dump create mode 100644 runtime/syntax/testdir/dumps/vim_new_99.dump create mode 100644 runtime/syntax/testdir/input/vim_new.vim diff --git a/runtime/syntax/generator/gen_syntax_vim.vim b/runtime/syntax/generator/gen_syntax_vim.vim index 2b4e4e2dc4..44f701613a 100644 --- a/runtime/syntax/generator/gen_syntax_vim.vim +++ b/runtime/syntax/generator/gen_syntax_vim.vim @@ -2,8 +2,8 @@ " Language: Vim script " Maintainer: Hirohito Higashi (h_east) " URL: https://github.com/vim-jp/syntax-vim-ex -" Last Change: Feb 11, 2024 -" Version: 2.0.0 +" Last Change: Feb 18, 2024 +" Version: 2.0.1 let s:keepcpo= &cpo set cpo&vim @@ -281,6 +281,7 @@ function! s:get_vim_command_type(cmd_name) \ 'behave', 'augroup', 'normal', 'syntax', \ 'append', 'insert', \ 'Next', 'Print', 'X', + \ 'new', \ ] " Required for original behavior " \ 'global', 'vglobal' diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index cf4aedd9df..a95e6f75c7 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -3,7 +3,7 @@ " Maintainer: Hirohito Higashi " Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex -" Last Change: Feb 13, 2024 +" Last Change: Feb 18, 2024 " Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 @@ -31,6 +31,8 @@ syn cluster vimCommentGroup contains=vimTodo,@Spell syn keyword vimCommand contained 2mat[ch] 3mat[ch] +" Lower priority for _new_ to distinguish constructors from the command. +syn match vimCommand contained "\(\@!" syn match vimCommand contained "\" syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man Over Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Until Winbar XMLent XMLns @@ -233,6 +235,7 @@ endif syn cluster vimFuncList contains=vimCommand,vimFunctionError,vimFuncKey,Tag,vimFuncSID syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,vimComment,vim9Comment,vimContinue,vimCtrlChar,vimEcho,vimEchoHL,vimEnvvar,vimExecute,vimIsCommand,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimGlobal,vimHighlight,vimIsCommand,vimLet,vimLetHereDoc,vimLineComment,vimMap,vimMark,vimNorm,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSet,vimSpecFile,vimString,vimSubst,vimSynLine,vimUnmap,vimUserCommand syn match vimFunction "\<\(fu\%[nction]\)!\=\s\+\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody +syn match vimFunction "\\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@ " Errors And Warnings: {{{2 " ==================== if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror") - syn match vimFunctionError "\s\zs[a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank + " TODO: The new-prefix exception should only apply to constructor definitions. + syn match vimFunctionError "\s\zs\%(new\)\@![a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\d\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank syn match vimElseIfErr "\" syn match vimBufnrWarn /\v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64 +@75 +|#+0#0000e05&| |V|i|m| |:|n|e|w| |c|o|m@1|a|n|d| |a|n|d| |c|l|a|s@1| |c|o|n|s|t|r|u|c|t|o|r|s|.| +0#0000000&@32 +|c+0#af5f00255&|l|a|s@1| +0#0000000&|T|e|s|t| @64 +@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|(+0#e000e06&|)| +0#0000000&@57 +@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 +@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|O|t|h|e|r|(+0#e000e06&|)| +0#0000000&@52 +@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 +@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|y|e|t|a|n|o|t|h|e|r|(+0#e000e06&|)| +0#0000000&@47 +@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 +|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@66 +@75 +|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|(+0#e000e06&|)| +0#0000000&@64 +|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|O|t|h|e|r|(+0#e000e06&|)| +0#0000000&@59 +|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|y|e|t|a|n|o|t|h|e|r|(+0#e000e06&|)| +0#0000000&@54 +|n+0#af5f00255&|e|w| +0#0000000&@71 +|q+0#af5f00255&|u|i|t| +0#0000000&@70 +|~+0#4040ff13&| @73 +|~| @73 +|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|n|e|w|.|v|i|m|"| |1|7|L|,| |2|0|5|B| @27|1|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/dumps/vim_new_99.dump b/runtime/syntax/testdir/dumps/vim_new_99.dump new file mode 100644 index 0000000000..50a54f2807 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_new_99.dump @@ -0,0 +1,20 @@ +|v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64 +@75 +|#+0#0000e05&| |V|i|m| |:|n|e|w| |c|o|m@1|a|n|d| |a|n|d| |c|l|a|s@1| |c|o|n|s|t|r|u|c|t|o|r|s|.| +0#0000000&@32 +|c+0#af5f00255&|l|a|s@1| +0#0000000&|T|e|s|t| @64 +@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|(+0#e000e06&|)| +0#0000000&@57 +@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 +@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|O|t|h|e|r|(+0#e000e06&|)| +0#0000000&@52 +@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 +@8|d+0#af5f00255&|e|f| +0#0000000&|n|e|w|y|e|t|a|n|o|t|h|e|r|(+0#e000e06&|)| +0#0000000&@47 +@8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 +|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@66 +@75 +|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|(+0#e000e06&|)| +0#0000000&@64 +|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|O|t|h|e|r|(+0#e000e06&|)| +0#0000000&@59 +|T|e|s|t|.+0#af5f00255&|n+0#0000000&|e|w|y|e|t|a|n|o|t|h|e|r|(+0#e000e06&|)| +0#0000000&@54 +|n+0#af5f00255&|e|w| +0#0000000&@71 +>q+0#af5f00255&|u|i|t| +0#0000000&@70 +|~+0#4040ff13&| @73 +|~| @73 +|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|n|e|w|.|v|i|m|"| |1|7|L|,| |2|0|5|B| @27|1|7|,|1| @9|A|l@1| diff --git a/runtime/syntax/testdir/input/vim_new.vim b/runtime/syntax/testdir/input/vim_new.vim new file mode 100644 index 0000000000..985cfd3c11 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_new.vim @@ -0,0 +1,17 @@ +vim9script + +# Vim :new command and class constructors. +class Test + def new() + enddef + def newOther() + enddef + def newyetanother() + enddef +endclass + +Test.new() +Test.newOther() +Test.newyetanother() +new +quit diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 33cb7cc031..ece39918b2 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -3,7 +3,7 @@ " Maintainer: Hirohito Higashi " Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex -" Last Change: Feb 14, 2024 +" Last Change: Feb 18, 2024 " Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 @@ -31,7 +31,7 @@ syn cluster vimCommentGroup contains=vimTodo,@Spell syn keyword vimCommand contained abc[lear] abo[veleft] abs[tract] al[l] ar[gs] arga[dd] argd[elete] argdo argded[upe] arge[dit] argg[lobal] argl[ocal] argu[ment] as[cii] b[uffer] bN[ext] ba[ll] bad[d] balt bd[elete] bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bo[tright] bp[revious] br[ewind] brea[k] breaka[dd] breakd[el] breakl[ist] bro[wse] buffers bufd[o] bun[load] bw[ipeout] c[hange] cN[ext] cNf[ile] cabc[lear] cabo[ve] cad[dbuffer] cadde[xpr] caddf[ile] caf[ter] cal[l] cat[ch] cb[uffer] cbe[fore] cbel[ow] cbo[ttom] cc ccl[ose] cd cdo ce[nter] cex[pr] cf[ile] cfd[o] cfir[st] cg[etfile] cgetb[uffer] cgete[xpr] chd[ir] changes che[ckpath] checkt[ime] chi[story] cl[ist] cla[st] class clo[se] cle[arjumps] cn[ext] cnew[er] cnf[ile] co[py] col[der] colo[rscheme] syn keyword vimCommand contained com[mand] comc[lear] comp[iler] con[tinue] conf[irm] cons[t] cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cuna[bbrev] cw[indow] d[elete] delm[arks] deb[ug] debugg[reedy] def defc[ompile] defe[r] delc[ommand] delf[unction] di[splay] dif[fupdate] diffg[et] diffo[ff] diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] echoe[rr] echom[sg] echoc[onsole] echon echow[indow] el[se] elsei[f] em[enu] en[dif] endin[terface] endc[lass] endd[ef] ende[num] endf[unction] endfo[r] endt[ry] endw[hile] ene[w] enu[m] ev[al] ex exi[t] exp[ort] exu[sage] f[ile] files filet[ype] filt[er] fin[d] fina[l] finall[y] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] syn keyword vimCommand contained foldd[oopen] folddoc[losed] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] gu[i] gv[im] h[elp] helpc[lose] helpf[ind] helpg[rep] helpt[ags] ha[rdcopy] hi[ghlight] hid[e] his[tory] ho[rizontal] iabc[lear] if ij[ump] il[ist] imp[ort] int[ro] inte[rface] is[earch] isp[lit] iuna[bbrev] j[oin] ju[mps] k kee[pmarks] keepj[umps] keepp[atterns] keepa[lt] l[ist] lN[ext] lNf[ile] la[st] lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lc[d] lch[dir] lcl[ose] lcs[cope] ld[o] le[ft] lefta[bove] let lex[pr] leg[acy] lf[ile] lfd[o] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lgr[ep] lgrepa[dd] lh[elpgrep] lhi[story] ll lla[st] lli[st] lmak[e] lne[xt] lnew[er] lnf[ile] -syn keyword vimCommand contained lo[adview] loadk[eymap] loc[kmarks] lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks mat[ch] menut[ranslate] mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] new noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] popu[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] +syn keyword vimCommand contained lo[adview] loadk[eymap] loc[kmarks] lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks mat[ch] menut[ranslate] mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] popu[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] syn keyword vimCommand contained python3 py3f[ile] pyx pyxd[o] pythonx pyxf[ile] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redi[r] redr[aw] redraws[tatus] redrawt[abline] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] ru[ntime] rub[y] rubyd[o] rubyf[ile] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] san[dbox] sav[eas] sb[uffer] sbN[ext] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] sc[riptnames] scripte[ncoding] scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] si[malt] sig[n] sil[ent] sl[eep] sla[st] sn[ext] so[urce] sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sr[ewind] st[op] sta[g] star[tinsert] startg[replace] startr[eplace] syn keyword vimCommand contained stat[ic] stopi[nsert] stj[ump] sts[elect] sun[hide] sus[pend] sv[iew] sw[apname] synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tab tabc[lose] tabd[o] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] tabp[revious] tabN[ext] tabr[ewind] tabs tc[d] tch[dir] tcl tcld[o] tclf[ile] te[aroff] ter[minal] tf[irst] th[row] thi[s] tj[ump] tl[ast] tm[enu] tn[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu[nmenu] ty[pe] u[ndo] undoj[oin] undol[ist] una[bbreviate] unh[ide] unl[et] unlo[ckvar] uns[ilent] up[date] v[global] ve[rsion] verb[ose] vert[ical] vi[sual] vie[w] vim[grep] vimgrepa[dd] vim9[cmd] vim9s[cript] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wh[ile] wi[nsize] winc[md] wind[o] winp[os] syn keyword vimCommand contained wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep deletp deletep a i @@ -42,6 +42,8 @@ syn keyword vimCommand contained cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] su syn keyword vimCommand contained 2mat[ch] 3mat[ch] +" Lower priority for _new_ to distinguish constructors from the command. +syn match vimCommand contained "\(\@!" syn match vimCommand contained "\" syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man Over Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Until Winbar XMLent XMLns @@ -275,6 +277,7 @@ endif syn cluster vimFuncList contains=vimCommand,vimFunctionError,vimFuncKey,Tag,vimFuncSID syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,vimComment,vim9Comment,vimContinue,vimCtrlChar,vimEcho,vimEchoHL,vimEnvvar,vimExecute,vimIsCommand,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimGlobal,vimHighlight,vimIsCommand,vimLet,vimLetHereDoc,vimLineComment,vimMap,vimMark,vimNorm,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSet,vimSpecFile,vimString,vimSubst,vimSynLine,vimUnmap,vimUserCommand syn match vimFunction "\<\(fu\%[nction]\)!\=\s\+\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody +syn match vimFunction "\\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@ " Errors And Warnings: {{{2 " ==================== if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror") - syn match vimFunctionError "\s\zs[a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank + " TODO: The new-prefix exception should only apply to constructor definitions. + syn match vimFunctionError "\s\zs\%(new\)\@![a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\d\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank syn match vimElseIfErr "\" syn match vimBufnrWarn /\ Date: Mon, 19 Feb 2024 20:37:11 +0100 Subject: [PATCH 058/426] runtime(misc): announce adoption of various runtime files Signed-off-by: Christian Brabandt --- .github/CODEOWNERS | 51 -------------------------- runtime/autoload/getscript.vim | 3 +- runtime/autoload/netrw.vim | 6 ++- runtime/autoload/netrwFileHandlers.vim | 3 +- runtime/autoload/netrwSettings.vim | 3 +- runtime/autoload/tar.vim | 3 +- runtime/autoload/vimball.vim | 5 ++- runtime/autoload/zip.vim | 3 +- runtime/ftplugin/r.vim | 8 ++-- runtime/ftplugin/rhelp.vim | 2 +- runtime/ftplugin/rmd.vim | 2 +- runtime/ftplugin/rnoweb.vim | 8 ++-- runtime/ftplugin/rrst.vim | 8 ++-- runtime/indent/r.vim | 8 ++-- runtime/indent/rhelp.vim | 8 ++-- runtime/indent/rmd.vim | 8 ++-- runtime/indent/rnoweb.vim | 8 ++-- runtime/indent/rrst.vim | 8 ++-- runtime/plugin/getscriptPlugin.vim | 3 +- runtime/plugin/logiPat.vim | 3 +- runtime/plugin/netrwPlugin.vim | 3 +- runtime/plugin/vimballPlugin.vim | 3 +- runtime/plugin/zipPlugin.vim | 3 +- runtime/syntax/amiga.vim | 5 ++- runtime/syntax/csh.vim | 5 ++- runtime/syntax/dcl.vim | 5 ++- runtime/syntax/elmfilt.vim | 5 ++- runtime/syntax/exports.vim | 5 ++- runtime/syntax/generator/vim.vim.base | 2 +- runtime/syntax/gpg.vim | 2 +- runtime/syntax/lex.vim | 6 ++- runtime/syntax/lisp.vim | 6 ++- runtime/syntax/maple.vim | 6 ++- runtime/syntax/netrw.vim | 6 ++- runtime/syntax/quarto.vim | 8 ++-- runtime/syntax/r.vim | 14 ++++--- runtime/syntax/rhelp.vim | 10 +++-- runtime/syntax/rmd.vim | 8 ++-- runtime/syntax/rpcgen.vim | 6 ++- runtime/syntax/sh.vim | 8 ++-- runtime/syntax/sm.vim | 6 ++- runtime/syntax/tags.vim | 6 ++- runtime/syntax/tex.vim | 6 ++- runtime/syntax/vim.vim | 2 +- runtime/syntax/xmath.vim | 6 ++- runtime/syntax/xxd.vim | 6 ++- runtime/syntax/yacc.vim | 5 ++- 47 files changed, 159 insertions(+), 145 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 45c8d33790..57b889b322 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,20 +10,13 @@ # will be requested to review. runtime/autoload/freebasic.vim @dkearns -runtime/autoload/getscript.vim @cecamp runtime/autoload/haskell.vim @alx741 runtime/autoload/javascript.vim @jsit runtime/autoload/modula2.vim @dkearns -runtime/autoload/netrw.vim @cecamp -runtime/autoload/netrwFileHandlers.vim @cecamp -runtime/autoload/netrwSettings.vim @cecamp runtime/autoload/php.vim @david-szabo97 runtime/autoload/rubycomplete.vim @segfault @dkearns runtime/autoload/rust.vim @lilyball -runtime/autoload/tar.vim @cecamp -runtime/autoload/vimball.vim @cecamp runtime/autoload/xmlformat.vim @chrisbra -runtime/autoload/zip.vim @cecamp runtime/autoload/dist/json.vim @habamax runtime/colors/blue.vim @habamax @romainl @neutaaaaan runtime/colors/darkblue.vim @habamax @romainl @neutaaaaan @@ -108,12 +101,6 @@ runtime/compiler/xmllint.vim @dkearns runtime/compiler/xo.vim @dkearns runtime/compiler/yamllint.vim @romainl runtime/compiler/zsh.vim @dkearns -runtime/doc/pi_getscript.txt @cecamp -runtime/doc/pi_logipat.txt @cecamp -runtime/doc/pi_netrw.txt @cecamp -runtime/doc/pi_tar.txt @cecamp -runtime/doc/pi_vimball.txt @cecamp -runtime/doc/pi_zip.txt @cecamp runtime/doc/ps1.txt @heaths runtime/ftplugin/abaqus.vim @costerwi runtime/ftplugin/apache.vim @dubgeiser @@ -182,7 +169,6 @@ runtime/ftplugin/lynx.vim @dkearns runtime/ftplugin/m3build.vim @dkearns runtime/ftplugin/m3quake.vim @dkearns runtime/ftplugin/markdown.vim @tpope -runtime/ftplugin/matlab.vim @cecamp runtime/ftplugin/meson.vim @Liambeguin runtime/ftplugin/modula2.vim @dkearns runtime/ftplugin/modula3.vim @dkearns @@ -205,14 +191,9 @@ runtime/ftplugin/pymanifest.vim @ObserverOfTime runtime/ftplugin/python.vim @tpict runtime/ftplugin/qb64.vim @dkearns runtime/ftplugin/qml.vim @ChaseKnowlden -runtime/ftplugin/r.vim @jalvesaq runtime/ftplugin/racket.vim @benknoble runtime/ftplugin/readline.vim @dkearns -runtime/ftplugin/rhelp.vim @jalvesaq -runtime/ftplugin/rmd.vim @jalvesaq -runtime/ftplugin/rnoweb.vim @jalvesaq runtime/ftplugin/routeros.vim @zainin -runtime/ftplugin/rrst.vim @jalvesaq runtime/ftplugin/rst.vim @marshallward runtime/ftplugin/ruby.vim @tpope @dkearns runtime/ftplugin/rust.vim @lilyball @@ -302,14 +283,9 @@ runtime/indent/prolog.vim @dkearns runtime/indent/ps1.vim @heaths runtime/indent/qb64.vim @dkearns runtime/indent/qml.vim @ChaseKnowlden -runtime/indent/r.vim @jalvesaq runtime/indent/racket.vim @benknoble runtime/indent/rapid.vim @KnoP-01 runtime/indent/readline.vim @dkearns -runtime/indent/rhelp.vim @jalvesaq -runtime/indent/rmd.vim @jalvesaq -runtime/indent/rnoweb.vim @jalvesaq -runtime/indent/rrst.vim @jalvesaq runtime/indent/ruby.vim @AndrewRadev @dkearns runtime/indent/sass.vim @tpope runtime/indent/scala.vim @derekwyatt @@ -331,17 +307,10 @@ runtime/keymap/tamil_tscii.vim @yegappan runtime/lang/menu_en_gb.latin1.vim @mrdubya runtime/pack/dist/opt/cfilter/plugin/cfilter.vim @yegappan runtime/pack/dist/opt/matchit/ @chrisbra -runtime/plugin/getscriptPlugin.vim @cecamp -runtime/plugin/logiPat.vim @cecamp -runtime/plugin/netrwPlugin.vim @cecamp -runtime/plugin/tarPlugin.vim @cecamp -runtime/plugin/vimballPlugin.vim @cecamp -runtime/plugin/zipPlugin.vim @cecamp runtime/plugin/manpager.vim @Konfekt runtime/syntax/shared/hgcommitDiff.vim @vegerot runtime/syntax/abaqus.vim @costerwi runtime/syntax/aidl.vim @dpelle -runtime/syntax/amiga.vim @cecamp runtime/syntax/ant.vim @dkearns runtime/syntax/arduino.vim @johshoff runtime/syntax/asciidoc.vim @aerostitch @@ -362,12 +331,10 @@ runtime/syntax/chatito.vim @ObserverOfTime runtime/syntax/chuck.vim @gacallea runtime/syntax/clojure.vim @axvr runtime/syntax/cs.vim @nickspoons -runtime/syntax/csh.vim @cecamp runtime/syntax/cucumber.vim @tpope runtime/syntax/d.vim @JesseKPhillips runtime/syntax/dart.vim @pr3d4t0r runtime/syntax/datascript.vim @dpelle -runtime/syntax/dcl.vim @cecamp runtime/syntax/deb822sources.vim @jamessan runtime/syntax/debchangelog.vim @jamessan runtime/syntax/debcontrol.vim @jamessan @@ -383,11 +350,9 @@ runtime/syntax/dtd.vim @chrisbra runtime/syntax/dts.vim @zonque runtime/syntax/editorconfig.vim @gpanders runtime/syntax/eiffel.vim @jocelyn -runtime/syntax/elmfilt.vim @cecamp runtime/syntax/erlang.vim @hcs42 runtime/syntax/eruby.vim @tpope @dkearns runtime/syntax/expect.vim @dkearns -runtime/syntax/exports.vim @cecamp runtime/syntax/falcon.vim @steveno runtime/syntax/fennel.vim @gpanders runtime/syntax/fetchmail.vim @dkearns @@ -432,9 +397,7 @@ runtime/syntax/kconfig.vim @chrisbra runtime/syntax/kotlin.vim @udalov runtime/syntax/krl.vim @KnoP-01 runtime/syntax/less.vim @genoma -runtime/syntax/lex.vim @cecamp runtime/syntax/liquid.vim @tpope -runtime/syntax/lisp.vim @cecamp runtime/syntax/lua.vim @marcuscf runtime/syntax/lyrics.vim @ObserverOfTime runtime/syntax/lynx.vim @dkearns @@ -443,7 +406,6 @@ runtime/syntax/m3quake.vim @dkearns runtime/syntax/mailcap.vim @dkearns runtime/syntax/make.vim @rohieb runtime/syntax/mallard.vim @jhradilek -runtime/syntax/maple.vim @cecamp runtime/syntax/markdown.vim @tpope runtime/syntax/mason.vim @petdance runtime/syntax/meson.vim @Liambeguin @@ -453,7 +415,6 @@ runtime/syntax/modula2/opt/pim.vim @trijezdci runtime/syntax/modula2/opt/r10.vim @trijezdci runtime/syntax/modula3.vim @dkearns runtime/syntax/n1ql.vim @pr3d4t0r -runtime/syntax/netrw.vim @cecamp runtime/syntax/nginx.vim @chr4 runtime/syntax/ninja.vim @nico runtime/syntax/nix.vim @equill @@ -478,7 +439,6 @@ runtime/syntax/psl.vim @danielkho runtime/syntax/pymanifest.vim @ObserverOfTime runtime/syntax/qb64.vim @dkearns runtime/syntax/qml.vim @ChaseKnowlden -runtime/syntax/r.vim @jalvesaq runtime/syntax/racket.vim @benknoble runtime/syntax/raml.vim @in3d runtime/syntax/rapid.vim @KnoP-01 @@ -488,11 +448,8 @@ runtime/syntax/rcs.vim @hdima runtime/syntax/rebol.vim @mrdubya runtime/syntax/rego.vim @zenmatic runtime/syntax/resolv.vim @rid9 -runtime/syntax/rmd.vim @jalvesaq runtime/syntax/rng.vim @jhradilek runtime/syntax/routeros.vim @zainin -runtime/syntax/rpcgen.vim @cecamp -runtime/syntax/rrst.vim @jalvesaq runtime/syntax/rst.vim @marshallward runtime/syntax/ruby.vim @dkearns runtime/syntax/sass.vim @tpope @@ -500,9 +457,7 @@ runtime/syntax/scala.vim @derekwyatt runtime/syntax/scss.vim @tpope runtime/syntax/sdoc.vim @gpanders runtime/syntax/sed.vim @dkearns -runtime/syntax/sh.vim @cecamp runtime/syntax/shared/debversions.vim @jamessan -runtime/syntax/sm.vim @cecamp runtime/syntax/solidity.vim @cothi runtime/syntax/spec.vim @ignatenkobrain runtime/syntax/sqloracle.vim @chrisbra @@ -516,11 +471,9 @@ runtime/syntax/svn.vim @hdima runtime/syntax/swayconfig.vim @jamespeapen runtime/syntax/swig.vim @jmarrec runtime/syntax/systemverilog.vim @Kocha -runtime/syntax/tags.vim @cecamp runtime/syntax/tap.vim @petdance runtime/syntax/tcsh.vim @dkearns runtime/syntax/teraterm.vim @k-takata -runtime/syntax/tex.vim @cecamp runtime/syntax/tidy.vim @dkearns runtime/syntax/tmux.vim @ericpruitt runtime/syntax/toml.vim @averms @@ -532,7 +485,6 @@ runtime/syntax/typescriptcommon.vim @HerringtonDarkholme runtime/syntax/typescriptreact.vim @HerringtonDarkholme runtime/syntax/unison.vim @chuwy runtime/syntax/vdf.vim @ObserverOfTime -runtime/syntax/vim.vim @cecamp runtime/syntax/vroom.vim @dbarnett runtime/syntax/wast.vim @rhysd runtime/syntax/wdl.vim @zenmatic @@ -540,12 +492,9 @@ runtime/syntax/wget.vim @dkearns runtime/syntax/wget2.vim @dkearns runtime/syntax/xbl.vim @dkearns runtime/syntax/xcompose.vim @ObserverOfTime -runtime/syntax/xmath.vim @cecamp runtime/syntax/xml.vim @chrisbra runtime/syntax/xs.vim @petdance runtime/syntax/xslt.vim @Boobies -runtime/syntax/xxd.vim @cecamp -runtime/syntax/yacc.vim @cecamp runtime/syntax/zserio.vim @dpelle runtime/syntax/zsh.vim @chrisbra runtime/tutor/tutor.eo @dpelle diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim index 1b14fe1bd9..1fd4e63025 100644 --- a/runtime/autoload/getscript.vim +++ b/runtime/autoload/getscript.vim @@ -1,6 +1,7 @@ " --------------------------------------------------------------------- " getscript.vim -" Author: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Original Author: Charles E. Campbell " Date: Jan 21, 2014 " Version: 36 " Installing: :help glvs-install diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index d9baabb011..0508dcae3b 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,11 +1,13 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: May 03, 2023 +" Maintainer: This runtime file is looking for a new maintainer. +" Date: May 03, 2023 " Version: 173a " Last Change: " 2023 Nov 21 by Vim Project: ignore wildignore when expanding $COMSPEC (v173a) " 2023 Nov 22 by Vim Project: fix handling of very long filename on longlist style (v173a) -" Maintainer: Charles E Campbell +" 2024 Feb 19 by Vim Project (announce adoption) +" Former Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, diff --git a/runtime/autoload/netrwFileHandlers.vim b/runtime/autoload/netrwFileHandlers.vim index d07235c107..2b6f8f7a0f 100644 --- a/runtime/autoload/netrwFileHandlers.vim +++ b/runtime/autoload/netrwFileHandlers.vim @@ -1,6 +1,7 @@ " netrwFileHandlers: contains various extension-based file handlers for " netrw's browsers' x command ("eXecute launcher") -" Author: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Original Author: Charles E. Campbell " Date: Sep 18, 2020 " Version: 11 " Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim index d65f83144e..5525c0d035 100644 --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -1,6 +1,7 @@ " netrwSettings.vim: makes netrw settings simpler " Date: Nov 15, 2021 -" Maintainer: Charles E Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E Campbell " Version: 18 " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index 3c4c9ccfb2..9c4f16d7f6 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -2,7 +2,8 @@ " AUTOLOAD PORTION " Date: Nov 14, 2023 " Version: 32b (with modifications from the Vim Project) -" Maintainer: Charles E Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E Campbell " License: Vim License (see vim's :help license) " " Contains many ideas from Michael Toren's diff --git a/runtime/autoload/vimball.vim b/runtime/autoload/vimball.vim index 9c7dcbda0f..774b798a83 100644 --- a/runtime/autoload/vimball.vim +++ b/runtime/autoload/vimball.vim @@ -1,6 +1,7 @@ " vimball.vim : construct a file containing both paths and files -" Author: Charles E. Campbell -" Date: Apr 11, 2016 +" Maintainer: This runtime file is looking for a new maintainer. +" Original Author: Charles E. Campbell +" Date: Apr 11, 2016 " Version: 37 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim " Copyright: (c) 2004-2011 by Charles E. Campbell diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index e61293c357..c0034f8a7a 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -2,7 +2,8 @@ " AUTOLOAD PORTION " Date: Mar 12, 2023 " Version: 33 -" Maintainer: Charles E Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E Campbell " License: Vim License (see vim's :help license) " Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim index f3b4960b7f..b3ffc91abc 100644 --- a/runtime/ftplugin/r.vim +++ b/runtime/ftplugin/r.vim @@ -1,9 +1,11 @@ " Vim filetype plugin file " Language: R -" Maintainer: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Apr 24, 2022 09:14AM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2022 Apr 24 09:14AM " 2024 Jan 14 by Vim Project (browsefilter) +" 2024 Feb 19 by Vim Project (announce adoption) " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim index c912f0cee8..6086b440f0 100644 --- a/runtime/ftplugin/rhelp.vim +++ b/runtime/ftplugin/rhelp.vim @@ -2,7 +2,7 @@ " Language: R help file " Maintainer: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Apr 24, 2022 09:12AM +" Last Change: 2022 Apr 24 09:12AM " 2024 Jan 14 by Vim Project (browsefilter) " Only do this when not yet done for this buffer diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim index 545aef2f31..74b920f19a 100644 --- a/runtime/ftplugin/rmd.vim +++ b/runtime/ftplugin/rmd.vim @@ -2,7 +2,7 @@ " Language: R Markdown file " Maintainer: Jakson Alves de Aquino " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Mon May 29, 2023 06:31AM +" Last Change: 2023 May 29 06:31AM " 2024 Jan 14 by Vim Project (browsefilter) " Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann) diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim index a7c151cfa5..3bed4b42cb 100644 --- a/runtime/ftplugin/rnoweb.vim +++ b/runtime/ftplugin/rnoweb.vim @@ -1,9 +1,11 @@ " Vim filetype plugin file " Language: Rnoweb -" Maintainer: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Mon Feb 27, 2023 07:16PM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2023 Feb 27 07:16PM " 2024 Jan 14 by Vim Project (browsefilter) +" 2024 Feb 19 by Vim Project (announce adoption) " Only do this when not yet done for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim index 7da2c4b74b..04a9737e42 100644 --- a/runtime/ftplugin/rrst.vim +++ b/runtime/ftplugin/rrst.vim @@ -1,9 +1,11 @@ " Vim filetype plugin file " Language: reStructuredText documentation format with R code -" Maintainer: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Mon Feb 27, 2023 07:16PM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2023 Feb 27 07:16PM " 2024 Jan 14 by Vim Project (browsefilter) +" 2024 Feb 19 by Vim Project (announce adoption) " Original work by Alex Zvoleff " Only do this when not yet done for this buffer diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index f7956e4fe0..339c46b172 100644 --- a/runtime/indent/r.vim +++ b/runtime/indent/r.vim @@ -1,8 +1,10 @@ " Vim indent file " Language: R -" Author: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Oct 08, 2023 10:45AM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2023 Oct 08 10:45AM +" 2024 Feb 19 by Vim Project (announce adoption) " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim index 334802ab78..97820ae148 100644 --- a/runtime/indent/rhelp.vim +++ b/runtime/indent/rhelp.vim @@ -1,8 +1,10 @@ " Vim indent file " Language: R Documentation (Help), *.Rd -" Author: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Mon Feb 27, 2023 07:01PM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2023 Feb 27 07:01PM +" 2024 Feb 19 by Vim Project (announce adoption) " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim index a043b0c994..f2d34a3f32 100644 --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -1,8 +1,10 @@ " Vim indent file " Language: Rmd -" Author: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Wed Nov 09, 2022 09:44PM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2022 Nov 09 09:44PM +" 2024 Feb 19 by Vim Project (announce adoption) " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim index 668cdb7ddd..1bdf7f3b12 100644 --- a/runtime/indent/rnoweb.vim +++ b/runtime/indent/rnoweb.vim @@ -1,8 +1,10 @@ " Vim indent file " Language: Rnoweb -" Author: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Mon Feb 27, 2023 07:17PM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 27 07:17PM +" 2024 Feb 19 by Vim Project (announce adoption) " Only load this indent file when no other was loaded. diff --git a/runtime/indent/rrst.vim b/runtime/indent/rrst.vim index 585c5e6654..73c8b04611 100644 --- a/runtime/indent/rrst.vim +++ b/runtime/indent/rrst.vim @@ -1,8 +1,10 @@ " Vim indent file " Language: Rrst -" Author: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Feb 25, 2023 +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2023 Feb 25 +" 2024 Feb 19 by Vim Project (announce adoption) " Only load this indent file when no other was loaded. diff --git a/runtime/plugin/getscriptPlugin.vim b/runtime/plugin/getscriptPlugin.vim index 8faa029f4d..6029b65a8d 100644 --- a/runtime/plugin/getscriptPlugin.vim +++ b/runtime/plugin/getscriptPlugin.vim @@ -1,6 +1,7 @@ " --------------------------------------------------------------------- " getscriptPlugin.vim -" Author: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Original Author: Charles E. Campbell " Date: Nov 29, 2013 " Installing: :help glvs-install " Usage: :help glvs diff --git a/runtime/plugin/logiPat.vim b/runtime/plugin/logiPat.vim index 47fabe954d..a8c154e207 100644 --- a/runtime/plugin/logiPat.vim +++ b/runtime/plugin/logiPat.vim @@ -1,5 +1,6 @@ " LogiPat: Boolean logical pattern matcher -" Author: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Original Author: Charles E. Campbell " Date: Apr 04, 2016 " Version: 4 " Purpose: to do Boolean-logic based regular expression pattern matching diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index a347781e6f..ed6f7dc008 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -1,7 +1,8 @@ " netrwPlugin.vim: Handles file transfer and remote directory listing across a network " PLUGIN SECTION +" Maintainer: This runtime file is looking for a new maintainer. " Date: Feb 09, 2021 -" Maintainer: Charles E Campbell +" Former Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 1999-2021 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, diff --git a/runtime/plugin/vimballPlugin.vim b/runtime/plugin/vimballPlugin.vim index cd14efa1be..e78805faf7 100644 --- a/runtime/plugin/vimballPlugin.vim +++ b/runtime/plugin/vimballPlugin.vim @@ -1,5 +1,6 @@ " vimballPlugin : construct a file containing both paths and files -" Author: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Original Author: Charles E. Campbell " Copyright: (c) 2004-2014 by Charles E. Campbell " The VIM LICENSE applies to Vimball.vim, and Vimball.txt " (see |copyright|) except use "Vimball" instead of "Vim". diff --git a/runtime/plugin/zipPlugin.vim b/runtime/plugin/zipPlugin.vim index c3118a361d..2af119bbcb 100644 --- a/runtime/plugin/zipPlugin.vim +++ b/runtime/plugin/zipPlugin.vim @@ -1,7 +1,8 @@ " zipPlugin.vim: Handles browsing zipfiles " PLUGIN PORTION " Date: Dec 07, 2021 -" Maintainer: Charles E Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E Campbell " License: Vim License (see vim's :help license) " Copyright: Copyright (C) 2005-2016 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, diff --git a/runtime/syntax/amiga.vim b/runtime/syntax/amiga.vim index 5a664c4f60..9402196482 100644 --- a/runtime/syntax/amiga.vim +++ b/runtime/syntax/amiga.vim @@ -1,9 +1,10 @@ " Vim syntax file " Language: AmigaDos -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Aug 31, 2016 " Version: 10 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_AMIGA +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_AMIGA " quit when a syntax file was already loaded if exists("b:current_syntax") diff --git a/runtime/syntax/csh.vim b/runtime/syntax/csh.vim index 6a056c7004..0ad85adfc7 100644 --- a/runtime/syntax/csh.vim +++ b/runtime/syntax/csh.vim @@ -1,9 +1,10 @@ " Vim syntax file " Language: C-shell (csh) -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Aug 31, 2016 " Version: 14 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_CSH +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_CSH " quit when a syntax file was already loaded if exists("b:current_syntax") diff --git a/runtime/syntax/dcl.vim b/runtime/syntax/dcl.vim index 530fbdb599..1987ebbce6 100644 --- a/runtime/syntax/dcl.vim +++ b/runtime/syntax/dcl.vim @@ -1,9 +1,10 @@ " Vim syntax file " Language: DCL (Digital Command Language - vms) -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Mar 26, 2019 " Version: 13 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL " quit when a syntax file was already loaded if exists("b:current_syntax") diff --git a/runtime/syntax/elmfilt.vim b/runtime/syntax/elmfilt.vim index d995853e8e..aa1b57cbfe 100644 --- a/runtime/syntax/elmfilt.vim +++ b/runtime/syntax/elmfilt.vim @@ -1,9 +1,10 @@ " Vim syntax file " Language: Elm Filter rules -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Aug 31, 2016 " Version: 9 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_ELMFILT +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_ELMFILT " quit when a syntax file was already loaded if exists("b:current_syntax") diff --git a/runtime/syntax/exports.vim b/runtime/syntax/exports.vim index 05a3f1acfe..00b7d80dfa 100644 --- a/runtime/syntax/exports.vim +++ b/runtime/syntax/exports.vim @@ -1,10 +1,11 @@ " Vim syntax file " Language: exports -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Aug 31, 2016 " Version: 8 " Notes: This file includes both SysV and BSD 'isms -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_EXPORTS +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_EXPORTS " quit when a syntax file was already loaded if exists("b:current_syntax") diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index a95e6f75c7..8dcdf846c8 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -4,7 +4,7 @@ " Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex " Last Change: Feb 18, 2024 -" Former Maintainer: Charles E. Campbell +" Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 diff --git a/runtime/syntax/gpg.vim b/runtime/syntax/gpg.vim index 2728ecfccd..f132a52705 100644 --- a/runtime/syntax/gpg.vim +++ b/runtime/syntax/gpg.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: gpg(1) configuration file -" Maintainer: This file is looking for a maintainer! +" Maintainer: This runtime file is looking for a maintainer. " Previous Maintainer: Nikolai Weibull " Latest Revision: 2024-02-11 " Updated: diff --git a/runtime/syntax/lex.vim b/runtime/syntax/lex.vim index 82197adbed..b05148e88f 100644 --- a/runtime/syntax/lex.vim +++ b/runtime/syntax/lex.vim @@ -1,9 +1,11 @@ " Vim syntax file " Language: Lex and Flex -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Contributor: Robert A. van Engelen -" Last Change: Apr 24, 2020 " Version: 18 +" Last Change: Apr 24, 2020 +" 2024 Feb 19 by Vim Project (announce adoption) " quit when a syntax file was already loaded if exists("b:current_syntax") diff --git a/runtime/syntax/lisp.vim b/runtime/syntax/lisp.vim index 90513e3a00..5350b4dc51 100644 --- a/runtime/syntax/lisp.vim +++ b/runtime/syntax/lisp.vim @@ -1,9 +1,11 @@ " Vim syntax file " Language: Lisp -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Nov 10, 2021 +" 2024 Feb 19 by Vim Project (announce adoption) " Version: 31 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP " " Thanks to F Xavier Noria for a list of 978 Common Lisp symbols taken from HyperSpec " Clisp additions courtesy of http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/emacs/lisp.vim diff --git a/runtime/syntax/maple.vim b/runtime/syntax/maple.vim index 78f2b4e09e..b0bd9aaef9 100644 --- a/runtime/syntax/maple.vim +++ b/runtime/syntax/maple.vim @@ -1,9 +1,11 @@ " Vim syntax file " Language: Maple V (based on release 4) -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer:Charles E. Campbell " Last Change: Mar 26, 2019 +" 2024 Feb 19 by Vim Project (announce adoption) " Version: 17 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE " " Package Function Selection: {{{1 " Because there are a lot of packages, and because of the potential for namespace diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim index 1f02bbef78..f5b7fdc2c6 100644 --- a/runtime/syntax/netrw.vim +++ b/runtime/syntax/netrw.vim @@ -1,6 +1,8 @@ " Language : Netrw Listing Syntax -" Maintainer : Charles E. Campbell -" Last change: Nov 07, 2019 +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell +" Last Change: Nov 07, 2019 +" 2024 Feb 19 by Vim Project (announce adoption) " Version : 20 " --------------------------------------------------------------------- if exists("b:current_syntax") diff --git a/runtime/syntax/quarto.vim b/runtime/syntax/quarto.vim index d5d4ee257d..f83071dd7f 100644 --- a/runtime/syntax/quarto.vim +++ b/runtime/syntax/quarto.vim @@ -1,7 +1,9 @@ " Language: Quarto (Markdown with chunks of R, Python and other languages) -" Provisory Maintainer: Jakson Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Fri Feb 24, 2023 08:26AM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2023 Feb 24 08:26AM +" 2024 Feb 19 by Vim Project (announce adoption) " " The developers of tools for Quarto maintain Vim runtime files in their " Github repository and, if required, I will hand over the maintenance of diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim index 1932d2479a..fa73194332 100644 --- a/runtime/syntax/r.vim +++ b/runtime/syntax/r.vim @@ -1,12 +1,14 @@ " Vim syntax file " Language: R (GNU S) -" Maintainer: Jakson Aquino -" Former Maintainers: Vaidotas Zemlys -" Tom Payne +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainers: Jakson Aquino +" Vaidotas Zemlys +" Tom Payne " Contributor: Johannes Ranke -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Dec 24, 2023 08:05AM -" Filenames: *.R *.r *.Rhistory *.Rt +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Filenames: *.R *.r *.Rhistory *.Rt +" Last Change: 2023 Dec 24 08:05AM +" 2024 Feb 19 by Vim Project (announce adoption) " " NOTE: The highlighting of R functions might be defined in " runtime files created by a filetype plugin, if installed. diff --git a/runtime/syntax/rhelp.vim b/runtime/syntax/rhelp.vim index 8cac585bb0..7407538e4c 100644 --- a/runtime/syntax/rhelp.vim +++ b/runtime/syntax/rhelp.vim @@ -1,9 +1,11 @@ " Vim syntax file " Language: R Help File -" Maintainer: Jakson Aquino -" Former Maintainer: Johannes Ranke -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Jun 28, 2016 08:53AM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainers: Jakson Aquino +" Johannes Ranke +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2016 Jun 28 08:53AM +" 2024 Feb 19 by Vim Project (announce adoption) " Remarks: - Includes R syntax highlighting in the appropriate " sections if an r.vim file is in the same directory or in the " default debian location. diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim index 7b8b7fea50..4b4db1e783 100644 --- a/runtime/syntax/rmd.vim +++ b/runtime/syntax/rmd.vim @@ -1,7 +1,9 @@ " Language: Markdown with chunks of R, Python and other languages -" Maintainer: Jakson Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Dec 24, 2023 07:21AM +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2023 Dec 24 07:21AM +" 2024 Feb 19 by Vim Project (announce adoption) " " For highlighting pandoc extensions to markdown like citations and TeX and " many other advanced features like folding of markdown sections, it is diff --git a/runtime/syntax/rpcgen.vim b/runtime/syntax/rpcgen.vim index 60c9b8cdda..e5a0b0b56f 100644 --- a/runtime/syntax/rpcgen.vim +++ b/runtime/syntax/rpcgen.vim @@ -1,9 +1,11 @@ " Vim syntax file " Language: rpcgen -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Aug 31, 2016 +" 2024 Feb 19 by Vim Project (announce adoption) " Version: 13 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_RPCGEN +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_RPCGEN if exists("b:current_syntax") finish diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 13f7b651b2..4c591736b7 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -1,10 +1,12 @@ " Vim syntax file " Language: shell (sh) Korn shell (ksh) bash (sh) -" Maintainer: Charles E. Campbell -" Previous Maintainer: Lennart Schultz +" Maintainer: This runtime file is looking for a new maintainer. +" Previous Maintainers: Charles E. Campbell +" Lennart Schultz " Last Change: Feb 28, 2023 +" 2024 Feb 19 by Vim Project (announce adoption) " Version: 208 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) and heredoc fixes from Felipe Contreras diff --git a/runtime/syntax/sm.vim b/runtime/syntax/sm.vim index a16575c519..13a5bf117e 100644 --- a/runtime/syntax/sm.vim +++ b/runtime/syntax/sm.vim @@ -1,9 +1,11 @@ " Vim syntax file " Language: sendmail -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Oct 25, 2016 +" 2024 Feb 19 by Vim Project (announce adoption) " Version: 9 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SM +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SM if exists("b:current_syntax") finish endif diff --git a/runtime/syntax/tags.vim b/runtime/syntax/tags.vim index 4c06dc1df8..e87e3fcf61 100644 --- a/runtime/syntax/tags.vim +++ b/runtime/syntax/tags.vim @@ -1,8 +1,10 @@ " Language: tags -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Oct 26, 2016 +" 2024 Feb 19 by Vim Project (announce adoption) " Version: 8 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TAGS +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TAGS " quit when a syntax file was already loaded if exists("b:current_syntax") diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index 5544fb63fc..d782bd4845 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,9 +1,11 @@ " Vim syntax file " Language: TeX -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Apr 22, 2022 +" 2024 Feb 19 by Vim Project (announce adoption) " Version: 121 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 " diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index ece39918b2..0f99674211 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -4,7 +4,7 @@ " Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex " Last Change: Feb 18, 2024 -" Former Maintainer: Charles E. Campbell +" Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 diff --git a/runtime/syntax/xmath.vim b/runtime/syntax/xmath.vim index 37ae951112..466c1159c7 100644 --- a/runtime/syntax/xmath.vim +++ b/runtime/syntax/xmath.vim @@ -1,9 +1,11 @@ " Vim syntax file " Language: xmath (a simulation tool) -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Aug 31, 2016 +" 2024 Feb 19 by Vim Project (announce adoption) " Version: 10 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XMATH +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XMATH " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded diff --git a/runtime/syntax/xxd.vim b/runtime/syntax/xxd.vim index 2f90b6b0bd..1c06b4296f 100644 --- a/runtime/syntax/xxd.vim +++ b/runtime/syntax/xxd.vim @@ -1,10 +1,12 @@ " Vim syntax file " Language: bin using xxd -" Maintainer: Charles E. Campbell +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Charles E. Campbell " Last Change: Aug 31, 2016 " Version: 11 +" 2024 Feb 19 by Vim Project (announce adoption) " Notes: use :help xxd to see how to invoke it -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XXD +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XXD " quit when a syntax file was already loaded if exists("b:current_syntax") diff --git a/runtime/syntax/yacc.vim b/runtime/syntax/yacc.vim index 3aa01e8841..8100489422 100644 --- a/runtime/syntax/yacc.vim +++ b/runtime/syntax/yacc.vim @@ -1,9 +1,10 @@ " Vim syntax file " Language: Yacc -" Maintainer: Charles E. Campbell +" Former Maintainer: Charles E. Campbell " Last Change: Mar 25, 2019 " Version: 17 -" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_YACC +" 2024 Feb 19 by Vim Project (announce adoption) +" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_YACC " " Options: {{{1 " g:yacc_uses_cpp : if this variable exists, then C++ is loaded rather than C From 72a1f45e9324f7e3b668b25cb18d2499df94720e Mon Sep 17 00:00:00 2001 From: Linda_pp Date: Tue, 20 Feb 2024 04:55:55 +0900 Subject: [PATCH 059/426] CI: install gnudiff and enable `Test_diffmode` on macos-14 runner again (#14056) Signed-off-by: rhysd Signed-off-by: Christian Brabandt --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 677630baa2..a641ef563e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -373,6 +373,11 @@ jobs: "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit + - name: Install packages for testing + run: | + # Apple diff is broken. Use GNU diff instead. See #14032. + brew install diffutils + - name: Test timeout-minutes: 20 run: | From ef387c062bb1966187d3f307d697d80162051a0d Mon Sep 17 00:00:00 2001 From: dkearns Date: Tue, 20 Feb 2024 06:58:30 +1100 Subject: [PATCH 060/426] runtime(filetype): Modula-2 files with priority not detected (#14055) Problem: Modula-2 files with a specified priority are not detected. Solution: Match the priority syntax in module header lines when performing heuristic content detection. Disable the :defcompile debug line. This was accidentally left enabled in commit 68a8947. Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/autoload/dist/ft.vim | 6 ++-- src/testdir/test_filetype.vim | 65 +++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 9d0f2ee7af..14628308ee 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -3,7 +3,7 @@ vim9script # Vim functions for file type detection # # Maintainer: The Vim Project -# Last Change: 2024 Jan 05 +# Last Change: 2024 Feb 18 # Former Maintainer: Bram Moolenaar # These functions are moved here from runtime/filetype.vim to make startup @@ -531,7 +531,7 @@ def IsLProlog(): bool enddef def IsModula2(): bool - return getline(nextnonblank(1)) =~ '\ Date: Tue, 20 Feb 2024 10:48:22 -0800 Subject: [PATCH 061/426] runtime(doc): Add a place holder section for version 9.2 (#14060) Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt --- runtime/doc/tags | 12 +++++++ runtime/doc/version9.txt | 73 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/runtime/doc/tags b/runtime/doc/tags index e457180d29..330ac8bc3d 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -5972,6 +5972,7 @@ added-7.4 version7.txt /*added-7.4* added-8.1 version8.txt /*added-8.1* added-8.2 version8.txt /*added-8.2* added-9.1 version9.txt /*added-9.1* +added-9.2 version9.txt /*added-9.2* added-BeOS version5.txt /*added-BeOS* added-Mac version5.txt /*added-Mac* added-VMS version5.txt /*added-VMS* @@ -6173,6 +6174,7 @@ bug-fixes-7 version7.txt /*bug-fixes-7* bug-fixes-8 version8.txt /*bug-fixes-8* bug-fixes-9 version9.txt /*bug-fixes-9* bug-fixes-9.1 version9.txt /*bug-fixes-9.1* +bug-fixes-9.2 version9.txt /*bug-fixes-9.2* bug-reports intro.txt /*bug-reports* bugreport.vim intro.txt /*bugreport.vim* bugs intro.txt /*bugs* @@ -6357,6 +6359,7 @@ changed-7.4 version7.txt /*changed-7.4* changed-8.1 version8.txt /*changed-8.1* changed-8.2 version8.txt /*changed-8.2* changed-9.1 version9.txt /*changed-9.1* +changed-9.2 version9.txt /*changed-9.2* changelist motion.txt /*changelist* changelog.vim syntax.txt /*changelog.vim* changenr() builtin.txt /*changenr()* @@ -6495,6 +6498,7 @@ compile-changes-6 version6.txt /*compile-changes-6* compile-changes-7 version7.txt /*compile-changes-7* compile-changes-8 version8.txt /*compile-changes-8* compile-changes-9 version9.txt /*compile-changes-9* +compile-changes-9.2 version9.txt /*compile-changes-9.2* compiler-compaqada ft_ada.txt /*compiler-compaqada* compiler-decada ft_ada.txt /*compiler-decada* compiler-dotnet quickfix.txt /*compiler-dotnet* @@ -8245,6 +8249,7 @@ improvements-6 version6.txt /*improvements-6* improvements-7 version7.txt /*improvements-7* improvements-8 version8.txt /*improvements-8* improvements-9 version9.txt /*improvements-9* +improvements-9.2 version9.txt /*improvements-9.2* in_bot channel.txt /*in_bot* in_buf channel.txt /*in_buf* in_io-buffer channel.txt /*in_io-buffer* @@ -8261,6 +8266,7 @@ incompatible-6 version6.txt /*incompatible-6* incompatible-7 version7.txt /*incompatible-7* incompatible-8 version8.txt /*incompatible-8* incompatible-9 version9.txt /*incompatible-9* +incompatible-9.2 version9.txt /*incompatible-9.2* indent() builtin.txt /*indent()* indent-expression indent.txt /*indent-expression* indent.txt indent.txt /*indent.txt* @@ -9059,6 +9065,7 @@ new-options-5.2 version5.txt /*new-options-5.2* new-options-5.4 version5.txt /*new-options-5.4* new-other-8.2 version8.txt /*new-other-8.2* new-other-9.1 version9.txt /*new-other-9.1* +new-other-9.2 version9.txt /*new-other-9.2* new-perl-python version5.txt /*new-perl-python* new-persistent-undo version7.txt /*new-persistent-undo* new-plugins version6.txt /*new-plugins* @@ -9228,8 +9235,10 @@ patches-8.1 version8.txt /*patches-8.1* patches-8.2 version8.txt /*patches-8.2* patches-9 version9.txt /*patches-9* patches-9.1 version9.txt /*patches-9.1* +patches-9.2 version9.txt /*patches-9.2* patches-after-8.2 version9.txt /*patches-after-8.2* patches-after-9.0 version9.txt /*patches-after-9.0* +patches-after-9.1 version9.txt /*patches-after-9.1* pathshorten() builtin.txt /*pathshorten()* pattern pattern.txt /*pattern* pattern-atoms pattern.txt /*pattern-atoms* @@ -11017,6 +11026,7 @@ version-8.1 version8.txt /*version-8.1* version-8.2 version8.txt /*version-8.2* version-9.0 version9.txt /*version-9.0* version-9.1 version9.txt /*version-9.1* +version-9.2 version9.txt /*version-9.2* version-variable eval.txt /*version-variable* version4.txt version4.txt /*version4.txt* version5.txt version5.txt /*version5.txt* @@ -11033,6 +11043,7 @@ version8.2 version8.txt /*version8.2* version8.txt version8.txt /*version8.txt* version9.0 version9.txt /*version9.0* version9.1 version9.txt /*version9.1* +version9.2 version9.txt /*version9.2* version9.txt version9.txt /*version9.txt* versionlong-variable eval.txt /*versionlong-variable* vi intro.txt /*vi* @@ -11052,6 +11063,7 @@ vim-8.2 version8.txt /*vim-8.2* vim-9 version9.txt /*vim-9* vim-9.0 version9.txt /*vim-9.0* vim-9.1 version9.txt /*vim-9.1* +vim-9.2 version9.txt /*vim-9.2* vim-additions vi_diff.txt /*vim-additions* vim-announce intro.txt /*vim-announce* vim-arguments starting.txt /*vim-arguments* diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index 697fd79844..e8973ce735 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -41535,4 +41535,77 @@ Patch 9.0.2190 Problem: proto files need update Solution: re-generate them +============================================================================== +VERSION 9.2 *version-9.2* *version9.2* *vim-9.2* + +This section is about improvements made between version 9.1 and 9.2 +and is a work in progress. + +Support for Wayland UI. + +Other improvements *new-other-9.2* +------------------ + +Changed *changed-9.2* +------- + +Added *added-9.2* +----- + +Various syntax, indent and other plugins were added. + +Functions: ~ + +|diff()| diff two Lists of strings +|foreach()| apply function to List items +|matchbufline()| all the matches of a pattern in a buffer +|matchstrlist()| all the matches of a pattern in a List of strings + + +Autocommands: ~ + +|TermResponseAll| after the terminal response to |t_RV| and others is + received +|WinNewPre| before creating a new window + + +Commands: ~ + + +Options: ~ + +============================================================================== +INCOMPATIBLE CHANGES *incompatible-9.2* + +============================================================================== +IMPROVEMENTS *improvements-9.2* + +Support for command-line completion of 'keymap' option values. + +Support for compiling all the methods in a Vim9 class using |:defcompile|. + +Support for alternate font highlighting using |t_CF| terminal code. + +Support for Super key mappings in GTK using . + +Improved visual highlighting. + +Python3 support in OpenVMS. + +============================================================================== +COMPILE TIME CHANGES *compile-changes-9.2* + +Support for building with Ruby 3.3. + +Support for building Vim 9 in z/OS (MVS). + +============================================================================== +PATCHES *patches-9.2* *bug-fixes-9.2* + *patches-after-9.1* + +The list of patches that got included since 9.1.0. This includes all the new +features, but does not include runtime file changes (syntax, indent, ftplugin, +documentation, etc.) + + vim:tw=78:ts=8:noet:ft=help:norl:fdm=manual: From 0fd44a5ad81ade342cb54d8984965bdedd2272c8 Mon Sep 17 00:00:00 2001 From: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Tue, 20 Feb 2024 20:28:15 +0100 Subject: [PATCH 062/426] patch 9.1.0116: win_split_ins may not check available room Problem: win_split_ins has no check for E36 when moving an existing window Solution: check for room and fix the issues in f_win_splitmove() (Sean Dewar) win_split_ins has no check for E36 when moving an existing window, allowing for layouts with many overlapping zero-sized windows to be created (which may also cause drawing issues with tablines and such). f_win_splitmove also has some bugs. So check for room and fix the issues in f_win_splitmove. Handle failure in the two relevant win_split_ins callers by restoring the original layout, and factor the common logic into win_splitmove. Don't check for room when opening an autocommand window, as it's a temporary window that's rarely interacted with or drawn anyhow, and is rather important for some autocommands. Issues fixed in f_win_splitmove: - Error if splitting is disallowed. - Fix heap-use-after-frees if autocommands fired from switching to "targetwin" close "wp" or "oldwin". - Fix splitting the wrong window if autocommands fired from switching to "targetwin" switch to a different window. - Ensure -1 is returned for all errors. Also handle allocation failure a bit earlier in make_snapshot (callers, except win_splitmove, don't really care if a snapshot can't be made, so just ignore the return value). Note: Test_smoothscroll_in_zero_width_window failed after these changes with E36, as it was using the previous behaviour to create a zero-width window. I've fixed the test such that it fails with UBSAN as expected when v9.0.1367 is reverted (and simplified it too). related: #14042 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt --- src/autocmd.c | 2 +- src/evalwindow.c | 70 +++------- src/proto/window.pro | 4 +- src/testdir/test_window_cmd.vim | 154 +++++++++++++++++++-- src/version.c | 2 + src/vim.h | 1 + src/window.c | 228 ++++++++++++++++++++++++++------ 7 files changed, 355 insertions(+), 106 deletions(-) diff --git a/src/autocmd.c b/src/autocmd.c index 7e4a1b211f..41a46958e5 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -1607,7 +1607,7 @@ aucmd_prepbuf( p_acd = FALSE; #endif - (void)win_split_ins(0, WSP_TOP, auc_win, 0); + (void)win_split_ins(0, WSP_TOP | WSP_FORCE_ROOM, auc_win, 0); (void)win_comp_pos(); // recompute window positions p_ea = save_ea; #ifdef FEAT_AUTOCHDIR diff --git a/src/evalwindow.c b/src/evalwindow.c index 7d035d53b0..5016eb4588 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -952,60 +952,18 @@ f_win_screenpos(typval_T *argvars, typval_T *rettv) list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1); } -/* - * Move the window wp into a new split of targetwin in a given direction - */ - static void -win_move_into_split(win_T *wp, win_T *targetwin, int size, int flags) -{ - int dir; - int height = wp->w_height; - win_T *oldwin = curwin; - - if (wp == targetwin) - return; - - // Jump to the target window - if (curwin != targetwin) - win_goto(targetwin); - - // Remove the old window and frame from the tree of frames - (void)winframe_remove(wp, &dir, NULL); - win_remove(wp, NULL); - last_status(FALSE); // may need to remove last status line - (void)win_comp_pos(); // recompute window positions - - // Split a window on the desired side and put the old window there - (void)win_split_ins(size, flags, wp, dir); - - // If splitting horizontally, try to preserve height - if (size == 0 && !(flags & WSP_VERT)) - { - win_setheight_win(height, wp); - if (p_ea) - win_equal(wp, TRUE, 'v'); - } - -#if defined(FEAT_GUI) - // When 'guioptions' includes 'L' or 'R' may have to remove or add - // scrollbars. Have to update them anyway. - gui_may_update_scrollbars(); -#endif - - if (oldwin != curwin) - win_goto(oldwin); -} - /* * "win_splitmove()" function */ void f_win_splitmove(typval_T *argvars, typval_T *rettv) { - win_T *wp; - win_T *targetwin; + win_T *wp, *targetwin; + win_T *oldwin = curwin; int flags = 0, size = 0; + rettv->vval.v_number = -1; + if (in_vim9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL @@ -1020,7 +978,6 @@ f_win_splitmove(typval_T *argvars, typval_T *rettv) || win_valid_popup(wp) || win_valid_popup(targetwin)) { emsg(_(e_invalid_window_number)); - rettv->vval.v_number = -1; return; } @@ -1040,7 +997,24 @@ f_win_splitmove(typval_T *argvars, typval_T *rettv) size = (int)dict_get_number(d, "size"); } - win_move_into_split(wp, targetwin, size, flags); + // Check if we can split the target before we bother switching windows. + if (check_split_disallowed(targetwin) == FAIL) + return; + + if (curwin != targetwin) + win_goto(targetwin); + + // Autocommands may have sent us elsewhere or closed "wp" or "oldwin". + if (curwin == targetwin && win_valid(wp)) + { + if (win_splitmove(wp, size, flags) == OK) + rettv->vval.v_number = 0; + } + else + emsg(_(e_autocommands_caused_command_to_abort)); + + if (oldwin != curwin && win_valid(oldwin)) + win_goto(oldwin); } /* diff --git a/src/proto/window.pro b/src/proto/window.pro index def28bbe41..97a25dfa25 100644 --- a/src/proto/window.pro +++ b/src/proto/window.pro @@ -4,7 +4,9 @@ win_T *prevwin_curwin(void); win_T *swbuf_goto_win_with_buf(buf_T *buf); void do_window(int nchar, long Prenum, int xchar); void get_wincmd_addr_type(char_u *arg, exarg_T *eap); +int check_split_disallowed(win_T *wp); int win_split(int size, int flags); +int win_splitmove(win_T *wp, int size, int flags); int win_split_ins(int size, int flags, win_T *new_wp, int dir); int win_valid_popup(win_T *win); int win_valid(win_T *win); @@ -88,7 +90,7 @@ int only_one_window(void); void check_lnums(int do_curwin); void check_lnums_nested(int do_curwin); void reset_lnums(void); -void make_snapshot(int idx); +int make_snapshot(int idx); void restore_snapshot(int idx, int close_curwin); int win_hasvertsplit(void); int get_win_number(win_T *wp, win_T *first_win); diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index 6b7dccbb00..c898a233af 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -290,6 +290,16 @@ func Test_window_split_no_room() for s in range(1, hor_split_count) | split | endfor call assert_fails('split', 'E36:') + botright vsplit + wincmd | + let layout = winlayout() + let restcmd = winrestcmd() + call assert_fails('wincmd J', 'E36:') + call assert_fails('wincmd K', 'E36:') + call assert_equal(layout, winlayout()) + call assert_equal(restcmd, winrestcmd()) + only + " N vertical windows need >= 2*(N - 1) + 1 columns: " - 1 column + 1 separator for each window (except last window) " - 1 column for the last window which does not have separator @@ -302,7 +312,35 @@ func Test_window_split_no_room() for s in range(1, ver_split_count) | vsplit | endfor call assert_fails('vsplit', 'E36:') + split + wincmd | + let layout = winlayout() + let restcmd = winrestcmd() + call assert_fails('wincmd H', 'E36:') + call assert_fails('wincmd L', 'E36:') + call assert_equal(layout, winlayout()) + call assert_equal(restcmd, winrestcmd()) + + " Check that the last statusline isn't lost. + set laststatus=0 + let restcmd = winrestcmd() + wincmd j + call setwinvar(winnr('k'), '&statusline', '@#') + let last_stl_row = win_screenpos(0)[0] - 1 + redraw + call assert_equal('@#|', GetScreenStr(last_stl_row)) + call assert_equal('~ |', GetScreenStr(&lines - &cmdheight)) + call assert_fails('wincmd H', 'E36:') + call assert_fails('wincmd L', 'E36:') + call assert_equal(layout, winlayout()) + call assert_equal(restcmd, winrestcmd()) + call setwinvar(winnr('k'), '&statusline', '=-') + redraw + call assert_equal('=-|', GetScreenStr(last_stl_row)) + call assert_equal('~ |', GetScreenStr(&lines - &cmdheight)) + %bw! + set laststatus& endfunc func Test_window_exchange() @@ -1097,6 +1135,44 @@ func Test_win_splitmove() tabnew call assert_fails('call win_splitmove(1, win_getid(1, 1))', 'E957:') tabclose + + split + augroup WinSplitMove + au! + au WinEnter * ++once call win_gotoid(win_getid(winnr('#'))) + augroup END + call assert_fails('call win_splitmove(winnr(), winnr("#"))', 'E855:') + + augroup WinSplitMove + au! + au WinLeave * ++once quit + augroup END + call assert_fails('call win_splitmove(winnr(), winnr("#"))', 'E855:') + + split + split + augroup WinSplitMove + au! + au WinEnter * ++once let s:triggered = v:true + \| call assert_fails('call win_splitmove(winnr("$"), winnr())', 'E242:') + augroup END + quit + call assert_equal(v:true, s:triggered) + unlet! s:triggered + + new + augroup WinSplitMove + au! + au BufHidden * ++once let s:triggered = v:true + \| call assert_fails('call win_splitmove(winnr("#"), winnr())', 'E1159:') + augroup END + hide + call assert_equal(v:true, s:triggered) + unlet! s:triggered + + au! WinSplitMove + augroup! WinSplitMove + %bw! endfunc " Test for the :only command @@ -2061,23 +2137,75 @@ func Test_new_help_window_on_error() endfunc func Test_smoothscroll_in_zero_width_window() - let save_lines = &lines - let save_columns = &columns + set cpo+=n number smoothscroll + set winwidth=99999 winminwidth=0 - winsize 0 24 - set cpo+=n - exe "noremap 0 \n\L" - norm 000000 - set number smoothscroll - exe "norm \" + vsplit + call assert_equal(0, winwidth(winnr('#'))) + call win_execute(win_getid(winnr('#')), "norm! \") + + only! + set winwidth& winminwidth& + set cpo-=n nonumber nosmoothscroll +endfunc + +func Test_splitmove_flatten_frame() + split + vsplit + + wincmd L + let layout = winlayout() + wincmd K + wincmd L + call assert_equal(winlayout(), layout) only! - let &lines = save_lines - let &columns = save_columns - set cpo-=n - unmap 0 - set nonumber nosmoothscroll endfunc +func Test_splitmove_autocmd_window_no_room() + " Open as many windows as possible + while v:true + try + split + catch /E36:/ + break + endtry + endwhile + while v:true + try + vsplit + catch /E36:/ + break + endtry + endwhile + + wincmd j + vsplit + call assert_fails('wincmd H', 'E36:') + call assert_fails('wincmd J', 'E36:') + call assert_fails('wincmd K', 'E36:') + call assert_fails('wincmd L', 'E36:') + + edit unload me + enew + bunload! unload\ me + augroup SplitMoveAucmdWin + au! + au BufEnter * ++once let s:triggered = v:true + \| call assert_equal('autocmd', win_gettype()) + augroup END + let layout = winlayout() + let restcmd = winrestcmd() + " bufload opening the autocommand window shouldn't give E36. + call bufload('unload me') + call assert_equal(v:true, s:triggered) + call assert_equal(winlayout(), layout) + call assert_equal(winrestcmd(), restcmd) + + unlet! s:triggered + au! SplitMoveAucmdWin + augroup! SplitMoveAucmdWin + %bw! +endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 80cdfbcf3c..cf1c9da78f 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 116, /**/ 115, /**/ diff --git a/src/vim.h b/src/vim.h index 45cf8cad0d..7ef9b00336 100644 --- a/src/vim.h +++ b/src/vim.h @@ -1255,6 +1255,7 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #define WSP_BELOW 0x40 // put new window below/right #define WSP_ABOVE 0x80 // put new window above/left #define WSP_NEWLOC 0x100 // don't copy location list +#define WSP_FORCE_ROOM 0x200 // ignore "not enough room" errors /* * arguments for gui_set_shellsize() diff --git a/src/window.c b/src/window.c index a7d9319bde..de43476650 100644 --- a/src/window.c +++ b/src/window.c @@ -17,7 +17,6 @@ static void frame_setheight(frame_T *curfrp, int height); static void frame_setwidth(frame_T *curfrp, int width); static void win_exchange(long); static void win_rotate(int, int); -static void win_totop(int size, int flags); static void win_equal_rec(win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height); static void trigger_winnewpre(void); static void trigger_winclosed(win_T *win); @@ -31,7 +30,7 @@ static void win_fix_cursor(int normal); static void frame_new_height(frame_T *topfrp, int height, int topfirst, int wfh); static int frame_fixed_height(frame_T *frp); static int frame_fixed_width(frame_T *frp); -static void frame_add_statusline(frame_T *frp); +static void frame_add_statusline(frame_T *frp, int adjust_winheight); static void frame_new_width(frame_T *topfrp, int width, int leftfirst, int wfw); static void frame_add_vsep(frame_T *frp); static int frame_minwidth(frame_T *topfrp, win_T *next_curwin); @@ -55,12 +54,15 @@ static void win_goto_hor(int left, long count); static void frame_add_height(frame_T *frp, int n); static void last_status_rec(frame_T *fr, int statusline); -static void make_snapshot_rec(frame_T *fr, frame_T **frp); +static int make_snapshot_rec(frame_T *fr, frame_T **frp, int snap_wins); static void clear_snapshot(tabpage_T *tp, int idx); static void clear_snapshot_rec(frame_T *fr); static int check_snapshot_rec(frame_T *sn, frame_T *fr); static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr); static win_T *get_snapshot_curwin(int idx); +static frame_T *make_full_snapshot(void); +static void restore_full_snapshot(frame_T *sn); +static void restore_full_snapshot_rec(frame_T *sn); static int frame_check_height(frame_T *topfrp, int height); static int frame_check_width(frame_T *topfrp, int width); @@ -494,9 +496,15 @@ do_window( case 'H': case 'L': CHECK_CMDWIN; - win_totop((int)Prenum, - ((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0) - | ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT)); + if (ONE_WINDOW) + beep_flush(); + else + { + int dir = ((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0) + | ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT); + + (void)win_splitmove(curwin, (int)Prenum, dir); + } break; // make all windows the same width and/or height @@ -858,18 +866,18 @@ cmd_with_count( } /* - * If "split_disallowed" is set give an error and return FAIL. + * If "split_disallowed" is set for "wp", give an error and return FAIL. * Otherwise return OK. */ - static int -check_split_disallowed(void) + int +check_split_disallowed(win_T *wp) { if (split_disallowed > 0) { emsg(_(e_cant_split_window_while_closing_another)); return FAIL; } - if (curwin->w_buffer->b_locked_split) + if (wp->w_buffer->b_locked_split) { emsg(_(e_cannot_split_window_when_closing_buffer)); return FAIL; @@ -898,7 +906,7 @@ win_split(int size, int flags) if (ERROR_IF_ANY_POPUP_WINDOW) return FAIL; - if (check_split_disallowed() == FAIL) + if (check_split_disallowed(curwin) == FAIL) return FAIL; // When the ":tab" modifier was used open a new tab page instead. @@ -968,7 +976,7 @@ win_split_ins( // add a status line when p_ls == 1 and splitting the first window if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0) { - if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL) + if (!(flags & WSP_FORCE_ROOM) && VISIBLE_HEIGHT(oldwin) <= p_wmh) { emsg(_(e_not_enough_room)); goto theend; @@ -1026,7 +1034,7 @@ win_split_ins( available = oldwin->w_frame->fr_width; needed += minwidth; } - if (available < needed && new_wp == NULL) + if (!(flags & WSP_FORCE_ROOM) && available < needed) { emsg(_(e_not_enough_room)); goto theend; @@ -1109,7 +1117,7 @@ win_split_ins( available = oldwin->w_frame->fr_height; needed += minheight; } - if (available < needed && new_wp == NULL) + if (!(flags & WSP_FORCE_ROOM) && available < needed) { emsg(_(e_not_enough_room)); goto theend; @@ -1360,7 +1368,7 @@ win_split_ins( if (!((flags & WSP_BOT) && p_ls == 0)) new_fr_height -= STATUS_HEIGHT; if (flags & WSP_BOT) - frame_add_statusline(curfrp); + frame_add_statusline(curfrp, FALSE); frame_new_height(curfrp, new_fr_height, flags & WSP_TOP, FALSE); } else @@ -1900,35 +1908,69 @@ win_rotate(int upwards, int count) } /* - * Move the current window to the very top/bottom/left/right of the screen. + * Move "wp" into a new split in a given direction, possibly relative to the + * current window. + * "wp" must be valid in the current tabpage. + * Returns FAIL for failure, OK otherwise. */ - static void -win_totop(int size, int flags) + int +win_splitmove(win_T *wp, int size, int flags) { int dir; - int height = curwin->w_height; + int height = wp->w_height; + frame_T *frp; if (ONE_WINDOW) + return OK; // nothing to do + if (check_split_disallowed(wp) == FAIL) + return FAIL; + + // Undoing changes to frames if splitting fails is complicated. + // Save a full snapshot to restore instead. + frp = make_full_snapshot(); + if (frp == NULL) { - beep_flush(); - return; + emsg(_(e_out_of_memory)); + return FAIL; } - if (check_split_disallowed() == FAIL) - return; // Remove the window and frame from the tree of frames. - (void)winframe_remove(curwin, &dir, NULL); - win_remove(curwin, NULL); + (void)winframe_remove(wp, &dir, NULL); + win_remove(wp, NULL); last_status(FALSE); // may need to remove last status line (void)win_comp_pos(); // recompute window positions - // Split a window on the desired side and put the window there. - (void)win_split_ins(size, flags, curwin, dir); - if (!(flags & WSP_VERT)) + // Split a window on the desired side and put "wp" there. + if (win_split_ins(size, flags, wp, dir) == FAIL) { - win_setheight(height); + // Restore the previous layout from the snapshot. + vim_free(wp->w_frame); + restore_full_snapshot(frp); + + // Vertical separators to the left may have been lost. Restore them. + frp = wp->w_frame; + if (frp->fr_parent->fr_layout == FR_ROW && frp->fr_prev != NULL) + frame_add_vsep(frp->fr_prev); + + // Statuslines above may have been lost. Restore them. + if (frp->fr_parent->fr_layout == FR_COL && frp->fr_prev != NULL) + frame_add_statusline(frp->fr_prev, TRUE); + + win_append(wp->w_prev, wp); + return FAIL; + } + clear_snapshot_rec(frp); + + // If splitting horizontally, try to preserve height. + if (size == 0 && !(flags & WSP_VERT)) + { + win_setheight_win(height, wp); if (p_ea) - win_equal(curwin, TRUE, 'v'); + { + // Equalize windows. Note that win_split_ins autocommands may have + // made a window other than "wp" current. + win_equal(curwin, curwin == wp, 'v'); + } } #if defined(FEAT_GUI) @@ -1936,6 +1978,7 @@ win_totop(int size, int flags) // scrollbars. Have to update them anyway. gui_may_update_scrollbars(); #endif + return OK; } /* @@ -3849,30 +3892,34 @@ frame_fixed_width(frame_T *frp) /* * Add a status line to windows at the bottom of "frp". - * Note: Does not check if there is room! + * If "adjust_winheight" is set, reduce the height of windows without a + * statusline to accommodate one; otherwise, there is no check for room! */ static void -frame_add_statusline(frame_T *frp) +frame_add_statusline(frame_T *frp, int adjust_winheight) { win_T *wp; if (frp->fr_layout == FR_LEAF) { wp = frp->fr_win; + if (adjust_winheight && wp->w_status_height == 0 + && wp->w_height >= STATUS_HEIGHT) // don't make it negative + wp->w_height -= STATUS_HEIGHT - wp->w_status_height; wp->w_status_height = STATUS_HEIGHT; } else if (frp->fr_layout == FR_ROW) { // Handle all the frames in the row. FOR_ALL_FRAMES(frp, frp->fr_child) - frame_add_statusline(frp); + frame_add_statusline(frp, adjust_winheight); } else // frp->fr_layout == FR_COL { // Only need to handle the last frame in the column. for (frp = frp->fr_child; frp->fr_next != NULL; frp = frp->fr_next) ; - frame_add_statusline(frp); + frame_add_statusline(frp, adjust_winheight); } } @@ -7498,29 +7545,44 @@ reset_lnums(void) /* * Create a snapshot of the current frame sizes. * "idx" is SNAP_HELP_IDX or SNAP_AUCMD_IDX. + * Return FAIL if out of memory, OK otherwise. */ - void + int make_snapshot(int idx) { clear_snapshot(curtab, idx); - make_snapshot_rec(topframe, &curtab->tp_snapshot[idx]); + if (make_snapshot_rec(topframe, &curtab->tp_snapshot[idx], FALSE) == FAIL) + { + clear_snapshot(curtab, idx); + return FAIL; + } + return OK; } - static void -make_snapshot_rec(frame_T *fr, frame_T **frp) + static int +make_snapshot_rec(frame_T *fr, frame_T **frp, int snap_wins) { *frp = ALLOC_CLEAR_ONE(frame_T); if (*frp == NULL) - return; + return FAIL; (*frp)->fr_layout = fr->fr_layout; (*frp)->fr_width = fr->fr_width; (*frp)->fr_height = fr->fr_height; if (fr->fr_next != NULL) - make_snapshot_rec(fr->fr_next, &((*frp)->fr_next)); + { + if (make_snapshot_rec(fr->fr_next, &((*frp)->fr_next), snap_wins) + == FAIL) + return FAIL; + } if (fr->fr_child != NULL) - make_snapshot_rec(fr->fr_child, &((*frp)->fr_child)); - if (fr->fr_layout == FR_LEAF && fr->fr_win == curwin) - (*frp)->fr_win = curwin; + { + if (make_snapshot_rec(fr->fr_child, &((*frp)->fr_child), snap_wins) + == FAIL) + return FAIL; + } + if (fr->fr_layout == FR_LEAF && (snap_wins || fr->fr_win == curwin)) + (*frp)->fr_win = fr->fr_win; + return OK; } /* @@ -7657,6 +7719,86 @@ restore_snapshot_rec(frame_T *sn, frame_T *fr) return wp; } +/* + * Return a snapshot of all frames in the current tabpage and which windows are + * in them, or NULL if out of memory. + * Use clear_snapshot_rec to free the snapshot. + */ + static frame_T * +make_full_snapshot(void) +{ + frame_T *frp; + + if (make_snapshot_rec(topframe, &frp, TRUE) == FAIL) + { + clear_snapshot_rec(frp); + return NULL; + } + return frp; +} + +/* + * Restore all frames in the full snapshot "sn" for the current tabpage. + * Caller must ensure that the screen size didn't change, no windows with frames + * in the snapshot were freed, and windows with frames not in the snapshot are + * removed from their frames! + * Doesn't restore changed window vertical separators or statuslines. + * Frees the old frames. Don't call clear_snapshot_rec on "sn" afterwards! + */ + static void +restore_full_snapshot(frame_T *sn) +{ + if (sn == NULL) + return; + + clear_snapshot_rec(topframe); + restore_full_snapshot_rec(sn); + curtab->tp_topframe = topframe = sn; + last_status(FALSE); + + // If the amount of space available changed, first try setting the sizes of + // windows with 'winfix{width,height}'. If that doesn't result in the right + // size, forget about that option. + if (topframe->fr_width != Columns) + { + frame_new_width(topframe, Columns, FALSE, TRUE); + if (!frame_check_width(topframe, Columns)) + frame_new_width(topframe, Columns, FALSE, FALSE); + } + if (topframe->fr_height != ROWS_AVAIL) + { + frame_new_height(topframe, ROWS_AVAIL, FALSE, TRUE); + if (!frame_check_height(topframe, ROWS_AVAIL)) + frame_new_height(topframe, ROWS_AVAIL, FALSE, FALSE); + } + + win_comp_pos(); +} + + static void +restore_full_snapshot_rec(frame_T *sn) +{ + if (sn == NULL) + return; + + if (sn->fr_child != NULL) + sn->fr_child->fr_parent = sn; + if (sn->fr_next != NULL) + { + sn->fr_next->fr_parent = sn->fr_parent; + sn->fr_next->fr_prev = sn; + } + if (sn->fr_win != NULL) + { + sn->fr_win->w_frame = sn; + // Resize window to fit the frame. + frame_new_height(sn, sn->fr_height, FALSE, FALSE); + frame_new_width(sn, sn->fr_width, FALSE, FALSE); + } + restore_full_snapshot_rec(sn->fr_child); + restore_full_snapshot_rec(sn->fr_next); +} + #if defined(FEAT_GUI) || defined(PROTO) /* * Return TRUE if there is any vertically split window. From 96cc4aef3d47d0fd70e68908af3d48a0dce8ea70 Mon Sep 17 00:00:00 2001 From: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Tue, 20 Feb 2024 21:52:31 +0100 Subject: [PATCH 063/426] patch 9.1.0117: Stop split-moving from firing WinNew and WinNewPre autocommands Problem: win_splitmove fires WinNewPre and possibly WinNew when moving windows, even though no new windows are created. Solution: don't fire WinNew and WinNewPre when inserting an existing window, even if it isn't the current window. Improve the accuracy of related documentation. (Sean Dewar) Likewise, before this patch, WinClosed was not fired anyway (even for :wincmd H/J/K/L, which also didn't fire WinNew, but did still fire WinNewPre), despite documentation saying windows are "closed". Note that :wincmd T actually indeed works by creating a new window (and closing the old one), unlike the others. This also fixes issues where WinNewPre is fired when split-moving while curwin doesn't yet have a frame or entry in the window list, causing many things to not work (it's not considered valid at that point). This was guaranteed when using :wincmd H/J/K/L. Because WinNewPre is no longer fired when split-moving, this makes restoring the previous window layout on failure easier, as we can be sure that frames are not resized from WinNewPre autocommands if win_split_ins fails. This allows us to use a different strategy in the following commit. -- In my opinion, this leaves questions about the current usefulness of WinNewPre. A motivation described in #10635 states how creating a new window can steal room from other windows, and how WinNewPre will be useful for detecting that, but this is also true when inserting an existing window, which now doesn't fire it. Maybe the autocommand should be changed to have a better name? There are also other issues I found with the current implementation of WinNewPre that need addressing: - it allows switching windows and tabpages, which can cause incorrect windows to be split/moved, and big problems when switching tabpages. - it fires before win_split_ins checks for room, before it makes any changes to window sizes or before it considers allocating a new window. This should be changed or documented. I hope to address some of this stuff in a different PR, if possible. related: #14038 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 10 +++++----- runtime/doc/windows.txt | 32 +++++++++++++++----------------- src/testdir/test_window_cmd.vim | 17 +++++++++++++++++ src/version.c | 2 ++ src/window.c | 7 +++++-- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 0b3d59e966..0cddeffa75 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 12 +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -10762,10 +10762,10 @@ win_screenpos({nr}) *win_screenpos()* GetWinid()->win_screenpos() < win_splitmove({nr}, {target} [, {options}]) *win_splitmove()* - Move the window {nr} to a new split of the window {target}. - This is similar to moving to {target}, creating a new window - using |:split| but having the same contents as window {nr}, and - then closing {nr}. + Temporarily switch to window {target}, then move window {nr} + to a new split adjacent to {target}. + Unlike commands such as |:split|, no new windows are created + (the |window-ID| of window {nr} is unchanged after the move). Both {nr} and {target} can be window numbers or |window-ID|s. Both must be in the current tab page. diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 8064748752..e264e51170 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 9.1. Last change: 2022 Nov 27 +*windows.txt* For Vim version 9.1. Last change: 2024 Feb 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -519,35 +519,33 @@ horizontally split windows. CTRL-W H does it the other way around. *CTRL-W_K* CTRL-W K Move the current window to be at the very top, using the full - width of the screen. This works like closing the current - window and then creating another one with ":topleft split", - except that the current window contents is used for the new - window. + width of the screen. This works like `:topleft split`, except + it is applied to the current window and no new window is + created. *CTRL-W_J* CTRL-W J Move the current window to be at the very bottom, using the - full width of the screen. This works like closing the current - window and then creating another one with ":botright split", - except that the current window contents is used for the new - window. + full width of the screen. This works like `:botright split`, + except it is applied to the current window and no new window + is created. *CTRL-W_H* CTRL-W H Move the current window to be at the far left, using the - full height of the screen. This works like closing the - current window and then creating another one with - `:vert topleft split`, except that the current window contents - is used for the new window. + full height of the screen. This works like + `:vert topleft split`, except it is applied to the current + window and no new window is created. *CTRL-W_L* CTRL-W L Move the current window to be at the far right, using the full - height of the screen. This works like closing the - current window and then creating another one with - `:vert botright split`, except that the current window - contents is used for the new window. + height of the screen. This works like `:vert botright split`, + except it is applied to the current window and no new window + is created. *CTRL-W_T* CTRL-W T Move the current window to a new tab page. This fails if there is only one window in the current tab page. + This works like `:tab split`, except the previous window is + closed. When a count is specified the new tab page will be opened before the tab page with this index. Otherwise it comes after the current tab page. diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index c898a233af..5b50f9dc5d 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -1104,6 +1104,18 @@ func Test_win_splitmove() leftabove split b leftabove vsplit c leftabove split d + + " win_splitmove doesn't actually create or close any windows, so expect an + " unchanged winid and no WinNew/WinClosed events, like :wincmd H/J/K/L. + let s:triggered = [] + augroup WinSplitMove + au! + au WinNewPre * let s:triggered += ['WinNewPre'] + au WinNew * let s:triggered += ['WinNew', win_getid()] + au WinClosed * let s:triggered += ['WinClosed', str2nr(expand(''))] + augroup END + let winid = win_getid() + call assert_equal(0, win_splitmove(winnr(), winnr('l'))) call assert_equal(bufname(winbufnr(1)), 'c') call assert_equal(bufname(winbufnr(2)), 'd') @@ -1126,6 +1138,11 @@ func Test_win_splitmove() call assert_equal(bufname(winbufnr(3)), 'a') call assert_equal(bufname(winbufnr(4)), 'd') call assert_fails('call win_splitmove(winnr(), winnr("k"), test_null_dict())', 'E1297:') + call assert_equal([], s:triggered) + call assert_equal(winid, win_getid()) + + unlet! s:triggered + au! WinSplitMove only | bd call assert_fails('call win_splitmove(winnr(), 123)', 'E957:') diff --git a/src/version.c b/src/version.c index cf1c9da78f..9ceb6cebe7 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 117, /**/ 116, /**/ diff --git a/src/window.c b/src/window.c index de43476650..1ae7b27d8f 100644 --- a/src/window.c +++ b/src/window.c @@ -935,6 +935,8 @@ win_split(int size, int flags) * When "new_wp" is NULL: split the current window in two. * When "new_wp" is not NULL: insert this window at the far * top/left/right/bottom. + * On failure, if "new_wp" was not NULL, no changes will have been made to the + * window layout or sizes. * Return FAIL for failure, OK otherwise. */ int @@ -964,7 +966,8 @@ win_split_ins( // Do not redraw here, curwin->w_buffer may be invalid. ++RedrawingDisabled; - trigger_winnewpre(); + if (new_wp == NULL) + trigger_winnewpre(); if (flags & WSP_TOP) oldwin = firstwin; @@ -1444,7 +1447,7 @@ win_split_ins( /* * make the new window the current window */ - (void)win_enter_ext(wp, WEE_TRIGGER_NEW_AUTOCMDS + (void)win_enter_ext(wp, (new_wp == NULL ? WEE_TRIGGER_NEW_AUTOCMDS : 0) | WEE_TRIGGER_ENTER_AUTOCMDS | WEE_TRIGGER_LEAVE_AUTOCMDS); if (flags & WSP_VERT) p_wiw = i; From 704966c2545897dfcf426dd9ef946aeb6fa80c38 Mon Sep 17 00:00:00 2001 From: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Tue, 20 Feb 2024 22:00:33 +0100 Subject: [PATCH 064/426] patch 9.1.0118: Use different restoration strategy in win_splitmove Problem: saving and restoring all frames to split-move is overkill now that WinNewPre is not fired when split-moving. Solution: defer the flattening of frames until win_split_ins begins reorganising them, and attempt to restore the layout by undoing our changes. (Sean Dewar) This also means we no longer must allocate. related: #14042 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt --- src/autocmd.c | 4 +- src/proto/window.pro | 4 +- src/version.c | 2 + src/window.c | 305 +++++++++++++++++++------------------------ 4 files changed, 139 insertions(+), 176 deletions(-) diff --git a/src/autocmd.c b/src/autocmd.c index 41a46958e5..8e43b34473 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -1607,7 +1607,7 @@ aucmd_prepbuf( p_acd = FALSE; #endif - (void)win_split_ins(0, WSP_TOP | WSP_FORCE_ROOM, auc_win, 0); + (void)win_split_ins(0, WSP_TOP | WSP_FORCE_ROOM, auc_win, 0, NULL); (void)win_comp_pos(); // recompute window positions p_ea = save_ea; #ifdef FEAT_AUTOCHDIR @@ -1670,7 +1670,7 @@ aucmd_restbuf( stop_insert_mode = save_stop_insert_mode; #endif // Remove the window and frame from the tree of frames. - (void)winframe_remove(curwin, &dummy, NULL); + (void)winframe_remove(curwin, &dummy, NULL, NULL); win_remove(curwin, NULL); // The window is marked as not used, but it is not freed, it can be diff --git a/src/proto/window.pro b/src/proto/window.pro index 97a25dfa25..0ec57349b2 100644 --- a/src/proto/window.pro +++ b/src/proto/window.pro @@ -7,7 +7,7 @@ void get_wincmd_addr_type(char_u *arg, exarg_T *eap); int check_split_disallowed(win_T *wp); int win_split(int size, int flags); int win_splitmove(win_T *wp, int size, int flags); -int win_split_ins(int size, int flags, win_T *new_wp, int dir); +int win_split_ins(int size, int flags, win_T *new_wp, int dir, frame_T *to_flatten); int win_valid_popup(win_T *win); int win_valid(win_T *win); win_T *win_find_by_id(int id); @@ -28,7 +28,7 @@ void may_make_initial_scroll_size_snapshot(void); void may_trigger_win_scrolled_resized(void); void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp); void win_free_all(void); -win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp); +win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp, frame_T **to_flatten); void close_others(int message, int forceit); void unuse_tabpage(tabpage_T *tp); void use_tabpage(tabpage_T *tp); diff --git a/src/version.c b/src/version.c index 9ceb6cebe7..7de75e35b6 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 118, /**/ 117, /**/ diff --git a/src/window.c b/src/window.c index 1ae7b27d8f..a6223eeffd 100644 --- a/src/window.c +++ b/src/window.c @@ -30,7 +30,7 @@ static void win_fix_cursor(int normal); static void frame_new_height(frame_T *topfrp, int height, int topfirst, int wfh); static int frame_fixed_height(frame_T *frp); static int frame_fixed_width(frame_T *frp); -static void frame_add_statusline(frame_T *frp, int adjust_winheight); +static void frame_add_statusline(frame_T *frp); static void frame_new_width(frame_T *topfrp, int width, int leftfirst, int wfw); static void frame_add_vsep(frame_T *frp); static int frame_minwidth(frame_T *topfrp, win_T *next_curwin); @@ -53,16 +53,15 @@ static void win_goto_ver(int up, long count); static void win_goto_hor(int left, long count); static void frame_add_height(frame_T *frp, int n); static void last_status_rec(frame_T *fr, int statusline); +static void frame_flatten(frame_T *frp); +static void winframe_restore(win_T *wp, int dir, frame_T *to_flatten); -static int make_snapshot_rec(frame_T *fr, frame_T **frp, int snap_wins); +static int make_snapshot_rec(frame_T *fr, frame_T **frp); static void clear_snapshot(tabpage_T *tp, int idx); static void clear_snapshot_rec(frame_T *fr); static int check_snapshot_rec(frame_T *sn, frame_T *fr); static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr); static win_T *get_snapshot_curwin(int idx); -static frame_T *make_full_snapshot(void); -static void restore_full_snapshot(frame_T *sn); -static void restore_full_snapshot_rec(frame_T *sn); static int frame_check_height(frame_T *topfrp, int height); static int frame_check_width(frame_T *topfrp, int width); @@ -928,13 +927,16 @@ win_split(int size, int flags) else clear_snapshot(curtab, SNAP_HELP_IDX); - return win_split_ins(size, flags, NULL, 0); + return win_split_ins(size, flags, NULL, 0, NULL); } /* * When "new_wp" is NULL: split the current window in two. * When "new_wp" is not NULL: insert this window at the far * top/left/right/bottom. + * When "to_flatten" is not NULL: flatten this frame before reorganising frames; + * remains unflattened on failure. + * * On failure, if "new_wp" was not NULL, no changes will have been made to the * window layout or sizes. * Return FAIL for failure, OK otherwise. @@ -944,7 +946,8 @@ win_split_ins( int size, int flags, win_T *new_wp, - int dir) + int dir, + frame_T *to_flatten) { win_T *wp = new_wp; win_T *oldwin; @@ -1219,6 +1222,10 @@ win_split_ins( win_init(wp, curwin, flags); } + // Going to reorganize frames now, make sure they're flat. + if (to_flatten != NULL) + frame_flatten(to_flatten); + /* * Reorganise the tree of frames to insert the new window. */ @@ -1371,7 +1378,7 @@ win_split_ins( if (!((flags & WSP_BOT) && p_ls == 0)) new_fr_height -= STATUS_HEIGHT; if (flags & WSP_BOT) - frame_add_statusline(curfrp, FALSE); + frame_add_statusline(curfrp); frame_new_height(curfrp, new_fr_height, flags & WSP_TOP, FALSE); } else @@ -1921,48 +1928,30 @@ win_splitmove(win_T *wp, int size, int flags) { int dir; int height = wp->w_height; - frame_T *frp; + frame_T *unflat_altfr; if (ONE_WINDOW) return OK; // nothing to do if (check_split_disallowed(wp) == FAIL) return FAIL; - // Undoing changes to frames if splitting fails is complicated. - // Save a full snapshot to restore instead. - frp = make_full_snapshot(); - if (frp == NULL) - { - emsg(_(e_out_of_memory)); - return FAIL; - } - - // Remove the window and frame from the tree of frames. - (void)winframe_remove(wp, &dir, NULL); + // Remove the window and frame from the tree of frames. Don't flatten any + // frames yet so we can restore things if win_split_ins fails. + winframe_remove(wp, &dir, NULL, &unflat_altfr); win_remove(wp, NULL); last_status(FALSE); // may need to remove last status line (void)win_comp_pos(); // recompute window positions // Split a window on the desired side and put "wp" there. - if (win_split_ins(size, flags, wp, dir) == FAIL) + if (win_split_ins(size, flags, wp, dir, unflat_altfr) == FAIL) { - // Restore the previous layout from the snapshot. - vim_free(wp->w_frame); - restore_full_snapshot(frp); - - // Vertical separators to the left may have been lost. Restore them. - frp = wp->w_frame; - if (frp->fr_parent->fr_layout == FR_ROW && frp->fr_prev != NULL) - frame_add_vsep(frp->fr_prev); - - // Statuslines above may have been lost. Restore them. - if (frp->fr_parent->fr_layout == FR_COL && frp->fr_prev != NULL) - frame_add_statusline(frp->fr_prev, TRUE); - + // win_split_ins doesn't change sizes or layout if it fails to insert an + // existing window, so just undo winframe_remove. + winframe_restore(wp, dir, unflat_altfr); win_append(wp->w_prev, wp); + (void)win_comp_pos(); // recompute window positions return FAIL; } - clear_snapshot_rec(frp); // If splitting horizontally, try to preserve height. if (size == 0 && !(flags & WSP_VERT)) @@ -3412,7 +3401,7 @@ win_free_mem( // Remove the window and its frame from the tree of frames. frp = win->w_frame; - wp = winframe_remove(win, dirp, tp); + wp = winframe_remove(win, dirp, tp, NULL); vim_free(frp); win_free(win, tp); @@ -3462,7 +3451,9 @@ win_free_all(void) winframe_remove( win_T *win, int *dirp UNUSED, // set to 'v' or 'h' for direction if 'ea' - tabpage_T *tp) // tab page "win" is in, NULL for current + tabpage_T *tp, // tab page "win" is in, NULL for current + frame_T **unflat_altfr) // if not NULL, set to pointer of frame that got + // the space, and it is not flattened { frame_T *frp, *frp2, *frp3; frame_T *frp_close = win->w_frame; @@ -3517,7 +3508,7 @@ winframe_remove( } } frame_new_height(frp2, frp2->fr_height + frp_close->fr_height, - frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE); + frp2 == frp_close->fr_next, FALSE); *dirp = 'v'; } else @@ -3554,7 +3545,7 @@ winframe_remove( } } frame_new_width(frp2, frp2->fr_width + frp_close->fr_width, - frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE); + frp2 == frp_close->fr_next, FALSE); *dirp = 'h'; } @@ -3568,50 +3559,106 @@ winframe_remove( frame_comp_pos(frp2, &row, &col); } - if (frp2->fr_next == NULL && frp2->fr_prev == NULL) - { - // There is no other frame in this list, move its info to the parent - // and remove it. - frp2->fr_parent->fr_layout = frp2->fr_layout; - frp2->fr_parent->fr_child = frp2->fr_child; - FOR_ALL_FRAMES(frp, frp2->fr_child) - frp->fr_parent = frp2->fr_parent; - frp2->fr_parent->fr_win = frp2->fr_win; - if (frp2->fr_win != NULL) - frp2->fr_win->w_frame = frp2->fr_parent; - frp = frp2->fr_parent; - if (topframe->fr_child == frp2) - topframe->fr_child = frp; - vim_free(frp2); + if (unflat_altfr == NULL) + frame_flatten(frp2); + else + *unflat_altfr = frp2; - frp2 = frp->fr_parent; - if (frp2 != NULL && frp2->fr_layout == frp->fr_layout) + return wp; +} + +/* + * Flatten "frp" into its parent frame if it's the only child, also merging its + * list with the grandparent if they share the same layout. + * Frees "frp" if flattened; also "frp->fr_parent" if it has the same layout. + * "frp" must be valid in the current tabpage. + */ + static void +frame_flatten(frame_T *frp) +{ + frame_T *frp2, *frp3; + + if (frp->fr_next != NULL || frp->fr_prev != NULL) + return; + + // There is no other frame in this list, move its info to the parent + // and remove it. + frp->fr_parent->fr_layout = frp->fr_layout; + frp->fr_parent->fr_child = frp->fr_child; + FOR_ALL_FRAMES(frp2, frp->fr_child) + frp2->fr_parent = frp->fr_parent; + frp->fr_parent->fr_win = frp->fr_win; + if (frp->fr_win != NULL) + frp->fr_win->w_frame = frp->fr_parent; + frp2 = frp->fr_parent; + if (topframe->fr_child == frp) + topframe->fr_child = frp2; + vim_free(frp); + + frp = frp2->fr_parent; + if (frp != NULL && frp->fr_layout == frp2->fr_layout) + { + // The frame above the parent has the same layout, have to merge + // the frames into this list. + if (frp->fr_child == frp2) + frp->fr_child = frp2->fr_child; + frp2->fr_child->fr_prev = frp2->fr_prev; + if (frp2->fr_prev != NULL) + frp2->fr_prev->fr_next = frp2->fr_child; + for (frp3 = frp2->fr_child; ; frp3 = frp3->fr_next) { - // The frame above the parent has the same layout, have to merge - // the frames into this list. - if (frp2->fr_child == frp) - frp2->fr_child = frp->fr_child; - frp->fr_child->fr_prev = frp->fr_prev; - if (frp->fr_prev != NULL) - frp->fr_prev->fr_next = frp->fr_child; - for (frp3 = frp->fr_child; ; frp3 = frp3->fr_next) + frp3->fr_parent = frp; + if (frp3->fr_next == NULL) { - frp3->fr_parent = frp2; - if (frp3->fr_next == NULL) - { - frp3->fr_next = frp->fr_next; - if (frp->fr_next != NULL) - frp->fr_next->fr_prev = frp3; - break; - } + frp3->fr_next = frp2->fr_next; + if (frp2->fr_next != NULL) + frp2->fr_next->fr_prev = frp3; + break; } - if (topframe->fr_child == frp) - topframe->fr_child = frp2; - vim_free(frp); } + if (topframe->fr_child == frp2) + topframe->fr_child = frp; + vim_free(frp2); } +} - return wp; +/* + * Undo changes from a prior call to winframe_remove, also restoring lost + * vertical separators and statuslines. + * Caller must ensure no other changes were made to the layout or window sizes! + */ + static void +winframe_restore(win_T *wp, int dir, frame_T *unflat_altfr) +{ + frame_T *frp = wp->w_frame; + + // Put "wp"'s frame back where it was. + if (frp->fr_prev != NULL) + frame_append(frp->fr_prev, frp); + else + frame_insert(frp->fr_next, frp); + + // Vertical separators to the left may have been lost. Restore them. + if (wp->w_vsep_width == 0 + && frp->fr_parent->fr_layout == FR_ROW && frp->fr_prev != NULL) + frame_add_vsep(frp->fr_prev); + + // Statuslines above may have been lost. Restore them. + if (wp->w_status_height == 0 + && frp->fr_parent->fr_layout == FR_COL && frp->fr_prev != NULL) + frame_add_statusline(frp->fr_prev); + + // Restore the lost room that was redistributed to the altframe. + if (dir == 'v') + { + frame_new_height(unflat_altfr, unflat_altfr->fr_height - frp->fr_height, + unflat_altfr == frp->fr_next, FALSE); + } + else if (dir == 'h') + { + frame_new_width(unflat_altfr, unflat_altfr->fr_width - frp->fr_width, + unflat_altfr == frp->fr_next, FALSE); + } } /* @@ -3895,34 +3942,30 @@ frame_fixed_width(frame_T *frp) /* * Add a status line to windows at the bottom of "frp". - * If "adjust_winheight" is set, reduce the height of windows without a - * statusline to accommodate one; otherwise, there is no check for room! + * Note: Does not check if there is room! */ static void -frame_add_statusline(frame_T *frp, int adjust_winheight) +frame_add_statusline(frame_T *frp) { win_T *wp; if (frp->fr_layout == FR_LEAF) { wp = frp->fr_win; - if (adjust_winheight && wp->w_status_height == 0 - && wp->w_height >= STATUS_HEIGHT) // don't make it negative - wp->w_height -= STATUS_HEIGHT - wp->w_status_height; wp->w_status_height = STATUS_HEIGHT; } else if (frp->fr_layout == FR_ROW) { // Handle all the frames in the row. FOR_ALL_FRAMES(frp, frp->fr_child) - frame_add_statusline(frp, adjust_winheight); + frame_add_statusline(frp); } else // frp->fr_layout == FR_COL { // Only need to handle the last frame in the column. for (frp = frp->fr_child; frp->fr_next != NULL; frp = frp->fr_next) ; - frame_add_statusline(frp, adjust_winheight); + frame_add_statusline(frp); } } @@ -7554,7 +7597,7 @@ reset_lnums(void) make_snapshot(int idx) { clear_snapshot(curtab, idx); - if (make_snapshot_rec(topframe, &curtab->tp_snapshot[idx], FALSE) == FAIL) + if (make_snapshot_rec(topframe, &curtab->tp_snapshot[idx]) == FAIL) { clear_snapshot(curtab, idx); return FAIL; @@ -7563,7 +7606,7 @@ make_snapshot(int idx) } static int -make_snapshot_rec(frame_T *fr, frame_T **frp, int snap_wins) +make_snapshot_rec(frame_T *fr, frame_T **frp) { *frp = ALLOC_CLEAR_ONE(frame_T); if (*frp == NULL) @@ -7573,18 +7616,16 @@ make_snapshot_rec(frame_T *fr, frame_T **frp, int snap_wins) (*frp)->fr_height = fr->fr_height; if (fr->fr_next != NULL) { - if (make_snapshot_rec(fr->fr_next, &((*frp)->fr_next), snap_wins) - == FAIL) + if (make_snapshot_rec(fr->fr_next, &((*frp)->fr_next)) == FAIL) return FAIL; } if (fr->fr_child != NULL) { - if (make_snapshot_rec(fr->fr_child, &((*frp)->fr_child), snap_wins) - == FAIL) + if (make_snapshot_rec(fr->fr_child, &((*frp)->fr_child)) == FAIL) return FAIL; } - if (fr->fr_layout == FR_LEAF && (snap_wins || fr->fr_win == curwin)) - (*frp)->fr_win = fr->fr_win; + if (fr->fr_layout == FR_LEAF && fr->fr_win == curwin) + (*frp)->fr_win = curwin; return OK; } @@ -7722,86 +7763,6 @@ restore_snapshot_rec(frame_T *sn, frame_T *fr) return wp; } -/* - * Return a snapshot of all frames in the current tabpage and which windows are - * in them, or NULL if out of memory. - * Use clear_snapshot_rec to free the snapshot. - */ - static frame_T * -make_full_snapshot(void) -{ - frame_T *frp; - - if (make_snapshot_rec(topframe, &frp, TRUE) == FAIL) - { - clear_snapshot_rec(frp); - return NULL; - } - return frp; -} - -/* - * Restore all frames in the full snapshot "sn" for the current tabpage. - * Caller must ensure that the screen size didn't change, no windows with frames - * in the snapshot were freed, and windows with frames not in the snapshot are - * removed from their frames! - * Doesn't restore changed window vertical separators or statuslines. - * Frees the old frames. Don't call clear_snapshot_rec on "sn" afterwards! - */ - static void -restore_full_snapshot(frame_T *sn) -{ - if (sn == NULL) - return; - - clear_snapshot_rec(topframe); - restore_full_snapshot_rec(sn); - curtab->tp_topframe = topframe = sn; - last_status(FALSE); - - // If the amount of space available changed, first try setting the sizes of - // windows with 'winfix{width,height}'. If that doesn't result in the right - // size, forget about that option. - if (topframe->fr_width != Columns) - { - frame_new_width(topframe, Columns, FALSE, TRUE); - if (!frame_check_width(topframe, Columns)) - frame_new_width(topframe, Columns, FALSE, FALSE); - } - if (topframe->fr_height != ROWS_AVAIL) - { - frame_new_height(topframe, ROWS_AVAIL, FALSE, TRUE); - if (!frame_check_height(topframe, ROWS_AVAIL)) - frame_new_height(topframe, ROWS_AVAIL, FALSE, FALSE); - } - - win_comp_pos(); -} - - static void -restore_full_snapshot_rec(frame_T *sn) -{ - if (sn == NULL) - return; - - if (sn->fr_child != NULL) - sn->fr_child->fr_parent = sn; - if (sn->fr_next != NULL) - { - sn->fr_next->fr_parent = sn->fr_parent; - sn->fr_next->fr_prev = sn; - } - if (sn->fr_win != NULL) - { - sn->fr_win->w_frame = sn; - // Resize window to fit the frame. - frame_new_height(sn, sn->fr_height, FALSE, FALSE); - frame_new_width(sn, sn->fr_width, FALSE, FALSE); - } - restore_full_snapshot_rec(sn->fr_child); - restore_full_snapshot_rec(sn->fr_next); -} - #if defined(FEAT_GUI) || defined(PROTO) /* * Return TRUE if there is any vertically split window. From f865895c874b0936b0563ebfef7490aac8cb8a1f Mon Sep 17 00:00:00 2001 From: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Tue, 20 Feb 2024 22:05:10 +0100 Subject: [PATCH 065/426] patch 9.1.0119: can move away from cmdwin using win_splitmove() Problem: can switch windows while textlocked via f_win_gotoid and f_win_splitmove (which also allows switching in the cmdwin). Solution: Check text_or_buf_locked in f_win_splitmove() (Sean Dewar) While at it, call text_or_buf_locked() in f_win_gotoid() instead of testing for cmdwin_type() (which text_buf_locked() does and in addition will also verify that the buffer is not locked). closes: #14042 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt --- src/evalwindow.c | 7 ++----- src/testdir/test_window_cmd.vim | 28 ++++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/evalwindow.c b/src/evalwindow.c index 5016eb4588..00081d43d5 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -824,11 +824,8 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv) return; id = tv_get_number(&argvars[0]); - if (cmdwin_type != 0) - { - emsg(_(e_invalid_in_cmdline_window)); + if (text_or_buf_locked()) return; - } #if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL) if (popup_is_popup(curwin) && curbuf->b_term != NULL) { @@ -998,7 +995,7 @@ f_win_splitmove(typval_T *argvars, typval_T *rettv) } // Check if we can split the target before we bother switching windows. - if (check_split_disallowed(targetwin) == FAIL) + if (text_or_buf_locked() || check_split_disallowed(targetwin) == FAIL) return; if (curwin != targetwin) diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index 5b50f9dc5d..ff4ab845ef 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -2225,4 +2225,32 @@ func Test_splitmove_autocmd_window_no_room() %bw! endfunc +func Test_win_gotoid_splitmove_textlock_cmdwin() + call setline(1, 'foo') + new + let curwin = win_getid() + call setline(1, 'bar') + + set debug+=throw indentexpr=win_gotoid(win_getid(winnr('#'))) + call assert_fails('normal! ==', 'E565:') + call assert_equal(curwin, win_getid()) + + set indentexpr=win_splitmove(winnr('#'),winnr()) + call assert_fails('normal! ==', 'E565:') + call assert_equal(curwin, win_getid()) + + %bw! + set debug-=throw indentexpr& + + call feedkeys('q:' + \ .. ":call assert_fails('call win_splitmove(winnr(''#''), winnr())', 'E11:')\" + \ .. ":call assert_equal('command', win_gettype())\" + \ .. ":call assert_equal('', win_gettype(winnr('#')))\", 'ntx') + + call feedkeys('q:' + \ .. ":call assert_fails('call win_gotoid(win_getid(winnr(''#'')))', 'E11:')\" + \ .. ":call assert_equal('command', win_gettype())\" + \ .. ":call assert_equal('', win_gettype(winnr('#')))\", 'ntx') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 7de75e35b6..f3d8fd8d1d 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 119, /**/ 118, /**/ From 3f905ab3c4f66562f4a224bf00f49d98a0b0da91 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Wed, 21 Feb 2024 00:02:45 +0100 Subject: [PATCH 066/426] patch 9.1.0120: hard to get visual region using Vim script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: hard to get visual region using Vim script Solution: Add getregion() Vim script function (Shougo Matsushita, Jakub Łuczyński) closes: #13998 closes: #11579 Co-authored-by: =?UTF-8?q?Jakub=20=C5=81uczy=C5=84ski?= Co-authored-by: Shougo Matsushita Signed-off-by: Shougo Matsushita Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 39 +++++++ runtime/doc/tags | 1 + runtime/doc/usr_41.txt | 3 +- runtime/doc/version9.txt | 1 + src/evalfunc.c | 187 +++++++++++++++++++++++++++++- src/ops.c | 78 +++++++++++++ src/proto/ops.pro | 1 + src/register.c | 66 +---------- src/testdir/test_vim9_builtin.vim | 9 ++ src/testdir/test_visual.vim | 155 +++++++++++++++++++++++++ src/version.c | 2 + 11 files changed, 474 insertions(+), 68 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 0cddeffa75..93b3000188 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -263,6 +263,8 @@ getqflist({what}) Dict get specific quickfix list properties getreg([{regname} [, 1 [, {list}]]]) String or List contents of a register getreginfo([{regname}]) Dict information about a register +getregion({pos1}, {pos2}, {type}) + List get the text from {pos1} to {pos2} getregtype([{regname}]) String type of a register getscriptinfo([{opts}]) List list of sourced scripts gettabinfo([{expr}]) List list of tab pages @@ -4266,6 +4268,43 @@ getreginfo([{regname}]) *getreginfo()* Can also be used as a |method|: > GetRegname()->getreginfo() +getregion({pos1}, {pos2}, {type}) *getregion()* + Returns the list of strings from {pos1} to {pos2} as if it's + selected in visual mode of {type}. + For possible values of {pos1} and {pos2} see |line()|. + {type} is the selection type: + "v" for |characterwise| mode + "V" for |linewise| mode + "" for |blockwise-visual| mode + You can get the last selection type by |visualmode()|. + If Visual mode is active, use |mode()| to get the Visual mode + (e.g., in a |:vmap|). + This function uses the line and column number from the + specified position. + It is useful to get text starting and ending in different + columns, such as |characterwise-visual| selection. + + Note that: + - Order of {pos1} and {pos2} doesn't matter, it will always + return content from the upper left position to the lower + right position. + - If 'virtualedit' is enabled and selection is past the end of + line, resulting lines are filled with blanks. + - If the selection starts or ends in the middle of a multibyte + character, it is not included but its selected part is + substituted with spaces. + - If {pos1} or {pos2} equals "v" (see |line()|) and it is not in + |visual-mode|, an empty list is returned. + - If {pos1}, {pos2} or {type} is an invalid string, an empty + list is returned. + + Examples: > + :xnoremap + \ echo getregion('v', '.', mode()) +< + Can also be used as a |method|: > + '.'->getregion("'a', 'v') +< getregtype([{regname}]) *getregtype()* The result is a String, which is type of register {regname}. The value will be one of: diff --git a/runtime/doc/tags b/runtime/doc/tags index 330ac8bc3d..b7e26ee49d 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -7760,6 +7760,7 @@ getqflist() builtin.txt /*getqflist()* getqflist-examples quickfix.txt /*getqflist-examples* getreg() builtin.txt /*getreg()* getreginfo() builtin.txt /*getreginfo()* +getregion() builtin.txt /*getregion()* getregtype() builtin.txt /*getregtype()* getscript pi_getscript.txt /*getscript* getscript-autoinstall pi_getscript.txt /*getscript-autoinstall* diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 0ca19beb0f..0d832a34c9 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 9.1. Last change: 2024 Feb 01 +*usr_41.txt* For Vim version 9.1. Last change: 2024 Feb 20 VIM USER MANUAL - by Bram Moolenaar @@ -929,6 +929,7 @@ Cursor and mark position: *cursor-functions* *mark-functions* Working with text in the current buffer: *text-functions* getline() get a line or list of lines from the buffer + getregion() get a region of text from the buffer setline() replace a line in the buffer append() append line or list of lines in the buffer indent() indent of a specific line diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index e8973ce735..29dbfb8c53 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -41560,6 +41560,7 @@ Functions: ~ |foreach()| apply function to List items |matchbufline()| all the matches of a pattern in a buffer |matchstrlist()| all the matches of a pattern in a List of strings +|getregion()| get a region of text from a buffer Autocommands: ~ diff --git a/src/evalfunc.c b/src/evalfunc.c index d13eb1c9f5..81f747f843 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -63,15 +63,16 @@ static void f_get(typval_T *argvars, typval_T *rettv); static void f_getchangelist(typval_T *argvars, typval_T *rettv); static void f_getcharpos(typval_T *argvars, typval_T *rettv); static void f_getcharsearch(typval_T *argvars, typval_T *rettv); +static void f_getcurpos(typval_T *argvars, typval_T *rettv); +static void f_getcursorcharpos(typval_T *argvars, typval_T *rettv); static void f_getenv(typval_T *argvars, typval_T *rettv); static void f_getfontname(typval_T *argvars, typval_T *rettv); static void f_getjumplist(typval_T *argvars, typval_T *rettv); static void f_getpid(typval_T *argvars, typval_T *rettv); -static void f_getcurpos(typval_T *argvars, typval_T *rettv); -static void f_getcursorcharpos(typval_T *argvars, typval_T *rettv); static void f_getpos(typval_T *argvars, typval_T *rettv); static void f_getreg(typval_T *argvars, typval_T *rettv); static void f_getreginfo(typval_T *argvars, typval_T *rettv); +static void f_getregion(typval_T *argvars, typval_T *rettv); static void f_getregtype(typval_T *argvars, typval_T *rettv); static void f_gettagstack(typval_T *argvars, typval_T *rettv); static void f_gettext(typval_T *argvars, typval_T *rettv); @@ -2131,6 +2132,8 @@ static funcentry_T global_functions[] = ret_getreg, f_getreg}, {"getreginfo", 0, 1, FEARG_1, arg1_string, ret_dict_any, f_getreginfo}, + {"getregion", 3, 3, FEARG_1, arg3_string, + ret_list_string, f_getregion}, {"getregtype", 0, 1, FEARG_1, arg1_string, ret_string, f_getregtype}, {"getscriptinfo", 0, 1, 0, arg1_dict_any, @@ -5452,6 +5455,186 @@ f_getpos(typval_T *argvars, typval_T *rettv) getpos_both(argvars, rettv, FALSE, FALSE); } +/* + * Convert from block_def to string + */ + static char_u * +block_def2str(struct block_def *bd) +{ + char_u *p, *ret; + size_t size = bd->startspaces + bd->endspaces + bd->textlen; + + ret = alloc(size + 1); + if (ret != NULL) + { + p = ret; + vim_memset(p, ' ', bd->startspaces); + p += bd->startspaces; + mch_memmove(p, bd->textstart, bd->textlen); + p += bd->textlen; + vim_memset(p, ' ', bd->endspaces); + *(p + bd->endspaces) = NUL; + } + return ret; +} + +/* + * "getregion()" function + */ + static void +f_getregion(typval_T *argvars, typval_T *rettv) +{ + linenr_T lnum; + oparg_T oap; + struct block_def bd; + char_u *akt = NULL; + int inclusive = TRUE; + int fnum = -1; + pos_T p1, p2; + pos_T *fp = NULL; + char_u *pos1, *pos2, *type; + int save_virtual = -1; + int l; + int region_type = -1; + int is_visual; + + if (rettv_list_alloc(rettv) == FAIL) + return; + + if (check_for_string_arg(argvars, 0) == FAIL + || check_for_string_arg(argvars, 1) == FAIL + || check_for_string_arg(argvars, 2) == FAIL) + return; + + // NOTE: var2fpos() returns static pointer. + fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE); + if (fp == NULL) + return; + p1 = *fp; + + fp = var2fpos(&argvars[1], TRUE, &fnum, FALSE); + if (fp == NULL) + return; + p2 = *fp; + + pos1 = tv_get_string(&argvars[0]); + pos2 = tv_get_string(&argvars[1]); + type = tv_get_string(&argvars[2]); + + is_visual = (pos1[0] == 'v' && pos1[1] == NUL) + || (pos2[0] == 'v' && pos2[1] == NUL); + + if (is_visual && !VIsual_active) + return; + + if (type[0] == 'v' && type[1] == NUL) + region_type = MCHAR; + else if (type[0] == 'V' && type[1] == NUL) + region_type = MLINE; + else if (type[0] == Ctrl_V && type[1] == NUL) + region_type = MBLOCK; + else + return; + + save_virtual = virtual_op; + virtual_op = virtual_active(); + + if (!LT_POS(p1, p2)) + { + // swap position + pos_T p; + + p = p1; + p1 = p2; + p2 = p; + } + + if (region_type == MCHAR) + { + // handle 'selection' == "exclusive" + if (*p_sel == 'e' && !EQUAL_POS(p1, p2)) + { + if (p2.coladd > 0) + p2.coladd--; + else if (p2.col > 0) + { + p2.col--; + + mb_adjustpos(curbuf, &p2); + } + else if (p2.lnum > 1) + { + p2.lnum--; + p2.col = (colnr_T)STRLEN(ml_get(p2.lnum)); + if (p2.col > 0) + { + p2.col--; + + mb_adjustpos(curbuf, &p2); + } + } + } + // if fp2 is on NUL (empty line) inclusive becomes false + if (*ml_get_pos(&p2) == NUL && !virtual_op) + inclusive = FALSE; + } + else if (region_type == MBLOCK) + { + colnr_T sc1, ec1, sc2, ec2; + + getvvcol(curwin, &p1, &sc1, NULL, &ec1); + getvvcol(curwin, &p2, &sc2, NULL, &ec2); + oap.motion_type = OP_NOP; + oap.inclusive = TRUE; + oap.start = p1; + oap.end = p2; + oap.start_vcol = MIN(sc1, sc2); + if (*p_sel == 'e' && ec1 < sc2 && 0 < sc2 && ec2 > ec1) + oap.end_vcol = sc2 - 1; + else + oap.end_vcol = MAX(ec1, ec2); + } + + // Include the trailing byte of a multi-byte char. + l = utfc_ptr2len((char_u *)ml_get_pos(&p2)); + if (l > 1) + p2.col += l - 1; + + for (lnum = p1.lnum; lnum <= p2.lnum; lnum++) + { + int ret = 0; + + if (region_type == MLINE) + akt = vim_strsave(ml_get(lnum)); + else if (region_type == MBLOCK) + { + block_prep(&oap, &bd, lnum, FALSE); + akt = block_def2str(&bd); + } + else if (p1.lnum < lnum && lnum < p2.lnum) + akt = vim_strsave(ml_get(lnum)); + else + { + charwise_block_prep(p1, p2, &bd, lnum, inclusive); + akt = block_def2str(&bd); + } + + if (akt) + { + ret = list_append_string(rettv->vval.v_list, akt, -1); + vim_free(akt); + } + + if (akt == NULL || ret == FAIL) + { + list_free(rettv->vval.v_list); + break; + } + } + + virtual_op = save_virtual; +} + /* * Common between getreg(), getreginfo() and getregtype(): get the register * name from the first argument. diff --git a/src/ops.c b/src/ops.c index 3fefbc8a40..e66b4b5ee7 100644 --- a/src/ops.c +++ b/src/ops.c @@ -2414,6 +2414,84 @@ block_prep( #endif } +/* + * Get block text from "start" to "end" + */ + void +charwise_block_prep( + pos_T start, + pos_T end, + struct block_def *bdp, + linenr_T lnum, + int inclusive) +{ + colnr_T startcol = 0, endcol = MAXCOL; + int is_oneChar = FALSE; + colnr_T cs, ce; + char_u *p; + + p = ml_get(lnum); + bdp->startspaces = 0; + bdp->endspaces = 0; + + if (lnum == start.lnum) + { + startcol = start.col; + if (virtual_op) + { + getvcol(curwin, &start, &cs, NULL, &ce); + if (ce != cs && start.coladd > 0) + { + // Part of a tab selected -- but don't + // double-count it. + bdp->startspaces = (ce - cs + 1) + - start.coladd; + if (bdp->startspaces < 0) + bdp->startspaces = 0; + startcol++; + } + } + } + + if (lnum == end.lnum) + { + endcol = end.col; + if (virtual_op) + { + getvcol(curwin, &end, &cs, NULL, &ce); + if (p[endcol] == NUL || (cs + end.coladd < ce + // Don't add space for double-wide + // char; endcol will be on last byte + // of multi-byte char. + && (*mb_head_off)(p, p + endcol) == 0)) + { + if (start.lnum == end.lnum + && start.col == end.col) + { + // Special case: inside a single char + is_oneChar = TRUE; + bdp->startspaces = end.coladd + - start.coladd + inclusive; + endcol = startcol; + } + else + { + bdp->endspaces = end.coladd + + inclusive; + endcol -= inclusive; + } + } + } + } + if (endcol == MAXCOL) + endcol = (colnr_T)STRLEN(p); + if (startcol > endcol || is_oneChar) + bdp->textlen = 0; + else + bdp->textlen = endcol - startcol + inclusive; + bdp->textstart = p + startcol; +} + /* * Handle the add/subtract operator. */ diff --git a/src/proto/ops.pro b/src/proto/ops.pro index 193e89430e..bebe63553b 100644 --- a/src/proto/ops.pro +++ b/src/proto/ops.pro @@ -14,6 +14,7 @@ void adjust_cursor_eol(void); char_u *skip_comment(char_u *line, int process, int include_space, int *is_comment); int do_join(long count, int insert_space, int save_undo, int use_formatoptions, int setmark); void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, int is_del); +void charwise_block_prep(pos_T start, pos_T end, struct block_def *bdp, linenr_T lnum, int inclusive); void op_addsub(oparg_T *oap, linenr_T Prenum1, int g_cmd); void clear_oparg(oparg_T *oap); void cursor_pos_info(dict_T *dict); diff --git a/src/register.c b/src/register.c index 3f1506a5d8..98015e05ba 100644 --- a/src/register.c +++ b/src/register.c @@ -1148,7 +1148,6 @@ op_yank(oparg_T *oap, int deleting, int mess) int yanktype = oap->motion_type; long yanklines = oap->line_count; linenr_T yankendlnum = oap->end.lnum; - char_u *p; char_u *pnew; struct block_def bd; #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) @@ -1240,70 +1239,7 @@ op_yank(oparg_T *oap, int deleting, int mess) case MCHAR: { - colnr_T startcol = 0, endcol = MAXCOL; - int is_oneChar = FALSE; - colnr_T cs, ce; - - p = ml_get(lnum); - bd.startspaces = 0; - bd.endspaces = 0; - - if (lnum == oap->start.lnum) - { - startcol = oap->start.col; - if (virtual_op) - { - getvcol(curwin, &oap->start, &cs, NULL, &ce); - if (ce != cs && oap->start.coladd > 0) - { - // Part of a tab selected -- but don't - // double-count it. - bd.startspaces = (ce - cs + 1) - - oap->start.coladd; - if (bd.startspaces < 0) - bd.startspaces = 0; - startcol++; - } - } - } - - if (lnum == oap->end.lnum) - { - endcol = oap->end.col; - if (virtual_op) - { - getvcol(curwin, &oap->end, &cs, NULL, &ce); - if (p[endcol] == NUL || (cs + oap->end.coladd < ce - // Don't add space for double-wide - // char; endcol will be on last byte - // of multi-byte char. - && (*mb_head_off)(p, p + endcol) == 0)) - { - if (oap->start.lnum == oap->end.lnum - && oap->start.col == oap->end.col) - { - // Special case: inside a single char - is_oneChar = TRUE; - bd.startspaces = oap->end.coladd - - oap->start.coladd + oap->inclusive; - endcol = startcol; - } - else - { - bd.endspaces = oap->end.coladd - + oap->inclusive; - endcol -= oap->inclusive; - } - } - } - } - if (endcol == MAXCOL) - endcol = (colnr_T)STRLEN(p); - if (startcol > endcol || is_oneChar) - bd.textlen = 0; - else - bd.textlen = endcol - startcol + oap->inclusive; - bd.textstart = p + startcol; + charwise_block_prep(oap->start, oap->end, &bd, lnum, oap->inclusive); if (yank_copy_line(&bd, y_idx, FALSE) == FAIL) goto fail; break; diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index aa819811cc..e2585d4f69 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -5197,4 +5197,13 @@ def Test_passing_type_to_builtin() v9.CheckScriptFailure(lines, 'E1405: Class "C" cannot be used as a value') enddef +def Test_getregion() + assert_equal(['x'], getregion('.', '.', 'v')->map((_, _) => 'x')) + + v9.CheckDefAndScriptFailure(['getregion(10, ".", "v")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) + assert_equal([''], getregion('.', '.', 'v')) + v9.CheckDefExecFailure(['getregion("a", ".", "v")'], 'E1209:') + v9.CheckDefExecAndScriptFailure(['getregion("", ".", "v")'], 'E1209: Invalid value for a line number') +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 17f0fd0687..34c572e617 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1630,4 +1630,159 @@ func Test_visual_substitute_visual() bwipe! endfunc +func Test_visual_getregion() + new + + call setline(1, ['one', 'two', 'three']) + + " Visual mode + call cursor(1, 1) + call feedkeys("\vjl", 'tx') + call assert_equal(['one', 'tw'], 'v'->getregion('.', 'v')) + call assert_equal(['one', 'tw'], '.'->getregion('v', 'v')) + call assert_equal(['o'], 'v'->getregion('v', 'v')) + call assert_equal(['w'], '.'->getregion('.', 'v')) + call assert_equal(['one', 'two'], '.'->getregion('v', 'V')) + call assert_equal(['on', 'tw'], '.'->getregion('v', "\")) + + " Line visual mode + call cursor(1, 1) + call feedkeys("\Vl", 'tx') + call assert_equal(['one'], getregion('v', '.', 'V')) + call assert_equal(['one'], getregion('.', 'v', 'V')) + call assert_equal(['one'], getregion('v', 'v', 'V')) + call assert_equal(['one'], getregion('.', '.', 'V')) + call assert_equal(['on'], '.'->getregion('v', 'v')) + call assert_equal(['on'], '.'->getregion('v', "\")) + + " Block visual mode + call cursor(1, 1) + call feedkeys("\\ll", 'tx') + call assert_equal(['one'], getregion('v', '.', "\")) + call assert_equal(['one'], getregion('.', 'v', "\")) + call assert_equal(['o'], getregion('v', 'v', "\")) + call assert_equal(['e'], getregion('.', '.', "\")) + call assert_equal(['one'], '.'->getregion('v', 'V')) + call assert_equal(['one'], '.'->getregion('v', 'v')) + + " Using Marks + call setpos("'a", [0, 2, 3, 0]) + call cursor(1, 1) + call assert_equal(['one', 'two'], "'a"->getregion('.', 'v')) + call assert_equal(['one', 'two'], "."->getregion("'a", 'v')) + call assert_equal(['one', 'two'], "."->getregion("'a", 'V')) + call assert_equal(['two'], "'a"->getregion("'a", 'V')) + call assert_equal(['one', 'two'], "."->getregion("'a", "\")) + + " Multiline with line visual mode + call cursor(1, 1) + call feedkeys("\Vjj", 'tx') + call assert_equal(['one', 'two', 'three'], getregion('v', '.', 'V')) + + " Multiline with block visual mode + call cursor(1, 1) + call feedkeys("\\jj", 'tx') + call assert_equal(['o', 't', 't'], getregion('v', '.', "\")) + + call cursor(1, 1) + call feedkeys("\\jj$", 'tx') + call assert_equal(['one', 'two', 'three'], getregion('v', '.', "\")) + + " 'virtualedit' + set virtualedit=all + call cursor(1, 1) + call feedkeys("\\10ljj$", 'tx') + call assert_equal(['one ', 'two ', 'three '], + \ getregion('v', '.', "\")) + set virtualedit& + + " Invalid position + call cursor(1, 1) + call feedkeys("\vjj$", 'tx') + call assert_fails("call getregion(1, 2, 'v')", 'E1174:') + call assert_fails("call getregion('.', {}, 'v')", 'E1174:') + call assert_equal([], getregion('', '.', 'v')) + call assert_equal([], getregion('.', '.', '')) + call feedkeys("\", 'tx') + call assert_equal([], getregion('v', '.', 'v')) + + " using an unset mark + call assert_equal([], "'z"->getregion(".", 'V')) + " using the wrong type + call assert_fails(':echo "."->getregion([],"V")', 'E1174:') + call assert_fails(':echo "."->getregion("$", {})', 'E1174:') + call assert_fails(':echo [0, 1, 1, 0]->getregion("$", "v")', 'E1174:') + + + bwipe! + " Selection in starts or ends in the middle of a multibyte character + new + call setline(1, [ + \ "abcdefghijk\u00ab", + \ "\U0001f1e6\u00ab\U0001f1e7\u00ab\U0001f1e8\u00ab\U0001f1e9", + \ "1234567890" + \ ]) + call cursor(1, 3) + call feedkeys("\\ljj", 'xt') + call assert_equal(['cd', "\u00ab ", '34'], + \ getregion('v', '.', "\")) + call cursor(1, 4) + call feedkeys("\\ljj", 'xt') + call assert_equal(['de', "\U0001f1e7", '45'], + \ getregion('v', '.', "\")) + call cursor(1, 5) + call feedkeys("\\jj", 'xt') + call assert_equal(['e', ' ', '5'], getregion('v', '.', "\")) + call cursor(1, 1) + call feedkeys("\vj", 'xt') + call assert_equal(['abcdefghijk«', "\U0001f1e6"], getregion('v', '.', "v")) + " marks on multibyte chars + set selection=exclusive + call setpos("'a", [0, 1, 11, 0]) + call setpos("'b", [0, 2, 16, 0]) + call setpos("'c", [0, 2, 0, 0]) + call cursor(1, 1) + call assert_equal(['ghijk', '🇨«🇩'], getregion("'a", "'b", "\")) + call assert_equal(['k«', '🇦«🇧«🇨'], getregion("'a", "'b", "v")) + call assert_equal(['k«'], getregion("'a", "'c", "v")) + + bwipe! + + " Exclusive selection + new + set selection=exclusive + call setline(1, ["a\tc", "x\tz", '', '']) + call cursor(1, 1) + call feedkeys("\v2l", 'xt') + call assert_equal(["a\t"], getregion('v', '.', 'v')) + call cursor(1, 1) + call feedkeys("\v$G", 'xt') + call assert_equal(["a\tc", "x\tz", ''], getregion('v', '.', 'v')) + call cursor(1, 1) + call feedkeys("\v$j", 'xt') + call assert_equal(["a\tc", "x\tz"], getregion('v', '.', 'v')) + call cursor(1, 1) + call feedkeys("\\$j", 'xt') + call assert_equal(["a\tc", "x\tz"], getregion('v', '.', "\")) + call cursor(1, 1) + call feedkeys("\\$G", 'xt') + call assert_equal(["a", "x", '', ''], getregion('v', '.', "\")) + call cursor(1, 1) + call feedkeys("\wv2j", 'xt') + call assert_equal(["c", "x\tz"], getregion('v', '.', 'v')) + + " virtualedit + set virtualedit=all + call cursor(1, 1) + call feedkeys("\2lv2lj", 'xt') + call assert_equal([' c', 'x '], getregion('v', '.', 'v')) + call cursor(1, 1) + call feedkeys("\2l\2l2j", 'xt') + call assert_equal([' ', ' ', ' '], getregion('v', '.', "\")) + set virtualedit& + set selection& + + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index f3d8fd8d1d..d495165516 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 120, /**/ 119, /**/ From 02fcae02a926e4e8379d77fb716da4202029882d Mon Sep 17 00:00:00 2001 From: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:40:44 +0100 Subject: [PATCH 067/426] patch 9.1.0121: Infinite loop or signed overflow with 'smoothscroll' Problem: infinite loop in win_update with 'smoothscroll' set when window width is equal to textoff, or signed integer overflow if smaller. Solution: don't revalidate wp->w_skipcol in that case, as no buffer text is being shown. (Sean Dewar) Don't instead reset w_skipcol; that would lose the scroll position within the line, which may be undesirable if the window is made wider later. Also include changes from the splitmove PR #14042 that I (in my infinite Git wisdom) forgot to commit. This includes a change to Test_window_split_no_room to ensure it doesn't fail for some screen sizes. Move Test_smoothscroll_in_zero_width_window to test_scroll_opt.vim, as that file feels more appropriate. closes: #14068 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt --- src/drawscreen.c | 2 +- src/proto/window.pro | 2 +- src/testdir/test_scroll_opt.vim | 38 +++++++++++++++++++++++++++++++++ src/testdir/test_window_cmd.vim | 29 +++++++++---------------- src/version.c | 2 ++ src/window.c | 2 +- 6 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/drawscreen.c b/src/drawscreen.c index 852d331826..5fb37a9849 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -1537,7 +1537,7 @@ win_update(win_T *wp) // Make sure skipcol is valid, it depends on various options and the window // width. - if (wp->w_skipcol > 0) + if (wp->w_skipcol > 0 && wp->w_width > win_col_off(wp)) { int w = 0; int width1 = wp->w_width - win_col_off(wp); diff --git a/src/proto/window.pro b/src/proto/window.pro index 0ec57349b2..a91a51190b 100644 --- a/src/proto/window.pro +++ b/src/proto/window.pro @@ -28,7 +28,7 @@ void may_make_initial_scroll_size_snapshot(void); void may_trigger_win_scrolled_resized(void); void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp); void win_free_all(void); -win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp, frame_T **to_flatten); +win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp, frame_T **unflat_altfr); void close_others(int message, int forceit); void unuse_tabpage(tabpage_T *tp); void use_tabpage(tabpage_T *tp); diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim index f41f0e2910..3467760740 100644 --- a/src/testdir/test_scroll_opt.vim +++ b/src/testdir/test_scroll_opt.vim @@ -960,4 +960,42 @@ func Test_smoothscroll_insert_bottom() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_in_zero_width_window() + set cpo+=n number smoothscroll + set winwidth=99999 winminwidth=0 + + vsplit + call assert_equal(0, winwidth(winnr('#'))) + call win_execute(win_getid(winnr('#')), "norm! \") + + only! + set winwidth& winminwidth& + set cpo-=n nonumber nosmoothscroll +endfunc + +func Test_smoothscroll_textoff_small_winwidth() + set smoothscroll number + call setline(1, 'llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch') + vsplit + + let textoff = getwininfo(win_getid())[0].textoff + execute 'vertical resize' textoff + 1 + redraw + call assert_equal(0, winsaveview().skipcol) + execute "normal! 0\" + redraw + call assert_equal(1, winsaveview().skipcol) + execute 'vertical resize' textoff - 1 + " This caused a signed integer overflow. + redraw + call assert_equal(1, winsaveview().skipcol) + execute 'vertical resize' textoff + " This caused an infinite loop. + redraw + call assert_equal(1, winsaveview().skipcol) + + %bw! + set smoothscroll& number& +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index ff4ab845ef..a68ed74cb6 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -322,14 +322,18 @@ func Test_window_split_no_room() call assert_equal(restcmd, winrestcmd()) " Check that the last statusline isn't lost. - set laststatus=0 - let restcmd = winrestcmd() + " Set its window's width to 2 for the test. wincmd j + set laststatus=0 winminwidth=0 + vertical resize 2 + set winminwidth& call setwinvar(winnr('k'), '&statusline', '@#') let last_stl_row = win_screenpos(0)[0] - 1 redraw call assert_equal('@#|', GetScreenStr(last_stl_row)) call assert_equal('~ |', GetScreenStr(&lines - &cmdheight)) + + let restcmd = winrestcmd() call assert_fails('wincmd H', 'E36:') call assert_fails('wincmd L', 'E36:') call assert_equal(layout, winlayout()) @@ -2153,19 +2157,6 @@ func Test_new_help_window_on_error() call assert_equal(expand(""), "'mod'") endfunc -func Test_smoothscroll_in_zero_width_window() - set cpo+=n number smoothscroll - set winwidth=99999 winminwidth=0 - - vsplit - call assert_equal(0, winwidth(winnr('#'))) - call win_execute(win_getid(winnr('#')), "norm! \") - - only! - set winwidth& winminwidth& - set cpo-=n nonumber nosmoothscroll -endfunc - func Test_splitmove_flatten_frame() split vsplit @@ -2179,7 +2170,7 @@ func Test_splitmove_flatten_frame() only! endfunc -func Test_splitmove_autocmd_window_no_room() +func Test_autocmd_window_force_room() " Open as many windows as possible while v:true try @@ -2206,7 +2197,7 @@ func Test_splitmove_autocmd_window_no_room() edit unload me enew bunload! unload\ me - augroup SplitMoveAucmdWin + augroup AucmdWinForceRoom au! au BufEnter * ++once let s:triggered = v:true \| call assert_equal('autocmd', win_gettype()) @@ -2220,8 +2211,8 @@ func Test_splitmove_autocmd_window_no_room() call assert_equal(winrestcmd(), restcmd) unlet! s:triggered - au! SplitMoveAucmdWin - augroup! SplitMoveAucmdWin + au! AucmdWinForceRoom + augroup! AucmdWinForceRoom %bw! endfunc diff --git a/src/version.c b/src/version.c index d495165516..471ecd83cd 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 121, /**/ 120, /**/ diff --git a/src/window.c b/src/window.c index a6223eeffd..66a1d7de41 100644 --- a/src/window.c +++ b/src/window.c @@ -54,7 +54,7 @@ static void win_goto_hor(int left, long count); static void frame_add_height(frame_T *frp, int n); static void last_status_rec(frame_T *fr, int statusline); static void frame_flatten(frame_T *frp); -static void winframe_restore(win_T *wp, int dir, frame_T *to_flatten); +static void winframe_restore(win_T *wp, int dir, frame_T *unflat_altfr); static int make_snapshot_rec(frame_T *fr, frame_T **frp); static void clear_snapshot(tabpage_T *tp, int idx); From e8f6af60917862d04a82efb9e900200fd36f798d Mon Sep 17 00:00:00 2001 From: Eric Pruitt Date: Wed, 21 Feb 2024 10:46:47 -0800 Subject: [PATCH 068/426] runtime(tmux): Update tmux syntax (#14065) Signed-off-by: Eric Pruitt Signed-off-by: Christian Brabandt --- runtime/syntax/tmux.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/syntax/tmux.vim b/runtime/syntax/tmux.vim index d2b31e874c..9766ed55d7 100644 --- a/runtime/syntax/tmux.vim +++ b/runtime/syntax/tmux.vim @@ -1,5 +1,5 @@ " Language: tmux(1) configuration file -" Version: 3.3a (git-e7c829fc) +" Version: 3.4 (git-608d1134) " URL: https://github.com/ericpruitt/tmux.vim/ " Maintainer: Eric Pruitt " License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) @@ -164,9 +164,9 @@ syn keyword tmuxCommands syn keyword tmuxEnums \ absolute-centre all always any arrows bar blinking-bar blinking-block \ blinking-underline block both bottom centre color colour current default -\ double emacs external failed heavy largest latest left manual next -\ no-detached none number off on other padded previous right rounded simple -\ single smallest top underline vi +\ double emacs external failed heavy keep-group keep-last largest latest left +\ manual next no-detached none number off on other padded previous right +\ rounded simple single smallest top underline vi let &cpo = s:original_cpo unlet! s:original_cpo s:bg s:i From 9ca335aad295fdaf4b75d3969b093422c1cc48ee Mon Sep 17 00:00:00 2001 From: Maxim Kim Date: Wed, 21 Feb 2024 19:48:37 +0100 Subject: [PATCH 069/426] patch 9.1.0122: Some minor issues with the getregion() function Problem: Some minor issues with the getregion() function Solution: Fix examples in the help, use OP_NOP op_type and MBLOCK as motion_type in f_getreg(), update vim syntax to for getregion() (Maxim Kim) ``` :xnoremap \ echow getregion('v', '.', mode()) ``` `echo` while in visual mode has no visible effect, thus people trying example might be frustrated as it looks like nothing happens. So the option is to change it to `echow` or `echom`. With `echom` it is again has no visible effect but one can at least inspect `:messages`. On the other hand `echow` showes selected text in a popup window. ``` Can also be used as a |method|: > '.'->getregion("'a', 'v') ``` Here is the typo, which makes example invalid, should be `("'a", ...` closes: #14064 Signed-off-by: Maxim Kim Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 6 +++--- runtime/syntax/vim.vim | 14 +++++++------- src/evalfunc.c | 3 ++- src/version.c | 2 ++ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 93b3000188..2dc8f615f2 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 20 +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4300,10 +4300,10 @@ getregion({pos1}, {pos2}, {type}) *getregion()* Examples: > :xnoremap - \ echo getregion('v', '.', mode()) + \ echow getregion('v', '.', mode()) < Can also be used as a |method|: > - '.'->getregion("'a', 'v') + '.'->getregion("'a", 'v') < getregtype([{regname}]) *getregtype()* The result is a String, which is type of register {regname}. diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 0f99674211..978cd0e31c 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -3,7 +3,7 @@ " Maintainer: Hirohito Higashi " Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex -" Last Change: Feb 18, 2024 +" Last Change: Feb 21, 2024 " Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 @@ -110,12 +110,12 @@ syn case match " GEN_SYN_VIM: vimFuncName, START_STR='syn keyword vimFuncName contained', END_STR='' syn keyword vimFuncName contained abs acos add and append appendbufline argc argidx arglistid argv asin assert_beeps assert_equal assert_equalfile assert_exception assert_fails assert_false assert_inrange assert_match assert_nobeep assert_notequal assert_notmatch assert_report assert_true atan atan2 autocmd_add autocmd_delete autocmd_get balloon_gettext balloon_show balloon_split blob2list browse browsedir bufadd bufexists buflisted bufload bufloaded bufname bufnr bufwinid bufwinnr byte2line byteidx byteidxcomp call ceil ch_canread ch_close ch_close_in ch_evalexpr ch_evalraw ch_getbufnr ch_getjob ch_info ch_log ch_logfile ch_open ch_read ch_readblob ch_readraw ch_sendexpr ch_sendraw ch_setoptions ch_status changenr char2nr charclass charcol charidx chdir cindent syn keyword vimFuncName contained clearmatches col complete complete_add complete_check complete_info confirm copy cos cosh count cscope_connection cursor debugbreak deepcopy delete deletebufline did_filetype diff diff_filler diff_hlID digraph_get digraph_getlist digraph_set digraph_setlist echoraw empty environ err_teapot escape eval eventhandler executable execute exepath exists exists_compiled exp expand expandcmd extend extendnew feedkeys filereadable filewritable filter finddir findfile flatten flattennew float2nr floor fmod fnameescape fnamemodify foldclosed foldclosedend foldlevel foldtext foldtextresult foreach foreground fullcommand funcref function garbagecollect get getbufinfo getbufline getbufoneline getbufvar getcellwidths getchangelist getchar getcharmod -syn keyword vimFuncName contained getcharpos getcharsearch getcharstr getcmdcompltype getcmdline getcmdpos getcmdscreenpos getcmdtype getcmdwintype getcompletion getcurpos getcursorcharpos getcwd getenv getfontname getfperm getfsize getftime getftype getimstatus getjumplist getline getloclist getmarklist getmatches getmousepos getmouseshape getpid getpos getqflist getreg getreginfo getregtype getscriptinfo gettabinfo gettabvar gettabwinvar gettagstack gettext getwininfo getwinpos getwinposx getwinposy getwinvar glob glob2regpat globpath has has_key haslocaldir hasmapto histadd histdel histget histnr hlID hlexists hlget hlset hostname iconv indent index indexof input inputdialog inputlist inputrestore inputsave inputsecret insert instanceof interrupt invert isabsolutepath -syn keyword vimFuncName contained isdirectory isinf islocked isnan items job_getchannel job_info job_setoptions job_start job_status job_stop join js_decode js_encode json_decode json_encode keys keytrans len libcall libcallnr line line2byte lispindent list2blob list2str listener_add listener_flush listener_remove localtime log log10 luaeval map maparg mapcheck maplist mapnew mapset match matchadd matchaddpos matcharg matchbufline matchdelete matchend matchfuzzy matchfuzzypos matchlist matchstr matchstrlist matchstrpos max menu_info min mkdir mode mzeval nextnonblank nr2char or pathshorten perleval popup_atcursor popup_beval popup_clear popup_close popup_create popup_dialog popup_filter_menu popup_filter_yesno popup_findecho popup_findinfo popup_findpreview popup_getoptions -syn keyword vimFuncName contained popup_getpos popup_hide popup_list popup_locate popup_menu popup_move popup_notification popup_setoptions popup_settext popup_show pow prevnonblank printf prompt_getprompt prompt_setcallback prompt_setinterrupt prompt_setprompt prop_add prop_add_list prop_clear prop_find prop_list prop_remove prop_type_add prop_type_change prop_type_delete prop_type_get prop_type_list pum_getpos pumvisible py3eval pyeval pyxeval rand range readblob readdir readdirex readfile reduce reg_executing reg_recording reltime reltimefloat reltimestr remote_expr remote_foreground remote_peek remote_read remote_send remote_startserver remove rename repeat resolve reverse round rubyeval screenattr screenchar screenchars screencol screenpos screenrow screenstring -syn keyword vimFuncName contained search searchcount searchdecl searchpair searchpairpos searchpos server2client serverlist setbufline setbufvar setcellwidths setcharpos setcharsearch setcmdline setcmdpos setcursorcharpos setenv setfperm setline setloclist setmatches setpos setqflist setreg settabvar settabwinvar settagstack setwinvar sha256 shellescape shiftwidth sign_define sign_getdefined sign_getplaced sign_jump sign_place sign_placelist sign_undefine sign_unplace sign_unplacelist simplify sin sinh slice sort sound_clear sound_playevent sound_playfile sound_stop soundfold spellbadword spellsuggest split sqrt srand state str2float str2list str2nr strcharlen strcharpart strchars strdisplaywidth strftime strgetchar stridx string strlen strpart strptime strridx -syn keyword vimFuncName contained strtrans strutf16len strwidth submatch substitute swapfilelist swapinfo swapname synID synIDattr synIDtrans synconcealed synstack system systemlist tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan tanh tempname term_dumpdiff term_dumpload term_dumpwrite term_getaltscreen term_getansicolors term_getattr term_getcursor term_getjob term_getline term_getscrolled term_getsize term_getstatus term_gettitle term_gettty term_list term_scrape term_sendkeys term_setansicolors term_setapi term_setkill term_setrestore term_setsize term_start term_wait terminalprops test_alloc_fail test_autochdir test_feedinput test_garbagecollect_now test_garbagecollect_soon test_getvalue test_gui_event test_ignore_error test_mswin_event test_null_blob -syn keyword vimFuncName contained test_null_channel test_null_dict test_null_function test_null_job test_null_list test_null_partial test_null_string test_option_not_set test_override test_refcount test_setmouse test_settime test_srand_seed test_unknown test_void timer_info timer_pause timer_start timer_stop timer_stopall tolower toupper tr trim trunc type typename undofile undotree uniq utf16idx values virtcol virtcol2col visualmode wildmenumode win_execute win_findbuf win_getid win_gettype win_gotoid win_id2tabwin win_id2win win_move_separator win_move_statusline win_screenpos win_splitmove winbufnr wincol windowsversion winheight winlayout winline winnr winrestcmd winrestview winsaveview winwidth wordcount writefile xor +syn keyword vimFuncName contained getcharpos getcharsearch getcharstr getcmdcompltype getcmdline getcmdpos getcmdscreenpos getcmdtype getcmdwintype getcompletion getcurpos getcursorcharpos getcwd getenv getfontname getfperm getfsize getftime getftype getimstatus getjumplist getline getloclist getmarklist getmatches getmousepos getmouseshape getpid getpos getqflist getreg getreginfo getregion getregtype getscriptinfo gettabinfo gettabvar gettabwinvar gettagstack gettext getwininfo getwinpos getwinposx getwinposy getwinvar glob glob2regpat globpath has has_key haslocaldir hasmapto histadd histdel histget histnr hlID hlexists hlget hlset hostname iconv indent index indexof input inputdialog inputlist inputrestore inputsave inputsecret insert instanceof interrupt +syn keyword vimFuncName contained invert isabsolutepath isdirectory isinf islocked isnan items job_getchannel job_info job_setoptions job_start job_status job_stop join js_decode js_encode json_decode json_encode keys keytrans len libcall libcallnr line line2byte lispindent list2blob list2str listener_add listener_flush listener_remove localtime log log10 luaeval map maparg mapcheck maplist mapnew mapset match matchadd matchaddpos matcharg matchbufline matchdelete matchend matchfuzzy matchfuzzypos matchlist matchstr matchstrlist matchstrpos max menu_info min mkdir mode mzeval nextnonblank nr2char or pathshorten perleval popup_atcursor popup_beval popup_clear popup_close popup_create popup_dialog popup_filter_menu popup_filter_yesno popup_findecho popup_findinfo +syn keyword vimFuncName contained popup_findpreview popup_getoptions popup_getpos popup_hide popup_list popup_locate popup_menu popup_move popup_notification popup_setoptions popup_settext popup_show pow prevnonblank printf prompt_getprompt prompt_setcallback prompt_setinterrupt prompt_setprompt prop_add prop_add_list prop_clear prop_find prop_list prop_remove prop_type_add prop_type_change prop_type_delete prop_type_get prop_type_list pum_getpos pumvisible py3eval pyeval pyxeval rand range readblob readdir readdirex readfile reduce reg_executing reg_recording reltime reltimefloat reltimestr remote_expr remote_foreground remote_peek remote_read remote_send remote_startserver remove rename repeat resolve reverse round rubyeval screenattr screenchar screenchars +syn keyword vimFuncName contained screencol screenpos screenrow screenstring search searchcount searchdecl searchpair searchpairpos searchpos server2client serverlist setbufline setbufvar setcellwidths setcharpos setcharsearch setcmdline setcmdpos setcursorcharpos setenv setfperm setline setloclist setmatches setpos setqflist setreg settabvar settabwinvar settagstack setwinvar sha256 shellescape shiftwidth sign_define sign_getdefined sign_getplaced sign_jump sign_place sign_placelist sign_undefine sign_unplace sign_unplacelist simplify sin sinh slice sort sound_clear sound_playevent sound_playfile sound_stop soundfold spellbadword spellsuggest split sqrt srand state str2float str2list str2nr strcharlen strcharpart strchars strdisplaywidth strftime strgetchar stridx +syn keyword vimFuncName contained string strlen strpart strptime strridx strtrans strutf16len strwidth submatch substitute swapfilelist swapinfo swapname synID synIDattr synIDtrans synconcealed synstack system systemlist tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan tanh tempname term_dumpdiff term_dumpload term_dumpwrite term_getaltscreen term_getansicolors term_getattr term_getcursor term_getjob term_getline term_getscrolled term_getsize term_getstatus term_gettitle term_gettty term_list term_scrape term_sendkeys term_setansicolors term_setapi term_setkill term_setrestore term_setsize term_start term_wait terminalprops test_alloc_fail test_autochdir test_feedinput test_garbagecollect_now test_garbagecollect_soon test_getvalue test_gui_event test_ignore_error +syn keyword vimFuncName contained test_mswin_event test_null_blob test_null_channel test_null_dict test_null_function test_null_job test_null_list test_null_partial test_null_string test_option_not_set test_override test_refcount test_setmouse test_settime test_srand_seed test_unknown test_void timer_info timer_pause timer_start timer_stop timer_stopall tolower toupper tr trim trunc type typename undofile undotree uniq utf16idx values virtcol virtcol2col visualmode wildmenumode win_execute win_findbuf win_getid win_gettype win_gotoid win_id2tabwin win_id2win win_move_separator win_move_statusline win_screenpos win_splitmove winbufnr wincol windowsversion winheight winlayout winline winnr winrestcmd winrestview winsaveview winwidth wordcount writefile xor "--- syntax here and above generated by mkvimvim --- " Special Vim Highlighting (not automatic) {{{1 diff --git a/src/evalfunc.c b/src/evalfunc.c index 81f747f843..071bf7d0f8 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -5584,8 +5584,9 @@ f_getregion(typval_T *argvars, typval_T *rettv) getvvcol(curwin, &p1, &sc1, NULL, &ec1); getvvcol(curwin, &p2, &sc2, NULL, &ec2); - oap.motion_type = OP_NOP; + oap.motion_type = MBLOCK; oap.inclusive = TRUE; + oap.op_type = OP_NOP; oap.start = p1; oap.end = p2; oap.start_vcol = MIN(sc1, sc2); diff --git a/src/version.c b/src/version.c index 471ecd83cd..a0bec91502 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 122, /**/ 121, /**/ From 52ecc76c7fa1865603f27bc838efaeaa03cad77c Mon Sep 17 00:00:00 2001 From: GuyBrush Date: Wed, 21 Feb 2024 20:16:38 +0100 Subject: [PATCH 070/426] patch 9.1.0123: MS-Windows: system() may deadlock Problem: MS-Windows: system() may deadlock when calling binaries that expect stdin Solution: Ignore the SHELL_EXPAND flag (GuyBrush) This happens on binaries that expect stdin. For example: :echo system("xxd") will cause a deadlock. SHELL_EXPAND is a flag devoted to support the linux implementation of the backtick-expansion mechanism. On linux backtic-expansion relies in the function mch_expand_wildchars() (os_unix.c) that delegates on each specific shell (bash, sh, csh, zsh) the expansion. Basically it composes a shell command that does the expansion and redirects the output to a file and call_shell() it. On windows backtick-expansion is performed by Vim itself. On linux SHELL_EXPAND modifies how mch_call_shell_fork() (os_unix.c) works. This function: - relies on posix fork() to spawn a child process to execute a external command. - Child and parent process communicate using pipes (or pseudoterminal if available). User input (type ahead content) is processed in a loop only if !(SHELL_EXPAND || SHELL_COOKED). Though signals are used to detect Ctrl-C in all cases (the input loop is not necessary to interrupt the function). In the backtick-expansion the external command is the shell command that provides the expansion. For the child redirection: - SHELL_EXPAND replaces stdin, stdout & stderr to /dev/null. This is why the shell command composed includes redirection (otherwise output would be lost). - !SHELL_EXPAND replaces stdin, stdout & stderr with the parent created pipes (or pseudoterminal). Note that the use of SIGINT signal prevents mch_call_shell_fork() from hanging vim. On Windows mch_system_piped() (os_win32.c) (which is only used when the GUI is running) mimics mch_call_shell_fork() (os_unix.c). Win32 lacks fork() and relies on CreateProcessW() and only has pipe support (not pseudoterminal) which makes the implementation much different. But, the key idea is that windows lacks signals, the OS provides support for console apps but gvim is not one. The only way of detecting a Ctrl-C is actually processing user input (type ahead content). By ignoring the user input under SHELL_EXPAND the function can hang gvim. Ignoring SHELL_EXPAND flag has no consequence in Windows because as mentioned above it is only meaningful in linux. closes: #13988 Signed-off-by: GuyBrush Signed-off-by: Christian Brabandt --- src/os_win32.c | 3 +-- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/os_win32.c b/src/os_win32.c index 3f2b3c3a4c..9947150cdf 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -5155,8 +5155,7 @@ mch_system_piped(char *cmd, int options) ) { len = 0; - if (!(options & SHELL_EXPAND) - && ((options & + if (((options & (SHELL_READ|SHELL_WRITE|SHELL_COOKED)) != (SHELL_READ|SHELL_WRITE|SHELL_COOKED) # ifdef FEAT_GUI diff --git a/src/version.c b/src/version.c index a0bec91502..650fb4fb4b 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 123, /**/ 122, /**/ From ec9c32637f566f38d097c566209d85d697182153 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 21 Feb 2024 20:40:05 +0100 Subject: [PATCH 071/426] runtime(doc): clarify expand() for :terminal windows While adding to the documentation, also mention the rolled-back key-translation strategy in version9.txt closes: #14069 Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 3 +++ runtime/doc/tags | 1 + runtime/doc/terminal.txt | 3 ++- runtime/doc/version9.txt | 5 ++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 2dc8f615f2..f1256b027c 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2540,6 +2540,9 @@ expand({string} [, {nosuf} [, {list}]]) *expand()* for a non-existing file is not included, unless {string} does not start with '%', '#' or '<', see below. + For a |:terminal| window '%' expands to a '!' followed by + the command or shell that is run |terminal-bufname| + When {string} starts with '%', '#' or '<', the expansion is done like for the |cmdline-special| variables with their associated modifiers. Here is a short overview: diff --git a/runtime/doc/tags b/runtime/doc/tags index b7e26ee49d..5c2eee33e6 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -10531,6 +10531,7 @@ termdebug_winbar terminal.txt /*termdebug_winbar* terminal terminal.txt /*terminal* terminal-api terminal.txt /*terminal-api* terminal-autoshelldir terminal.txt /*terminal-autoshelldir* +terminal-bufname terminal.txt /*terminal-bufname* terminal-client-server terminal.txt /*terminal-client-server* terminal-close terminal.txt /*terminal-close* terminal-colors os_unix.txt /*terminal-colors* diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt index c5331fa857..3720603ff2 100644 --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -1,4 +1,4 @@ -*terminal.txt* For Vim version 9.1. Last change: 2023 Nov 08 +*terminal.txt* For Vim version 9.1. Last change: 2024 Feb 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -208,6 +208,7 @@ Command syntax ~ [command]. Use `:execute` if you must have a Vim command following in the same line. + *terminal-bufname* A new buffer will be created, using [command] or 'shell' as the name, prefixed with a "!". If a buffer by this name already exists a number is added in diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index 29dbfb8c53..7b9a3664a0 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -1,4 +1,4 @@ -*version9.txt* For Vim version 9.1. Last change: 2024 Jan 05 +*version9.txt* For Vim version 9.1. Last change: 2024 Feb 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -41578,6 +41578,9 @@ Options: ~ ============================================================================== INCOMPATIBLE CHANGES *incompatible-9.2* +Improved/Different MS-Windows mapping support +|w32-experimental-keycode-trans-strategy| + ============================================================================== IMPROVEMENTS *improvements-9.2* From 8055721c2d30f21cfabe7453014f526e7becfc06 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Wed, 21 Feb 2024 21:00:59 +0100 Subject: [PATCH 072/426] patch 9.1.0124: display of below/right virtual text with non-virtual text overlap Problem: Virtual text with text_align 'right'/'below' wasn't being used when a non-virtual text property overlaps with the end of the line. This was because the non-virtual text property had a higher priority, preventing the virtual text from being used. Solution: Fix the sorting of text properties so virtual text properties have a higher priority than non-virtual text properties. (Dylan Thacker-Smith) related: #14063 Signed-off-by: Dylan Thacker-Smith Signed-off-by: Christian Brabandt --- ...virtual_text_overlap_with_highlight_1.dump | 8 ++++ src/testdir/test_textprop.vim | 40 +++++++++++++++++++ src/textprop.c | 9 +++-- src/version.c | 2 + 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 src/testdir/dumps/Test_virtual_text_overlap_with_highlight_1.dump diff --git a/src/testdir/dumps/Test_virtual_text_overlap_with_highlight_1.dump b/src/testdir/dumps/Test_virtual_text_overlap_with_highlight_1.dump new file mode 100644 index 0000000000..d81456fff3 --- /dev/null +++ b/src/testdir/dumps/Test_virtual_text_overlap_with_highlight_1.dump @@ -0,0 +1,8 @@ +| +0#af5f00255#ffffff0@1|1| |o+0#0000000&|n|e| @52 +| +0#af5f00255&@1|2| |t+0#0000000&|w|o| @52 +| +0#af5f00255&@3|s+0#ffffff16#ff404010|y|n|t|a|x| |e|r@1|o|r| +0#0000000#ffffff0@43 +| +0#af5f00255&@1|3| >t+0#0000000&|h|r|e@1| @50 +| +0#af5f00255&@1|4| |f+0#0000000&|o|u|r+0#e000002&| +0#0000000&@40|o+0#ffffff16#ff404010|t|h|e|r| |e|r@1|o|r +| +0#af5f00255#ffffff0@1|5| |f+0#e000002&|i+0#0000000&|v|e| @51 +|~+0#4040ff13&| @58 +| +0#0000000&@41|3|,|1| @10|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 97fea60e6d..18ff3df2ee 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -4090,6 +4090,46 @@ func Test_text_below_nowrap() call StopVimInTerminal(buf) endfunc +func Test_virtual_text_overlap_with_highlight() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + setline(1, ['one', 'two', 'three', 'four', 'five']) + set number + + prop_type_add('demo_highlight_warning', {highlight: 'WarningMsg'}) + prop_type_add('demo_virtual_text_error', {highlight: 'Error'}) + + prop_add(2, 4, { + type: 'demo_highlight_warning', + end_col: 4, + }) + prop_add(2, 0, { + type: 'demo_virtual_text_error', + text: 'syntax error', + text_align: 'below', + }) + normal 2j + + prop_add(4, 4, { + type: 'demo_highlight_warning', + end_lnum: 5, + end_col: 1, + }) + prop_add(4, 0, { + type: 'demo_virtual_text_error', + text: 'other error', + text_align: 'right', + }) + END + call writefile(lines, 'XVirtualTextOverlapWithHighlight', 'D') + let buf = RunVimInTerminal('-S XVirtualTextOverlapWithHighlight', #{rows: 8, cols: 60}) + call VerifyScreenDump(buf, 'Test_virtual_text_overlap_with_highlight_1', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_virtual_text_in_popup_highlight() CheckRunVimInTerminal diff --git a/src/textprop.c b/src/textprop.c index 168b1808fb..cd07844f14 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -758,6 +758,11 @@ text_prop_compare(const void *s1, const void *s2) tp2 = &text_prop_compare_props[idx2]; col1 = tp1->tp_col; col2 = tp2->tp_col; + + // property that inserts text has priority over one that doesn't + if ((tp1->tp_id < 0) != (tp2->tp_id < 0)) + return tp1->tp_id < 0 ? 1 : -1; + if (col1 == MAXCOL || col2 == MAXCOL) { int order1 = text_prop_order(tp1->tp_flags); @@ -768,10 +773,6 @@ text_prop_compare(const void *s1, const void *s2) return order1 < order2 ? 1 : -1; } - // property that inserts text has priority over one that doesn't - if ((tp1->tp_id < 0) != (tp2->tp_id < 0)) - return tp1->tp_id < 0 ? 1 : -1; - // check highest priority, defined by the type pt1 = text_prop_type_by_id(text_prop_compare_buf, tp1->tp_type); pt2 = text_prop_type_by_id(text_prop_compare_buf, tp2->tp_type); diff --git a/src/version.c b/src/version.c index 650fb4fb4b..1893b5f2b7 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 124, /**/ 123, /**/ From 83925be1e68445f7f6a377b7735f93fbc8689003 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Wed, 21 Feb 2024 21:03:10 +0100 Subject: [PATCH 073/426] patch 9.1.0125: unused init of text_prop_idxs in win_line() Problem: unused init of text_prop_idxs in win_line Solution: Remove it, fix typo (Dylan Thacker-Smith) Later use of text_prop_idxs treats it as empty, incrementing text_props_active as new elements are added to this array, so remove this unused conditional initialization when text_props_active is 0. closes: #14063 Signed-off-by: Dylan Thacker-Smith Signed-off-by: Christian Brabandt --- src/drawline.c | 12 +----------- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/drawline.c b/src/drawline.c index 0f3400f9da..3499d39e77 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -1633,16 +1633,6 @@ win_line( if (text_props[i].tp_id < 0) last_textprop_text_idx = i; - // When skipping virtual text the props need to be sorted. The - // order is reversed! - if (lnum == wp->w_topline && wp->w_skipcol > 0) - { - for (int i = 0; i < text_prop_count; ++i) - text_prop_idxs[i] = i; - sort_text_props(wp->w_buffer, text_props, - text_prop_idxs, text_prop_count); - } - // Text props "above" move the line number down to where the text // is. Only count the ones that are visible, not those that are // skipped because of w_skipcol. @@ -2298,7 +2288,7 @@ win_line( // If another text prop follows the condition below at // the last window column must know. - // If this is an "above" text prop and 'nowrap' the we + // If this is an "above" text prop and 'nowrap' then we // must wrap anyway. text_prop_above = above; text_prop_follows |= other_tpi != -1 diff --git a/src/version.c b/src/version.c index 1893b5f2b7..f4b2a1eac8 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 125, /**/ 124, /**/ From 20d61e1b94e5ac571b3a313765517582f86616f3 Mon Sep 17 00:00:00 2001 From: Nick Hanley Date: Thu, 22 Feb 2024 09:06:19 -0500 Subject: [PATCH 074/426] runtime(java): add syntax support for Java switch expressions (#9124) Signed-off-by: Nick Hanley Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/java.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index 00d6071944..44fbfa8398 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -2,7 +2,7 @@ " Language: Java " Maintainer: Claudio Fleiner " URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim -" Last Change: 2022 Jun 08 +" Last Change: 2023 Aug 13 " Please check :help java.vim for comments on some of the options available. @@ -39,7 +39,7 @@ syn keyword javaTypedef this super syn keyword javaOperator var new instanceof syn keyword javaType boolean char byte short int long float double syn keyword javaType void -syn keyword javaStatement return +syn keyword javaStatement return yield syn keyword javaStorageClass static synchronized transient volatile final strictfp serializable syn keyword javaExceptions throw try catch finally syn keyword javaAssert assert @@ -142,7 +142,7 @@ if exists("java_space_errors") endif endif -syn region javaLabelRegion transparent matchgroup=javaLabel start="\" end="->" matchgroup=NONE end=":" contains=javaNumber,javaCharacter,javaString +syn region javaLabelRegion transparent matchgroup=javaLabel start="\" matchgroup=NONE end=":\|->" contains=javaNumber,javaCharacter,javaString syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel syn keyword javaLabel default From 1624970d321cfb637ac76232df9c9b3f2fae904c Mon Sep 17 00:00:00 2001 From: dkearns Date: Fri, 23 Feb 2024 05:45:05 +1100 Subject: [PATCH 075/426] runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077) Fixes issue #7876 Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/generator/gen_syntax_vim.vim | 4 +-- runtime/syntax/generator/vim.vim.base | 5 ++-- .../testdir/dumps/vim_ex_abbreviate_00.dump | 20 +++++++++++++++ .../testdir/dumps/vim_ex_abbreviate_01.dump | 20 +++++++++++++++ .../testdir/dumps/vim_ex_abbreviate_99.dump | 20 +++++++++++++++ .../syntax/testdir/dumps/vim_ex_map_00.dump | 20 +++++++++++++++ .../syntax/testdir/dumps/vim_ex_map_99.dump | 20 +++++++++++++++ runtime/syntax/testdir/dumps/vim_map_00.dump | 20 --------------- runtime/syntax/testdir/dumps/vim_map_99.dump | 20 --------------- .../testdir/input/vim_ex_abbreviate.vim | 25 +++++++++++++++++++ runtime/syntax/testdir/input/vim_ex_map.vim | 21 ++++++++++++++++ runtime/syntax/testdir/input/vim_map.vim | 9 ------- runtime/syntax/vim.vim | 25 ++++++++++--------- 13 files changed, 164 insertions(+), 65 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/vim_ex_abbreviate_00.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_abbreviate_01.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_abbreviate_99.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_map_00.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_map_99.dump delete mode 100644 runtime/syntax/testdir/dumps/vim_map_00.dump delete mode 100644 runtime/syntax/testdir/dumps/vim_map_99.dump create mode 100644 runtime/syntax/testdir/input/vim_ex_abbreviate.vim create mode 100644 runtime/syntax/testdir/input/vim_ex_map.vim delete mode 100644 runtime/syntax/testdir/input/vim_map.vim diff --git a/runtime/syntax/generator/gen_syntax_vim.vim b/runtime/syntax/generator/gen_syntax_vim.vim index 44f701613a..bc561dd6c7 100644 --- a/runtime/syntax/generator/gen_syntax_vim.vim +++ b/runtime/syntax/generator/gen_syntax_vim.vim @@ -273,7 +273,7 @@ function! s:get_vim_command_type(cmd_name) let menu_prefix = '^\%([acinosvx]\?\|tl\)' let map_prefix = '^[acilnostvx]\?' let exclude_list = [ - \ 'map', + \ 'map', 'mapclear', \ 'substitute', 'smagic', 'snomagic', \ 'setlocal', 'setglobal', 'set', 'var', \ 'autocmd', 'doautocmd', 'doautoall', @@ -288,7 +288,7 @@ function! s:get_vim_command_type(cmd_name) if index(exclude_list, a:cmd_name) != -1 let ret = 99 - elseif a:cmd_name =~# '^\%(abbreviate\|noreabbrev\|\l\%(nore\)\?abbrev\)$' + elseif a:cmd_name =~# '^\%(\%(un\)\?abbreviate\|noreabbrev\|\l\%(nore\|un\)\?abbrev\)$' let ret = 2 elseif a:cmd_name =~# menu_prefix . '\%(nore\|un\)\?menu$' let ret = 3 diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index 8dcdf846c8..99a0488b34 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -454,10 +454,11 @@ syn case match syn match vimMap "\\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMap "\" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMapRhs contained ".*" contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimContinue diff --git a/runtime/syntax/testdir/dumps/vim_ex_abbreviate_00.dump b/runtime/syntax/testdir/dumps/vim_ex_abbreviate_00.dump new file mode 100644 index 0000000000..68055d8a6b --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_abbreviate_00.dump @@ -0,0 +1,20 @@ +>"+0#0000e05#ffffff0| |V|i|m| |:|a|b@1|r|e|v|i|a|t|e| |c|o|m@1|a|n|d|s| +0#0000000&@48 +@75 +|a+0#af5f00255&|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| |f|o@1|b|a|r| @48 +|c+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| |c|f|o@1|b|a|r| @45 +|i+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @45 +@75 +|a+0#af5f00255&|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| |f|o@1|b|a|r| @41 +|c+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| |c|f|o@1|b|a|r| @38 +|i+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @38 +@75 +|n+0#af5f00255&|o|r|e|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| |f|o@1|b|a|r| @44 +|c+0#af5f00255&|n|o|r|e|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| |c|f|o@1|b|a|r| @41 +|i+0#af5f00255&|n|o|r|e|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @41 +@75 +|a+0#af5f00255&|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| |f|o@1|b|a|r| @41 +|c+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| |c|f|o@1|b|a|r| @38 +|i+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @38 +@75 +|u+0#af5f00255&|n|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| @53 +|"|i|n|p|u|t|/|v|i|m|_|e|x|_|a|b@1|r|e|v|i|a|t|e|.|v|i|m|"| |2|5|L|,| |5@1|8|B| @17|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_abbreviate_01.dump b/runtime/syntax/testdir/dumps/vim_ex_abbreviate_01.dump new file mode 100644 index 0000000000..c5cc26feb0 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_abbreviate_01.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@74 +|a+0#af5f00255&|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| |f|o@1|b|a|r| @41 +|c+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| |c|f|o@1|b|a|r| @38 +|i+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @38 +@75 +>u+0#af5f00255&|n|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| @53 +|c+0#af5f00255&|u|n|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| @51 +|i+0#af5f00255&|u|n|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| @51 +@75 +|a+0#af5f00255&|b|c|l|e|a|r| +0#0000000&|<+0#af5f00255&|b|u|f@1|e|r|>| +0#0000000&@58 +|c+0#af5f00255&|a|b|c|l|e|a|r| +0#0000000&|<+0#af5f00255&|b|u|f@1|e|r|>| +0#0000000&@57 +|i+0#af5f00255&|a|b|c|l|e|a|r| +0#0000000&|<+0#af5f00255&|b|u|f@1|e|r|>| +0#0000000&@57 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|1|9|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/dumps/vim_ex_abbreviate_99.dump b/runtime/syntax/testdir/dumps/vim_ex_abbreviate_99.dump new file mode 100644 index 0000000000..5cec5eed3c --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_abbreviate_99.dump @@ -0,0 +1,20 @@ +|a+0#af5f00255#ffffff0|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| |f|o@1|b|a|r| @41 +|c+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| |c|f|o@1|b|a|r| @38 +|i+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @38 +@75 +|n+0#af5f00255&|o|r|e|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| |f|o@1|b|a|r| @44 +|c+0#af5f00255&|n|o|r|e|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| |c|f|o@1|b|a|r| @41 +|i+0#af5f00255&|n|o|r|e|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @41 +@75 +|a+0#af5f00255&|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| |f|o@1|b|a|r| @41 +|c+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| |c|f|o@1|b|a|r| @38 +|i+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @38 +@75 +|u+0#af5f00255&|n|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| @53 +|c+0#af5f00255&|u|n|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|c|f|o@1| @51 +|i+0#af5f00255&|u|n|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| @51 +@75 +|a+0#af5f00255&|b|c|l|e|a|r| +0#0000000&|<+0#af5f00255&|b|u|f@1|e|r|>| +0#0000000&@58 +|c+0#af5f00255&|a|b|c|l|e|a|r| +0#0000000&|<+0#af5f00255&|b|u|f@1|e|r|>| +0#0000000&@57 +>i+0#af5f00255&|a|b|c|l|e|a|r| +0#0000000&|<+0#af5f00255&|b|u|f@1|e|r|>| +0#0000000&@57 +@57|2|5|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/dumps/vim_ex_map_00.dump b/runtime/syntax/testdir/dumps/vim_ex_map_00.dump new file mode 100644 index 0000000000..032eeb4169 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_map_00.dump @@ -0,0 +1,20 @@ +>"+0#0000e05#ffffff0| |V|i|m| |:|m|a|p| |c|o|m@1|a|n|d|s| +0#0000000&@55 +@75 +|m+0#af5f00255&|a|p|!| +0#0000000&@70 +|m+0#af5f00255&|a|p|!| +0#0000000&|l|h|s| |r|h|s| @62 +|m+0#af5f00255&|a|p| +0#0000000&@71 +|m+0#af5f00255&|a|p| +0#0000000&|l|h|s| |r|h|s| @63 +@75 +|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@51 +|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p| +0#0000000&|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@50 +@75 +|m+0#af5f00255&|a|p|c|l|e|a|r| +0#0000000&@1|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|m+0#af5f00255&|a|p|c|l|e|a|r|!| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|n+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|v+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|x+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|s+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|o+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|i+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|l+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|"|i|n|p|u|t|/|v|i|m|_|e|x|_|m|a|p|.|v|i|m|"| |2|1|L|,| |3|1|6|B| @24|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_map_99.dump b/runtime/syntax/testdir/dumps/vim_ex_map_99.dump new file mode 100644 index 0000000000..fa5a0d7ea5 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_map_99.dump @@ -0,0 +1,20 @@ +|m+0#af5f00255#ffffff0|a|p|!| +0#0000000&@70 +|m+0#af5f00255&|a|p|!| +0#0000000&|l|h|s| |r|h|s| @62 +|m+0#af5f00255&|a|p| +0#0000000&@71 +|m+0#af5f00255&|a|p| +0#0000000&|l|h|s| |r|h|s| @63 +@75 +|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@51 +|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p| +0#0000000&|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@50 +@75 +|m+0#af5f00255&|a|p|c|l|e|a|r| +0#0000000&@1|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|m+0#af5f00255&|a|p|c|l|e|a|r|!| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|n+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|v+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|x+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|s+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|o+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|i+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|l+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +|c+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +>t+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 +@57|2|1|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/dumps/vim_map_00.dump b/runtime/syntax/testdir/dumps/vim_map_00.dump deleted file mode 100644 index d3a290e9b6..0000000000 --- a/runtime/syntax/testdir/dumps/vim_map_00.dump +++ /dev/null @@ -1,20 +0,0 @@ ->"+0#0000e05#ffffff0| |V|i|m| |m|a|p| |c|o|m@1|a|n|d|s| +0#0000000&@56 -@75 -|m+0#af5f00255&|a|p|!| +0#0000000&@70 -|m+0#af5f00255&|a|p|!| +0#0000000&|l|h|s| |r|h|s| @62 -|m+0#af5f00255&|a|p| +0#0000000&@71 -|m+0#af5f00255&|a|p| +0#0000000&|l|h|s| |r|h|s| @63 -@75 -|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@51 -|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p| +0#0000000&|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@50 -|~+0#4040ff13&| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|m|a|p|.|v|i|m|"| |9|L|,| |1|0|5|B| @28|1|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/dumps/vim_map_99.dump b/runtime/syntax/testdir/dumps/vim_map_99.dump deleted file mode 100644 index f8710b9538..0000000000 --- a/runtime/syntax/testdir/dumps/vim_map_99.dump +++ /dev/null @@ -1,20 +0,0 @@ -|"+0#0000e05#ffffff0| |V|i|m| |m|a|p| |c|o|m@1|a|n|d|s| +0#0000000&@56 -@75 -|m+0#af5f00255&|a|p|!| +0#0000000&@70 -|m+0#af5f00255&|a|p|!| +0#0000000&|l|h|s| |r|h|s| @62 -|m+0#af5f00255&|a|p| +0#0000000&@71 -|m+0#af5f00255&|a|p| +0#0000000&|l|h|s| |r|h|s| @63 -@75 -|c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@51 ->c+0#af5f00255&|a|l@1| +0#0000000&|m+0#00e0e07&|a|p| +0#0000000&|(+0#e000e06&|l+0#00e0e07&|i|s|t|,+0#0000000&| |'+0#e000002&|v|:|v|a|l|'|)+0#e000e06&| +0#0000000&@50 -|~+0#4040ff13&| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|m|a|p|.|v|i|m|"| |9|L|,| |1|0|5|B| @28|9|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/input/vim_ex_abbreviate.vim b/runtime/syntax/testdir/input/vim_ex_abbreviate.vim new file mode 100644 index 0000000000..7360e38317 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_abbreviate.vim @@ -0,0 +1,25 @@ +" Vim :abbreviate commands + +abbrev foo foobar +cabbrev cfoo cfoobar +iabbrev ifoo cfoobar + +abbrev foo foobar +cabbrev cfoo cfoobar +iabbrev ifoo cfoobar + +noreabbrev foo foobar +cnoreabbrev cfoo cfoobar +inoreabbrev ifoo cfoobar + +abbrev foo foobar +cabbrev cfoo cfoobar +iabbrev ifoo cfoobar + +unabbrev foo +cunabbrev cfoo +iunabbrev ifoo + +abclear +cabclear +iabclear diff --git a/runtime/syntax/testdir/input/vim_ex_map.vim b/runtime/syntax/testdir/input/vim_ex_map.vim new file mode 100644 index 0000000000..81fe84cc93 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_map.vim @@ -0,0 +1,21 @@ +" Vim :map commands + +map! +map! lhs rhs +map +map lhs rhs + +call map(list, 'v:val') +call map (list, 'v:val') + +mapclear +mapclear! +nmapclear +vmapclear +xmapclear +smapclear +omapclear +imapclear +lmapclear +cmapclear +tmapclear diff --git a/runtime/syntax/testdir/input/vim_map.vim b/runtime/syntax/testdir/input/vim_map.vim deleted file mode 100644 index 7c73b996f4..0000000000 --- a/runtime/syntax/testdir/input/vim_map.vim +++ /dev/null @@ -1,9 +0,0 @@ -" Vim map commands - -map! -map! lhs rhs -map -map lhs rhs - -call map(list, 'v:val') -call map (list, 'v:val') diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 978cd0e31c..7dde1a3408 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -3,7 +3,7 @@ " Maintainer: Hirohito Higashi " Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex -" Last Change: Feb 21, 2024 +" Last Change: Feb 23, 2024 " Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 @@ -29,15 +29,15 @@ syn cluster vimCommentGroup contains=vimTodo,@Spell " regular vim commands {{{2 " GEN_SYN_VIM: vimCommand normal, START_STR='syn keyword vimCommand contained', END_STR='' syn keyword vimCommand contained abc[lear] abo[veleft] abs[tract] al[l] ar[gs] arga[dd] argd[elete] argdo argded[upe] arge[dit] argg[lobal] argl[ocal] argu[ment] as[cii] b[uffer] bN[ext] ba[ll] bad[d] balt bd[elete] bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bo[tright] bp[revious] br[ewind] brea[k] breaka[dd] breakd[el] breakl[ist] bro[wse] buffers bufd[o] bun[load] bw[ipeout] c[hange] cN[ext] cNf[ile] cabc[lear] cabo[ve] cad[dbuffer] cadde[xpr] caddf[ile] caf[ter] cal[l] cat[ch] cb[uffer] cbe[fore] cbel[ow] cbo[ttom] cc ccl[ose] cd cdo ce[nter] cex[pr] cf[ile] cfd[o] cfir[st] cg[etfile] cgetb[uffer] cgete[xpr] chd[ir] changes che[ckpath] checkt[ime] chi[story] cl[ist] cla[st] class clo[se] cle[arjumps] cn[ext] cnew[er] cnf[ile] co[py] col[der] colo[rscheme] -syn keyword vimCommand contained com[mand] comc[lear] comp[iler] con[tinue] conf[irm] cons[t] cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cuna[bbrev] cw[indow] d[elete] delm[arks] deb[ug] debugg[reedy] def defc[ompile] defe[r] delc[ommand] delf[unction] di[splay] dif[fupdate] diffg[et] diffo[ff] diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] echoe[rr] echom[sg] echoc[onsole] echon echow[indow] el[se] elsei[f] em[enu] en[dif] endin[terface] endc[lass] endd[ef] ende[num] endf[unction] endfo[r] endt[ry] endw[hile] ene[w] enu[m] ev[al] ex exi[t] exp[ort] exu[sage] f[ile] files filet[ype] filt[er] fin[d] fina[l] finall[y] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] -syn keyword vimCommand contained foldd[oopen] folddoc[losed] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] gu[i] gv[im] h[elp] helpc[lose] helpf[ind] helpg[rep] helpt[ags] ha[rdcopy] hi[ghlight] hid[e] his[tory] ho[rizontal] iabc[lear] if ij[ump] il[ist] imp[ort] int[ro] inte[rface] is[earch] isp[lit] iuna[bbrev] j[oin] ju[mps] k kee[pmarks] keepj[umps] keepp[atterns] keepa[lt] l[ist] lN[ext] lNf[ile] la[st] lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lc[d] lch[dir] lcl[ose] lcs[cope] ld[o] le[ft] lefta[bove] let lex[pr] leg[acy] lf[ile] lfd[o] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lgr[ep] lgrepa[dd] lh[elpgrep] lhi[story] ll lla[st] lli[st] lmak[e] lne[xt] lnew[er] lnf[ile] -syn keyword vimCommand contained lo[adview] loadk[eymap] loc[kmarks] lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks mat[ch] menut[ranslate] mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] popu[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] -syn keyword vimCommand contained python3 py3f[ile] pyx pyxd[o] pythonx pyxf[ile] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redi[r] redr[aw] redraws[tatus] redrawt[abline] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] ru[ntime] rub[y] rubyd[o] rubyf[ile] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] san[dbox] sav[eas] sb[uffer] sbN[ext] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] sc[riptnames] scripte[ncoding] scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] si[malt] sig[n] sil[ent] sl[eep] sla[st] sn[ext] so[urce] sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sr[ewind] st[op] sta[g] star[tinsert] startg[replace] startr[eplace] -syn keyword vimCommand contained stat[ic] stopi[nsert] stj[ump] sts[elect] sun[hide] sus[pend] sv[iew] sw[apname] synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tab tabc[lose] tabd[o] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] tabp[revious] tabN[ext] tabr[ewind] tabs tc[d] tch[dir] tcl tcld[o] tclf[ile] te[aroff] ter[minal] tf[irst] th[row] thi[s] tj[ump] tl[ast] tm[enu] tn[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu[nmenu] ty[pe] u[ndo] undoj[oin] undol[ist] una[bbreviate] unh[ide] unl[et] unlo[ckvar] uns[ilent] up[date] v[global] ve[rsion] verb[ose] vert[ical] vi[sual] vie[w] vim[grep] vimgrepa[dd] vim9[cmd] vim9s[cript] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wh[ile] wi[nsize] winc[md] wind[o] winp[os] -syn keyword vimCommand contained wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep deletp deletep a i +syn keyword vimCommand contained com[mand] comc[lear] comp[iler] con[tinue] conf[irm] cons[t] cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cw[indow] d[elete] delm[arks] deb[ug] debugg[reedy] def defc[ompile] defe[r] delc[ommand] delf[unction] di[splay] dif[fupdate] diffg[et] diffo[ff] diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] echoe[rr] echom[sg] echoc[onsole] echon echow[indow] el[se] elsei[f] em[enu] en[dif] endin[terface] endc[lass] endd[ef] ende[num] endf[unction] endfo[r] endt[ry] endw[hile] ene[w] enu[m] ev[al] ex exi[t] exp[ort] exu[sage] f[ile] files filet[ype] filt[er] fin[d] fina[l] finall[y] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] foldd[oopen] +syn keyword vimCommand contained folddoc[losed] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] gu[i] gv[im] h[elp] helpc[lose] helpf[ind] helpg[rep] helpt[ags] ha[rdcopy] hi[ghlight] hid[e] his[tory] ho[rizontal] iabc[lear] if ij[ump] il[ist] imp[ort] int[ro] inte[rface] is[earch] isp[lit] j[oin] ju[mps] k kee[pmarks] keepj[umps] keepp[atterns] keepa[lt] l[ist] lN[ext] lNf[ile] la[st] lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lc[d] lch[dir] lcl[ose] lcs[cope] ld[o] le[ft] lefta[bove] let lex[pr] leg[acy] lf[ile] lfd[o] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lgr[ep] lgrepa[dd] lh[elpgrep] lhi[story] ll lla[st] lli[st] lmak[e] lne[xt] lnew[er] lnf[ile] lo[adview] loadk[eymap] loc[kmarks] +syn keyword vimCommand contained lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks mat[ch] menut[ranslate] mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] popu[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] python3 py3f[ile] pyx pyxd[o] pythonx +syn keyword vimCommand contained pyxf[ile] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redi[r] redr[aw] redraws[tatus] redrawt[abline] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] ru[ntime] rub[y] rubyd[o] rubyf[ile] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] san[dbox] sav[eas] sb[uffer] sbN[ext] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] sc[riptnames] scripte[ncoding] scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] si[malt] sig[n] sil[ent] sl[eep] sla[st] sn[ext] so[urce] sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sr[ewind] st[op] sta[g] star[tinsert] startg[replace] startr[eplace] stat[ic] stopi[nsert] stj[ump] sts[elect] +syn keyword vimCommand contained sun[hide] sus[pend] sv[iew] sw[apname] synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tab tabc[lose] tabd[o] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] tabp[revious] tabN[ext] tabr[ewind] tabs tc[d] tch[dir] tcl tcld[o] tclf[ile] te[aroff] ter[minal] tf[irst] th[row] thi[s] tj[ump] tl[ast] tm[enu] tn[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu[nmenu] ty[pe] u[ndo] undoj[oin] undol[ist] unh[ide] unl[et] unlo[ckvar] uns[ilent] up[date] v[global] ve[rsion] verb[ose] vert[ical] vi[sual] vie[w] vim[grep] vimgrepa[dd] vim9[cmd] vim9s[cript] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wh[ile] wi[nsize] winc[md] wind[o] winp[os] wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] +syn keyword vimCommand contained xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep deletp deletep a i syn keyword vimCommand contained am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] sme[nu] snoreme[nu] sunme[nu] tlm[enu] tln[oremenu] tlu[nmenu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] xme[nu] xnoreme[nu] xunme[nu] syn keyword vimCommand contained cm[ap] cno[remap] im[ap] ino[remap] lm[ap] ln[oremap] nm[ap] nn[oremap] no[remap] om[ap] ono[remap] smap snor[emap] tma[p] tno[remap] vm[ap] vn[oremap] xm[ap] xn[oremap] -syn keyword vimCommand contained cmapc[lear] imapc[lear] lmapc[lear] mapc[lear] nmapc[lear] omapc[lear] smapc[lear] tmapc[lear] vmapc[lear] xmapc[lear] +syn keyword vimCommand contained cmapc[lear] imapc[lear] lmapc[lear] nmapc[lear] omapc[lear] smapc[lear] tmapc[lear] vmapc[lear] xmapc[lear] syn keyword vimCommand contained cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] tunma[p] unm[ap] vu[nmap] xu[nmap] syn keyword vimCommand contained 2mat[ch] 3mat[ch] @@ -474,7 +474,7 @@ syn keyword vimFor for skipwhite nextgroup=vimVar,vimVarList " Abbreviations: {{{2 " ============= " GEN_SYN_VIM: vimCommand abbrev, START_STR='syn keyword vimAbb', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs' -syn keyword vimAbb ab[breviate] ca[bbrev] cnorea[bbrev] ia[bbrev] inorea[bbrev] norea[bbrev] skipwhite nextgroup=vimMapMod,vimMapLhs +syn keyword vimAbb ab[breviate] ca[bbrev] cnorea[bbrev] cuna[bbrev] ia[bbrev] inorea[bbrev] iuna[bbrev] norea[bbrev] una[bbreviate] skipwhite nextgroup=vimMapMod,vimMapLhs " Autocmd: {{{2 " ======= @@ -499,12 +499,13 @@ syn match vimMap "\\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapL syn match vimMap "\" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs syn match vimMapRhs contained ".*" contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimContinue From 421b597470c118871c7081de00dd065e0e000b7e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Feb 2024 19:48:06 +0100 Subject: [PATCH 076/426] patch 9.1.0126: Internal error when using upper-case mark in getregion() Problem: Internal error when passing mark in another buffer to getregion(). Solution: Don't allow marks in another buffer (zeertzjq) closes: #14076 Signed-off-by: zeertzjq Internal error when passing mark in another buffer to getregion() --- runtime/doc/builtin.txt | 4 +++- src/evalfunc.c | 4 ++-- src/testdir/test_visual.vim | 11 ++++++++++- src/version.c | 2 ++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index f1256b027c..b117bf84b1 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 21 +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 22 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4300,6 +4300,8 @@ getregion({pos1}, {pos2}, {type}) *getregion()* |visual-mode|, an empty list is returned. - If {pos1}, {pos2} or {type} is an invalid string, an empty list is returned. + - If {pos1} or {pos2} is a mark in different buffer, an empty + list is returned. Examples: > :xnoremap diff --git a/src/evalfunc.c b/src/evalfunc.c index 071bf7d0f8..981f8abedf 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -5508,12 +5508,12 @@ f_getregion(typval_T *argvars, typval_T *rettv) // NOTE: var2fpos() returns static pointer. fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE); - if (fp == NULL) + if (fp == NULL || (fnum >= 0 && fnum != curbuf->b_fnum)) return; p1 = *fp; fp = var2fpos(&argvars[1], TRUE, &fnum, FALSE); - if (fp == NULL) + if (fp == NULL || (fnum >= 0 && fnum != curbuf->b_fnum)) return; p2 = *fp; diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 34c572e617..8b434238a8 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1712,7 +1712,16 @@ func Test_visual_getregion() call assert_fails(':echo "."->getregion([],"V")', 'E1174:') call assert_fails(':echo "."->getregion("$", {})', 'E1174:') call assert_fails(':echo [0, 1, 1, 0]->getregion("$", "v")', 'E1174:') - + " using a mark in another buffer + new + let newbuf = bufnr() + call setline(1, range(10)) + normal! GmA + wincmd p + call assert_equal([newbuf, 10, 1, 0], getpos("'A")) + call assert_equal([], getregion(".", "'A", 'v')) + call assert_equal([], getregion("'A", ".", 'v')) + exe newbuf .. 'bwipe!' bwipe! " Selection in starts or ends in the middle of a multibyte character diff --git a/src/version.c b/src/version.c index f4b2a1eac8..b8e79dd546 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 126, /**/ 125, /**/ From 5e3674b42da10b7e7c72d1f20f9a15379af1b60a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Feb 2024 19:51:34 +0100 Subject: [PATCH 077/426] patch 9.1.0127: Naming a non-pointer variable "oap" is strange Problem: Naming a non-pointer variable "oap" is strange. Solution: Rename it to "oa". Also prevent using freed memory in case of memory allocation failure. (zeertzjq) closes: #14075 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/evalfunc.c | 23 ++++++++++++----------- src/version.c | 2 ++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index 981f8abedf..37010d7bad 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -5485,7 +5485,7 @@ block_def2str(struct block_def *bd) f_getregion(typval_T *argvars, typval_T *rettv) { linenr_T lnum; - oparg_T oap; + oparg_T oa; struct block_def bd; char_u *akt = NULL; int inclusive = TRUE; @@ -5584,16 +5584,16 @@ f_getregion(typval_T *argvars, typval_T *rettv) getvvcol(curwin, &p1, &sc1, NULL, &ec1); getvvcol(curwin, &p2, &sc2, NULL, &ec2); - oap.motion_type = MBLOCK; - oap.inclusive = TRUE; - oap.op_type = OP_NOP; - oap.start = p1; - oap.end = p2; - oap.start_vcol = MIN(sc1, sc2); + oa.motion_type = MBLOCK; + oa.inclusive = TRUE; + oa.op_type = OP_NOP; + oa.start = p1; + oa.end = p2; + oa.start_vcol = MIN(sc1, sc2); if (*p_sel == 'e' && ec1 < sc2 && 0 < sc2 && ec2 > ec1) - oap.end_vcol = sc2 - 1; + oa.end_vcol = sc2 - 1; else - oap.end_vcol = MAX(ec1, ec2); + oa.end_vcol = MAX(ec1, ec2); } // Include the trailing byte of a multi-byte char. @@ -5609,7 +5609,7 @@ f_getregion(typval_T *argvars, typval_T *rettv) akt = vim_strsave(ml_get(lnum)); else if (region_type == MBLOCK) { - block_prep(&oap, &bd, lnum, FALSE); + block_prep(&oa, &bd, lnum, FALSE); akt = block_def2str(&bd); } else if (p1.lnum < lnum && lnum < p2.lnum) @@ -5628,7 +5628,8 @@ f_getregion(typval_T *argvars, typval_T *rettv) if (akt == NULL || ret == FAIL) { - list_free(rettv->vval.v_list); + clear_tv(rettv); + (void)rettv_list_alloc(rettv); break; } } diff --git a/src/version.c b/src/version.c index b8e79dd546..e2d1f591ab 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 127, /**/ 126, /**/ From 2a65e739447949a7aee966ce8a3b75521b2a79ea Mon Sep 17 00:00:00 2001 From: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:53:33 +0100 Subject: [PATCH 078/426] patch 9.1.0128: win_gotoid() may abort even when not switching a window Problem: win_gotoid() checks for textlock and other things when switching to a window that is already current (after v9.1.0119) Solution: return early with success when attempting to switch to curwin (Sean Dewar) Other potential causes of E565 from win_gotoid after v9.1.0119 should be correct. Plugins can consider using win_execute() instead if they wish to temporarily switch windows during textlock. fixes: #14073 closes: #14074 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt --- src/evalwindow.c | 7 +++++++ src/testdir/test_window_cmd.vim | 6 ++++++ src/version.c | 2 ++ 3 files changed, 15 insertions(+) diff --git a/src/evalwindow.c b/src/evalwindow.c index 00081d43d5..f9b1c12961 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -824,6 +824,13 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv) return; id = tv_get_number(&argvars[0]); + if (curwin->w_id == id) + { + // Nothing to do. + rettv->vval.v_number = 1; + return; + } + if (text_or_buf_locked()) return; #if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL) diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index a68ed74cb6..a70fb790c5 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -2225,6 +2225,10 @@ func Test_win_gotoid_splitmove_textlock_cmdwin() set debug+=throw indentexpr=win_gotoid(win_getid(winnr('#'))) call assert_fails('normal! ==', 'E565:') call assert_equal(curwin, win_getid()) + " No error if attempting to switch to curwin; nothing happens. + set indentexpr=assert_equal(1,win_gotoid(win_getid())) + normal! == + call assert_equal(curwin, win_getid()) set indentexpr=win_splitmove(winnr('#'),winnr()) call assert_fails('normal! ==', 'E565:') @@ -2240,6 +2244,8 @@ func Test_win_gotoid_splitmove_textlock_cmdwin() call feedkeys('q:' \ .. ":call assert_fails('call win_gotoid(win_getid(winnr(''#'')))', 'E11:')\" + "\ No error if attempting to switch to curwin; nothing happens. + \ .. ":call assert_equal(1, win_gotoid(win_getid()))\" \ .. ":call assert_equal('command', win_gettype())\" \ .. ":call assert_equal('', win_gettype(winnr('#')))\", 'ntx') endfunc diff --git a/src/version.c b/src/version.c index e2d1f591ab..9b38a34964 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 128, /**/ 127, /**/ From 315cd1fbcbba7c44ec8743f03645bfcaef58bd55 Mon Sep 17 00:00:00 2001 From: Petr Pisar Date: Thu, 22 Feb 2024 20:39:09 +0100 Subject: [PATCH 079/426] runtime(spec): Recognize SourceLicense tag name in RPM spec syntax (#14046) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rpm-4.19.0 added a new SourceLicense tag. It is used at the same place as License tag. This patch adds the new tag name into a Vim syntax file to be highligted the same way as the License tag. Note that it has to be defined in the syntax file before Source\d* regexp. Otherwise it's not recognized by Vim. Signed-off-by: Petr Písař Signed-off-by: Christian Brabandt --- runtime/syntax/spec.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/spec.vim b/runtime/syntax/spec.vim index aed04bc900..12ce8d5ac1 100644 --- a/runtime/syntax/spec.vim +++ b/runtime/syntax/spec.vim @@ -102,7 +102,7 @@ syn case ignore "%% PreAmble Section %% "Copyright and Serial were deprecated by License and Epoch syn region specPreAmbleDeprecated oneline matchgroup=specError start='^\(Copyright\|Serial\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier -syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Recommends\|Suggests\|Supplements\|Enhances\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier +syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Recommends\|Suggests\|Supplements\|Enhances\|Icon\|URL\|SourceLicense\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier "%% Description Section %% syn region specDescriptionArea matchgroup=specSection start='^%description' end='^%'me=e-1 contains=specDescriptionOpts,specEmail,specURL,specNumber,specMacroIdentifier,specComment From aa31346da4e486013975b92f65d4ae70aca66ff0 Mon Sep 17 00:00:00 2001 From: dragonish Date: Sat, 24 Feb 2024 17:08:19 +0800 Subject: [PATCH 080/426] runtime(tutor): small fixes to the zh tutor (#14081) dragonish Signed-off-by: Christian Brabandt --- runtime/tutor/tutor.zh.euc | 2 +- runtime/tutor/tutor.zh_cn.utf-8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/tutor/tutor.zh.euc b/runtime/tutor/tutor.zh.euc index 16a031a3b9..5cdf21c058 100644 --- a/runtime/tutor/tutor.zh.euc +++ b/runtime/tutor/tutor.zh.euc @@ -905,7 +905,7 @@ 2. 鿴һµǰĿ¼ѾЩļ룺 :!ls :!dir - 3. һĿ¼ʼ֣룺 :e + 3. һʼ֣룺 :e 4. Ű CTRL-D Vim ʾ e ʼб diff --git a/runtime/tutor/tutor.zh_cn.utf-8 b/runtime/tutor/tutor.zh_cn.utf-8 index cc8e57504d..34879a4a2e 100644 --- a/runtime/tutor/tutor.zh_cn.utf-8 +++ b/runtime/tutor/tutor.zh_cn.utf-8 @@ -905,7 +905,7 @@ 2. 查看一下当前目录下已经存在哪些文件,输入: :!ls 或者 :!dir - 3. 现在输入一个目录的起始部分,例如输入: :e + 3. 现在输入一个命令的起始部分,例如输入: :e 4. 接着按 CTRL-D 键,Vim 会显示以 e 开始的命令的列表。 From a35235e824bb77df0cebdb2bd290e13f1201b292 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sat, 24 Feb 2024 10:09:43 +0100 Subject: [PATCH 081/426] runtime(doc) Update help text for matchbufline() and matchstrlist() closes: #14080 Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 9 ++++++++- runtime/doc/tags | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index b117bf84b1..849b1808f1 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 22 +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -6090,6 +6090,7 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()* Note that when {count} is added the way {start} works changes, see above. + *match-pattern* See |pattern| for the patterns that are accepted. The 'ignorecase' option is used to set the ignore-caseness of the pattern. 'smartcase' is NOT used. The matching is always @@ -6237,6 +6238,9 @@ matchbufline({buf}, {pat}, {lnum}, {end}, [, {dict}]) This function works only for loaded buffers. First call |bufload()| if needed. + See |match-pattern| for information about the effect of some + option settings on the pattern. + When {buf} is not a valid buffer, the buffer is not loaded or {lnum} or {end} is not valid then an error is given and an empty |List| is returned. @@ -6411,6 +6415,9 @@ matchstrlist({list}, {pat} [, {dict}]) submatches a List of submatches. Present only if "submatches" is set to v:true in {dict}. + See |match-pattern| for information about the effect of some + option settings on the pattern. + Example: > :echo matchstrlist(['tik tok'], '\<\k\+\>') [{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}] diff --git a/runtime/doc/tags b/runtime/doc/tags index 5c2eee33e6..fb0b540535 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -8615,6 +8615,7 @@ masm.vim syntax.txt /*masm.vim* match() builtin.txt /*match()* match-highlight pattern.txt /*match-highlight* match-parens tips.txt /*match-parens* +match-pattern builtin.txt /*match-pattern* matchadd() builtin.txt /*matchadd()* matchaddpos() builtin.txt /*matchaddpos()* matcharg() builtin.txt /*matcharg()* From f548ae7b6357c7934411df243bc987800c9b76d1 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Sat, 24 Feb 2024 10:17:11 +0100 Subject: [PATCH 082/426] patch 9.1.0129: Fix truncation of text_wrap 'wrap' virt text after EOL list char Problem: Virtual text with text_wrap 'wrap' was effectively being truncated by a break conditional on the EOL list character being added to the screen line. (BigPeet) Solution: Remove the condition that was leading to the early break and instead fix a similar but incorrectly written outer condition that checks if there is more to add at the end of the screen line. (Dylan Thacker-Smith) Also, related: - update comment in win_line() - remove no longer necessary at_end_str variable in win_line() fixes: #12725 closes: #14079 Co-authored-by: zeertzjq Signed-off-by: Dylan Thacker-Smith Signed-off-by: Christian Brabandt --- src/drawline.c | 16 +++++----------- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/drawline.c b/src/drawline.c index 3499d39e77..0bb7ed57d5 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -1121,8 +1121,6 @@ win_line( #if defined(FEAT_LINEBREAK) && defined(FEAT_PROP_POPUP) int in_linebreak = FALSE; // n_extra set for showing linebreak #endif - static char_u *at_end_str = (char_u *)""; // used for p_extra when - // displaying eol at end-of-line int lcs_eol_one = wp->w_lcs_chars.eol; // eol until it's been used int lcs_prec_todo = wp->w_lcs_chars.prec; // prec until it's been used @@ -3304,7 +3302,7 @@ win_line( if (!(area_highlighting && virtual_active() && wlv.tocol != MAXCOL && wlv.vcol < wlv.tocol)) - wlv.p_extra = at_end_str; + wlv.p_extra = (char_u *)""; wlv.n_extra = 0; } if (wp->w_p_list && wp->w_lcs_chars.eol > 0) @@ -4116,7 +4114,7 @@ win_line( || text_prop_next <= last_textprop_text_idx #endif || (wp->w_p_list && wp->w_lcs_chars.eol != NUL - && wlv.p_extra != at_end_str) + && lcs_eol_one != -1) || (wlv.n_extra != 0 && (wlv.c_extra != NUL || *wlv.p_extra != NUL))) ) @@ -4133,18 +4131,14 @@ win_line( ++wlv.row; ++wlv.screen_row; - // When not wrapping and finished diff lines, or when displayed - // '$' and highlighting until last column, break here. - if (((!wp->w_p_wrap + // When not wrapping and finished diff lines, break here. + if (!wp->w_p_wrap #ifdef FEAT_DIFF && wlv.filler_todo <= 0 #endif #ifdef FEAT_PROP_POPUP && !text_prop_above -#endif - ) || lcs_eol_one == -1) -#ifdef FEAT_PROP_POPUP - && !text_prop_follows + && !text_prop_follows #endif ) break; diff --git a/src/version.c b/src/version.c index 9b38a34964..3ea94ee92a 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 129, /**/ 128, /**/ From abf7030a5c22257f066fa9c4061ad150d5a82577 Mon Sep 17 00:00:00 2001 From: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Sat, 24 Feb 2024 10:20:24 +0100 Subject: [PATCH 083/426] patch 9.1.0130: [security]: UAF if win_split_ins autocommands delete "wp" Problem: heap-use-after-free in win_splitmove if Enter/Leave autocommands from win_split_ins immediately closes "wp". Solution: check that "wp" is valid after win_split_ins. (Sean Dewar) closes: #14078 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt --- src/testdir/test_window_cmd.vim | 9 +++++++++ src/version.c | 2 ++ src/window.c | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index a70fb790c5..917c43203c 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -1191,6 +1191,15 @@ func Test_win_splitmove() call assert_equal(v:true, s:triggered) unlet! s:triggered + split + let close_win = winnr('#') + augroup WinSplitMove + au! + au WinEnter * ++once quit! + augroup END + call win_splitmove(close_win, winnr()) + call assert_equal(0, win_id2win(close_win)) + au! WinSplitMove augroup! WinSplitMove %bw! diff --git a/src/version.c b/src/version.c index 3ea94ee92a..b6e25e665a 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 130, /**/ 129, /**/ diff --git a/src/window.c b/src/window.c index 66a1d7de41..7123780c52 100644 --- a/src/window.c +++ b/src/window.c @@ -1954,7 +1954,8 @@ win_splitmove(win_T *wp, int size, int flags) } // If splitting horizontally, try to preserve height. - if (size == 0 && !(flags & WSP_VERT)) + // Note that win_split_ins autocommands may have immediately closed "wp"! + if (size == 0 && !(flags & WSP_VERT) && win_valid(wp)) { win_setheight_win(height, wp); if (p_ea) From 0dc0bff000fd804c6b0778ccc4554a4e4c82c8c9 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 24 Feb 2024 14:12:13 +0100 Subject: [PATCH 084/426] patch 9.1.0131: buffer-completion may not always find all matches Problem: buffer-completion code too complicated and does not always find all matches (irisjae) Solution: do not try to anchor pattern to beginning of line or directory-separator, always return all matches Note: we are considering the non-fuzzy buffer-matching here. Currently, the buffer-completion code makes 2 attempts to match a pattern against the list of available patterns. First try is to match the pattern and anchor it to either the beginning of the file name or at a directory-separator (// or \\). When a match is found, Vim returns the matching buffers and does not try to find a match anywhere within a buffer name. So if you have opened two buffers like /tmp/Foobar.c and /tmp/MyFoobar.c using `:b Foo` will only complete to the first filename, but not the second (the same happens with `getcompletion('Foo', 'buffer')`). It may make sense, that completion priorities buffer names at directory boundaries, but it inconsistent, may cause confusion why a certain buffer name is not completed when typing `:b Foo` which returns only a single file name and then pressing Enter (to switch to that buffer), Vim will error with 'E93: More than one match for Foo'). Similar things may happen when wiping the /tmp/Foobar.c pattern and afterwards the completion starts completing other buffers. So let's simplify the code and always match the pattern anywhere in the buffer name, do not try to favor matches at directory boundaries. This is also simplifies the code a bit, we do not need to run over the list of buffers several times, but only twice. fixes #13894 closes: #14082 Signed-off-by: Christian Brabandt --- src/buffer.c | 211 +++++++++++++++++------------------ src/testdir/test_cmdline.vim | 19 +++- src/version.c | 2 + 3 files changed, 120 insertions(+), 112 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 4a39329c5c..b17ae16521 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2772,17 +2772,19 @@ ExpandBufnames( char_u ***file, int options) { - int count = 0; + int count; buf_T *buf; int round; char_u *p; - int attempt; char_u *patc = NULL; #ifdef FEAT_VIMINFO bufmatch_T *matches = NULL; #endif int fuzzy; fuzmatch_str_T *fuzmatch = NULL; + regmatch_T regmatch; + int score = 0; + int to_free = FALSE; *num_file = 0; // return values in case of FAIL *file = NULL; @@ -2798,151 +2800,138 @@ ExpandBufnames( // expression matching) if (!fuzzy) { - if (*pat == '^') + if (*pat == '^' && pat[1] != NUL) { - patc = alloc(STRLEN(pat) + 11); + int len = (int)STRLEN(pat); + patc = alloc(len); if (patc == NULL) return FAIL; - STRCPY(patc, "\\(^\\|[\\/]\\)"); - STRCPY(patc + 11, pat + 1); + STRNCPY(patc, pat + 1, len - 1); + patc[len - 1] = NUL; + to_free = TRUE; } + else if (*pat == '^') + patc = (char_u *)""; else patc = pat; + regmatch.regprog = vim_regcomp(patc, RE_MAGIC); } - // attempt == 0: try match with '\<', match at start of word - // attempt == 1: try match without '\<', match anywhere - for (attempt = 0; attempt <= (fuzzy ? 0 : 1); ++attempt) + // round == 1: Count the matches. + // round == 2: Build the array to keep the matches. + for (round = 1; round <= 2; ++round) { - regmatch_T regmatch; - int score = 0; - - if (!fuzzy) - { - if (attempt > 0 && patc == pat) - break; // there was no anchor, no need to try again - regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC); - } - - // round == 1: Count the matches. - // round == 2: Build the array to keep the matches. - for (round = 1; round <= 2; ++round) + count = 0; + FOR_ALL_BUFFERS(buf) { - count = 0; - FOR_ALL_BUFFERS(buf) - { - if (!buf->b_p_bl) // skip unlisted buffers - continue; + if (!buf->b_p_bl) // skip unlisted buffers + continue; #ifdef FEAT_DIFF - if (options & BUF_DIFF_FILTER) - // Skip buffers not suitable for - // :diffget or :diffput completion. - if (buf == curbuf || !diff_mode_buf(buf)) - continue; + if (options & BUF_DIFF_FILTER) + // Skip buffers not suitable for + // :diffget or :diffput completion. + if (buf == curbuf || !diff_mode_buf(buf)) + continue; #endif - if (!fuzzy) + if (!fuzzy) + { + if (regmatch.regprog == NULL) { - if (regmatch.regprog == NULL) - { - // invalid pattern, possibly after recompiling - if (patc != pat) - vim_free(patc); - return FAIL; - } - p = buflist_match(®match, buf, p_wic); + // invalid pattern, possibly after recompiling + if (to_free) + vim_free(patc); + return FAIL; } - else + p = buflist_match(®match, buf, p_wic); + } + else + { + p = NULL; + // first try matching with the short file name + if ((score = fuzzy_match_str(buf->b_sfname, pat)) != 0) + p = buf->b_sfname; + if (p == NULL) { - p = NULL; - // first try matching with the short file name - if ((score = fuzzy_match_str(buf->b_sfname, pat)) != 0) - p = buf->b_sfname; - if (p == NULL) - { - // next try matching with the full path file name - if ((score = fuzzy_match_str(buf->b_ffname, pat)) != 0) - p = buf->b_ffname; - } + // next try matching with the full path file name + if ((score = fuzzy_match_str(buf->b_ffname, pat)) != 0) + p = buf->b_ffname; } + } - if (p == NULL) - continue; + if (p == NULL) + continue; - if (round == 1) - { - ++count; - continue; - } + if (round == 1) + { + ++count; + continue; + } - if (options & WILD_HOME_REPLACE) - p = home_replace_save(buf, p); - else - p = vim_strsave(p); + if (options & WILD_HOME_REPLACE) + p = home_replace_save(buf, p); + else + p = vim_strsave(p); - if (!fuzzy) - { + if (!fuzzy) + { #ifdef FEAT_VIMINFO - if (matches != NULL) - { - matches[count].buf = buf; - matches[count].match = p; - count++; - } - else -#endif - (*file)[count++] = p; - } - else + if (matches != NULL) { - fuzmatch[count].idx = count; - fuzmatch[count].str = p; - fuzmatch[count].score = score; + matches[count].buf = buf; + matches[count].match = p; count++; } + else +#endif + (*file)[count++] = p; } - if (count == 0) // no match found, break here - break; - if (round == 1) + else { - if (!fuzzy) + fuzmatch[count].idx = count; + fuzmatch[count].str = p; + fuzmatch[count].score = score; + count++; + } + } + if (count == 0) // no match found, break here + break; + if (round == 1) + { + if (!fuzzy) + { + *file = ALLOC_MULT(char_u *, count); + if (*file == NULL) { - *file = ALLOC_MULT(char_u *, count); - if (*file == NULL) - { - vim_regfree(regmatch.regprog); - if (patc != pat) - vim_free(patc); - return FAIL; - } + vim_regfree(regmatch.regprog); + if (to_free) + vim_free(patc); + return FAIL; + } #ifdef FEAT_VIMINFO - if (options & WILD_BUFLASTUSED) - matches = ALLOC_MULT(bufmatch_T, count); + if (options & WILD_BUFLASTUSED) + matches = ALLOC_MULT(bufmatch_T, count); #endif - } - else + } + else + { + fuzmatch = ALLOC_MULT(fuzmatch_str_T, count); + if (fuzmatch == NULL) { - fuzmatch = ALLOC_MULT(fuzmatch_str_T, count); - if (fuzmatch == NULL) - { - *num_file = 0; - *file = NULL; - return FAIL; - } + *num_file = 0; + *file = NULL; + return FAIL; } } } - - if (!fuzzy) - { - vim_regfree(regmatch.regprog); - if (count) // match(es) found, break here - break; - } } - if (!fuzzy && patc != pat) - vim_free(patc); + if (!fuzzy) + { + vim_regfree(regmatch.regprog); + if (to_free) + vim_free(patc); + } #ifdef FEAT_VIMINFO if (!fuzzy) diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index ea95cbfce5..c0d01fb967 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -691,7 +691,7 @@ func Test_getcompletion() bw Xtest\ endif - call assert_fails("call getcompletion('\\\\@!\\\\@=', 'buffer')", 'E871:') + call assert_fails("call getcompletion('\\\\@!\\\\@=', 'buffer')", 'E866:') call assert_fails('call getcompletion("", "burp")', 'E475:') call assert_fails('call getcompletion("abc", [])', 'E1174:') endfunc @@ -3755,4 +3755,21 @@ func Test_window_size_stays_same_after_changing_cmdheight() call assert_equal(expected, winheight(0)) endfunc +" verify that buffer-completion finds all buffer names matching a pattern +func Test_buffer_completion() + " should return empty list + call assert_equal([], getcompletion('', 'buffer')) + + call mkdir('Xbuf_complete', 'R') + e Xbuf_complete/Foobar.c + e Xbuf_complete/MyFoobar.c + e AFoobar.h + let expected = ["Xbuf_complete/Foobar.c", "Xbuf_complete/MyFoobar.c", "AFoobar.h"] + + call assert_equal(3, len(getcompletion('Foo', 'buffer'))) + call assert_equal(expected, getcompletion('Foo', 'buffer')) + call feedkeys(":b Foo\\\"\", 'xt') + call assert_equal("\"b Xbuf_complete/Foobar.c Xbuf_complete/MyFoobar.c AFoobar.h", @:) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index b6e25e665a..a80f2a87b5 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 131, /**/ 130, /**/ From 048761bcd40ec630fd3e039f0066cf4e484ceabd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 24 Feb 2024 14:21:39 +0100 Subject: [PATCH 085/426] patch 9.1.0132: "C" doesn't include composing chars with 'virtualedit' Problem: using "C" and 've=all' set, doesn't include composing chars when changing a line, keeps the composing chars for whatever is typed afterwards. Solution: Use mb_head_off() and mb_ptr2len() instead of mb_tail_off(). (zeertzjq) closes: #14083 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/ops.c | 13 ++++++++++--- src/testdir/test_virtualedit.vim | 17 +++++++++++++++++ src/version.c | 2 ++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/ops.c b/src/ops.c index e66b4b5ee7..57e699150f 100644 --- a/src/ops.c +++ b/src/ops.c @@ -990,13 +990,20 @@ op_delete(oparg_T *oap) static void mb_adjust_opend(oparg_T *oap) { - char_u *p; + char_u *line; + char_u *ptr; if (!oap->inclusive) return; - p = ml_get(oap->end.lnum); - oap->end.col += mb_tail_off(p, p + oap->end.col); + line = ml_get(oap->end.lnum); + ptr = line + oap->end.col; + if (*ptr != NUL) + { + ptr -= (*mb_head_off)(line, ptr); + ptr += (*mb_ptr2len)(ptr) - 1; + oap->end.col = ptr - line; + } } /* diff --git a/src/testdir/test_virtualedit.vim b/src/testdir/test_virtualedit.vim index ec2b276c3f..48d4aa0616 100644 --- a/src/testdir/test_virtualedit.vim +++ b/src/testdir/test_virtualedit.vim @@ -77,13 +77,30 @@ endfunc func Test_edit_change() new set virtualedit=all + call setline(1, "\t⒌") normal Cx call assert_equal('x', getline(1)) + + call setline(1, "\ta̳") + normal Cx + call assert_equal('x', getline(1)) + + call setline(1, "\tβ̳") + normal Cx + call assert_equal('x', getline(1)) + + if has('arabic') + call setline(1, "\tلا") + normal Cx + call assert_equal('x', getline(1)) + endif + " Do a visual block change call setline(1, ['a', 'b', 'c']) exe "normal gg3l\2jcx" call assert_equal(['a x', 'b x', 'c x'], getline(1, '$')) + bwipe! set virtualedit= endfunc diff --git a/src/version.c b/src/version.c index a80f2a87b5..59a940ba09 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 132, /**/ 131, /**/ From 8b1e749ca6ca6d09a174c57de6999f69393ee567 Mon Sep 17 00:00:00 2001 From: "Erik S. V. Jansson" Date: Sat, 24 Feb 2024 14:26:52 +0100 Subject: [PATCH 086/426] patch 9.1.0133: MS-Windows: ligatures not rendering correctly Problem: font ligatures don't render correctly in the Win32 GUI-version of gvim even when set rop=type:directx is used. Setting guiligatures also doesn't make any difference. This leads to broken font ligatures when the cursor passes through them. It does not recover from this, and they remain broken until you re-render the whole buffer (e.g. by using Ctrl+L). Solution: the problem is that we only re-draw the current and previous character in gui_undraw_cursor() and only have the special case for GTK when it comes to rendering ligatures. So let's enable gui_adjust_undraw_cursor_for_ligatures() to also happen for Win32 GUI if guiligatures is setup correctly (all this does is expand the range of gui_undraw_cursor() with ligature characters). related: #9181 related: #12901 closes: #14084 Signed-off-by: Erik S. V. Jansson Signed-off-by: Christian Brabandt --- runtime/doc/options.txt | 4 ++-- src/errors.h | 2 +- src/gui.c | 6 +++--- src/gui.h | 4 +++- src/option.h | 2 +- src/optiondefs.h | 2 +- src/optionstr.c | 2 +- src/testdir/test_gui.vim | 2 +- src/version.c | 2 ++ 9 files changed, 15 insertions(+), 11 deletions(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 78cac3f33a..b70fb15d98 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 9.1. Last change: 2024 Jan 30 +*options.txt* For Vim version 9.1. Last change: 2024 Feb 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4000,7 +4000,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'guiligatures'* *'gli'* *E1243* 'guiligatures' 'gli' string (default "") global - {only for GTK GUI} + {only for GTK and Win32 GUI} List of ASCII characters that, when combined together, can create more complex shapes. Each character must be a printable ASCII character with a value in the 32-127 range. diff --git a/src/errors.h b/src/errors.h index 00994312bb..dd2bc95b76 100644 --- a/src/errors.h +++ b/src/errors.h @@ -3185,7 +3185,7 @@ EXTERN char e_separator_not_supported_str[] EXTERN char e_no_white_space_allowed_before_separator_str[] INIT(= N_("E1242: No white space allowed before separator: %s")); #endif -#ifdef FEAT_GUI_GTK +#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) EXTERN char e_ascii_code_not_in_range[] INIT(= N_("E1243: ASCII code not in 32-127 range")); #endif diff --git a/src/gui.c b/src/gui.c index 29e462380c..78299f0454 100644 --- a/src/gui.c +++ b/src/gui.c @@ -455,7 +455,7 @@ gui_init_check(void) gui.scrollbar_width = gui.scrollbar_height = SB_DEFAULT_WIDTH; gui.prev_wrap = -1; -#ifdef FEAT_GUI_GTK +#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) CLEAR_FIELD(gui.ligatures_map); #endif @@ -1064,7 +1064,7 @@ gui_get_wide_font(void) return OK; } -#if defined(FEAT_GUI_GTK) || defined(PROTO) +#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) || defined(PROTO) /* * Set list of ascii characters that combined can create ligature. * Store them in char map for quick access from gui_gtk2_draw_string. @@ -2691,7 +2691,7 @@ gui_undraw_cursor(void) int startcol = gui.cursor_col > 0 ? gui.cursor_col - 1 : gui.cursor_col; int endcol = gui.cursor_col; -#ifdef FEAT_GUI_GTK +#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) gui_adjust_undraw_cursor_for_ligatures(&startcol, &endcol); #endif gui_redraw_block(gui.cursor_row, startcol, diff --git a/src/gui.h b/src/gui.h index c677ba1fe4..f9fdd2d66b 100644 --- a/src/gui.h +++ b/src/gui.h @@ -389,10 +389,12 @@ typedef struct Gui char_u *browse_fname; // file name from filedlg guint32 event_time; +#endif // FEAT_GUI_GTK +#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) char_u ligatures_map[256]; // ascii map for characters 0-255, value is // 1 if in 'guiligatures' -#endif // FEAT_GUI_GTK +#endif #if defined(FEAT_GUI_TABLINE) \ && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) \ diff --git a/src/option.h b/src/option.h index 28a4a96b41..75940cce0a 100644 --- a/src/option.h +++ b/src/option.h @@ -637,7 +637,7 @@ EXTERN char_u *p_guifontset; // 'guifontset' EXTERN char_u *p_guifontwide; // 'guifontwide' EXTERN int p_guipty; // 'guipty' #endif -#ifdef FEAT_GUI_GTK +#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) EXTERN char_u *p_guiligatures; // 'guiligatures' # endif #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) diff --git a/src/optiondefs.h b/src/optiondefs.h index 776858804d..1a09e1c7fb 100644 --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -1212,7 +1212,7 @@ static struct vimoption options[] = {(char_u *)50L, (char_u *)0L} SCTX_INIT}, {"guiligatures", "gli", P_STRING|P_VI_DEF|P_RCLR|P_ONECOMMA|P_NODUP, -#if defined(FEAT_GUI_GTK) +#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) (char_u *)&p_guiligatures, PV_NONE, did_set_guiligatures, NULL, {(char_u *)"", (char_u *)0L} diff --git a/src/optionstr.c b/src/optionstr.c index 8b000abbb4..457fccb1eb 100644 --- a/src/optionstr.c +++ b/src/optionstr.c @@ -2438,7 +2438,7 @@ did_set_guifontwide(optset_T *args UNUSED) } #endif -#if defined(FEAT_GUI_GTK) || defined(PROTO) +#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) || defined(PROTO) /* * The 'guiligatures' option is changed. */ diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim index dbf1d3b310..2ff8d3400b 100644 --- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -635,7 +635,7 @@ endfunc func Test_set_guiligatures() CheckX11BasedGui - if has('gui_gtk') || has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') + if has('gui_gtk') || has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') || has('win32') " Try correct value set guiligatures=<>=ab call assert_equal("<>=ab", &guiligatures) diff --git a/src/version.c b/src/version.c index 59a940ba09..1405854d80 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 133, /**/ 132, /**/ From 6a46c19b2507bce632b5e67ef31e47e60a95ed10 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 24 Feb 2024 15:56:34 +0100 Subject: [PATCH 087/426] patch 9.1.0134: CI: Test_term_gettitle() is flaky on MacOS 14 Problem: Test_term_gettitle() is flaky on MacOS 14 and Github runners Solution: Skip the test on Github CI closes: #14085 It fails with this: '^\\[No Name\\] - VIM\\d*$' does not match 'e] - VIM' It is not clear why term_gettitle() only get's the last part of the expected title (perhaps there is a Carriage return in there or the terminal window is too small?) So let's just skip this test for now. Signed-off-by: Christian Brabandt --- src/testdir/test_terminal2.vim | 8 ++++++++ src/version.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/testdir/test_terminal2.vim b/src/testdir/test_terminal2.vim index 9798c51940..05b228ed7d 100644 --- a/src/testdir/test_terminal2.vim +++ b/src/testdir/test_terminal2.vim @@ -535,6 +535,7 @@ func Test_term_getcursor() endfunc " Test for term_gettitle() +" Known to be flaky on Mac-OS X and the GH runners func Test_term_gettitle() " term_gettitle() returns an empty string for a non-terminal buffer " and for a non-existing buffer. @@ -544,6 +545,13 @@ func Test_term_gettitle() if !has('title') || empty(&t_ts) throw "Skipped: can't get/set title" endif + if has('osx') && !empty($CI) && system('uname -m') =~# 'arm64' + " This test often fails with the following error message on Github runners + " MacOS-14 + " '^\\[No Name\\] - VIM\\d*$' does not match 'e] - VIM' + " Why? Is the terminal that runs Vim too small? + throw 'Skipped: FIXME: Running this test on M1 Mac fails on GitHub Actions' + endif let term = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', '-c', 'set title']) call TermWait(term) diff --git a/src/version.c b/src/version.c index 1405854d80..9ad2015c5a 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 134, /**/ 133, /**/ From cd3a13e774823c44cf2e1e483d9e5b6df2cbcf50 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 24 Feb 2024 16:51:32 +0100 Subject: [PATCH 088/426] patch 9.1.0135: Insufficient testing for 'delcombine' Problem: Insufficient testing for 'delcombine'. Solution: Add test for both Normal and Insert modes without Arabic. (zeertzjq) closes: #14086 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/testdir/test_options.vim | 30 ++++++++++++++++++++++++++++++ src/version.c | 2 ++ 2 files changed, 32 insertions(+) diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim index 37dc20187e..908f0da124 100644 --- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -2234,4 +2234,34 @@ func Test_set_wrap() set wrap& smoothscroll& scrolloff& endfunc +func Test_delcombine() + new + set backspace=indent,eol,start + + set delcombine + call setline(1, 'β̳̈:β̳̈') + normal! 0x + call assert_equal('β̈:β̳̈', getline(1)) + exe "normal! A\" + call assert_equal('β̈:β̈', getline(1)) + normal! 0x + call assert_equal('β:β̈', getline(1)) + exe "normal! A\" + call assert_equal('β:β', getline(1)) + normal! 0x + call assert_equal(':β', getline(1)) + exe "normal! A\" + call assert_equal(':', getline(1)) + + set nodelcombine + call setline(1, 'β̳̈:β̳̈') + normal! 0x + call assert_equal(':β̳̈', getline(1)) + exe "normal! A\" + call assert_equal(':', getline(1)) + + set backspace& delcombine& + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 9ad2015c5a..7ecfc94445 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 135, /**/ 134, /**/ From 374e26aba2e5e0a220b1a7ce1934b0eb5f493e6c Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Sat, 24 Feb 2024 17:02:43 +0100 Subject: [PATCH 089/426] runtime(doc): clarify ':set[l] {option}<' behaviour closes: #14062 Signed-off-by: Matt Ellis Signed-off-by: Christian Brabandt --- runtime/doc/options.txt | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index b70fb15d98..48e45e835d 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -365,11 +365,24 @@ created, thus they behave slightly differently: For a global option the global value is shown (but that might change in the future). -:setl[ocal] {option}< Set the local value of {option} to its global value by - copying the value. - -:se[t] {option}< For |global-local| options: Remove the local value of - {option}, so that the global value will be used. +:se[t] {option}< Set the effective value of {option} to its global + value. + For string |global-local| options, the local value is + removed, so that the global value will be used. + For all other options, the global value is copied to + the local value. + +:setl[ocal] {option}< Set the effective value of {option} to its global + value. + For number and boolean |global-local| options, the + local value is removed, so that the global value will + be used. + For all other options, including string |global-local| + options, the global value is copied to the local + value. + +Note that the behaviour for |global-local| options is slightly different +between string and number-based options. *:setg* *:setglobal* :setg[lobal][!] ... Like ":set" but set only the global value for a local From a2ebb6e9176d007c11804bb9784beee35a8050c8 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sun, 25 Feb 2024 08:40:10 +0100 Subject: [PATCH 090/426] patch 9.1.0136: Vim9: need more test for exists() methods Problem: Vim9: need more test for exists() Solution: Add test for exists() with class/objct variables and methods (Yegappan Lakshmanan) closes: #14088 Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 12 ++++----- src/testdir/test_exists.vim | 49 +++++++++++++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 849b1808f1..0af9b0e0f7 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 24 +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2405,11 +2405,11 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined, varname internal variable (see dict.key |internal-variables|). Also works list[i] for |curly-braces-names|, |Dictionary| - import.Func entries, |List| items, imported - items, etc. - Does not work for local variables in a - compiled `:def` function. - Also works for a function in |Vim9| + import.Func entries, |List| items, class and + class.Func object methods, imported items, etc. + object.Func Does not work for local variables in a + class.varname compiled `:def` function. + object.varname Also works for a function in |Vim9| script, since it can be used as a function reference. Beware that evaluating an index may diff --git a/src/testdir/test_exists.vim b/src/testdir/test_exists.vim index a735a7d19b..9cdb3fb5c0 100644 --- a/src/testdir/test_exists.vim +++ b/src/testdir/test_exists.vim @@ -1,5 +1,7 @@ " Tests for the exists() function +import './vim9.vim' as v9 + func Test_exists() augroup myagroup autocmd! BufEnter *.my echo "myfile edited" @@ -334,4 +336,51 @@ func Test_exists_funcarg() call FuncArg_Tests("arg1", "arg2") endfunc +" Test for using exists() with class and object variables and methods. +func Test_exists_class_object() + let lines =<< trim END + vim9script + class A + var var1: number = 10 + static var var2: number = 10 + static def Foo() + enddef + def Bar() + enddef + endclass + + assert_equal(1, exists("A")) + var a = A.new() + assert_equal(1, exists("a")) + + assert_equal(1, exists("a.var1")) + assert_fails('exists("a.var2")', 'E1375: Class variable "var2" accessible only using class "A"') + assert_fails('exists("a.var3")', 'E1326: Variable "var3" not found in object "A"') + assert_equal(1, exists("A.var2")) + assert_fails('exists("A.var1")', 'E1376: Object variable "var1" accessible only using class "A" object') + assert_fails('exists("A.var3")', 'E1337: Class variable "var3" not found in class "A"') + + assert_equal(1, exists("a.Bar")) + assert_fails('exists("a.Barz")', 'E1326: Variable "Barz" not found in object "A"') + assert_fails('exists("a.Foo")', 'E1326: Variable "Foo" not found in object "A"') + assert_equal(1, exists("A.Foo")) + assert_fails('exists("A.Bar")', 'E1337: Class variable "Bar" not found in class "A"') + assert_fails('exists("A.Barz")', 'E1337: Class variable "Barz" not found in class "A"') + + def Baz() + assert_equal(1, exists("A")) + var aa = A.new() + assert_equal(1, exists("A.var2")) + assert_fails('exists("A.var1")', 'E1376: Object variable "var1" accessible only using class "A" object') + assert_fails('exists("A.var3")', 'E1337: Class variable "var3" not found in class "A"') + + assert_equal(1, exists("A.Foo")) + assert_fails('exists("A.Bar")', 'E1337: Class variable "Bar" not found in class "A"') + assert_fails('exists("A.Barz")', 'E1337: Class variable "Barz" not found in class "A"') + enddef + Baz() + END + call v9.CheckSourceSuccess(lines) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 7ecfc94445..6d6a5a19a8 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 136, /**/ 135, /**/ From d086b8f646a67f6b16c46061ce773de1011b8ec7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 25 Feb 2024 15:42:52 +0800 Subject: [PATCH 091/426] runtime(doc): fix inconsistent indent (#14089) Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- runtime/doc/filetype.txt | 4 ++-- runtime/doc/ft_ada.txt | 2 +- runtime/doc/ft_sql.txt | 2 +- runtime/doc/if_ole.txt | 6 +++--- runtime/doc/map.txt | 2 +- runtime/doc/options.txt | 8 ++++---- runtime/doc/os_vms.txt | 2 +- runtime/doc/pi_netrw.txt | 4 ++-- runtime/doc/quickfix.txt | 14 +++++++------- runtime/doc/terminal.txt | 20 ++++++++++---------- runtime/doc/vim9.txt | 2 +- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index b56a3d3fa7..41b27ccb12 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -496,7 +496,7 @@ g:changelog_new_date_format %% insert a single '%' character %d insert the date from above %u insert the user from above - %p insert result of b:changelog_entry_prefix + %p insert result of b:changelog_entry_prefix %c where to position cursor when done The default is "%d %u\n\n\t* %p%c\n\n", which produces something like (| is where cursor will be, unless at @@ -510,7 +510,7 @@ g:changelog_new_entry_format The format used when creating a new entry. The following table describes special tokens in the string: - %p insert result of b:changelog_entry_prefix + %p insert result of b:changelog_entry_prefix %c where to position cursor when done The default is "\t*%c", which produces something similar to > diff --git a/runtime/doc/ft_ada.txt b/runtime/doc/ft_ada.txt index 80ed728d3f..35dd534bb1 100644 --- a/runtime/doc/ft_ada.txt +++ b/runtime/doc/ft_ada.txt @@ -172,7 +172,7 @@ GNAT OBJECT ~ *g:gnat.Make()* g:gnat.Make() Calls |g:gnat.Make_Command| and displays the result inside a - |quickfix| window. + |quickfix| window. *g:gnat.Pretty()* g:gnat.Pretty() diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt index f98b06252b..110784d8cf 100644 --- a/runtime/doc/ft_sql.txt +++ b/runtime/doc/ft_sql.txt @@ -371,7 +371,7 @@ This command breaks down as: > 'sqlKeyword' - Display the items for the sqlKeyword highlight group 'sqlKeyword\w*' - A second option available with Vim 7.4 which - uses a regular expression to determine which + uses a regular expression to determine which syntax groups to use ) - Execute the :let command - Trigger the standard omni completion key stroke. diff --git a/runtime/doc/if_ole.txt b/runtime/doc/if_ole.txt index b08fa98181..c546e971a6 100644 --- a/runtime/doc/if_ole.txt +++ b/runtime/doc/if_ole.txt @@ -39,9 +39,9 @@ instance), code similar to the following should be used: $vim = new Win32::OLE 'Vim.Application'; [C#] > - // Add a reference to Vim in your project. - // Choose the COM tab. - // Select "Vim Ole Interface 1.1 Type Library" + // Add a reference to Vim in your project. + // Choose the COM tab. + // Select "Vim Ole Interface 1.1 Type Library" Vim.Vim vimobj = new Vim.Vim(); Vim does not support acting as a "hidden" OLE server, like some other OLE diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index cf83ffc0c8..12297261c7 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -592,7 +592,7 @@ displayed in the first line. Also a key map will also display where it was last defined. Example: > :verbose map * - Kitty keyboard protocol: Cleared + Kitty keyboard protocol: Cleared n * * * Last set from /home/abcd/.vimrc diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 48e45e835d..210bfdcbd6 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -366,14 +366,14 @@ created, thus they behave slightly differently: shown (but that might change in the future). :se[t] {option}< Set the effective value of {option} to its global - value. + value. For string |global-local| options, the local value is removed, so that the global value will be used. For all other options, the global value is copied to the local value. :setl[ocal] {option}< Set the effective value of {option} to its global - value. + value. For number and boolean |global-local| options, the local value is removed, so that the global value will be used. @@ -2932,7 +2932,7 @@ A jump table for the options with a short description can be found at |Q_op|. Use the indent heuristic for the internal diff library. - algorithm:{text} Use the specified diff algorithm with the + algorithm:{text} Use the specified diff algorithm with the internal diff engine. Currently supported algorithms are: myers the default algorithm @@ -6467,7 +6467,7 @@ A jump table for the options with a short description can be found at |Q_op|. this option at the default "on". Only switch it off when working with old Vi scripts. - *'renderoptions'* *'rop'* + *'renderoptions'* *'rop'* 'renderoptions' 'rop' string (default: empty) global {only available when compiled with GUI and DIRECTX on diff --git a/runtime/doc/os_vms.txt b/runtime/doc/os_vms.txt index ff435482d3..862f31d07f 100644 --- a/runtime/doc/os_vms.txt +++ b/runtime/doc/os_vms.txt @@ -753,7 +753,7 @@ Solution 2. Different directories: > $ say "IA64 platform" $ define/nolog VIM RF10:[UTIL.IA64_EXE] ! IA64 executables $ endif - $! VIMRUNTIME must be defined in order to find runtime files + $! VIMRUNTIME must be defined in order to find runtime files $ define/nolog VIMRUNTIME RF10:[UTIL.VIM73] A good example for this approach is the [GNU]gnu_tools.com script from diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 90164e2996..2b22105d56 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -642,7 +642,7 @@ additional prompting. work with your ftp client. Otherwise the script will prompt for user-id and password. - (*3) for ftp, "machine" may be machine#port or machine:port + (*3) for ftp, "machine" may be machine#port or machine:port if a different port is needed than the standard ftp port (*4) for http:..., if wget is available it will be used. Otherwise, @@ -788,7 +788,7 @@ below, a {netfile} is a URL to a remote file. (related: |netrw-userpass|) :NetrwSettings This command is described in |netrw-settings| -- used to - display netrw settings and change netrw behavior. + display netrw settings and change netrw behavior. ============================================================================== diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 325f592204..ae3bfb57b3 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -378,14 +378,14 @@ processing a quickfix or location list command, it will be aborted. List all errors. :cl[ist]! +{count} List the current and next {count} error lines. This - is useful to see unrecognized lines after the current + is useful to see unrecognized lines after the current one. For example, if ":clist" shows: - 8384 testje.java:252: error: cannot find symbol ~ - Then using ":cl! +3" shows the reason: - 8384 testje.java:252: error: cannot find symbol ~ - 8385: ZexitCode = Fmainx(); ~ - 8386: ^ ~ - 8387: symbol: method Fmainx() ~ + 8384 testje.java:252: error: cannot find symbol ~ + Then using ":cl! +3" shows the reason: + 8384 testje.java:252: error: cannot find symbol ~ + 8385: ZexitCode = Fmainx(); ~ + 8386: ^ ~ + 8387: symbol: method Fmainx() ~ :lli[st] [from] [, [to]] *:lli* *:llist* Same as ":clist", except the location list for the diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt index 3720603ff2..8535fcf962 100644 --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -1025,17 +1025,17 @@ This can be used to pass the current directory from a shell to Vim. Put this in your .vimrc: > def g:Tapi_lcd(_, path: string) if isdirectory(path) - execute 'silent lcd ' .. fnameescape(path) - endif + execute 'silent lcd ' .. fnameescape(path) + endif enddef < And, in a bash init file: > - if [[ -n "$VIM_TERMINAL" ]]; then - PROMPT_COMMAND='_vim_sync_PWD' - function _vim_sync_PWD() { - printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD" - } - fi + if [[ -n "$VIM_TERMINAL" ]]; then + PROMPT_COMMAND='_vim_sync_PWD' + function _vim_sync_PWD() { + printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD" + } + fi < Or, for zsh: > if [[ -n "$VIM_TERMINAL" ]]; then @@ -1403,8 +1403,8 @@ Other commands ~ *:Asm* jump to the window with the disassembly, create it if there isn't one *:Var* jump to the window with the local and argument variables, - create it if there isn't one. This window updates whenever the - program is stopped + create it if there isn't one. This window updates whenever the + program is stopped Events ~ *termdebug-events* diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 0f5884b65c..7dd2ab0183 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -2024,7 +2024,7 @@ Note that this does not work for variables, only for functions. *import-legacy* *legacy-import* `:import` can also be used in legacy Vim script. The imported namespace still becomes script-local, even when the "s:" prefix is not given. For example: > - import "myfile.vim" + import "myfile.vim" call s:myfile.MyFunc() And using the "as name" form: > From db7622ea827034124c22da0c235ff5170e44b8bc Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 25 Feb 2024 15:21:54 +0100 Subject: [PATCH 092/426] runtime(doc): Fix typo in usr_41.txt closes: #14092 Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/doc/usr_41.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 0d832a34c9..04a9afb1b1 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 9.1. Last change: 2024 Feb 20 +*usr_41.txt* For Vim version 9.1. Last change: 2024 Feb 25 VIM USER MANUAL - by Bram Moolenaar @@ -69,7 +69,7 @@ The output of the example code is: In the first line the `vim9script` command makes clear this is a new, |Vim9| script file. That matters for how the rest of the file is used. It is -recommended to put it in the very fist line, before any comments. +recommended to put it in the very first line, before any comments. *vim9-declarations* The `var i = 1` command declares the "i" variable and initializes it. The generic form is: > From ff2b79d23956263ab0120623c37e0b4498be01db Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 26 Feb 2024 20:38:36 +0100 Subject: [PATCH 093/426] patch 9.1.0137: in cmdline mode doesn't delete composing chars Problem: in cmdline mode doesn't delete composing chars Solution: Use mb_head_off() and mb_ptr2len() (zeertzjq) closes: #14095 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/mbyte.c | 28 ++++------------------------ src/testdir/test_cmdline.vim | 20 ++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/mbyte.c b/src/mbyte.c index 0427f0ce3c..d6d81c4c71 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -4188,32 +4188,12 @@ mb_copy_char(char_u **fp, char_u **tp) int mb_off_next(char_u *base, char_u *p) { - int i; - int j; + int head_off = (*mb_head_off)(base, p); - if (enc_utf8) - { - if (*p < 0x80) // be quick for ASCII - return 0; - - // Find the next character that isn't 10xx.xxxx - for (i = 0; (p[i] & 0xc0) == 0x80; ++i) - ; - if (i > 0) - { - // Check for illegal sequence. - for (j = 0; p - j > base; ++j) - if ((p[-j] & 0xc0) != 0x80) - break; - if (utf8len_tab[p[-j]] != i + j) - return 0; - } - return i; - } + if (head_off == 0) + return 0; - // Only need to check if we're on a trail byte, it doesn't matter if we - // want the offset to the next or current character. - return (*mb_head_off)(base, p); + return (*mb_ptr2len)(p - head_off) - head_off; } /* diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index c0d01fb967..7c86bcd123 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -917,6 +917,26 @@ func Test_cmdline_remove_char() let &encoding = encoding_save endfunc +func Test_cmdline_del_utf8() + let @s = '⒌' + call feedkeys(":\"\s,,\\\\", 'tx') + call assert_equal('",,', @:) + + let @s = 'a̳' + call feedkeys(":\"\s,,\\\\", 'tx') + call assert_equal('",,', @:) + + let @s = 'β̳' + call feedkeys(":\"\s,,\\\\", 'tx') + call assert_equal('",,', @:) + + if has('arabic') + let @s = 'لا' + call feedkeys(":\"\s,,\\\\", 'tx') + call assert_equal('",,', @:) + endif +endfunc + func Test_cmdline_keymap_ctrl_hat() CheckFeature keymap diff --git a/src/version.c b/src/version.c index 6d6a5a19a8..38201599ef 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 137, /**/ 136, /**/ From 2c51e15b66a4be9b5134c495ef546479aaa89ce9 Mon Sep 17 00:00:00 2001 From: dkearns Date: Tue, 27 Feb 2024 07:10:18 +1100 Subject: [PATCH 094/426] runtime(vim): Update syntax file, improve :substitute matching (#14093) - Differentiate between :substitute and substitute(), fixes #13883. - Match all allowed :substitute delimiters. - Remove leading context from :substitute matches. Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/generator/vim.vim.base | 80 ++++++++--------- .../testdir/dumps/vim_ex_commands_23.dump | 2 +- .../testdir/dumps/vim_ex_commands_25.dump | 2 +- .../testdir/dumps/vim_ex_commands_26.dump | 2 +- .../testdir/dumps/vim_ex_commands_56.dump | 2 +- .../testdir/dumps/vim_ex_commands_58.dump | 2 +- .../testdir/dumps/vim_ex_commands_59.dump | 2 +- .../testdir/dumps/vim_ex_substitute_00.dump | 20 +++++ .../testdir/dumps/vim_ex_substitute_01.dump | 20 +++++ .../testdir/dumps/vim_ex_substitute_02.dump | 20 +++++ .../testdir/dumps/vim_ex_substitute_03.dump | 20 +++++ .../testdir/dumps/vim_ex_substitute_04.dump | 20 +++++ .../testdir/dumps/vim_ex_substitute_99.dump | 20 +++++ .../testdir/input/vim_ex_substitute.vim | 86 +++++++++++++++++++ runtime/syntax/vim.vim | 82 +++++++++--------- 15 files changed, 293 insertions(+), 87 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/vim_ex_substitute_00.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_substitute_01.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_substitute_02.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_substitute_03.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_substitute_04.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_substitute_99.dump create mode 100644 runtime/syntax/testdir/input/vim_ex_substitute.vim diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index 99a0488b34..6527fe178f 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -157,16 +157,16 @@ endif " Numbers {{{2 " ======= -syn match vimNumber '\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '\<0[xX]\x\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '\<0[zZ][a-zA-Z0-9.]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment +syn match vimNumber '\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '\<0[xX]\x\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '\<0[zZ][a-zA-Z0-9.]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment " All vimCommands are contained by vimIsCommand. {{{2 -syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFilter,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd +syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFilter,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNorm,vimSet,vimSubst1,vimSyntax,vimUnlet,vimUnmap,vimUserCmd syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" @@ -194,7 +194,6 @@ syn match vimBehave "\" nextgroup=vimBehaveBang,vimBehaveModel,vi syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite syn keyword vimBehaveModel contained mswin xterm -hi def link vimBehaveBang vimBang " Filetypes {{{2 " ========= syn match vimFiletype "\" nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "<\([acs]file\|amatch\|abuf\)>" nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "\s%[ \t:]"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "\s%$"ms=s+1 nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "\s%<"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "#\d\+\|[#%]<\>" nextgroup=vimSpecFileMod,vimSubst +syn match vimSpecFile "" nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "<\([acs]file\|amatch\|abuf\)>" nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "\s%[ \t:]"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "\s%$"ms=s+1 nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "\s%<"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "#\d\+\|[#%]<\>" nextgroup=vimSpecFileMod,vimSubst1 syn match vimSpecFileMod "\(:[phtre]\)\+" contained " User-Specified Commands: {{{2 @@ -356,33 +355,34 @@ syn match vimStringInterpolationBrace "}}" syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation syn cluster vimSubstList add=vimCollection -syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(\\|\\|\\)[:#[:alpha:]]\@!" nextgroup=vimSubstPat -"syn match vimSubst "\%(^\|[^\\]\)\[:#[:alpha:]]\@!" nextgroup=vimSubstPat contained -syn match vimSubst "\%(^\|[^\\\"']\)\[:#[:alpha:]\"']\@!" nextgroup=vimSubstPat contained -syn match vimSubst "/\zs\\ze/" nextgroup=vimSubstPat -syn match vimSubst "\(:\+\s*\|^\s*\)s\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat -syn match vimSubst1 contained "\" nextgroup=vimSubstPat -syn match vimSubst2 contained "s\%[ubstitute]\>" nextgroup=vimSubstPat -syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([^a-zA-Z( \t[\]&]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline -syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline -syn region vimCollection contained transparent start="\\\@[\"#|]\@!" nextgroup=vimSubstPat +syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat +syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat +syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat +syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat +syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat +" TODO: Vim9 illegal separators for abbreviated :s form are [-.:], :su\%[...] required +" : # is allowed but "not recommended" (see :h pattern-delimiter) +syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline +syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline +syn region vimCollection contained transparent start="\\\@]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst -syn match vimMark ",\zs'[<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst -syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst -syn match vimMark "\]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst1 +syn match vimMark ",\zs'[<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst1 +syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst1 +syn match vimMark "\s+0#af5f00255#ffffff0|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@54 +|s+0#af5f00255&|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@45 +@75 +|s+0#af5f00255&|n|o|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@56 +|s+0#af5f00255&|n|o|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@47 +@75 +|s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@58 +|s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@49 +@75 +|:|s+0#af5f00255&|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@53 +|:|s+0#af5f00255&|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@44 +@75 +|:|s+0#af5f00255&|n|o|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@55 +|:|s+0#af5f00255&|n|o|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@46 +@75 +|:|s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@57 +|:|s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@48 +@75 +|c+0#af5f00255&|a|l@1| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&||| |s+0#af5f00255&|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@41 +|"|i|n|p|u|t|/|v|i|m|_|e|x|_|s|u|b|s|t|i|t|u|t|e|.|v|i|m|"| |8|6|L|,| |1|5|1|0|B| @16|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_substitute_01.dump b/runtime/syntax/testdir/dumps/vim_ex_substitute_01.dump new file mode 100644 index 0000000000..806101c296 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_substitute_01.dump @@ -0,0 +1,20 @@ +|:+0&#ffffff0|s+0#af5f00255&|n|o|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@46 +@75 +|:|s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@57 +|:|s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@48 +@75 +>c+0#af5f00255&|a|l@1| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&||| |s+0#af5f00255&|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@41 +|c+0#af5f00255&|a|l@1| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&||| |s+0#af5f00255&|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@32 +@75 +|c+0#af5f00255&|a|l@1| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&||| |s+0#af5f00255&|n|o|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@43 +|c+0#af5f00255&|a|l@1| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&||| |s+0#af5f00255&|n|o|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@34 +@75 +|c+0#af5f00255&|a|l@1| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&||| |s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@45 +|c+0#af5f00255&|a|l@1| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&||| |s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@36 +@75 +|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|s|t|r|-+0#af5f00255&|>|s+0#00e0e07&|u|b|s|t|i|t|u|t|e|(+0#e000e06&|s+0#00e0e07&|t|r|,+0#0000000&| |p+0#00e0e07&|a|t|,+0#0000000&| |s+0#00e0e07&|u|b|,+0#0000000&| |f+0#00e0e07&|l|a|g|s|)+0#e000e06&| +0#0000000&@27 +@75 +|f+0#af5f00255&|u|n|c|t|i|o|n| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@60 +| +0#af5f00255&@1|s|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&| +0#0000000&@53 +@2|l+0#af5f00255&|e|t| +0#0000000&|b+0#00e0e07&|a|r| +0#0000000&|=+0#af5f00255&| +0#0000000&|s|t|r|-+0#af5f00255&|>|s+0#00e0e07&|u|b|s|t|i|t|u|t|e|(+0#e000e06&|s+0#00e0e07&|t|r|,+0#0000000&| |p+0#00e0e07&|a|t|,+0#0000000&| |s+0#00e0e07&|u|b|,+0#0000000&| |f+0#00e0e07&|l|a|g|s|)+0#e000e06&| +0#0000000&@25 +@57|1|9|,|1| @9|1|9|%| diff --git a/runtime/syntax/testdir/dumps/vim_ex_substitute_02.dump b/runtime/syntax/testdir/dumps/vim_ex_substitute_02.dump new file mode 100644 index 0000000000..b0e722d26f --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_substitute_02.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@1|l+0#af5f00255&|e|t| +0#0000000&|b+0#00e0e07&|a|r| +0#0000000&|=+0#af5f00255&| +0#0000000&|s|t|r|-+0#af5f00255&|>|s+0#00e0e07&|u|b|s|t|i|t|u|t|e|(+0#e000e06&|s+0#00e0e07&|t|r|,+0#0000000&| |p+0#00e0e07&|a|t|,+0#0000000&| |s+0#00e0e07&|u|b|,+0#0000000&| |f+0#00e0e07&|l|a|g|s|)+0#e000e06&| +0#0000000&@25 +|e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63 +@75 +|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@65 +| +0#af5f00255&@1|s|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&| +0#0000000&@53 +@2>l+0#af5f00255&|e|t| +0#0000000&|b+0#00e0e07&|a|r| +0#0000000&|=+0#af5f00255&| +0#0000000&|s|t|r|-+0#af5f00255&|>|s+0#00e0e07&|u|b|s|t|i|t|u|t|e|(+0#e000e06&|s+0#00e0e07&|t|r|,+0#0000000&| |p+0#00e0e07&|a|t|,+0#0000000&| |s+0#00e0e07&|u|b|,+0#0000000&| |f+0#00e0e07&|l|a|g|s|)+0#e000e06&| +0#0000000&@25 +|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68 +@75 +|"+0#0000e05&| |v|a|r|i|o|u|s| |d|e|l|i|m|i|t|e|r|s| +0#0000000&@54 +@75 +|s+0#af5f00255&|!+0#e000e06&|/+0#0000000&|!+0#e000e06&|/+0#0000000&@1|!+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|"+0#0000e05&| |s|"|/|"|/@1|"| |"| |c|o|m@1|e|n|t| |(|w|o|r|k|s| |b|u|t| |d|i|s|a|l@1|o|w|e|d|)| +0#0000000&@32 +|s+0#af5f00255&|#+0#e000e06&|/+0#0000000&|#+0#e000e06&|/+0#0000000&@1|#+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|$+0#e000e06&|/+0#0000000&|$+0#e000e06&|/+0#0000000&@1|$+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|%+0#e000e06&|/+0#0000000&|%+0#e000e06&|/+0#0000000&@1|%+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|&+0#e000e06&|/+0#0000000&|&+0#e000e06&|/+0#0000000&@1|&+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|'+0#e000e06&|/+0#0000000&|'+0#e000e06&|/+0#0000000&@1|'+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|"+0#0000e05&| |F+0#0000001#ffff4012|I|X|M|E| +0#0000e05#ffffff0|-| |m|a|t|c|h|e|s| |v|i|m|U|s|e|r|F|u|n|c| +0#0000000&@45 +|"+0#0000e05&| |s|(|/|(|/@1|(| |"| |c|o|m@1|e|n|t| +0#0000000&@55 +@57|3|7|,|3| @9|4|6|%| diff --git a/runtime/syntax/testdir/dumps/vim_ex_substitute_03.dump b/runtime/syntax/testdir/dumps/vim_ex_substitute_03.dump new file mode 100644 index 0000000000..cb12bb38a6 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_substitute_03.dump @@ -0,0 +1,20 @@ +|"+0#0000e05#ffffff0| |s|(|/|(|/@1|(| |"| |c|o|m@1|e|n|t| +0#0000000&@55 +|s+0#af5f00255&|)+0#e000e06&|/+0#0000000&|)+0#e000e06&|/+0#0000000&@1|)+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|*+0#e000e06&|/+0#0000000&|*+0#e000e06&|/+0#0000000&@1|*+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|++0#e000e06&|/+0#0000000&|++0#e000e06&|/+0#0000000&@1|++0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|,+0#e000e06&|/+0#0000000&|,+0#e000e06&|/+0#0000000&@1|,+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +>s+0#af5f00255&|-+0#e000e06&|/+0#0000000&|-+0#e000e06&|/+0#0000000&@1|-+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|.+0#e000e06&|/+0#0000000&|.+0#e000e06&|/+0#0000000&@1|.+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|/+0#e000e06&|X+0#0000000&|/+0#e000e06&|X+0#0000000&@1|/+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|:+0#e000e06&|/+0#0000000&|:+0#e000e06&|/+0#0000000&@1|:+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|;+0#e000e06&|/+0#0000000&|;+0#e000e06&|/+0#0000000&@1|;+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|<+0#e000e06&|/+0#0000000&|<+0#e000e06&|/+0#0000000&@1|<+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|=+0#e000e06&|/+0#0000000&|=+0#e000e06&|/+0#0000000&@1|=+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|>+0#e000e06&|/+0#0000000&|>+0#e000e06&|/+0#0000000&@1|>+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|?+0#e000e06&|/+0#0000000&|?+0#e000e06&|/+0#0000000&@1|?+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|@+0#e000e06&|/+0#0000000&|@+0#e000e06&|/+0#0000000&@1|@+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|[+0#e000e06&|/+0#0000000&|[+0#e000e06&|/+0#0000000&@1|[+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|"+0#0000e05&| |s|\|/|\|/@1|\| |"| |c|o|m@1|e|n|t| |(|d|i|s|a|l@1|o|w|e|d|)| +0#0000000&@42 +|s+0#af5f00255&|]+0#e000e06&|/+0#0000000&|]+0#e000e06&|/+0#0000000&@1|]+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|^+0#e000e06&|/+0#0000000&|^+0#e000e06&|/+0#0000000&@1|^+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +@57|5@1|,|1| @9|7|3|%| diff --git a/runtime/syntax/testdir/dumps/vim_ex_substitute_04.dump b/runtime/syntax/testdir/dumps/vim_ex_substitute_04.dump new file mode 100644 index 0000000000..b37826020c --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_substitute_04.dump @@ -0,0 +1,20 @@ +|s+0#af5f00255#ffffff0|^+0#e000e06&|/+0#0000000&|^+0#e000e06&|/+0#0000000&@1|^+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|_+0#e000e06&|/+0#0000000&|_+0#e000e06&|/+0#0000000&@1|_+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|`+0#e000e06&|/+0#0000000&|`+0#e000e06&|/+0#0000000&@1|`+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|{+0#e000e06&|/+0#0000000&|{+0#e000e06&|/+0#0000000&@1|{+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|"+0#0000e05&| |s|||/|||/@1||| |"| |c|o|m@1|e|n|t| |(|d|i|s|a|l@1|o|w|e|d|)| +0#0000000&@42 +>s+0#af5f00255&|}+0#e000e06&|/+0#0000000&|}+0#e000e06&|/+0#0000000&@1|}+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|~+0#e000e06&|/+0#0000000&|~+0#e000e06&|/+0#0000000&@1|~+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +@75 +@75 +|"+0#0000e05&| |I|s@1|u|e| |#|1|3|8@1|3| +0#0000000&@60 +@75 +|s|t|r|[|s|]| @68 +|s|t|r|(+0#e000e06&|s+0#00e0e07&|)+0#e000e06&| +0#0000000&@68 +@75 +|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|(+0#e000e06&|)| +0#0000000&@64 +@2|s|t|r|[|s|]| @66 +@2|s|t|r|(+0#e000e06&|s+0#00e0e07&|)+0#e000e06&| +0#0000000&@66 +|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68 +@75 +@57|7|3|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/dumps/vim_ex_substitute_99.dump b/runtime/syntax/testdir/dumps/vim_ex_substitute_99.dump new file mode 100644 index 0000000000..88cb7dc218 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_substitute_99.dump @@ -0,0 +1,20 @@ +|s+0#af5f00255#ffffff0|^+0#e000e06&|/+0#0000000&|^+0#e000e06&|/+0#0000000&@1|^+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|_+0#e000e06&|/+0#0000000&|_+0#e000e06&|/+0#0000000&@1|_+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|`+0#e000e06&|/+0#0000000&|`+0#e000e06&|/+0#0000000&@1|`+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|{+0#e000e06&|/+0#0000000&|{+0#e000e06&|/+0#0000000&@1|{+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|"+0#0000e05&| |s|||/|||/@1||| |"| |c|o|m@1|e|n|t| |(|d|i|s|a|l@1|o|w|e|d|)| +0#0000000&@42 +|s+0#af5f00255&|}+0#e000e06&|/+0#0000000&|}+0#e000e06&|/+0#0000000&@1|}+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +|s+0#af5f00255&|~+0#e000e06&|/+0#0000000&|~+0#e000e06&|/+0#0000000&@1|~+0#e000e06&| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57 +@75 +@75 +|"+0#0000e05&| |I|s@1|u|e| |#|1|3|8@1|3| +0#0000000&@60 +@75 +|s|t|r|[|s|]| @68 +|s|t|r|(+0#e000e06&|s+0#00e0e07&|)+0#e000e06&| +0#0000000&@68 +@75 +|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|(+0#e000e06&|)| +0#0000000&@64 +@2|s|t|r|[|s|]| @66 +@2|s|t|r|(+0#e000e06&|s+0#00e0e07&|)+0#e000e06&| +0#0000000&@66 +|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68 +> @74 +@57|8|6|,|0|-|1| @7|B|o|t| diff --git a/runtime/syntax/testdir/input/vim_ex_substitute.vim b/runtime/syntax/testdir/input/vim_ex_substitute.vim new file mode 100644 index 0000000000..340d573ac1 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_substitute.vim @@ -0,0 +1,86 @@ +substitute/foo/bar/& +substitute/foo/bar/cegiInp#lr + +snomagic/foo/bar/& +snomagic/foo/bar/cegiInp#lr + +smagic/foo/bar/& +smagic/foo/bar/cegiInp#lr + +:substitute/foo/bar/& +:substitute/foo/bar/cegiInp#lr + +:snomagic/foo/bar/& +:snomagic/foo/bar/cegiInp#lr + +:smagic/foo/bar/& +:smagic/foo/bar/cegiInp#lr + +call Foo() | substitute/foo/bar/& +call Foo() | substitute/foo/bar/cegiInp#lr + +call Foo() | snomagic/foo/bar/& +call Foo() | snomagic/foo/bar/cegiInp#lr + +call Foo() | smagic/foo/bar/& +call Foo() | smagic/foo/bar/cegiInp#lr + +let foo = str->substitute(str, pat, sub, flags) + +function Foo() + substitute/foo/bar/ + let bar = str->substitute(str, pat, sub, flags) +endfunction + +def Foo() + substitute/foo/bar/ + let bar = str->substitute(str, pat, sub, flags) +enddef + +" various delimiters + +s!/!//! " comment +" s"/"//" " comment (works but disallowed) +s#/#//# " comment +s$/$//$ " comment +s%/%//% " comment +s&/&//& " comment +s'/'//' " comment +" FIXME - matches vimUserFunc +" s(/(//( " comment +s)/)//) " comment +s*/*//* " comment +s+/+//+ " comment +s,/,//, " comment +s-/-//- " comment +s././/. " comment +s/X/XX/ " comment +s:/://: " comment +s;/;//; " comment +s/>//> " comment +s?/?//? " comment +s@/@//@ " comment +s[/[//[ " comment +" s\/\//\ " comment (disallowed) +s]/]//] " comment +s^/^//^ " comment +s_/_//_ " comment +s`/`//` " comment +s{/{//{ " comment +" s|/|//| " comment (disallowed) +s}/}//} " comment +s~/~//~ " comment + + +" Issue #13883 + +str[s] +str(s) + +def Test() + str[s] + str(s) +enddef + diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 7dde1a3408..c845651c98 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -3,7 +3,7 @@ " Maintainer: Hirohito Higashi " Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex -" Last Change: Feb 23, 2024 +" Last Change: Feb 27, 2024 " Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 @@ -199,16 +199,16 @@ endif " Numbers {{{2 " ======= -syn match vimNumber '\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '\<0[xX]\x\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '\<0[zZ][a-zA-Z0-9.]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment -syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment +syn match vimNumber '\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '\<0[xX]\x\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '\<0[zZ][a-zA-Z0-9.]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment +syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment " All vimCommands are contained by vimIsCommand. {{{2 -syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFilter,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd +syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFilter,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNorm,vimSet,vimSubst1,vimSyntax,vimUnlet,vimUnmap,vimUserCmd syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" @@ -236,7 +236,6 @@ syn match vimBehave "\" nextgroup=vimBehaveBang,vimBehaveModel,vi syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite syn keyword vimBehaveModel contained mswin xterm -hi def link vimBehaveBang vimBang " Filetypes {{{2 " ========= syn match vimFiletype "\" nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "<\([acs]file\|amatch\|abuf\)>" nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "\s%[ \t:]"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "\s%$"ms=s+1 nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "\s%<"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst -syn match vimSpecFile "#\d\+\|[#%]<\>" nextgroup=vimSpecFileMod,vimSubst +syn match vimSpecFile "" nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "<\([acs]file\|amatch\|abuf\)>" nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "\s%[ \t:]"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "\s%$"ms=s+1 nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "\s%<"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst1 +syn match vimSpecFile "#\d\+\|[#%]<\>" nextgroup=vimSpecFileMod,vimSubst1 syn match vimSpecFileMod "\(:[phtre]\)\+" contained " User-Specified Commands: {{{2 @@ -399,33 +398,34 @@ syn match vimStringInterpolationBrace "}}" syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation syn cluster vimSubstList add=vimCollection -syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(\\|\\|\\)[:#[:alpha:]]\@!" nextgroup=vimSubstPat -"syn match vimSubst "\%(^\|[^\\]\)\[:#[:alpha:]]\@!" nextgroup=vimSubstPat contained -syn match vimSubst "\%(^\|[^\\\"']\)\[:#[:alpha:]\"']\@!" nextgroup=vimSubstPat contained -syn match vimSubst "/\zs\\ze/" nextgroup=vimSubstPat -syn match vimSubst "\(:\+\s*\|^\s*\)s\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat -syn match vimSubst1 contained "\" nextgroup=vimSubstPat -syn match vimSubst2 contained "s\%[ubstitute]\>" nextgroup=vimSubstPat -syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([^a-zA-Z( \t[\]&]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline -syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline -syn region vimCollection contained transparent start="\\\@[\"#|]\@!" nextgroup=vimSubstPat +syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat +syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat +syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat +syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat +syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat +" TODO: Vim9 illegal separators for abbreviated :s form are [-.:], :su\%[...] required +" : # is allowed but "not recommended" (see :h pattern-delimiter) +syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline +syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline +syn region vimCollection contained transparent start="\\\@]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst -syn match vimMark ",\zs'[<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst -syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst -syn match vimMark "\]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst1 +syn match vimMark ",\zs'[<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst1 +syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst1 +syn match vimMark "\ Date: Mon, 26 Feb 2024 21:21:17 +0100 Subject: [PATCH 095/426] patch 9.1.0138: too many STRLEN calls when getting a memline Problem: too many STRLEN calls when getting a memline Solution: Optimize calls to STRLEN(), add a few functions in memline.c that return the byte length instead of relying on STRLEN() (John Marriott) closes: #14052 Signed-off-by: John Marriott Signed-off-by: Christian Brabandt --- src/memline.c | 53 +++++++++++++++++++++++++++++++++---------- src/normal.c | 24 ++++++++++---------- src/proto/memline.pro | 4 ++++ src/version.c | 2 ++ 4 files changed, 59 insertions(+), 24 deletions(-) diff --git a/src/memline.c b/src/memline.c index cf2dc8c312..bbc13d7ed6 100644 --- a/src/memline.c +++ b/src/memline.c @@ -1754,7 +1754,7 @@ ml_recover(int checkext) for (idx = 1; idx <= lnum; ++idx) { // Need to copy one line, fetching the other one may flush it. - p = vim_strsave(ml_get(idx)); + p = vim_strnsave(ml_get(idx), ml_get_len(idx)); i = STRCMP(p, ml_get(idx + lnum)); vim_free(p); if (i != 0) @@ -2675,6 +2675,37 @@ ml_get_cursor(void) curwin->w_cursor.col); } +// return length (excluding the NUL) of the given line + colnr_T +ml_get_len(linenr_T lnum) +{ + return ml_get_buf_len(curbuf, lnum); +} + +// return length (excluding the NUL) of the cursor line + colnr_T +ml_get_curline_len(void) +{ + return ml_get_buf_len(curbuf, curwin->w_cursor.lnum); +} + +// return length (excluding the NUL) of the cursor position + colnr_T +ml_get_cursor_len(void) +{ + return ml_get_buf_len(curbuf, curwin->w_cursor.lnum) - curwin->w_cursor.col; +} + +// return length (excluding the NUL) of the given line in the given buffer + colnr_T +ml_get_buf_len(buf_T *buf, linenr_T lnum) +{ + if (*ml_get_buf(buf, lnum, FALSE) == NUL) + return 0; + + return buf->b_ml.ml_line_len - 1; +} + /* * Return a pointer to a line in a specific buffer * @@ -2727,7 +2758,6 @@ ml_get_buf( if (buf->b_ml.ml_line_lnum != lnum || mf_dont_release) { unsigned start, end; - colnr_T len; int idx; ml_flush_line(buf); @@ -2763,10 +2793,9 @@ ml_get_buf( end = dp->db_txt_end; else end = ((dp->db_index[idx - 1]) & DB_INDEX_MASK); - len = end - start; buf->b_ml.ml_line_ptr = (char_u *)dp + start; - buf->b_ml.ml_line_len = len; + buf->b_ml.ml_line_len = end - start; buf->b_ml.ml_line_lnum = lnum; buf->b_ml.ml_flags &= ~(ML_LINE_DIRTY | ML_ALLOCATED); } @@ -3400,10 +3429,10 @@ ml_append_int( #ifdef FEAT_NETBEANS_INTG if (netbeans_active()) { - if (STRLEN(line) > 0) - netbeans_inserted(buf, lnum+1, (colnr_T)0, line, (int)STRLEN(line)); - netbeans_inserted(buf, lnum+1, (colnr_T)STRLEN(line), - (char_u *)"\n", 1); + int line_len = (int)STRLEN(line); + if (line_len > 0) + netbeans_inserted(buf, lnum+1, (colnr_T)0, line, line_len); + netbeans_inserted(buf, lnum+1, (colnr_T)line_len, (char_u *)"\n", 1); } #endif #ifdef FEAT_JOB_CHANNEL @@ -3571,7 +3600,7 @@ ml_replace_len( #ifdef FEAT_NETBEANS_INTG if (netbeans_active()) { - netbeans_removed(curbuf, lnum, 0, (long)STRLEN(ml_get(lnum))); + netbeans_removed(curbuf, lnum, 0, (long)ml_get_len(lnum)); netbeans_inserted(curbuf, lnum, 0, line, (int)STRLEN(line)); } #endif @@ -5192,15 +5221,15 @@ findswapname( { char_u *name; int dialog_result; + size_t len = STRLEN(_("Swap file \"")); name = alloc(STRLEN(fname) - + STRLEN(_("Swap file \"")) + + len + STRLEN(_("\" already exists!")) + 5); if (name != NULL) { STRCPY(name, _("Swap file \"")); - home_replace(NULL, fname, name + STRLEN(name), - 1000, TRUE); + home_replace(NULL, fname, name + len, 1000, TRUE); STRCAT(name, _("\" already exists!")); } dialog_result = do_dialog(VIM_WARNING, diff --git a/src/normal.c b/src/normal.c index 8a10b86d75..015a250781 100644 --- a/src/normal.c +++ b/src/normal.c @@ -3225,8 +3225,7 @@ nv_colon(cmdarg_T *cap) clearop(cap->oap); else if (cap->oap->op_type != OP_NOP && (cap->oap->start.lnum > curbuf->b_ml.ml_line_count - || cap->oap->start.col > - (colnr_T)STRLEN(ml_get(cap->oap->start.lnum)) + || cap->oap->start.col > ml_get_len(cap->oap->start.lnum) || did_emsg )) // The start of the operator has become invalid by the Ex command. @@ -3675,7 +3674,7 @@ get_visual_text( if (VIsual_mode == 'V') { *pp = ml_get_curline(); - *lenp = (int)STRLEN(*pp); + *lenp = (int)ml_get_curline_len(); } else { @@ -4768,7 +4767,6 @@ nv_kundo(cmdarg_T *cap) static void nv_replace(cmdarg_T *cap) { - char_u *ptr; int had_ctrl_v; long n; @@ -4835,9 +4833,8 @@ nv_replace(cmdarg_T *cap) } // Abort if not enough characters to replace. - ptr = ml_get_cursor(); - if (STRLEN(ptr) < (unsigned)cap->count1 - || (has_mbyte && mb_charlen(ptr) < cap->count1)) + if ((size_t)ml_get_cursor_len() < (unsigned)cap->count1 + || (has_mbyte && mb_charlen(ml_get_cursor()) < cap->count1)) { clearopbeep(cap->oap); return; @@ -4917,11 +4914,13 @@ nv_replace(cmdarg_T *cap) } else { + char_u *ptr; + // Replace the characters within one line. for (n = cap->count1; n > 0; --n) { - // Get ptr again, because u_save and/or showmatch() will have - // released the line. This may also happen in ins_copychar(). + // Get ptr again, because ins_copychar() and showmatch() + // will have released the line. // At the same time we let know that the line will be changed. if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y) { @@ -4945,6 +4944,7 @@ nv_replace(cmdarg_T *cap) if (netbeans_active()) { colnr_T start = (colnr_T)(curwin->w_cursor.col - cap->count1); + ptr = ml_get_curline(); netbeans_removed(curbuf, curwin->w_cursor.lnum, start, cap->count1); @@ -5130,7 +5130,7 @@ n_swapchar(cmdarg_T *cap) if (did_change) { ptr = ml_get(pos.lnum); - count = (int)STRLEN(ptr) - pos.col; + count = (int)ml_get_len(pos.lnum) - pos.col; netbeans_removed(curbuf, pos.lnum, pos.col, (long)count); // line may have been flushed, get it again @@ -5919,7 +5919,7 @@ nv_gi_cmd(cmdarg_T *cap) { curwin->w_cursor = curbuf->b_last_insert; check_cursor_lnum(); - i = (int)STRLEN(ml_get_curline()); + i = (int)ml_get_curline_len(); if (curwin->w_cursor.col > (colnr_T)i) { if (virtual_active()) @@ -6717,7 +6717,7 @@ unadjust_for_sel(void) else if (pp->lnum > 1) { --pp->lnum; - pp->col = (colnr_T)STRLEN(ml_get(pp->lnum)); + pp->col = ml_get_len(pp->lnum); return TRUE; } } diff --git a/src/proto/memline.pro b/src/proto/memline.pro index 3fa8707d80..eb21a7eecf 100644 --- a/src/proto/memline.pro +++ b/src/proto/memline.pro @@ -19,6 +19,10 @@ char_u *ml_get(linenr_T lnum); char_u *ml_get_pos(pos_T *pos); char_u *ml_get_curline(void); char_u *ml_get_cursor(void); +colnr_T ml_get_len(linenr_T lnum); +colnr_T ml_get_curline_len(void); +colnr_T ml_get_cursor_len(void); +colnr_T ml_get_buf_len(buf_T *buf, linenr_T lnum); char_u *ml_get_buf(buf_T *buf, linenr_T lnum, int will_change); int ml_line_alloced(void); int ml_append(linenr_T lnum, char_u *line, colnr_T len, int newfile); diff --git a/src/version.c b/src/version.c index 38201599ef..8ad03e380c 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 138, /**/ 137, /**/ From 2f02638aa8f737786551c92e78ce13def3d098b2 Mon Sep 17 00:00:00 2001 From: "Erik S. V. Jansson" Date: Mon, 26 Feb 2024 22:23:05 +0100 Subject: [PATCH 096/426] patch 9.1.0139: MS-Windows: ligatures map cleared on startup Problem: MS-Windows: ligatures map cleared on startup Solution: Don't clear the ligatures_map, if the guiligatures option has already been set (Erik S. V. Jansson) If guiligatures is set from a .vimrc it's possible that it will be cleared on start-up (e.g. in Win32 that's what happens). So don't clear the ligatures map if gui_set_ligatures() has already been called (e.g. after setting 'ligatures' from .vimrc) closes: #14094 Signed-off-by: Erik S. V. Jansson Signed-off-by: Christian Brabandt --- src/gui.c | 6 +++++- src/optionstr.c | 2 +- src/version.c | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui.c b/src/gui.c index 78299f0454..1953691021 100644 --- a/src/gui.c +++ b/src/gui.c @@ -456,7 +456,11 @@ gui_init_check(void) gui.prev_wrap = -1; #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) - CLEAR_FIELD(gui.ligatures_map); + // Note: gui_set_ligatures() might already have been called e.g. from .vimrc, + // and in that case we don't want to overwrite ligatures map that has already + // been correctly populated (as that would lead to a cleared ligatures maps). + if (*p_guiligatures == NUL) + CLEAR_FIELD(gui.ligatures_map); #endif #if defined(ALWAYS_USE_GUI) || defined(VIMDLL) diff --git a/src/optionstr.c b/src/optionstr.c index 457fccb1eb..7f6225fd2f 100644 --- a/src/optionstr.c +++ b/src/optionstr.c @@ -4530,7 +4530,7 @@ did_set_string_option( || varp == &p_guifontset // 'guifontset' # endif || varp == &p_guifontwide // 'guifontwide' -# ifdef FEAT_GUI_GTK +# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) || varp == &p_guiligatures // 'guiligatures' # endif ) diff --git a/src/version.c b/src/version.c index 8ad03e380c..07d2558e2a 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 139, /**/ 138, /**/ From c7ddc9b73543d4b3b906b56948dc9a6861150e12 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 27 Feb 2024 01:34:45 -0500 Subject: [PATCH 097/426] runtime(debian): update Debian syntax files (#14098) * debversions.vim: Move lunar to unsupported release * debsources: Add word boundaries around keyword match patterns Co-authored-by: James Addison Signed-off-by: James Addison Signed-off-by: James McCoy Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/deb822sources.vim | 24 ++++++++++++------------ runtime/syntax/debsources.vim | 9 ++++----- runtime/syntax/shared/debversions.vim | 6 +++--- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/runtime/syntax/deb822sources.vim b/runtime/syntax/deb822sources.vim index 81113610e8..f7d337fce9 100644 --- a/runtime/syntax/deb822sources.vim +++ b/runtime/syntax/deb822sources.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Debian deb822-format source list file " Maintainer: Debian Vim Maintainers -" Last Change: 2023 May 25 +" Last Change: 2024 Jan 30 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/deb822sources.vim " Standard syntax initialization @@ -12,19 +12,19 @@ endif " case insensitive syn case ignore +" A bunch of useful keywords +syn match deb822sourcesType /\<\(deb-src\|deb\)\ */ contained +syn match deb822sourcesFreeComponent /\<\(main\|universe\)\> */ contained +syn match deb822sourcesNonFreeComponent /\<\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)\> */ contained + " Comments are matched from the first character of a line to the end-of-line syn region deb822sourcesComment start="^#" end="$" -" A bunch of useful keywords -syn match deb822sourcesType /\(deb-src\|deb\)/ -syn match deb822sourcesFreeComponent /\(main\|universe\)/ -syn match deb822sourcesNonFreeComponent /\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)/ - " Include Debian versioning information runtime! syntax/shared/debversions.vim -exe 'syn match deb822sourcesSupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedSupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\)+' -exe 'syn match deb822sourcesUnsupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedUnsupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\)+' +exe 'syn match deb822sourcesSupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedSupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\) *+' +exe 'syn match deb822sourcesUnsupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedUnsupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\) *+' unlet g:debSharedSupportedVersions unlet g:debSharedUnsupportedVersions @@ -37,13 +37,13 @@ syn keyword deb822sourcesYesNo contained yes no " Match uri's syn match deb822sourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\+' -syn match deb822sourcesEntryField "^\%(Types\|URIs\|Suites\|Components\): *" -syn match deb822sourcesOptionField "^\%(Signed-By\|Check-Valid-Until\|Valid-Until-Min\|Valid-Until-Max\|Date-Max-Future\|InRelease-Path\): *" -syn match deb822sourcesMultiValueOptionField "^\%(Architectures\|Languages\|Targets\)\%(-Add\|-Remove\)\?: *" - +syn region deb822sourcesStrictField matchgroup=deb822sourcesEntryField start="^\%(Types\|URIs\|Suites\|Components\): *" end="$" contains=deb822sourcesType,deb822sourcesUri,deb822sourcesSupportedSuites,deb822sourcesUnsupportedSuites,deb822sourcesFreeComponent,deb822sourcesNonFreeComponent oneline +syn region deb822sourcesField matchgroup=deb822sourcesOptionField start="^\%(Signed-By\|Check-Valid-Until\|Valid-Until-Min\|Valid-Until-Max\|Date-Max-Future\|InRelease-Path\): *" end="$" oneline +syn region deb822sourcesField matchgroup=deb822sourcesMultiValueOptionField start="^\%(Architectures\|Languages\|Targets\)\%(-Add\|-Remove\)\?: *" end="$" oneline syn region deb822sourcesStrictField matchgroup=deb822sourcesBooleanOptionField start="^\%(PDiffs\|Allow-Insecure\|Allow-Weak\|Allow-Downgrade-To-Insecure\|Trusted\|Check-Date\): *" end="$" contains=deb822sourcesYesNo oneline syn region deb822sourcesStrictField matchgroup=deb822sourcesForceBooleanOptionField start="^\%(By-Hash\): *" end="$" contains=deb822sourcesForce,deb822sourcesYesNo oneline +hi def link deb822sourcesField Default hi def link deb822sourcesComment Comment hi def link deb822sourcesEntryField Keyword hi def link deb822sourcesOptionField Special diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index 9846cfdef0..76b52cfaa4 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,7 +2,7 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann -" Last Change: 2023 Oct 11 +" Last Change: 2024 Jan 30 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debsources.vim " Standard syntax initialization @@ -14,9 +14,9 @@ endif syn case match " A bunch of useful keywords -syn match debsourcesType /\(deb-src\|deb\)/ -syn match debsourcesFreeComponent /\(main\|universe\)/ -syn match debsourcesNonFreeComponent /\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)/ +syn match debsourcesType /\<\(deb-src\|deb\)\>/ contained +syn match debsourcesFreeComponent /\<\(main\|universe\)\>/ contained +syn match debsourcesNonFreeComponent /\<\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)\>/ contained " Match comments syn match debsourcesComment /#.*/ contains=@Spell @@ -34,7 +34,6 @@ unlet g:debSharedUnsupportedVersions syn match debsourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\+' syn region debsourcesLine start="^" end="$" contains=debsourcesType,debsourcesFreeComponent,debsourcesNonFreeComponent,debsourcesComment,debsourcesUri,debsourcesDistrKeyword,debsourcesUnsupportedDistrKeyword oneline - " Associate our matches and regions with pretty colours hi def link debsourcesType Statement hi def link debsourcesFreeComponent Statement diff --git a/runtime/syntax/shared/debversions.vim b/runtime/syntax/shared/debversions.vim index 6c944cd4e1..4aec246e27 100644 --- a/runtime/syntax/shared/debversions.vim +++ b/runtime/syntax/shared/debversions.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Debian version information " Maintainer: Debian Vim Maintainers -" Last Change: 2023 Nov 01 +" Last Change: 2024 Jan 25 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/shared/debversions.vim let s:cpo = &cpo @@ -11,7 +11,7 @@ let g:debSharedSupportedVersions = [ \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', \ 'bullseye', 'bookworm', 'trixie', 'forky', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'lunar', 'mantic', 'noble', + \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'mantic', 'noble', \ 'devel' \ ] let g:debSharedUnsupportedVersions = [ @@ -23,7 +23,7 @@ let g:debSharedUnsupportedVersions = [ \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', - \ 'disco', 'eoan', 'hirsute', 'impish', 'kinetic', 'groovy' + \ 'disco', 'eoan', 'hirsute', 'impish', 'kinetic', 'lunar', 'groovy' \ ] let &cpo=s:cpo From b1427b46f5fe50a1daba102c4017d0ef2624b3ba Mon Sep 17 00:00:00 2001 From: dkearns Date: Wed, 28 Feb 2024 05:59:30 +1100 Subject: [PATCH 098/426] runtime(vim): Update base-syntax, improve :echo highlighting (#14103) - Normalise behaviour of :echo commands and improve expression matching. - Allow continued argument lines. - Refine string interpolation groups. - Remove duplicated :menu and :map generated commands that are handled specially later in the file. Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/syntax/generator/gen_syntax_vim.vim | 48 ++++++++++--------- runtime/syntax/generator/vim.vim.base | 24 ++++++---- .../syntax/testdir/dumps/vim_ex_echo_00.dump | 20 ++++++++ .../syntax/testdir/dumps/vim_ex_echo_99.dump | 20 ++++++++ runtime/syntax/testdir/input/vim_ex_echo.vim | 20 ++++++++ runtime/syntax/vim.vim | 39 ++++++++------- 6 files changed, 122 insertions(+), 49 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/vim_ex_echo_00.dump create mode 100644 runtime/syntax/testdir/dumps/vim_ex_echo_99.dump create mode 100644 runtime/syntax/testdir/input/vim_ex_echo.vim diff --git a/runtime/syntax/generator/gen_syntax_vim.vim b/runtime/syntax/generator/gen_syntax_vim.vim index bc561dd6c7..bbcdb06074 100644 --- a/runtime/syntax/generator/gen_syntax_vim.vim +++ b/runtime/syntax/generator/gen_syntax_vim.vim @@ -2,8 +2,8 @@ " Language: Vim script " Maintainer: Hirohito Higashi (h_east) " URL: https://github.com/vim-jp/syntax-vim-ex -" Last Change: Feb 18, 2024 -" Version: 2.0.1 +" Last Change: Feb 27, 2024 +" Version: 2.0.3 let s:keepcpo= &cpo set cpo&vim @@ -264,20 +264,23 @@ function! s:get_vim_command_type(cmd_name) " Return value: " 0: normal " 1: (Reserved) - " 2: abbrev (without un) - " 3: menu - " 4: map - " 5: mapclear - " 6: unmap + " 2: abbrev + " 3: echo + " 4: menu + " 5: map + " 6: mapclear + " 7: unmap " 99: (Exclude registration of "syn keyword") let menu_prefix = '^\%([acinosvx]\?\|tl\)' let map_prefix = '^[acilnostvx]\?' + let echo_suffix = '\%(n\|hl\|msg\|window\|err\|console\|\)$' let exclude_list = [ \ 'map', 'mapclear', \ 'substitute', 'smagic', 'snomagic', \ 'setlocal', 'setglobal', 'set', 'var', \ 'autocmd', 'doautocmd', 'doautoall', - \ 'echo', 'echohl', 'execute', + \ 'echohl', + \ 'execute', \ 'behave', 'augroup', 'normal', 'syntax', \ 'append', 'insert', \ 'Next', 'Print', 'X', @@ -290,14 +293,16 @@ function! s:get_vim_command_type(cmd_name) let ret = 99 elseif a:cmd_name =~# '^\%(\%(un\)\?abbreviate\|noreabbrev\|\l\%(nore\|un\)\?abbrev\)$' let ret = 2 - elseif a:cmd_name =~# menu_prefix . '\%(nore\|un\)\?menu$' + elseif a:cmd_name =~# '^echo' . echo_suffix let ret = 3 - elseif a:cmd_name =~# map_prefix . '\%(nore\)\?map$' + elseif a:cmd_name =~# menu_prefix . '\%(nore\|un\)\?menu$' let ret = 4 - elseif a:cmd_name =~# map_prefix . 'mapclear$' + elseif a:cmd_name =~# map_prefix . '\%(nore\)\?map$' let ret = 5 - elseif a:cmd_name =~# map_prefix . 'unmap$' + elseif a:cmd_name =~# map_prefix . 'mapclear$' let ret = 6 + elseif a:cmd_name =~# map_prefix . 'unmap$' + let ret = 7 else let ret = 0 endif @@ -566,10 +571,6 @@ function! s:update_syntax_vim_file(vim_info) " vimCommand - normal let lnum = s:search_and_check('vimCommand normal', base_fname, str_info) let lnum = s:append_syn_vimcmd(lnum, str_info, li, 0) - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3) " menu - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 4) " map - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 5) " mapclear - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 6) " unmap " vimOption let kword = 'vimOption' @@ -620,16 +621,19 @@ function! s:update_syntax_vim_file(vim_info) let li = a:vim_info.cmd let lnum = s:search_and_check(kword . ' abbrev', base_fname, str_info) let lnum = s:append_syn_vimcmd(lnum, str_info, li, 2) + " vimCommand - echo + let lnum = s:search_and_check(kword . ' echo', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3) + " vimCommand - menu + let lnum = s:search_and_check(kword . ' menu', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 4) " vimCommand - map let lnum = s:search_and_check(kword . ' map', base_fname, str_info) - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 4) - let lnum = s:search_and_check(kword . ' mapclear', base_fname, str_info) let lnum = s:append_syn_vimcmd(lnum, str_info, li, 5) - let lnum = s:search_and_check(kword . ' unmap', base_fname, str_info) + let lnum = s:search_and_check(kword . ' mapclear', base_fname, str_info) let lnum = s:append_syn_vimcmd(lnum, str_info, li, 6) - " vimCommand - menu - let lnum = s:search_and_check(kword . ' menu', base_fname, str_info) - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3) + let lnum = s:search_and_check(kword . ' unmap', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 7) update quit! diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index 6527fe178f..f74406e499 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -3,7 +3,7 @@ " Maintainer: Hirohito Higashi " Doug Kearns " URL: https://github.com/vim-jp/syntax-vim-ex -" Last Change: Feb 18, 2024 +" Last Change: Feb 27, 2024 " Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 @@ -176,6 +176,8 @@ syn match vimVar "\s\zs&t_k;" syn match vimFBVar contained "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" syn keyword vimCommand contained in +syn cluster vimExprList contains=vimEnvvar,vimFunc,vimFuncVar,vimNumber,vimOper,vimOperParen,vimLetRegister,vimString,vimVar + " Insertions And Appends: insert append {{{2 " (buftype != nofile test avoids having append, change, insert show up in the command window) " ======================= @@ -344,11 +346,11 @@ syn match vimEscape contained "\\\o\{1,3}\|\\[xX]\x\{1,2}\|\\u\x\{1,4}\|\\U\x\{1 syn match vimEscape contained "\\<" contains=vimNotation syn match vimEscape contained "\\<\*[^>]*>\=>" -syn region vimString start=+$'+ end=+'+ skip=+''+ oneline contains=vimStringInterpolationBrace,vimStringInterpolationExpr -syn region vimString start=+$"+ end=+"+ oneline contains=@vimStringGroup,vimStringInterpolationBrace,vimStringInterpolationExpr -syn region vimStringInterpolationExpr matchgroup=vimSep start=+{+ end=+}+ oneline contains=vimFunc,vimFuncVar,vimOper,vimOperParen,vimNotation,vimNumber,vimString,vimVar -syn match vimStringInterpolationBrace "{{" -syn match vimStringInterpolationBrace "}}" +syn region vimString oneline start=+$'+ skip=+''+ end=+'+ contains=vimStringInterpolationBrace,vimStringInterpolationExpr +syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,vimStringInterpolationBrace,vimStringInterpolationExpr +syn region vimStringInterpolationExpr oneline contained matchgroup=vimSep start=+{+ end=+}+ contains=@vimExprList +syn match vimStringInterpolationBrace contained "{{" +syn match vimStringInterpolationBrace contained "}}" " Substitutions: {{{2 " ============= @@ -442,13 +444,16 @@ syn match vimAutoCmdMod "\(++\)\=\(once\|nested\)" " Echo And Execute: -- prefer strings! {{{2 " ================ -syn region vimEcho oneline excludenl matchgroup=vimCommand start="\" skip="\(\\\\\)*\\|" end="$\||" contains=vimFunc,vimFuncVar,vimString,vimVar -syn region vimExecute oneline excludenl matchgroup=vimCommand start="\" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar -syn match vimEchoHL "echohl\=" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone +" GEN_SYN_VIM: vimCommand echo, START_STR='syn keyword vimEcho', END_STR='skipwhite nextgroup=vimEchoExpr' +syn region vimEchoExpr contained start="[^[:space:]|]" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" end="$" contains=@vimContinue,@vimExprList + +syn match vimEchoHL "\" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone syn case ignore syn keyword vimEchoHLNone none syn case match +syn region vimExecute oneline excludenl matchgroup=vimCommand start="\" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar + " Maps: {{{2 " ==== syn match vimMap "\\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapLhs @@ -949,6 +954,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimContinue Special hi def link vimContinueComment vimComment hi def link vimCtrlChar SpecialChar + hi def link vimEcho vimCommand hi def link vimEchoHLNone vimGroup hi def link vimEchoHL vimCommand hi def link vimElseIfErr Error diff --git a/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump b/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump new file mode 100644 index 0000000000..506c9e2d87 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump @@ -0,0 +1,20 @@ +>"+0#0000e05#ffffff0| |V|i|m| |:|e|c|h|o| |c|o|m@1|a|n|d|s| +0#0000000&@54 +@75 +|e+0#af5f00255&|c|h|o| +0#0000000&@7|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|n| +0#0000000&@6|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|m|s|g| +0#0000000&@4|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|w|i|n|d|o|w| +0#0000000&@1|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|e|r@1| +0#0000000&@4|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|c|o|n|s|o|l|e| +0#0000000&|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +@75 +|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|f|o|l@1|o|w|i|n|g| |c|o|m@1|a|n|d| |i|s| |:|||"| +0#0000000&||| ||| @40 +@75 +|e+0#af5f00255&|c|h|o|h|l| +0#0000000&|W+0#00e0003&|a|r|n|i|n|g|M|s|g| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|D|o|n|'|t| |p|a|n|i|c|!|"| +0#0000000&||| |e+0#af5f00255&|c|h|o|h|l| +0#0000000&|N+0#00e0003&|o|n|e| +0#0000000&@21 +@75 +|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&@58 +@5|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@59 +@6|\+0#e000e06&| +0#0000000&|4+0#e000002&|2| +0#0000000&@64 +@75 +|"+0#0000e05&| |:|e|c|h|o| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@52 +|e+0#af5f00255&|c|h|o||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@58 +|"|i|n|p|u|t|/|v|i|m|_|e|x|_|e|c|h|o|.|v|i|m|"| |2|0|L|,| |3|6|2|B| @23|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_echo_99.dump b/runtime/syntax/testdir/dumps/vim_ex_echo_99.dump new file mode 100644 index 0000000000..e8dd4541bc --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_echo_99.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@74 +|e+0#af5f00255&|c|h|o| +0#0000000&@7|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|n| +0#0000000&@6|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|m|s|g| +0#0000000&@4|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|w|i|n|d|o|w| +0#0000000&@1|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|e|r@1| +0#0000000&@4|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +|e+0#af5f00255&|c|h|o|c|o|n|s|o|l|e| +0#0000000&|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 +@75 +|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|f|o|l@1|o|w|i|n|g| |c|o|m@1|a|n|d| |i|s| |:|||"| +0#0000000&||| ||| @40 +@75 +|e+0#af5f00255&|c|h|o|h|l| +0#0000000&|W+0#00e0003&|a|r|n|i|n|g|M|s|g| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|D|o|n|'|t| |p|a|n|i|c|!|"| +0#0000000&||| |e+0#af5f00255&|c|h|o|h|l| +0#0000000&|N+0#00e0003&|o|n|e| +0#0000000&@21 +@75 +|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&@58 +@5|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@59 +@6|\+0#e000e06&| +0#0000000&|4+0#e000002&|2| +0#0000000&@64 +@75 +|"+0#0000e05&| |:|e|c|h|o| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@52 +|e+0#af5f00255&|c|h|o||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@58 +> @74 +@57|2|0|,|0|-|1| @7|B|o|t| diff --git a/runtime/syntax/testdir/input/vim_ex_echo.vim b/runtime/syntax/testdir/input/vim_ex_echo.vim new file mode 100644 index 0000000000..c031724b8a --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_echo.vim @@ -0,0 +1,20 @@ +" Vim :echo commands + +echo "Answer = " 42 +echon "Answer = " 42 +echomsg "Answer = " 42 +echowindow "Answer = " 42 +echoerr "Answer = " 42 +echoconsole "Answer = " 42 + +echo "following command is :|" | | + +echohl WarningMsg | echo "Don't panic!" | echohl None + +echo "Answer = " + "\ comment + \ 42 + +" :echo without {expr} +echo| echo "Foo" + diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index c845651c98..0532a48e84 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -29,16 +29,12 @@ syn cluster vimCommentGroup contains=vimTodo,@Spell " regular vim commands {{{2 " GEN_SYN_VIM: vimCommand normal, START_STR='syn keyword vimCommand contained', END_STR='' syn keyword vimCommand contained abc[lear] abo[veleft] abs[tract] al[l] ar[gs] arga[dd] argd[elete] argdo argded[upe] arge[dit] argg[lobal] argl[ocal] argu[ment] as[cii] b[uffer] bN[ext] ba[ll] bad[d] balt bd[elete] bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bo[tright] bp[revious] br[ewind] brea[k] breaka[dd] breakd[el] breakl[ist] bro[wse] buffers bufd[o] bun[load] bw[ipeout] c[hange] cN[ext] cNf[ile] cabc[lear] cabo[ve] cad[dbuffer] cadde[xpr] caddf[ile] caf[ter] cal[l] cat[ch] cb[uffer] cbe[fore] cbel[ow] cbo[ttom] cc ccl[ose] cd cdo ce[nter] cex[pr] cf[ile] cfd[o] cfir[st] cg[etfile] cgetb[uffer] cgete[xpr] chd[ir] changes che[ckpath] checkt[ime] chi[story] cl[ist] cla[st] class clo[se] cle[arjumps] cn[ext] cnew[er] cnf[ile] co[py] col[der] colo[rscheme] -syn keyword vimCommand contained com[mand] comc[lear] comp[iler] con[tinue] conf[irm] cons[t] cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cw[indow] d[elete] delm[arks] deb[ug] debugg[reedy] def defc[ompile] defe[r] delc[ommand] delf[unction] di[splay] dif[fupdate] diffg[et] diffo[ff] diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] echoe[rr] echom[sg] echoc[onsole] echon echow[indow] el[se] elsei[f] em[enu] en[dif] endin[terface] endc[lass] endd[ef] ende[num] endf[unction] endfo[r] endt[ry] endw[hile] ene[w] enu[m] ev[al] ex exi[t] exp[ort] exu[sage] f[ile] files filet[ype] filt[er] fin[d] fina[l] finall[y] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] foldd[oopen] -syn keyword vimCommand contained folddoc[losed] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] gu[i] gv[im] h[elp] helpc[lose] helpf[ind] helpg[rep] helpt[ags] ha[rdcopy] hi[ghlight] hid[e] his[tory] ho[rizontal] iabc[lear] if ij[ump] il[ist] imp[ort] int[ro] inte[rface] is[earch] isp[lit] j[oin] ju[mps] k kee[pmarks] keepj[umps] keepp[atterns] keepa[lt] l[ist] lN[ext] lNf[ile] la[st] lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lc[d] lch[dir] lcl[ose] lcs[cope] ld[o] le[ft] lefta[bove] let lex[pr] leg[acy] lf[ile] lfd[o] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lgr[ep] lgrepa[dd] lh[elpgrep] lhi[story] ll lla[st] lli[st] lmak[e] lne[xt] lnew[er] lnf[ile] lo[adview] loadk[eymap] loc[kmarks] -syn keyword vimCommand contained lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks mat[ch] menut[ranslate] mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] popu[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] python3 py3f[ile] pyx pyxd[o] pythonx -syn keyword vimCommand contained pyxf[ile] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redi[r] redr[aw] redraws[tatus] redrawt[abline] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] ru[ntime] rub[y] rubyd[o] rubyf[ile] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] san[dbox] sav[eas] sb[uffer] sbN[ext] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] sc[riptnames] scripte[ncoding] scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] si[malt] sig[n] sil[ent] sl[eep] sla[st] sn[ext] so[urce] sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sr[ewind] st[op] sta[g] star[tinsert] startg[replace] startr[eplace] stat[ic] stopi[nsert] stj[ump] sts[elect] -syn keyword vimCommand contained sun[hide] sus[pend] sv[iew] sw[apname] synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tab tabc[lose] tabd[o] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] tabp[revious] tabN[ext] tabr[ewind] tabs tc[d] tch[dir] tcl tcld[o] tclf[ile] te[aroff] ter[minal] tf[irst] th[row] thi[s] tj[ump] tl[ast] tm[enu] tn[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu[nmenu] ty[pe] u[ndo] undoj[oin] undol[ist] unh[ide] unl[et] unlo[ckvar] uns[ilent] up[date] v[global] ve[rsion] verb[ose] vert[ical] vi[sual] vie[w] vim[grep] vimgrepa[dd] vim9[cmd] vim9s[cript] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wh[ile] wi[nsize] winc[md] wind[o] winp[os] wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] -syn keyword vimCommand contained xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep deletp deletep a i -syn keyword vimCommand contained am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] sme[nu] snoreme[nu] sunme[nu] tlm[enu] tln[oremenu] tlu[nmenu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] xme[nu] xnoreme[nu] xunme[nu] -syn keyword vimCommand contained cm[ap] cno[remap] im[ap] ino[remap] lm[ap] ln[oremap] nm[ap] nn[oremap] no[remap] om[ap] ono[remap] smap snor[emap] tma[p] tno[remap] vm[ap] vn[oremap] xm[ap] xn[oremap] -syn keyword vimCommand contained cmapc[lear] imapc[lear] lmapc[lear] nmapc[lear] omapc[lear] smapc[lear] tmapc[lear] vmapc[lear] xmapc[lear] -syn keyword vimCommand contained cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] tunma[p] unm[ap] vu[nmap] xu[nmap] +syn keyword vimCommand contained com[mand] comc[lear] comp[iler] con[tinue] conf[irm] cons[t] cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cw[indow] d[elete] delm[arks] deb[ug] debugg[reedy] def defc[ompile] defe[r] delc[ommand] delf[unction] di[splay] dif[fupdate] diffg[et] diffo[ff] diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] el[se] elsei[f] em[enu] en[dif] endin[terface] endc[lass] endd[ef] ende[num] endf[unction] endfo[r] endt[ry] endw[hile] ene[w] enu[m] ev[al] ex exi[t] exp[ort] exu[sage] f[ile] files filet[ype] filt[er] fin[d] fina[l] finall[y] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] foldd[oopen] folddoc[losed] foldo[pen] for fu[nction] g[lobal] +syn keyword vimCommand contained go[to] gr[ep] grepa[dd] gu[i] gv[im] h[elp] helpc[lose] helpf[ind] helpg[rep] helpt[ags] ha[rdcopy] hi[ghlight] hid[e] his[tory] ho[rizontal] iabc[lear] if ij[ump] il[ist] imp[ort] int[ro] inte[rface] is[earch] isp[lit] j[oin] ju[mps] k kee[pmarks] keepj[umps] keepp[atterns] keepa[lt] l[ist] lN[ext] lNf[ile] la[st] lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lc[d] lch[dir] lcl[ose] lcs[cope] ld[o] le[ft] lefta[bove] let lex[pr] leg[acy] lf[ile] lfd[o] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lgr[ep] lgrepa[dd] lh[elpgrep] lhi[story] ll lla[st] lli[st] lmak[e] lne[xt] lnew[er] lnf[ile] lo[adview] loadk[eymap] loc[kmarks] lockv[ar] lol[der] lop[en] lp[revious] +syn keyword vimCommand contained lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks mat[ch] menut[ranslate] mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] popu[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] python3 py3f[ile] pyx pyxd[o] pythonx pyxf[ile] q[uit] quita[ll] qa[ll] r[ead] +syn keyword vimCommand contained rec[over] red[o] redi[r] redr[aw] redraws[tatus] redrawt[abline] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] ru[ntime] rub[y] rubyd[o] rubyf[ile] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] san[dbox] sav[eas] sb[uffer] sbN[ext] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] sc[riptnames] scripte[ncoding] scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] si[malt] sig[n] sil[ent] sl[eep] sla[st] sn[ext] so[urce] sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sr[ewind] st[op] sta[g] star[tinsert] startg[replace] startr[eplace] stat[ic] stopi[nsert] stj[ump] sts[elect] sun[hide] sus[pend] sv[iew] sw[apname] +syn keyword vimCommand contained synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tab tabc[lose] tabd[o] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] tabp[revious] tabN[ext] tabr[ewind] tabs tc[d] tch[dir] tcl tcld[o] tclf[ile] te[aroff] ter[minal] tf[irst] th[row] thi[s] tj[ump] tl[ast] tm[enu] tn[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu[nmenu] ty[pe] u[ndo] undoj[oin] undol[ist] unh[ide] unl[et] unlo[ckvar] uns[ilent] up[date] v[global] ve[rsion] verb[ose] vert[ical] vi[sual] vie[w] vim[grep] vimgrepa[dd] vim9[cmd] vim9s[cript] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wh[ile] wi[nsize] winc[md] wind[o] winp[os] wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] xa[ll] xr[estore] y[ank] z dl dell delel +syn keyword vimCommand contained deletl deletel dp dep delp delep deletp deletep a i syn keyword vimCommand contained 2mat[ch] 3mat[ch] @@ -218,6 +214,8 @@ syn match vimVar "\s\zs&t_k;" syn match vimFBVar contained "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>" syn keyword vimCommand contained in +syn cluster vimExprList contains=vimEnvvar,vimFunc,vimFuncVar,vimNumber,vimOper,vimOperParen,vimLetRegister,vimString,vimVar + " Insertions And Appends: insert append {{{2 " (buftype != nofile test avoids having append, change, insert show up in the command window) " ======================= @@ -387,11 +385,11 @@ syn match vimEscape contained "\\\o\{1,3}\|\\[xX]\x\{1,2}\|\\u\x\{1,4}\|\\U\x\{1 syn match vimEscape contained "\\<" contains=vimNotation syn match vimEscape contained "\\<\*[^>]*>\=>" -syn region vimString start=+$'+ end=+'+ skip=+''+ oneline contains=vimStringInterpolationBrace,vimStringInterpolationExpr -syn region vimString start=+$"+ end=+"+ oneline contains=@vimStringGroup,vimStringInterpolationBrace,vimStringInterpolationExpr -syn region vimStringInterpolationExpr matchgroup=vimSep start=+{+ end=+}+ oneline contains=vimFunc,vimFuncVar,vimOper,vimOperParen,vimNotation,vimNumber,vimString,vimVar -syn match vimStringInterpolationBrace "{{" -syn match vimStringInterpolationBrace "}}" +syn region vimString oneline start=+$'+ skip=+''+ end=+'+ contains=vimStringInterpolationBrace,vimStringInterpolationExpr +syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,vimStringInterpolationBrace,vimStringInterpolationExpr +syn region vimStringInterpolationExpr oneline contained matchgroup=vimSep start=+{+ end=+}+ contains=@vimExprList +syn match vimStringInterpolationBrace contained "{{" +syn match vimStringInterpolationBrace contained "}}" " Substitutions: {{{2 " ============= @@ -486,13 +484,17 @@ syn match vimAutoCmdMod "\(++\)\=\(once\|nested\)" " Echo And Execute: -- prefer strings! {{{2 " ================ -syn region vimEcho oneline excludenl matchgroup=vimCommand start="\" skip="\(\\\\\)*\\|" end="$\||" contains=vimFunc,vimFuncVar,vimString,vimVar -syn region vimExecute oneline excludenl matchgroup=vimCommand start="\" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar -syn match vimEchoHL "echohl\=" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone +" GEN_SYN_VIM: vimCommand echo, START_STR='syn keyword vimEcho', END_STR='skipwhite nextgroup=vimEchoExpr' +syn keyword vimEcho ec[ho] echoe[rr] echom[sg] echoc[onsole] echon echow[indow] skipwhite nextgroup=vimEchoExpr +syn region vimEchoExpr contained start="[^[:space:]|]" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" end="$" contains=@vimContinue,@vimExprList + +syn match vimEchoHL "\" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone syn case ignore syn keyword vimEchoHLNone none syn case match +syn region vimExecute oneline excludenl matchgroup=vimCommand start="\" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar + " Maps: {{{2 " ==== syn match vimMap "\\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapLhs @@ -997,6 +999,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimContinue Special hi def link vimContinueComment vimComment hi def link vimCtrlChar SpecialChar + hi def link vimEcho vimCommand hi def link vimEchoHLNone vimGroup hi def link vimEchoHL vimCommand hi def link vimElseIfErr Error From e84d2d4432cd6e43f2bb300d02abc90d551bcf4a Mon Sep 17 00:00:00 2001 From: dkearns Date: Wed, 28 Feb 2024 06:00:32 +1100 Subject: [PATCH 099/426] runtime(sh): Update ftplugin, fix #14101 (#14102) Add the 'b' flag to 'comments', so that the shebang line is not detected as comment. Fixes #14101. Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/ftplugin/sh.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim index fccfe4be91..6d2093bf83 100644 --- a/runtime/ftplugin/sh.vim +++ b/runtime/ftplugin/sh.vim @@ -4,7 +4,7 @@ " Previous Maintainer: Dan Sharp " Contributor: Enno Nagel " Eisuke Kawashima -" Last Change: 2024 Jan 14 +" Last Change: 2024 Feb 27 if exists("b:did_ftplugin") finish @@ -14,7 +14,7 @@ let b:did_ftplugin = 1 let s:save_cpo = &cpo set cpo-=C -setlocal comments=:# +setlocal comments=b:# setlocal commentstring=#\ %s setlocal formatoptions-=t formatoptions+=croql From da0c9137d1ec96f4d79b818502d2f921a21f710e Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Tue, 27 Feb 2024 20:25:10 +0100 Subject: [PATCH 100/426] patch 9.1.0140: cursor on wrong row after 1 char 'below' virtual text when EOL is shown Problem: The cursor screen row was incorrectly being calculated when the cursor follows a 1 character text_align 'below' virtual text line, resulting in the cursor being shown on the wrong line. This was caused by a cell size of 2 instead of 1 being used for the EOL character, which propagated to the calculation of space for putting the 'below' virtual text on its own line. (rickhowe) Solution: Fix the size used for the EOL character in calculating the cursor's screen position (Dylan Thacker-Smith) fixes: #11959 related: #12028 closes: #14096 Signed-off-by: Dylan Thacker-Smith Signed-off-by: Christian Brabandt --- src/charset.c | 8 ++++++-- .../dumps/Test_prop_above_below_empty_1.dump | 20 +++++++++---------- .../dumps/Test_prop_above_below_empty_2.dump | 20 +++++++++---------- .../dumps/Test_prop_above_below_empty_3.dump | 20 +++++++++---------- .../dumps/Test_prop_above_below_empty_4.dump | 20 +++++++++---------- .../dumps/Test_prop_above_below_empty_5.dump | 20 +++++++++---------- src/testdir/test_textprop.vim | 5 +++-- src/version.c | 2 ++ 8 files changed, 61 insertions(+), 54 deletions(-) diff --git a/src/charset.c b/src/charset.c index 919885df07..9f4c0ae828 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1160,8 +1160,12 @@ win_lbr_chartabsize( * First get the normal size, without 'linebreak' or text properties */ size = win_chartabsize(wp, s, vcol); - if (*s == NUL && !has_lcs_eol) - size = 0; // NUL is not displayed + if (*s == NUL) + { + // 1 cell for EOL list char (if present), as opposed to the two cell ^@ + // for a NUL character in the text. + size = has_lcs_eol ? 1 : 0; + } # ifdef FEAT_LINEBREAK int is_doublewidth = has_mbyte && size == 2 && MB_BYTE2LEN(*s) > 1; # endif diff --git a/src/testdir/dumps/Test_prop_above_below_empty_1.dump b/src/testdir/dumps/Test_prop_above_below_empty_1.dump index f47001693e..1cc6d01c32 100644 --- a/src/testdir/dumps/Test_prop_above_below_empty_1.dump +++ b/src/testdir/dumps/Test_prop_above_below_empty_1.dump @@ -1,16 +1,16 @@ -| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|1| |1+0#0000000&@7| @47 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|2| | +0#0000000&@55 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|3| |3+0#0000000&@8| @46 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|4| | +0#0000000&@55 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|5| >5+0#0000000&@10| @44 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 @42|5|,|1|-|5|7| @7|A|l@1| diff --git a/src/testdir/dumps/Test_prop_above_below_empty_2.dump b/src/testdir/dumps/Test_prop_above_below_empty_2.dump index 3954a4b062..db117241a3 100644 --- a/src/testdir/dumps/Test_prop_above_below_empty_2.dump +++ b/src/testdir/dumps/Test_prop_above_below_empty_2.dump @@ -1,16 +1,16 @@ -| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|1| |1+0#0000000&@7|$+0#4040ff13&| +0#0000000&@46 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|2| |$+0#4040ff13&| +0#0000000&@54 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|3| |3+0#0000000&@8|$+0#4040ff13&| +0#0000000&@45 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|4| |$+0#4040ff13&| +0#0000000&@54 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|5| >5+0#0000000&@10|$+0#4040ff13&| +0#0000000&@43 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 |:|s|e|t| |l|i|s|t| @32|5|,|1|-|5|7| @7|A|l@1| diff --git a/src/testdir/dumps/Test_prop_above_below_empty_3.dump b/src/testdir/dumps/Test_prop_above_below_empty_3.dump index 27f9eec580..78f30b726d 100644 --- a/src/testdir/dumps/Test_prop_above_below_empty_3.dump +++ b/src/testdir/dumps/Test_prop_above_below_empty_3.dump @@ -1,16 +1,16 @@ -| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|1| |1+0#0000000&@7| | +0&#ffd7d7255| +0&#ffffff0@45 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|2| | +0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|3| |3+0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|4| | +0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|5| >5+0#0000000&@8|5+0&#ffd7d7255|5+0&#ffffff0| @44 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 |:| @40|5|,|1|-|5|7| @7|A|l@1| diff --git a/src/testdir/dumps/Test_prop_above_below_empty_4.dump b/src/testdir/dumps/Test_prop_above_below_empty_4.dump index cc3c27d0f5..2c7bf4d9ed 100644 --- a/src/testdir/dumps/Test_prop_above_below_empty_4.dump +++ b/src/testdir/dumps/Test_prop_above_below_empty_4.dump @@ -1,16 +1,16 @@ -| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|4| |1+0#0000000&@7| @47 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|3| | +0#0000000&@55 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|2| |3+0#0000000&@8| @46 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|1| | +0#0000000&@55 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 |5+0#af5f00255&| @2>5+0#0000000&@10| @44 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 |:| @40|5|,|1|-|5|7| @7|A|l@1| diff --git a/src/testdir/dumps/Test_prop_above_below_empty_5.dump b/src/testdir/dumps/Test_prop_above_below_empty_5.dump index 5ee4d80767..1928ea2215 100644 --- a/src/testdir/dumps/Test_prop_above_below_empty_5.dump +++ b/src/testdir/dumps/Test_prop_above_below_empty_5.dump @@ -1,16 +1,16 @@ -| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|2| |1+0#0000000&@7| @47 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|1| | +0#0000000&@55 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 |3+0#af5f00255&| @2>3+0#0000000&@8| @46 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|1| | +0#0000000&@55 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 -| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54 | +0#af5f00255&@1|2| |5+0#0000000&@10| @44 -| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54 |:| @40|3|,|1|-|5|7| @7|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 18ff3df2ee..7542c08da1 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -3075,8 +3075,9 @@ func Test_prop_with_text_above_below_empty() let vt = 'test' call prop_type_add(vt, {'highlight': 'ToDo'}) for ln in range(1, line('$')) - call prop_add(ln, 0, {'type': vt, 'text': '---', 'text_align': 'above'}) - call prop_add(ln, 0, {'type': vt, 'text': '+++', 'text_align': 'below'}) + " use 1 character text to test for off-by-one regressions + call prop_add(ln, 0, {'type': vt, 'text': '-', 'text_align': 'above'}) + call prop_add(ln, 0, {'type': vt, 'text': '+', 'text_align': 'below'}) endfor normal G END diff --git a/src/version.c b/src/version.c index 07d2558e2a..673c707c7d 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 140, /**/ 139, /**/ From 0c98a71236e6eca983fed5d903d07bd53190d16b Mon Sep 17 00:00:00 2001 From: Antonio Giovanni Colombo Date: Tue, 27 Feb 2024 22:41:22 +0100 Subject: [PATCH 101/426] translation(it): Update Italian translation Signed-off-by: Antonio Giovanni Colombo Signed-off-by: Christian Brabandt --- src/po/it.po | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/po/it.po b/src/po/it.po index 66a3bfa3b2..5006967c1f 100644 --- a/src/po/it.po +++ b/src/po/it.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-12-27 16:38+0100\n" +"PO-Revision-Date: 2024-02-27 10:30+0100\n" "Last-Translator: Antonio Colombo \n" "Language-Team: Italian\n" "Language: it\n" @@ -163,6 +163,9 @@ msgstr " (file %d di %d)" msgid " (file (%d) of %d)" msgstr " (file (%d) di %d)" +msgid "[Command Line]" +msgstr "[Riga-di-comando]" + msgid "[Prompt]" msgstr "[Richiesta]" @@ -647,9 +650,6 @@ msgstr "Errore" msgid "Interrupt" msgstr "Interruzione" -msgid "[Command Line]" -msgstr "[Riga-di-comando]" - msgid "is a directory" msgstr "è una directory" @@ -1366,6 +1366,9 @@ msgstr "argomento di mapnew()" msgid "filter() argument" msgstr "argomento di filter()" +msgid "foreach() argument" +msgstr "argomento di foreach()" + msgid "extendnew() argument" msgstr "argomento di extendnew()" @@ -2404,6 +2407,12 @@ msgstr "a %s su %s" msgid "Printing '%s'" msgstr "Stampato: '%s'" +#. Default font name for current language on MS-Windows. +#. If not translated, falls back to "Consolas". +#. This must be a fixed-pitch font. +msgid "DefaultFontNameForWindows" +msgstr "NomeCarattereDefaultPerWindows" + msgid "Opening the X display took %ld msec" msgstr "Attivazione visualizzazione X ha richiesto %ld msec" @@ -3250,11 +3259,11 @@ msgstr "%s ritorno #%ld" msgid "%s returning %s" msgstr "%s ritorno %s" -msgid "Function %s does not need compiling" -msgstr "La funzione %s non ha bisogno di compilazione" +msgid "Function %s%s%s does not need compiling" +msgstr "La funzione %s%s%s non ha bisogno di compilazione" msgid "%s (%s, compiled %s)" -msgstr "%s (%s, compilato %s)" +msgstr "%s (%s, compilata %s)" msgid "" "\n" @@ -3986,6 +3995,9 @@ msgstr "E104: Escape non consentito nei digrammi" msgid "E105: Using :loadkeymap not in a sourced file" msgstr "E105: Uso di :loadkeymap fuori da un file di comandi" +msgid "E106: Unsupported diff output format: %s" +msgstr "E106: Formato output di diff non supportato: %s" + msgid "E107: Missing parentheses: %s" msgstr "E107: Mancano parentesi: %s" @@ -4272,8 +4284,8 @@ msgstr "E196: Digrammi non supportati in questa versione" msgid "E197: Cannot set language to \"%s\"" msgstr "E197: Non posso impostare lingua a \"%s\"" -msgid "E199: Active window or buffer deleted" -msgstr "E199: Finestra attiva o buffer cancellato" +msgid "E199: Active window or buffer changed or deleted" +msgstr "E199: Finestra attiva o buffer modificato o cancellato" msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "E200: Gli autocomandi *ReadPre hanno reso il file illeggibile" @@ -8076,8 +8088,16 @@ msgstr "E1509: Errore in lettura o scrittura degli attributi estesi" msgid "E1510: Value too large: %s" msgstr "E1510: Valore troppo grande: %s" +msgid "E1511: Wrong number of characters for field \"%s\"" +msgstr "E1511: Numero caratteri errato per campo \"%s\"" + +msgid "E1512: Wrong character width for field \"%s\"" +msgstr "E1512: Larghezza carattere errata per campo \"%s\"" + #. type of cmdline window or 0 #. result of cmdline window or 0 +#. buffer of cmdline window or NULL +#. window of cmdline window or NULL msgid "--No lines in buffer--" msgstr "--File vuoto--" From 56824430c02bd557cc41737eacd3edb2453ed4f9 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 28 Feb 2024 21:24:25 +0100 Subject: [PATCH 102/426] runtime(syntax-tests): simplify code and allow filetype options The whole testdir/runtest.vim is a bit of a mess. So this is an attempt to improving the current state. First of all, let's move most of the code into a single RunTest() function so that it's easier to run this manually. Then, let's add the possibility to customize filetype specific tests by applying filetype specific options. We will make use of it in the next commit, where the provided java file uses tabs, which cause line wrapping which will then cause the scrolling to miss some lines when redrawing (see #14105) related: #14105 Signed-off-by: Christian Brabandt --- runtime/syntax/Makefile | 3 + runtime/syntax/testdir/dumps/c_00.dump | 2 +- .../syntax/testdir/dumps/modula2_iso_00.dump | 2 +- .../syntax/testdir/dumps/modula2_pim_00.dump | 2 +- .../syntax/testdir/dumps/modula2_r10_00.dump | 2 +- .../testdir/dumps/vim_ex_abbreviate_00.dump | 2 +- .../testdir/dumps/vim_ex_behave_00.dump | 2 +- .../testdir/dumps/vim_ex_behave_99.dump | 2 +- .../testdir/dumps/vim_ex_commands_00.dump | 2 +- .../syntax/testdir/dumps/vim_ex_echo_00.dump | 2 +- .../syntax/testdir/dumps/vim_ex_map_00.dump | 2 +- .../testdir/dumps/vim_ex_substitute_00.dump | 2 +- runtime/syntax/testdir/dumps/vim_expr_00.dump | 2 +- .../testdir/dumps/vim_key_notation_00.dump | 2 +- .../syntax/testdir/dumps/vim_keymap_00.dump | 2 +- .../dumps/vim_line_continuation_00.dump | 2 +- runtime/syntax/testdir/dumps/vim_new_00.dump | 2 +- runtime/syntax/testdir/dumps/vim_new_99.dump | 2 +- .../syntax/testdir/dumps/vim_syntax_00.dump | 2 +- .../testdir/dumps/vim_variables_00.dump | 2 +- runtime/syntax/testdir/runtest.vim | 292 +++++++++--------- 21 files changed, 176 insertions(+), 157 deletions(-) diff --git a/runtime/syntax/Makefile b/runtime/syntax/Makefile index 945308fd7c..bc6de0bc26 100644 --- a/runtime/syntax/Makefile +++ b/runtime/syntax/Makefile @@ -1,5 +1,8 @@ # Portable Makefile for running syntax tests. +# To run the test manually: +# ../../src/vim -u 'testdir/runtest.vim' --cmd 'breakadd func RunTest' + # Override this if needed, the default assumes Vim was build in the src dir. #VIMPROG = vim VIMPROG = ../../src/vim diff --git a/runtime/syntax/testdir/dumps/c_00.dump b/runtime/syntax/testdir/dumps/c_00.dump index d32cbd22ff..46c42f1d68 100644 --- a/runtime/syntax/testdir/dumps/c_00.dump +++ b/runtime/syntax/testdir/dumps/c_00.dump @@ -17,4 +17,4 @@ |#+0#e000e06&| |i|n|c|l|u|d|e| |<+0#e000002&|l|i|m|i|t|s|.|h|>| +0#0000000&@54 |#+0#e000e06&|e|n|d|i|f| +0#0000000&@68 @75 -|"|i|n|p|u|t|/|c|.|c|"| |1|2@1|L|,| |3|1|7|4|B| @33|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/modula2_iso_00.dump b/runtime/syntax/testdir/dumps/modula2_iso_00.dump index 797376fc1d..0c24cb8603 100644 --- a/runtime/syntax/testdir/dumps/modula2_iso_00.dump +++ b/runtime/syntax/testdir/dumps/modula2_iso_00.dump @@ -17,4 +17,4 @@ |(+0#0000e05&|*| |p|r|e|d|e|f|i|n|e|d| |c|o|n|s|t|a|n|t|s| |*|)| +0#0000000&@48 |F+0#e000002&|A|L|S|E| +0#0000000&|N+0#e000002&|I|L| +0#0000000&|T+0#e000002&|R|U|E| +0#0000000&|I+0#e000002&|N|T|E|R@1|U|P|T|I|B|L|E| +0#0000000&|U+0#e000002&|N|I|N|T|E|R@1|U|P|T|I|B|L|E| +0#0000000&@30 @75 -|"|i|n|p|u|t|/|m|o|d|u|l|a|2|_|i|s|o|.|d|e|f|"| |1@1|4|L|,| |2|3|1|8|B| @21|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/modula2_pim_00.dump b/runtime/syntax/testdir/dumps/modula2_pim_00.dump index 5e85b7aa80..36aa0deecd 100644 --- a/runtime/syntax/testdir/dumps/modula2_pim_00.dump +++ b/runtime/syntax/testdir/dumps/modula2_pim_00.dump @@ -17,4 +17,4 @@ |F+0#e000002&|A|L|S|E| +0#0000000&|N+0#e000002&|I|L| +0#0000000&|T+0#e000002&|R|U|E| +0#0000000&@60 @75 |(+0#0000e05&|*| |p|r|e|d|e|f|i|n|e|d| |t|y|p|e|s| |*|)| +0#0000000&@52 -|"|i|n|p|u|t|/|m|o|d|u|l|a|2|_|p|i|m|.|d|e|f|"| |1@2|L|,| |2|1|9|7|B| @21|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/modula2_r10_00.dump b/runtime/syntax/testdir/dumps/modula2_r10_00.dump index ab4167abf5..a2e475ef9f 100644 --- a/runtime/syntax/testdir/dumps/modula2_r10_00.dump +++ b/runtime/syntax/testdir/dumps/modula2_r10_00.dump @@ -17,4 +17,4 @@ |N+0#e000002&|I|L| +0#0000000&|F+0#e000002&|A|L|S|E| +0#0000000&|T+0#e000002&|R|U|E| +0#0000000&@60 @75 |(+0#0000e05&|*| |p|r|e|d|e|f|i|n|e|d| |t|y|p|e|s| |*|)| +0#0000000&@52 -|"|i|n|p|u|t|/|m|o|d|u|l|a|2|_|r|1|0|.|d|e|f|"| |1|4|6|L|,| |2|9|8|3|B| @21|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_abbreviate_00.dump b/runtime/syntax/testdir/dumps/vim_ex_abbreviate_00.dump index 68055d8a6b..5224a4f6e5 100644 --- a/runtime/syntax/testdir/dumps/vim_ex_abbreviate_00.dump +++ b/runtime/syntax/testdir/dumps/vim_ex_abbreviate_00.dump @@ -17,4 +17,4 @@ |i+0#af5f00255&|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|e|x|p|r|>| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|i|f|o@1| |c|f|o@1|b|a|r| @38 @75 |u+0#af5f00255&|n|a|b@1|r|e|v| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&|f|o@1| @53 -|"|i|n|p|u|t|/|v|i|m|_|e|x|_|a|b@1|r|e|v|i|a|t|e|.|v|i|m|"| |2|5|L|,| |5@1|8|B| @17|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_behave_00.dump b/runtime/syntax/testdir/dumps/vim_ex_behave_00.dump index cd88b75375..b3c57de6f3 100644 --- a/runtime/syntax/testdir/dumps/vim_ex_behave_00.dump +++ b/runtime/syntax/testdir/dumps/vim_ex_behave_00.dump @@ -17,4 +17,4 @@ |~| @73 |~| @73 |~| @73 -|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|e|x|_|b|e|h|a|v|e|.|v|i|m|"| |7|L|,| |7@1|B| @23|1|,|1| @10|A|l@1| +| +0#0000000&@56|1|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/dumps/vim_ex_behave_99.dump b/runtime/syntax/testdir/dumps/vim_ex_behave_99.dump index a0a0e188c8..c3fefebd3b 100644 --- a/runtime/syntax/testdir/dumps/vim_ex_behave_99.dump +++ b/runtime/syntax/testdir/dumps/vim_ex_behave_99.dump @@ -17,4 +17,4 @@ |~| @73 |~| @73 |~| @73 -|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|e|x|_|b|e|h|a|v|e|.|v|i|m|"| |7|L|,| |7@1|B| @23|7|,|1| @10|A|l@1| +| +0#0000000&@56|7|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/dumps/vim_ex_commands_00.dump b/runtime/syntax/testdir/dumps/vim_ex_commands_00.dump index f3e48c0dbf..863ae382c9 100644 --- a/runtime/syntax/testdir/dumps/vim_ex_commands_00.dump +++ b/runtime/syntax/testdir/dumps/vim_ex_commands_00.dump @@ -17,4 +17,4 @@ |:|3+0#af5f00255&|m|a|t|c|h| +0#0000000&@67 |:+0#af5f00255&|a|p@1|e|n|d| +0#0000000&@67 | +0#e000002&@3|t|e|x|t| +0#0000000&@66 -|"|i|n|p|u|t|/|v|i|m|_|e|x|_|c|o|m@1|a|n|d|s|.|v|i|m|"| |1@1|9|5|L|,| |1|7|3|0|1|B| @15|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump b/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump index 506c9e2d87..a626c7b247 100644 --- a/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump +++ b/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump @@ -17,4 +17,4 @@ @75 |"+0#0000e05&| |:|e|c|h|o| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@52 |e+0#af5f00255&|c|h|o||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@58 -|"|i|n|p|u|t|/|v|i|m|_|e|x|_|e|c|h|o|.|v|i|m|"| |2|0|L|,| |3|6|2|B| @23|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_map_00.dump b/runtime/syntax/testdir/dumps/vim_ex_map_00.dump index 032eeb4169..371c1ce664 100644 --- a/runtime/syntax/testdir/dumps/vim_ex_map_00.dump +++ b/runtime/syntax/testdir/dumps/vim_ex_map_00.dump @@ -17,4 +17,4 @@ |o+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 |i+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 |l+0#af5f00255&|m|a|p|c|l|e|a|r| +0#0000000&|<+0#e000e06&|b|u|f@1|e|r|>| +0#0000000&@56 -|"|i|n|p|u|t|/|v|i|m|_|e|x|_|m|a|p|.|v|i|m|"| |2|1|L|,| |3|1|6|B| @24|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_substitute_00.dump b/runtime/syntax/testdir/dumps/vim_ex_substitute_00.dump index 31094c952d..aea97ed4bf 100644 --- a/runtime/syntax/testdir/dumps/vim_ex_substitute_00.dump +++ b/runtime/syntax/testdir/dumps/vim_ex_substitute_00.dump @@ -17,4 +17,4 @@ |:|s+0#af5f00255&|m|a|g|i|c|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|c|e|g|i|I|n|p|#|l|r| +0#0000000&@48 @75 |c+0#af5f00255&|a|l@1| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&||| |s+0#af5f00255&|u|b|s|t|i|t|u|t|e|/+0#e000e06&|f+0#0000000&|o@1|/+0#e000e06&|b+0#0000000&|a|r|/+0#e000e06&|&| +0#0000000&@41 -|"|i|n|p|u|t|/|v|i|m|_|e|x|_|s|u|b|s|t|i|t|u|t|e|.|v|i|m|"| |8|6|L|,| |1|5|1|0|B| @16|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_expr_00.dump b/runtime/syntax/testdir/dumps/vim_expr_00.dump index dd1cfa71da..899b73cd91 100644 --- a/runtime/syntax/testdir/dumps/vim_expr_00.dump +++ b/runtime/syntax/testdir/dumps/vim_expr_00.dump @@ -17,4 +17,4 @@ |e+0#af5f00255&|c|h|o| +0#0000000&|$+0#e000002&|'|\|3|1|6| |\|3|1| |\|3| |\|x|1|f| |\|x|f| |\|X|1|F| |\|X|F| |\|u|0|2|a|4| |\|U|0@4|2|a|4| |\|b| |\|e| |\|f| |\|n| |\|r| |\|t| |\@1 | |\|"| |\|<|C|-|W|>|'| +0#0000000&@63 |e+0#af5f00255&|c|h|o| +0#0000000&|$+0#e000002&|"|\+0#e000e06&|3|1|6|0+0#e000002&| |-| |\+0#e000e06&|x|1|f|0+0#e000002&| |-| |\+0#e000e06&|X|1|F|0+0#e000002&| |-| |\+0#e000e06&|u|0|2|a|4|0+0#e000002&| |-| |\+0#e000e06&|U|0@4|2|a|4|0+0#e000002&|"| +0#0000000&@21 -|"|i|n|p|u|t|/|v|i|m|_|e|x|p|r|.|v|i|m|"| |3|1|L|,| |1@1|6|2|B| @25|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_key_notation_00.dump b/runtime/syntax/testdir/dumps/vim_key_notation_00.dump index 8b77cf347b..ed58e2fdec 100644 --- a/runtime/syntax/testdir/dumps/vim_key_notation_00.dump +++ b/runtime/syntax/testdir/dumps/vim_key_notation_00.dump @@ -17,4 +17,4 @@ |<+0#e000e06&|x|C|S|I|>| +0#0000000&@68 |<+0#e000e06&|B|a|r|>| +0#0000000&@69 |<+0#e000e06&|B|s|l|a|s|h|>| +0#0000000&@66 -|"|i|n|p|u|t|/|v|i|m|_|k|e|y|_|n|o|t|a|t|i|o|n|.|v|i|m|"| |1|6|3|L|,| |1|3|4|6|B| @16|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_keymap_00.dump b/runtime/syntax/testdir/dumps/vim_keymap_00.dump index 974c5ad31c..2c43e3dada 100644 --- a/runtime/syntax/testdir/dumps/vim_keymap_00.dump +++ b/runtime/syntax/testdir/dumps/vim_keymap_00.dump @@ -17,4 +17,4 @@ |s+0#af5f00255&|c|r|i|p|t|e|n|c|o|d|i|n|g| +0#0000000&|u|t|f|-+0#af5f00255&|8+0#e000002&| +0#0000000&@54 @75 |@+0#4040ff13&@2| @71 -|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|k|e|y|m|a|p|.|v|i|m|"| |2|6|L|,| |3|9@1|2|B| @23|1|,|1| @10|T|o|p| +| +0#0000000&@56|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_line_continuation_00.dump b/runtime/syntax/testdir/dumps/vim_line_continuation_00.dump index 7733c0b1a5..3bc4ebaa50 100644 --- a/runtime/syntax/testdir/dumps/vim_line_continuation_00.dump +++ b/runtime/syntax/testdir/dumps/vim_line_continuation_00.dump @@ -17,4 +17,4 @@ @8|\+0#e000e06&| +0#0000000&|b+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|b|}+0#e000e06&|,+0#0000000&| @54 | +0#0000e05&@7|"|\| |p|r|i|n|t| |c| +0#0000000&@56 @8|\+0#e000e06&| +0#0000000&|c+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|c|}+0#e000e06&| +0#0000000&@55 -|"|i|n|p|u|t|/|v|i|m|_|l|i|n|e|_|c|o|n|t|i|n|u|a|t|i|o|n|.|v|i|m|"| |4|9|L|,| |6|2|6|B| @13|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_new_00.dump b/runtime/syntax/testdir/dumps/vim_new_00.dump index 6306faefad..2ff76f4adf 100644 --- a/runtime/syntax/testdir/dumps/vim_new_00.dump +++ b/runtime/syntax/testdir/dumps/vim_new_00.dump @@ -17,4 +17,4 @@ |q+0#af5f00255&|u|i|t| +0#0000000&@70 |~+0#4040ff13&| @73 |~| @73 -|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|n|e|w|.|v|i|m|"| |1|7|L|,| |2|0|5|B| @27|1|,|1| @10|A|l@1| +| +0#0000000&@56|1|,|1| @10|A|l@1| diff --git a/runtime/syntax/testdir/dumps/vim_new_99.dump b/runtime/syntax/testdir/dumps/vim_new_99.dump index 50a54f2807..a9fe50fad3 100644 --- a/runtime/syntax/testdir/dumps/vim_new_99.dump +++ b/runtime/syntax/testdir/dumps/vim_new_99.dump @@ -17,4 +17,4 @@ >q+0#af5f00255&|u|i|t| +0#0000000&@70 |~+0#4040ff13&| @73 |~| @73 -|"+0#0000000&|i|n|p|u|t|/|v|i|m|_|n|e|w|.|v|i|m|"| |1|7|L|,| |2|0|5|B| @27|1|7|,|1| @9|A|l@1| +| +0#0000000&@56|1|7|,|1| @9|A|l@1| diff --git a/runtime/syntax/testdir/dumps/vim_syntax_00.dump b/runtime/syntax/testdir/dumps/vim_syntax_00.dump index 21dcc8893c..916f96dc4a 100644 --- a/runtime/syntax/testdir/dumps/vim_syntax_00.dump +++ b/runtime/syntax/testdir/dumps/vim_syntax_00.dump @@ -17,4 +17,4 @@ @6|"+0#0000e05&|\| |c|o|n|t|a|i|n|e|d| |o|p|t|i|o|n| +0#0000000&@49 @6|\+0#e000e06&| +0#0000000&|c+0#e000e06&|o|n|t|a|i|n|e|d| +0#0000000&@57 @6|"+0#0000e05&|\| |c|o|n|t|a|i|n|e|d|i|n| |o|p|t|i|o|n| +0#0000000&@47 -|"|i|n|p|u|t|/|v|i|m|_|s|y|n|t|a|x|.|v|i|m|"| |1|6|4|L|,| |3|7|2|9|B| @22|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_variables_00.dump b/runtime/syntax/testdir/dumps/vim_variables_00.dump index 9794113405..da77064afc 100644 --- a/runtime/syntax/testdir/dumps/vim_variables_00.dump +++ b/runtime/syntax/testdir/dumps/vim_variables_00.dump @@ -17,4 +17,4 @@ |l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|/+0#af5f00255&|=| +0#0000000&|e|x|p|r| @59 |l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|%+0#af5f00255&|=| +0#0000000&|e|x|p|r| @59 |l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|.+0#af5f00255&|=| +0#0000000&|e|x|p|r| @59 -|"|i|n|p|u|t|/|v|i|m|_|v|a|r|i|a|b|l|e|s|.|v|i|m|"| |1|3|8|L|,| |1|5@1|4|B| @19|1|,|1| @10|T|o|p| +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/runtest.vim b/runtime/syntax/testdir/runtest.vim index d2ce3d19fa..a2cdef3721 100644 --- a/runtime/syntax/testdir/runtest.vim +++ b/runtime/syntax/testdir/runtest.vim @@ -85,164 +85,180 @@ func HandleSwapExists() endif endfunc -let ok_count = 0 -let failed_tests = [] -let skipped_count = 0 -let MAX_FAILED_COUNT = 5 -for fname in glob('input/*.*', 1, 1) - if fname =~ '\~$' - " backup file, skip - continue - endif +func RunTest() + let ok_count = 0 + let failed_tests = [] + let skipped_count = 0 + let MAX_FAILED_COUNT = 5 + for fname in glob('input/*.*', 1, 1) + if fname =~ '\~$' + " backup file, skip + continue + endif + + let linecount = readfile(fname)->len() + let root = fnamemodify(fname, ':t:r') + let filetype = substitute(root, '\([^_.]*\)[_.].*', '\1', '') + let failed_root = 'failed/' .. root + + " Execute the test if the "done" file does not exist or when the input file + " is newer. + let in_time = getftime(fname) + let out_time = getftime('done/' .. root) + if out_time < 0 || in_time > out_time + call ch_log('running tests for: ' .. fname) + + for dumpname in glob(failed_root .. '_\d*\.dump', 1, 1) + call delete(dumpname) + endfor + call delete('done/' .. root) - let linecount = readfile(fname)->len() - let root = fnamemodify(fname, ':t:r') - let filetype = substitute(root, '\([^_.]*\)[_.].*', '\1', '') - let failed_root = 'failed/' .. root - - " Execute the test if the "done" file does not exist or when the input file - " is newer. - let in_time = getftime(fname) - let out_time = getftime('done/' .. root) - if out_time < 0 || in_time > out_time - call ch_log('running tests for: ' .. fname) - - for dumpname in glob(failed_root .. '_\d*\.dump', 1, 1) - call delete(dumpname) - endfor - call delete('done/' .. root) - - let lines =<< trim END - syntax on - - " extra info for shell variables - func ShellInfo() - let msg = '' - for [key, val] in items(b:) - if key =~ '^is_' - let msg ..= key .. ': ' .. val .. ', ' + let lines =<< trim END + syntax on + + " extra info for shell variables + func ShellInfo() + let msg = '' + for [key, val] in items(b:) + if key =~ '^is_' + let msg ..= key .. ': ' .. val .. ', ' + endif + endfor + if msg != '' + echomsg msg endif - endfor - if msg != '' - echomsg msg - endif - endfunc - - au! SwapExists * call HandleSwapExists() - func HandleSwapExists() - " Ignore finding a swap file for the test input, the user might be - " editing it and that's OK. - if expand('') =~ 'input[/\\].*\..*' - let v:swapchoice = 'e' - endif - endfunc - END - call writefile(lines, 'Xtestscript') + endfunc + + au! SwapExists * call HandleSwapExists() + func HandleSwapExists() + " Ignore finding a swap file for the test input, the user might be + " editing it and that's OK. + if expand('') =~ 'input[/\\].*\..*' + let v:swapchoice = 'e' + endif + endfunc + + func LoadFiletype(type) + for file in glob("ftplugin/" .. a:type .. "*.vim", 1, 1) + exe "source " .. file + endfor + redraw! + endfunc + + END + call writefile(lines, 'Xtestscript') + + " close all but the last window + while winnr('$') > 1 + close + endwhile + + " Redraw to make sure that messages are cleared and there is enough space + " for the terminal window. + redraw + + let buf = RunVimInTerminal('-S Xtestscript', {}) + " edit the file only after catching the SwapExists event + call term_sendkeys(buf, ":edit " .. fname .. "\") + " load filetype specific settings + call term_sendkeys(buf, ":call LoadFiletype('" .. filetype .. "')\") + + if filetype == 'sh' + call term_sendkeys(buf, ":call ShellInfo()\") + endif - " close all but the last window - while winnr('$') > 1 - close - endwhile + " Screendump at the start of the file: failed/root_00.dump + let root_00 = root .. '_00' + call ch_log('First screendump for ' .. fname .. ': failed/' .. root_00 .. '.dump') + let fail = VerifyScreenDump(buf, root_00, {}) - " Redraw to make sure that messages are cleared and there is enough space - " for the terminal window. - redraw + " clear the shell info if there are not enough lines to cause a scroll + if filetype == 'sh' && linecount <= 19 + call term_sendkeys(buf, ":redraw\") + endif - let buf = RunVimInTerminal('-S Xtestscript', {}) - " edit the file only after catching the SwapExists event - call term_sendkeys(buf, ":edit " .. fname .. "\") + " Make a Screendump every 18 lines of the file: failed/root_NN.dump + let topline = 1 + let nr = 1 + while linecount - topline > 20 + let topline += 18 + call term_sendkeys(buf, printf("%dGzt", topline)) + let root_next = root .. printf('_%02d', nr) + call ch_log('Next screendump for ' .. fname .. ': failed/' .. root_next .. '.dump') + let fail += VerifyScreenDump(buf, root_next, {}) + let nr += 1 + endwhile + + " Screendump at the end of the file: failed/root_99.dump + call term_sendkeys(buf, 'Gzb') + let root_last = root .. '_99' + call ch_log('Last screendump for ' .. fname .. ': failed/' .. root_last .. '.dump') + let fail += VerifyScreenDump(buf, root_last, {}) + + call StopVimInTerminal(buf) + call delete('Xtestscript') + + " redraw here to avoid the following messages to get mixed up with screen + " output. + redraw + + " Add any assert errors to s:messages. + if len(v:errors) > 0 + call extend(s:messages, v:errors) + " Echo the errors here, in case the script aborts or the "messages" file + " is not displayed later. + echomsg v:errors + let v:errors = [] + let fail += 1 + endif - if filetype == 'sh' - call term_sendkeys(buf, ":call ShellInfo()\") - endif + if fail == 0 + call Message("Test " .. root .. " OK") - " Screendump at the start of the file: failed/root_00.dump - let root_00 = root .. '_00' - call ch_log('First screendump for ' .. fname .. ': failed/' .. root_00 .. '.dump') - let fail = VerifyScreenDump(buf, root_00, {}) + call writefile(['OK'], 'done/' .. root) - " clear the shell info if there are not enough lines to cause a scroll - if filetype == 'sh' && linecount <= 19 - call term_sendkeys(buf, ":redraw\") - endif + let ok_count += 1 + else + call Message("Test " .. root .. " FAILED") - " Make a Screendump every 18 lines of the file: failed/root_NN.dump - let topline = 1 - let nr = 1 - while linecount - topline > 20 - let topline += 18 - call term_sendkeys(buf, printf("%dGzt", topline)) - let root_next = root .. printf('_%02d', nr) - call ch_log('Next screendump for ' .. fname .. ': failed/' .. root_next .. '.dump') - let fail += VerifyScreenDump(buf, root_next, {}) - let nr += 1 - endwhile - - " Screendump at the end of the file: failed/root_99.dump - call term_sendkeys(buf, 'Gzb') - let root_last = root .. '_99' - call ch_log('Last screendump for ' .. fname .. ': failed/' .. root_last .. '.dump') - let fail += VerifyScreenDump(buf, root_last, {}) - - call StopVimInTerminal(buf) - call delete('Xtestscript') - - " redraw here to avoid the following messages to get mixed up with screen - " output. - redraw - - " Add any assert errors to s:messages. - if len(v:errors) > 0 - call extend(s:messages, v:errors) - " Echo the errors here, in case the script aborts or the "messages" file - " is not displayed later. - echomsg v:errors - let v:errors = [] - let fail += 1 - endif + call delete('done/' .. root) - if fail == 0 - call Message("Test " .. root .. " OK") - - call writefile(['OK'], 'done/' .. root) - - let ok_count += 1 + eval failed_tests->add(root) + if len(failed_tests) > MAX_FAILED_COUNT + call Message('') + call Message('Too many errors, aborting') + endif + endif else - call Message("Test " .. root .. " FAILED") + call Message("Test " .. root .. " skipped") + let skipped_count += 1 + endif - call delete('done/' .. root) + " Append messages to the file "testdir/messages" + call AppendMessages('Input file ' .. fname .. ':') - eval failed_tests->add(root) - if len(failed_tests) > MAX_FAILED_COUNT - call Message('') - call Message('Too many errors, aborting') - endif + if len(failed_tests) > MAX_FAILED_COUNT + break endif - else - call Message("Test " .. root .. " skipped") - let skipped_count += 1 - endif + endfor - " Append messages to the file "testdir/messages" - call AppendMessages('Input file ' .. fname .. ':') + call Message(s:test_run_message) + call Message('OK: ' .. ok_count) + call Message('FAILED: ' .. len(failed_tests) .. ': ' .. string(failed_tests)) + call Message('skipped: ' .. skipped_count) + call AppendMessages('== SUMMARY ==') - if len(failed_tests) > MAX_FAILED_COUNT - break + if len(failed_tests) > 0 + " have make report an error + cquit endif -endfor - -call Message(s:test_run_message) -call Message('OK: ' .. ok_count) -call Message('FAILED: ' .. len(failed_tests) .. ': ' .. string(failed_tests)) -call Message('skipped: ' .. skipped_count) -call AppendMessages('== SUMMARY ==') +endfunc -if len(failed_tests) > 0 - " have make report an error - cquit -endif +call RunTest() " Matching "if 1" at the start. endif qall! + +" vim:ts=8 From 9ecf02cd5f5feabe096f66cd5f503a822c78793f Mon Sep 17 00:00:00 2001 From: Aliaksei Budavei <0x000c70@gmail.com> Date: Wed, 28 Feb 2024 21:30:22 +0100 Subject: [PATCH 103/426] runtime(java): Recognise _when_ clauses in _switch_ blocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also: - distinguish _yield_ when used as a contextual keyword from when used qualified as a method or a method reference (as can be seen in testdir/input/java_switch.java, variables and method declarations named _yield_ will be recognised as the namesake keyword--consider picking other names for variables, and defining g:java_highlight_functions to have method names painted; since _yield_ statements can have trailing parens, they must be recognised as statements, for only qualified _yield_ method calls are supported); - recognise grouped _default_ _case_ labels; - describe primitive types for _case_ labels (JLS, §14.11, §3.10.1); - recognise some non-ASCII identifiers (see javaLambdaDef, javaUserLabel) (further improvement for better recognition of identifiers will be arranged in a separate PR). Because the arrow '->' is used in two kinds of expressions, lambda (abstractions) and _switch_, necessary changes were made for the recognition of either (and further improvement touching lambda expressions will be separately arranged). Because 'default' is used for instance method declarations in interfaces and in _switch_ labels, necessary changes were made for the recognition of either (and further improvement touching method declarations will be separately arranged). Finally, it deemed appropriate to put 'yield' in the syntax group of javaOperator rather than javaStatement, for its member 'var' is also another contextual keyword (e.g., this is valid syntax: "var var = var(test.var);"). References: https://openjdk.org/jeps/361 (Switch Expressions) https://openjdk.org/jeps/440 (Record Patterns) https://openjdk.org/jeps/441 (Pattern Matching for switch) Also, add a Java specific filetype plugin for the syntax test, so that no soft-wrapping of long indented lines occur. Otherwise the syntax scripts would miss a few lines during scrolling and verification of the screen dumps. closes: #14105 Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com> Signed-off-by: Christian Brabandt --- runtime/syntax/java.vim | 41 ++++-- .../syntax/testdir/dumps/java_switch_00.dump | 20 +++ .../syntax/testdir/dumps/java_switch_01.dump | 20 +++ .../syntax/testdir/dumps/java_switch_02.dump | 20 +++ .../syntax/testdir/dumps/java_switch_03.dump | 20 +++ .../syntax/testdir/dumps/java_switch_04.dump | 20 +++ .../syntax/testdir/dumps/java_switch_05.dump | 20 +++ .../syntax/testdir/dumps/java_switch_06.dump | 20 +++ .../syntax/testdir/dumps/java_switch_99.dump | 20 +++ runtime/syntax/testdir/ftplugin/java.vim | 5 + runtime/syntax/testdir/input/java_switch.java | 122 ++++++++++++++++++ 11 files changed, 320 insertions(+), 8 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/java_switch_00.dump create mode 100644 runtime/syntax/testdir/dumps/java_switch_01.dump create mode 100644 runtime/syntax/testdir/dumps/java_switch_02.dump create mode 100644 runtime/syntax/testdir/dumps/java_switch_03.dump create mode 100644 runtime/syntax/testdir/dumps/java_switch_04.dump create mode 100644 runtime/syntax/testdir/dumps/java_switch_05.dump create mode 100644 runtime/syntax/testdir/dumps/java_switch_06.dump create mode 100644 runtime/syntax/testdir/dumps/java_switch_99.dump create mode 100644 runtime/syntax/testdir/ftplugin/java.vim create mode 100644 runtime/syntax/testdir/input/java_switch.java diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index 44fbfa8398..1b940ebd39 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -2,7 +2,7 @@ " Language: Java " Maintainer: Claudio Fleiner " URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim -" Last Change: 2023 Aug 13 +" Last Change: 2024 Feb 27 " Please check :help java.vim for comments on some of the options available. @@ -37,9 +37,17 @@ syn keyword javaBoolean true false syn keyword javaConstant null syn keyword javaTypedef this super syn keyword javaOperator var new instanceof +" Since the yield statement, which could take a parenthesised operand, +" and _qualified_ yield methods get along within the switch block +" (JLS-17, §3.8), it seems futile to make a region definition for this +" block; instead look for the _yield_ word alone, and if found, +" backtrack (arbitrarily) 80 bytes, at most, on the matched line and, +" if necessary, on the line before that (h: \@<=), trying to match +" neither a method reference nor a qualified method invocation. +syn match javaOperator "\%(\%(::\|\.\)[[:space:]\n]*\)\@80" syn keyword javaType boolean char byte short int long float double syn keyword javaType void -syn keyword javaStatement return yield +syn keyword javaStatement return syn keyword javaStorageClass static synchronized transient volatile final strictfp serializable syn keyword javaExceptions throw try catch finally syn keyword javaAssert assert @@ -56,6 +64,7 @@ syn keyword javaBranch break continue nextgroup=javaUserLabelRef skipwhite syn match javaUserLabelRef "\k\+" contained syn match javaVarArg "\.\.\." syn keyword javaScopeDecl public protected private abstract +syn match javaConceptKind "\\%(\s*\%(:\|->\)\)\@!" function s:isModuleInfoDeclarationCurrentBuffer() abort return fnamemodify(bufname("%"), ":t") =~ '^module-info\%(\.class\>\)\@!' @@ -142,15 +151,30 @@ if exists("java_space_errors") endif endif -syn region javaLabelRegion transparent matchgroup=javaLabel start="\" matchgroup=NONE end=":\|->" contains=javaNumber,javaCharacter,javaString -syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel -syn keyword javaLabel default +syn match javaUserLabel "^\s*\<\K\k*\>\%(\\)\@" matchgroup=NONE end=":\|->" contains=javaLabelCastType,javaLabelNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaLabelDefault,javaLabelVarType,javaLabelWhenClause +syn region javaLabelRegion transparent matchgroup=javaLabel start="\\%(\s*\%(:\|->\)\)\@=" matchgroup=NONE end=":\|->" oneline +" Consider grouped _default_ _case_ labels, i.e. +" case null, default -> +" case null: default: +syn keyword javaLabelDefault contained default +syn keyword javaLabelVarType contained var +syn keyword javaLabelCastType contained char byte short int +" Allow for the contingency of the enclosing region not being able to +" _keep_ its _end_, e.g. case ':':. +syn region javaLabelWhenClause contained transparent matchgroup=javaLabel start="\" matchgroup=NONE end=":"me=e-1 end="->"me=e-2 contains=TOP,javaExternal +syn match javaLabelNumber contained "\<0\>[lL]\@!" +syn match javaLabelNumber contained "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)\>[lL]\@!" +hi def link javaLabelDefault javaLabel +hi def link javaLabelVarType javaOperator +hi def link javaLabelNumber javaNumber +hi def link javaLabelCastType javaType " highlighting C++ keywords as errors removed, too many people find it " annoying. Was: if !exists("java_allow_cpp_keywords") " The following cluster contains all java groups except the contained ones -syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaLabel,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaScopeDecl,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg +syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaScopeDecl,javaConceptKind,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg " Comments @@ -231,9 +255,9 @@ if exists("java_highlight_functions") " 1. class names are always capitalized (ie: Button) " 2. method names are never capitalized (except constructors, of course) "syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses - syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(<.*>\s\+\)\?\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^(){}]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*(+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses,javaAnnotation + syn region javaFuncDef start=+^\s\+\%(\%(public\|protected\|private\|static\|\%(abstract\|default\)\|final\|native\|synchronized\)\s\+\)*\%(<.*>\s\+\)\?\%(\%(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\%([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\%(<[^(){}]*>\)\=\%(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*(+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses,javaAnnotation endif - syn match javaLambdaDef "[a-zA-Z_][a-zA-Z0-9_]*\s*->" + syn match javaLambdaDef "\<\K\k*\>\%(\\)\@" syn match javaBraces "[{}]" syn cluster javaTop add=javaFuncDef,javaBraces,javaLambdaDef endif @@ -326,6 +350,7 @@ hi def link javaStorageClass StorageClass hi def link javaMethodDecl javaStorageClass hi def link javaClassDecl javaStorageClass hi def link javaScopeDecl javaStorageClass +hi def link javaConceptKind NonText hi def link javaBoolean Boolean hi def link javaSpecial Special diff --git a/runtime/syntax/testdir/dumps/java_switch_00.dump b/runtime/syntax/testdir/dumps/java_switch_00.dump new file mode 100644 index 0000000000..95e01426b6 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_switch_00.dump @@ -0,0 +1,20 @@ +>c+0#00e0003#ffffff0|l|a|s@1| +0#0000000&|S|w|i|t|c|h|T|e|s|t|s| @2|/+0#0000e05&@1| |J|D|K| |2|1|+|.| +0#0000000&@43 +|{| @73 +@4|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|e|c|h|o|(|O|b|j|e|c|t| |o|)| |{| |S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|o|)|;| |}| @17 +@75 +@4|s+0#00e0003&|t|a|t|i|c| +0#0000000&|{| @62 +@8|i+0#00e0003&|n|t|e|r|f|a|c|e| +0#0000000&|Y|i|e|l|d|a|b|l|e|<|T|>| @44 +@8|{| @65 +@12|T| |y+0#af5f00255&|i|e|l|d|(+0#0000000&|)|;| @52 +@12|d+0#4040ff13&|e|f|a|u|l|t| +0#0000000&|Y|i|e|l|d|a|b|l|e|<|T|>| |d|e|f|a|u|l|t|_|(|)| |{| |r+0#af5f00255&|e|t|u|r|n| +0#0000000&|t+0#00e0003&|h|i|s|;+0#0000000&| |}| @14 +@12|d+0#4040ff13&|e|f|a|u|l|t| +0#0000000&|Y|i|e|l|d|a|b|l|e|<|T|>| |w|h|e|n|(|)| |{| |r+0#af5f00255&|e|t|u|r|n| +0#0000000&|t+0#00e0003&|h|i|s|;+0#0000000&| |}| @18 +@8|}| @65 +@75 +@8|/+0#0000e05&@1| |T|h|e|r|e| |a|r|e| |8|0| |b|y|t|e|s| |(|\|@|8|0|<|!|)| |b|e|t|w|e@1|n| |"|:@1|"| |a|n|d| |"|y|i|e|l|d|;|"|.| +0#0000000&@9 +@8|Y|i|e|l|d|a|b|l|e|<|?|>| |y| |=| |(@1|Y|i|e|l|d|a|b|l|e|<|?|>|)| |(|)| |-|>| |0+0#e000002&|)+0#0000000&|:@1| @23 +@75 +@4|y|i|e|l|d|;| @64 +@8|(@1|Y|i|e|l|d|a|b|l|e|<|?|>|)| |(|)| |-|>| |0+0#e000002&|)+0#0000000&|.|w|h|e|n|(|)|.|d|e|f|a|u|l|t|_|(|)|.|y|i|e|l|d|(|)|;| @15 +@75 +@8|e+0#00e0003&|n|u|m| +0#0000000&|L|e|t@1|e|r|s| |{| |O|T|H|E|R|,| |A|L|P|H|A|,| |B|E|T|A| |}| @31 +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/java_switch_01.dump b/runtime/syntax/testdir/dumps/java_switch_01.dump new file mode 100644 index 0000000000..0a76a87ff4 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_switch_01.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@74 +@4|y|i|e|l|d|;| @64 +@8|(@1|Y|i|e|l|d|a|b|l|e|<|?|>|)| |(|)| |-|>| |0+0#e000002&|)+0#0000000&|.|w|h|e|n|(|)|.|d|e|f|a|u|l|t|_|(|)|.|y|i|e|l|d|(|)|;| @15 +@75 +@8|e+0#00e0003&|n|u|m| +0#0000000&|L|e|t@1|e|r|s| |{| |O|T|H|E|R|,| |A|L|P|H|A|,| |B|E|T|A| |}| @31 +> @74 +@8|L|e|t@1|e|r|s| |w|h|e|n| |=| |L|e|t@1|e|r|s|.|O|T|H|E|R|;| @37 +@75 +@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|w|h|e|n|)| |{| @51 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|A|L|P|H|A|:| |{| |e|c|h|o|(|L|e|t@1|e|r|s|.|A|L|P|H|A|)|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @23 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|B|E|T|A|:| @1|{| |e|c|h|o|(|L|e|t@1|e|r|s|.|B|E|T|A|)|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @24 +@8|d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @3|{| |e|c|h|o|(|L|e|t@1|e|r|s|.|O|T|H|E|R|)|;| |}| @30 +@8|}| @65 +@75 +@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|w|h|e|n|)| |{| @46 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|A|L|P|H|A| @1|-|>| |L|e|t@1|e|r|s|.|A|L|P|H|A|;| @33 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|B|E|T|A| @2|-|>| |L|e|t@1|e|r|s|.|B|E|T|A|;| @34 +@12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@4|-|>| |{| |y+0#af5f00255&|i|e|l|d|(+0#0000000&|L|e|t@1|e|r|s|.|O|T|H|E|R|)|;| |}| @22 +@8|}|)|;| @63 +@57|1|9|,|0|-|1| @7|1|3|%| diff --git a/runtime/syntax/testdir/dumps/java_switch_02.dump b/runtime/syntax/testdir/dumps/java_switch_02.dump new file mode 100644 index 0000000000..cf213ed474 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_switch_02.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|}|)|;| @63 +@75 +@8|S|t|r|i|n|g| |y+0#af5f00255&|i|e|l|d| +0#0000000&|=| |n+0#e000002&|u|l@1|;+0#0000000&| @46 +@75 +@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|y+0#af5f00255&|i|e|l|d|)+0#0000000&| |{| @50 +@8>c+0#af5f00255&|a|s|e| +0#0000000&|"+0#e000002&|A|"|:+0#0000000&| |c+0#af5f00255&|a|s|e| +0#0000000&|"+0#e000002&|B|"|:+0#0000000&| |{| |e|c|h|o|(|"+0#e000002&|A| |o|r| |B|"|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @20 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|"+0#e000002&|:|"|:+0#0000000&| @6|{| |e|c|h|o|(|"+0#e000002&|C|o|l|o|n|"|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @25 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r| |w+0#af5f00255&|h|e|n| +0#0000000&|!|s|t|r|.|e|q|u|a|l|s|(|"+0#e000002&@1|)+0#0000000&|:| @29 +@20|{| |e|c|h|o|(|"+0#e000002&|<|n|o|n|-|e|m|p|t|y|>|"|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @23 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|n+0#e000002&|u|l@1|:+0#0000000&| |d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| |{| |e|c|h|o|(|"+0#e000002&|O|t|h|e|r|"|)+0#0000000&|;| |}| @28 +@8|}| @65 +@75 +@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|y+0#af5f00255&|i|e|l|d|)+0#0000000&| |{| @45 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|"+0#e000002&|A|"|,+0#0000000&| |"+0#e000002&|B|"| +0#0000000&@6|-|>| |{| |y+0#af5f00255&|i|e|l|d|(+0#0000000&|"+0#e000002&|A| |o|r| |B|"|)+0#0000000&|;| |}| @19 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|"+0#e000002&|-|>|"| +0#0000000&@6|-|>| |"+0#e000002&|A|r@1|o|w|"|;+0#0000000&| @35 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|S|t|r|i|n|g| |s|t|r| |w+0#af5f00255&|h|e|n| +0#0000000&|!|s|t|r|.|e|q|u|a|l|s|(|"+0#e000002&@1|)+0#0000000&| @26 +@24|-|>| |"+0#e000002&|<|n|o|n|-|e|m|p|t|y|>|"|;+0#0000000&| @33 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|n+0#e000002&|u|l@1|,+0#0000000&| |d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@1|-|>| |"+0#e000002&|O|t|h|e|r|"|;+0#0000000&| @31 +@8|}|)|;| @63 +@57|3|7|,|3|-|9| @7|3|0|%| diff --git a/runtime/syntax/testdir/dumps/java_switch_03.dump b/runtime/syntax/testdir/dumps/java_switch_03.dump new file mode 100644 index 0000000000..7766af363d --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_switch_03.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|}|)|;| @63 +@75 +@8|O|b|j|e|c|t| |o| |=| |n+0#af5f00255&|e|w| +0#0000000&|O|b|j|e|c|t|(|)|;| @42 +@75 +@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|o|)| |{| @54 +@8>c+0#af5f00255&|a|s|e| +0#0000000&|n+0#e000002&|u|l@1|:+0#0000000&| @5|{| |e|c|h|o|(|"+0#e000002&|n|u|l@1|"|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @26 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|L|e|t@1|e|r|s|[|]| |l@1|:| @1|{| |e|c|h|o|(|"+0#e000002&|S|w|i|t|c|h|T|e|s|t|s|$|1|L|e|t@1|e|r|s|[|]|"|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @4 +@8|d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @7|{| |e|c|h|o|(|"+0#e000002&|j|a|v|a|.|l|a|n|g|.|O|b|j|e|c|t|"|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @14 +@8|}|;| @64 +@75 +@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|o|)| |{| @49 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|n+0#e000002&|u|l@1| +0#0000000&@6|-|>| |"+0#e000002&|n|u|l@1|"|;+0#0000000&| @36 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|L|e|t@1|e|r|s|[|]| |l@1| @2|-|>| |"+0#e000002&|S|w|i|t|c|h|T|e|s|t|s|$|1|L|e|t@1|e|r|s|[|]|"|;+0#0000000&| @14 +@12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@8|-|>| |"+0#e000002&|j|a|v|a|.|l|a|n|g|.|O|b|j|e|c|t|"|;+0#0000000&| @24 +@8|}|)|;| @63 +@75 +@8|c+0#00e0003&|h|a|r| +0#0000000&|c|h| |=| |'+0#e000002&|c|'|;+0#0000000&| @52 +@75 +@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|c|h|)| |{| @53 +@57|5@1|,|3|-|9| @7|4|7|%| diff --git a/runtime/syntax/testdir/dumps/java_switch_04.dump b/runtime/syntax/testdir/dumps/java_switch_04.dump new file mode 100644 index 0000000000..38dfe4096c --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_switch_04.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|c|h|)| |{| @53 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|'+0#e000002&|a|'|:+0#0000000&| @6|{| |e|c|h|o|(|'+0#e000002&|a|'|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @29 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|'+0#e000002&|b|'|:+0#0000000&| @6|{| |e|c|h|o|(|'+0#e000002&|b|'|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @29 +@8|d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @7|{| |e|c|h|o|(|'+0#e000002&|\+0#e000e06&|u|0@3|'+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @24 +@8|}|;| @64 +> @74 +@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|c|h|)| |{| @48 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|'+0#e000002&|a|'| +0#0000000&@3|-|>| |'+0#e000002&|a|'|;+0#0000000&| @43 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|'+0#e000002&|b|'| +0#0000000&@3|-|>| |'+0#e000002&|b|'|;+0#0000000&| @43 +@12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@4|-|>| |'+0#e000002&|\+0#e000e06&|u|0@3|'+0#e000002&|;+0#0000000&| @38 +@8|}|)|;| @63 +@75 +@8|b+0#00e0003&|y|t|e| +0#0000000&|b| |=| |(|b+0#00e0003&|y|t|e|)+0#0000000&| |2+0#e000002&|;+0#0000000&| @48 +@75 +@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|b|)| |{| @54 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|b+0#00e0003&|y|t|e|)+0#0000000&| |0+0#e000002&|)+0#0000000&|:| @3|{| |e|c|h|o|(@1|b+0#00e0003&|y|t|e|)+0#0000000&| |0+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @20 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|b+0#00e0003&|y|t|e|)+0#0000000&| |1+0#e000002&|)+0#0000000&|:| @3|{| |e|c|h|o|(@1|b+0#00e0003&|y|t|e|)+0#0000000&| |1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @20 +@8|d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @7|{| |e|c|h|o|(@1|b+0#00e0003&|y|t|e|)+0#0000000&| |-|1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @23 +@8|}|;| @64 +@57|7|3|,|0|-|1| @7|6|5|%| diff --git a/runtime/syntax/testdir/dumps/java_switch_05.dump b/runtime/syntax/testdir/dumps/java_switch_05.dump new file mode 100644 index 0000000000..3a256671b6 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_switch_05.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|}|;| @64 +@75 +@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|b|)| |{| @49 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|b+0#00e0003&|y|t|e|)+0#0000000&| |0+0#e000002&|)+0#0000000&| |-|>| |(|b+0#00e0003&|y|t|e|)+0#0000000&| |0+0#e000002&|;+0#0000000&| @34 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|b+0#00e0003&|y|t|e|)+0#0000000&| |1+0#e000002&|)+0#0000000&| |-|>| |(|b+0#00e0003&|y|t|e|)+0#0000000&| |1+0#e000002&|;+0#0000000&| @34 +@12>d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@4|-|>| |(|b+0#00e0003&|y|t|e|)+0#0000000&| |-|1+0#e000002&|;+0#0000000&| @37 +@8|}|)|;| @63 +@75 +@8|s+0#00e0003&|h|o|r|t| +0#0000000&|s|h| |=| |(|s+0#00e0003&|h|o|r|t|)+0#0000000&| |2+0#e000002&|;+0#0000000&| @45 +@75 +@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|s|h|)| |{| @53 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |0+0#e000002&|)+0#0000000&|:| @2|{| |e|c|h|o|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |0+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @19 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|)+0#0000000&|:| @2|{| |e|c|h|o|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @19 +@8|d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @7|{| |e|c|h|o|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |-|1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @22 +@8|}|;| @64 +@75 +@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|s|h|)| |{| @48 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |0+0#e000002&|)+0#0000000&| @3|-|>| |(|s+0#00e0003&|h|o|r|t|)+0#0000000&| |0+0#e000002&|;+0#0000000&| @29 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|)+0#0000000&| @3|-|>| |(|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|;+0#0000000&| @29 +@57|9|1|,|4|-|1|3| @6|8|2|%| diff --git a/runtime/syntax/testdir/dumps/java_switch_06.dump b/runtime/syntax/testdir/dumps/java_switch_06.dump new file mode 100644 index 0000000000..9e72cc7bb8 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_switch_06.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@11|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|)+0#0000000&| @3|-|>| |(|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|;+0#0000000&| @29 +@12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@8|-|>| |(|s+0#00e0003&|h|o|r|t|)+0#0000000&| |-|1+0#e000002&|;+0#0000000&| @32 +@8|}|)|;| @63 +@75 +@8|i+0#00e0003&|n|t| +0#0000000&|i| |=| |2+0#e000002&|;+0#0000000&| @56 +> @74 +@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|i|)| |{| @54 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|0+0#e000002&|b|0|_@1|0@1|_@2|0@2|:+0#0000000&| |{| |e|c|h|o|(|0+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @27 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|0+0#e000002&|x|0@2|_@2|0@1|_@1|1|:+0#0000000&| |{| |e|c|h|o|(|1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @27 +@8|d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @7|{| |e|c|h|o|(|-|1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @30 +@8|}|;| @64 +@75 +@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|i|)| |{| @49 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|0+0#e000002&|_|0|_|0|_|0|_|0| +0#0000000&@1|-|>| |0+0#e000002&|;+0#0000000&| @41 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|1+0#e000002&| +0#0000000&@5|-|>| |1+0#e000002&|;+0#0000000&| @45 +@12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@4|-|>| |-|1+0#e000002&|;+0#0000000&| @44 +@8|}|)|;| @63 +@4|}| @69 +|}| @73 +@57|1|0|9|,|0|-|1| @6|B|o|t| diff --git a/runtime/syntax/testdir/dumps/java_switch_99.dump b/runtime/syntax/testdir/dumps/java_switch_99.dump new file mode 100644 index 0000000000..f275382a30 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_switch_99.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@11|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|)+0#0000000&| @3|-|>| |(|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|;+0#0000000&| @29 +@12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@8|-|>| |(|s+0#00e0003&|h|o|r|t|)+0#0000000&| |-|1+0#e000002&|;+0#0000000&| @32 +@8|}|)|;| @63 +@75 +@8|i+0#00e0003&|n|t| +0#0000000&|i| |=| |2+0#e000002&|;+0#0000000&| @56 +@75 +@8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|i|)| |{| @54 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|0+0#e000002&|b|0|_@1|0@1|_@2|0@2|:+0#0000000&| |{| |e|c|h|o|(|0+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @27 +@8|c+0#af5f00255&|a|s|e| +0#0000000&|0+0#e000002&|x|0@2|_@2|0@1|_@1|1|:+0#0000000&| |{| |e|c|h|o|(|1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @27 +@8|d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @7|{| |e|c|h|o|(|-|1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @30 +@8|}|;| @64 +@75 +@8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|i|)| |{| @49 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|0+0#e000002&|_|0|_|0|_|0|_|0| +0#0000000&@1|-|>| |0+0#e000002&|;+0#0000000&| @41 +@12|c+0#af5f00255&|a|s|e| +0#0000000&|1+0#e000002&| +0#0000000&@5|-|>| |1+0#e000002&|;+0#0000000&| @45 +@12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@4|-|>| |-|1+0#e000002&|;+0#0000000&| @44 +@8|}|)|;| @63 +@4|}| @69 +>}| @73 +@57|1|2@1|,|1| @8|B|o|t| diff --git a/runtime/syntax/testdir/ftplugin/java.vim b/runtime/syntax/testdir/ftplugin/java.vim new file mode 100644 index 0000000000..da198e18e7 --- /dev/null +++ b/runtime/syntax/testdir/ftplugin/java.vim @@ -0,0 +1,5 @@ +" The Java source file uses long lines with tabs +" so use a smaller tabstop value, so that no +" soft-wrapping occurs (which may cause the syntax +" tests to miss some lines during scrolling) +setl ts=4 diff --git a/runtime/syntax/testdir/input/java_switch.java b/runtime/syntax/testdir/input/java_switch.java new file mode 100644 index 0000000000..14b2e1149d --- /dev/null +++ b/runtime/syntax/testdir/input/java_switch.java @@ -0,0 +1,122 @@ +class SwitchTests // JDK 21+. +{ + static void echo(Object o) { System.out.println(o); } + + static { + interface Yieldable + { + T yield(); + default Yieldable default_() { return this; } + default Yieldable when() { return this; } + } + + // There are 80 bytes (\@80 y = ((Yieldable) () -> 0):: + yield; + ((Yieldable) () -> 0).when().default_().yield(); + + enum Letters { OTHER, ALPHA, BETA } + + Letters when = Letters.OTHER; + + switch (when) { + case ALPHA: { echo(Letters.ALPHA); break; } + case BETA: { echo(Letters.BETA); break; } + default: { echo(Letters.OTHER); } + } + + echo(switch (when) { + case ALPHA -> Letters.ALPHA; + case BETA -> Letters.BETA; + default -> { yield(Letters.OTHER); } + }); + + String yield = null; + + switch (yield) { + case "A": case "B": { echo("A or B"); break; } + case ":": { echo("Colon"); break; } + case String str when !str.equals(""): + { echo(""); break; } + case null: default: { echo("Other"); } + } + + echo(switch (yield) { + case "A", "B" -> { yield("A or B"); } + case "->" -> "Arrow"; + case String str when !str.equals("") + -> ""; + case null, default -> "Other"; + }); + + Object o = new Object(); + + switch (o) { + case null: { echo("null"); break; } + case Letters[] ll: { echo("SwitchTests$1Letters[]"); break; } + default: { echo("java.lang.Object"); break; } + }; + + echo(switch (o) { + case null -> "null"; + case Letters[] ll -> "SwitchTests$1Letters[]"; + default -> "java.lang.Object"; + }); + + char ch = 'c'; + + switch (ch) { + case 'a': { echo('a'); break; } + case 'b': { echo('b'); break; } + default: { echo('\u0000'); break; } + }; + + echo(switch (ch) { + case 'a' -> 'a'; + case 'b' -> 'b'; + default -> '\u0000'; + }); + + byte b = (byte) 2; + + switch (b) { + case ((byte) 0): { echo((byte) 0); break; } + case ((byte) 1): { echo((byte) 1); break; } + default: { echo((byte) -1); break; } + }; + + echo(switch (b) { + case ((byte) 0) -> (byte) 0; + case ((byte) 1) -> (byte) 1; + default -> (byte) -1; + }); + + short sh = (short) 2; + + switch (sh) { + case ((short) 0): { echo((short) 0); break; } + case ((short) 1): { echo((short) 1); break; } + default: { echo((short) -1); break; } + }; + + echo(switch (sh) { + case ((short) 0) -> (short) 0; + case ((short) 1) -> (short) 1; + default -> (short) -1; + }); + + int i = 2; + + switch (i) { + case 0b0__00___000: { echo(0); break; } + case 0x000___00__1: { echo(1); break; } + default: { echo(-1); break; } + }; + + echo(switch (i) { + case 0_0_0_0_0 -> 0; + case 1 -> 1; + default -> -1; + }); + } +} From 97a35ae356432c85b071505dc1b4c48ad170189f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Pe=C5=A1i=C4=87?= <27575106+eevan78@users.noreply.github.com> Date: Thu, 29 Feb 2024 00:41:27 +0400 Subject: [PATCH 104/426] translation(sr): Update Serbian translation (#14107) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ivan Pešić <27575106+eevan78@users.noreply.github.com> Signed-off-by: Christian Brabandt --- src/po/sr.po | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/po/sr.po b/src/po/sr.po index 88e910c77f..eb5f8d3e07 100644 --- a/src/po/sr.po +++ b/src/po/sr.po @@ -2,7 +2,7 @@ # # Do ":help uganda" in Vim to read copying and usage conditions. # Do ":help credits" in Vim to see a list of people who contributed. -# Copyright (C) 2023 +# Copyright (C) 2024 # This file is distributed under the same license as the Vim package. # FIRST AUTHOR Ivan Pešić , 2017. # @@ -10,8 +10,8 @@ msgid "" msgstr "" "Project-Id-Version: Vim(Serbian)\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-19 11:15+0400\n" -"PO-Revision-Date: 2024-01-19 11:31+0400\n" +"POT-Creation-Date: 2024-02-28 10:54+0400\n" +"PO-Revision-Date: 2024-02-28 10:56+0400\n" "Last-Translator: Ivan Pešić \n" "Language-Team: Serbian\n" "Language: sr\n" @@ -180,6 +180,9 @@ msgstr " (фајл %d од %d)" msgid " (file (%d) of %d)" msgstr " (фајл (%d) од %d)" +msgid "[Command Line]" +msgstr "[Командна линија]" + msgid "[Prompt]" msgstr "[Одзив]" @@ -705,9 +708,6 @@ msgstr "Грешка" msgid "Interrupt" msgstr "Прекид" -msgid "[Command Line]" -msgstr "[Командна линија]" - msgid "is a directory" msgstr "је директоријум" @@ -4219,6 +4219,10 @@ msgstr "E104: Escape није дозвољен у digraph" msgid "E105: Using :loadkeymap not in a sourced file" msgstr "E105: Коришћење :loadkeymap ван фајла који се учитава као скрипта" +#, c-format +msgid "E106: Unsupported diff output format: %s" +msgstr "E106: Није подржан diff излазни формат: %s" + #, c-format msgid "E107: Missing parentheses: %s" msgstr "E107: Недостају заграде: %s" @@ -4549,8 +4553,8 @@ msgstr "E196: У овој верзији нема диграфа" msgid "E197: Cannot set language to \"%s\"" msgstr "E197: Језик не може да се постави на „%s”" -msgid "E199: Active window or buffer deleted" -msgstr "E199: Active window or buffer deleted" +msgid "E199: Active window or buffer changed or deleted" +msgstr "E199: Активни прозор или бафер је измењен или обрисан" msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "E200: *ReadPre аутокоманде су учиниле фајл нечитљивим" From b1289f19efb75a3234c8f22bdd303a6ebe56f78c Mon Sep 17 00:00:00 2001 From: elig0n <31196036+elig0n@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:45:48 +0100 Subject: [PATCH 105/426] runtime(doc): Fix typo under *kitty-terminal* in term.txt closes: #14106 Signed-off-by: elig0n <31196036+elig0n@users.noreply.github.com> Signed-off-by: Christian Brabandt --- runtime/doc/term.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 8154ec596e..d958229bc4 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 9.1. Last change: 2024 Jan 15 +*term.txt* For Vim version 9.1. Last change: 2024 Feb 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -345,7 +345,7 @@ versions (and will then also end up in terminfo/termcap). *xterm-kitty* *kitty-terminal* The Kitty terminal is a special case. Mainly because it works differently -from most other terminals, but also because, instead of trying the fit in and +from most other terminals, but also because, instead of trying to fit in and make it behave like other terminals by default, it dictates how applications need to work when using Kitty. This makes it very difficult for Vim to work in a Kitty terminal. Some exceptions have been hard coded, but it is not at From 4e141c66b9104136ddcf9cc240d2fbc83d825a5a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 28 Feb 2024 21:49:51 +0100 Subject: [PATCH 106/426] patch 9.1.0141: Put in Visual mode wrong if it replaces fold marker Problem: Put in Visual mode wrong if it replaces fold marker. Solution: Temporarily disable folding during put in Visual mode. (zeertzjq) fixes: #14097 closes: #14100 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/normal.c | 17 +++++++++++++++-- src/testdir/test_put.vim | 28 ++++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/normal.c b/src/normal.c index 015a250781..791b02f1cd 100644 --- a/src/normal.c +++ b/src/normal.c @@ -7323,6 +7323,9 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) int dir; int flags = 0; int keep_registers = FALSE; +#ifdef FEAT_FOLDING + int save_fen = curwin->w_p_fen; +#endif if (cap->oap->op_type != OP_NOP) { @@ -7388,6 +7391,12 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) reg1 = get_register(regname, TRUE); } +#ifdef FEAT_FOLDING + // Temporarily disable folding, as deleting a fold marker may cause + // the cursor to be included in a fold. + curwin->w_p_fen = FALSE; +#endif + // Now delete the selected text. Avoid messages here. cap->cmdchar = 'd'; cap->nchar = NUL; @@ -7435,10 +7444,14 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) if (reg2 != NULL) put_register(regname, reg2); - // What to reselect with "gv"? Selecting the just put text seems to - // be the most useful, since the original text was removed. if (was_visual) { +#ifdef FEAT_FOLDING + if (save_fen) + curwin->w_p_fen = TRUE; +#endif + // What to reselect with "gv"? Selecting the just put text seems to + // be the most useful, since the original text was removed. curbuf->b_visual.vi_start = curbuf->b_op_start; curbuf->b_visual.vi_end = curbuf->b_op_end; // need to adjust cursor position diff --git a/src/testdir/test_put.vim b/src/testdir/test_put.vim index 559a4dccd6..5b5c354c45 100644 --- a/src/testdir/test_put.vim +++ b/src/testdir/test_put.vim @@ -290,5 +290,33 @@ func Test_put_in_last_displayed_line() call StopVimInTerminal(buf) endfunc +func Test_put_visual_replace_whole_fold() + new + let lines = repeat(['{{{1', 'foo', 'bar', ''], 2) + call setline(1, lines) + setlocal foldmethod=marker + call setreg('"', 'baz') + call setreg('1', '') + normal! Vp + call assert_equal("{{{1\nfoo\nbar\n\n", getreg('1')) + call assert_equal(['baz', '{{{1', 'foo', 'bar', ''], getline(1, '$')) + + bwipe! +endfunc + +func Test_put_visual_replace_fold_marker() + new + let lines = repeat(['{{{1', 'foo', 'bar', ''], 4) + call setline(1, lines) + setlocal foldmethod=marker + normal! Gkzo + call setreg('"', '{{{1') + call setreg('1', '') + normal! Vp + call assert_equal("{{{1\n", getreg('1')) + call assert_equal(lines, getline(1, '$')) + + bwipe! +endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 673c707c7d..5a6f4c13c9 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 141, /**/ 140, /**/ From d0d4adb609064d6ca4fce111a09c2cbbcdef1cf1 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 28 Feb 2024 21:53:26 +0100 Subject: [PATCH 107/426] runtime(Filelist): include runtime/syntax/testdir/ftplugin Signed-off-by: Christian Brabandt --- Filelist | 1 + 1 file changed, 1 insertion(+) diff --git a/Filelist b/Filelist index acc9318225..c875c0b410 100644 --- a/Filelist +++ b/Filelist @@ -825,6 +825,7 @@ RT_SCRIPTS = \ runtime/syntax/Makefile \ runtime/syntax/testdir/README.txt \ runtime/syntax/testdir/runtest.vim \ + runtime/syntax/testdir/ftplugin/*.* \ runtime/syntax/testdir/input/*.* \ runtime/syntax/testdir/dumps/*.dump \ runtime/syntax/generator/Makefile \ From 19b718828d8d5fab52d94c6cdba694641879ab38 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Wed, 28 Feb 2024 22:48:12 +0100 Subject: [PATCH 108/426] patch 9.1.0142: getregion() can be improved Problem: getregion() can be improved (after v9.1.120) Solution: change getregion() implementation to use pos as lists and one optional {opt} dictionary (Shougo Matsushita) Note: The following is a breaking change! Currently, the getregion() function (included as of patch v9.1.120) takes 3 arguments: the first 2 arguments are strings, describing a position, arg3 is the type string. However, that is slightly inflexible, there is no way to specify additional arguments. So let's instead change the function signature to: getregion(pos1, pos2 [, {Dict}]) where both pos1 and pos2 are lists. This is slightly cleaner, and gives us the flexibility to specify additional arguments as key/value pairs to the optional Dict arg. Now it supports the "type" key to specify the selection type (characterwise, blockwise or linewise) and now in addition one can also define the selection type, independently of what the 'selection' option actually is. Technically, this is a breaking change, but since the getregion() Vimscript function is still quite new, this should be fine. closes: #14090 Co-authored-by: zeertzjq Signed-off-by: Shougo Matsushita Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 42 +++--- src/evalfunc.c | 57 +++++---- src/testdir/test_vim9_builtin.vim | 9 +- src/testdir/test_visual.vim | 206 ++++++++++++++++++++++-------- src/version.c | 2 + 5 files changed, 213 insertions(+), 103 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 0af9b0e0f7..6d1d372cfd 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 25 +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -263,7 +263,7 @@ getqflist({what}) Dict get specific quickfix list properties getreg([{regname} [, 1 [, {list}]]]) String or List contents of a register getreginfo([{regname}]) Dict information about a register -getregion({pos1}, {pos2}, {type}) +getregion({pos1}, {pos2} [, {opts}]) List get the text from {pos1} to {pos2} getregtype([{regname}]) String type of a register getscriptinfo([{opts}]) List list of sourced scripts @@ -4271,14 +4271,25 @@ getreginfo([{regname}]) *getreginfo()* Can also be used as a |method|: > GetRegname()->getreginfo() -getregion({pos1}, {pos2}, {type}) *getregion()* - Returns the list of strings from {pos1} to {pos2} as if it's - selected in visual mode of {type}. - For possible values of {pos1} and {pos2} see |line()|. - {type} is the selection type: - "v" for |characterwise| mode - "V" for |linewise| mode - "" for |blockwise-visual| mode +getregion({pos1}, {pos2} [, {opts}]) *getregion()* + Returns the list of strings from {pos1} to {pos2} in current + buffer. + + {pos1} and {pos2} must both be |List|s with four numbers. + See |getpos()| for the format of the list. + + The optional argument {opts} is a Dict and supports the + following items: + + type Specify the selection type + (default: "v"): + "v" for |characterwise| mode + "V" for |linewise| mode + "" for |blockwise-visual| mode + + exclusive If |true|, use exclusive selection + for the end position 'selection'. + You can get the last selection type by |visualmode()|. If Visual mode is active, use |mode()| to get the Visual mode (e.g., in a |:vmap|). @@ -4296,19 +4307,16 @@ getregion({pos1}, {pos2}, {type}) *getregion()* - If the selection starts or ends in the middle of a multibyte character, it is not included but its selected part is substituted with spaces. - - If {pos1} or {pos2} equals "v" (see |line()|) and it is not in - |visual-mode|, an empty list is returned. - - If {pos1}, {pos2} or {type} is an invalid string, an empty - list is returned. - - If {pos1} or {pos2} is a mark in different buffer, an empty + - If {pos1} or {pos2} is not current in the buffer, an empty list is returned. Examples: > :xnoremap - \ echow getregion('v', '.', mode()) + \ echow getregion( + \ getpos('v'), getpos('.'), #{ type: mode() }) < Can also be used as a |method|: > - '.'->getregion("'a", 'v') + getpos('.')->getregion(getpos("'a")) < getregtype([{regname}]) *getregtype()* The result is a String, which is type of register {regname}. diff --git a/src/evalfunc.c b/src/evalfunc.c index 37010d7bad..b5d8c872ed 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1151,6 +1151,7 @@ static argcheck_T arg3_buffer_string_dict[] = {arg_buffer, arg_string, arg_dict_ static argcheck_T arg3_dict_number_number[] = {arg_dict_any, arg_number, arg_number}; static argcheck_T arg3_diff[] = {arg_list_string, arg_list_string, arg_dict_any}; static argcheck_T arg3_list_string_dict[] = {arg_list_any, arg_string, arg_dict_any}; +static argcheck_T arg3_list_list_dict[] = {arg_list_any, arg_list_any, arg_dict_any}; static argcheck_T arg3_lnum_number_bool[] = {arg_lnum, arg_number, arg_bool}; static argcheck_T arg3_number[] = {arg_number, arg_number, arg_number}; static argcheck_T arg3_number_any_dict[] = {arg_number, arg_any, arg_dict_any}; @@ -2132,7 +2133,7 @@ static funcentry_T global_functions[] = ret_getreg, f_getreg}, {"getreginfo", 0, 1, FEARG_1, arg1_string, ret_dict_any, f_getreginfo}, - {"getregion", 3, 3, FEARG_1, arg3_string, + {"getregion", 2, 3, FEARG_1, arg3_list_list_dict, ret_list_string, f_getregion}, {"getregtype", 0, 1, FEARG_1, arg1_string, ret_string, f_getregtype}, @@ -5491,41 +5492,43 @@ f_getregion(typval_T *argvars, typval_T *rettv) int inclusive = TRUE; int fnum = -1; pos_T p1, p2; - pos_T *fp = NULL; - char_u *pos1, *pos2, *type; + char_u *type; + char_u default_type[] = "v"; int save_virtual = -1; int l; int region_type = -1; - int is_visual; + int is_select_exclusive; if (rettv_list_alloc(rettv) == FAIL) return; - if (check_for_string_arg(argvars, 0) == FAIL - || check_for_string_arg(argvars, 1) == FAIL - || check_for_string_arg(argvars, 2) == FAIL) + if (check_for_list_arg(argvars, 0) == FAIL + || check_for_list_arg(argvars, 1) == FAIL + || check_for_opt_dict_arg(argvars, 2) == FAIL) return; - // NOTE: var2fpos() returns static pointer. - fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE); - if (fp == NULL || (fnum >= 0 && fnum != curbuf->b_fnum)) + if (list2fpos(&argvars[0], &p1, &fnum, NULL, FALSE) != OK + || (fnum >= 0 && fnum != curbuf->b_fnum)) return; - p1 = *fp; - fp = var2fpos(&argvars[1], TRUE, &fnum, FALSE); - if (fp == NULL || (fnum >= 0 && fnum != curbuf->b_fnum)) + if (list2fpos(&argvars[1], &p2, &fnum, NULL, FALSE) != OK + || (fnum >= 0 && fnum != curbuf->b_fnum)) return; - p2 = *fp; - pos1 = tv_get_string(&argvars[0]); - pos2 = tv_get_string(&argvars[1]); - type = tv_get_string(&argvars[2]); - - is_visual = (pos1[0] == 'v' && pos1[1] == NUL) - || (pos2[0] == 'v' && pos2[1] == NUL); - - if (is_visual && !VIsual_active) - return; + if (argvars[2].v_type == VAR_DICT) + { + is_select_exclusive = dict_get_bool( + argvars[2].vval.v_dict, "exclusive", *p_sel == 'e'); + type = dict_get_string( + argvars[2].vval.v_dict, "type", FALSE); + if (type == NULL) + type = default_type; + } + else + { + is_select_exclusive = *p_sel == 'e'; + type = default_type; + } if (type[0] == 'v' && type[1] == NUL) region_type = MCHAR; @@ -5539,6 +5542,10 @@ f_getregion(typval_T *argvars, typval_T *rettv) save_virtual = virtual_op; virtual_op = virtual_active(); + // NOTE: Adjust is needed. + p1.col--; + p2.col--; + if (!LT_POS(p1, p2)) { // swap position @@ -5552,7 +5559,7 @@ f_getregion(typval_T *argvars, typval_T *rettv) if (region_type == MCHAR) { // handle 'selection' == "exclusive" - if (*p_sel == 'e' && !EQUAL_POS(p1, p2)) + if (is_select_exclusive && !EQUAL_POS(p1, p2)) { if (p2.coladd > 0) p2.coladd--; @@ -5590,7 +5597,7 @@ f_getregion(typval_T *argvars, typval_T *rettv) oa.start = p1; oa.end = p2; oa.start_vcol = MIN(sc1, sc2); - if (*p_sel == 'e' && ec1 < sc2 && 0 < sc2 && ec2 > ec1) + if (is_select_exclusive && ec1 < sc2 && 0 < sc2 && ec2 > ec1) oa.end_vcol = sc2 - 1; else oa.end_vcol = MAX(ec1, ec2); diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index e2585d4f69..afb8cb9100 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -5198,12 +5198,11 @@ def Test_passing_type_to_builtin() enddef def Test_getregion() - assert_equal(['x'], getregion('.', '.', 'v')->map((_, _) => 'x')) + assert_equal(['x'], getregion(getpos('.'), getpos('.'))->map((_, _) => 'x')) - v9.CheckDefAndScriptFailure(['getregion(10, ".", "v")'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1']) - assert_equal([''], getregion('.', '.', 'v')) - v9.CheckDefExecFailure(['getregion("a", ".", "v")'], 'E1209:') - v9.CheckDefExecAndScriptFailure(['getregion("", ".", "v")'], 'E1209: Invalid value for a line number') + v9.CheckDefAndScriptFailure(['getregion(10, getpos("."))'], ['E1013: Argument 1: type mismatch, expected list but got number', 'E1211: List required for argument 1']) + assert_equal([''], getregion(getpos('.'), getpos('.'))) + v9.CheckDefExecFailure(['getregion(getpos("a"), getpos("."))'], 'E1209:') enddef " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 8b434238a8..fdc19827b5 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1638,80 +1638,113 @@ func Test_visual_getregion() " Visual mode call cursor(1, 1) call feedkeys("\vjl", 'tx') - call assert_equal(['one', 'tw'], 'v'->getregion('.', 'v')) - call assert_equal(['one', 'tw'], '.'->getregion('v', 'v')) - call assert_equal(['o'], 'v'->getregion('v', 'v')) - call assert_equal(['w'], '.'->getregion('.', 'v')) - call assert_equal(['one', 'two'], '.'->getregion('v', 'V')) - call assert_equal(['on', 'tw'], '.'->getregion('v', "\")) + call assert_equal(['one', 'tw'], + \ 'v'->getpos()->getregion(getpos('.'))) + call assert_equal(['one', 'tw'], + \ '.'->getpos()->getregion(getpos('v'))) + call assert_equal(['o'], + \ 'v'->getpos()->getregion(getpos('v'))) + call assert_equal(['w'], + \ '.'->getpos()->getregion(getpos('.'), #{ type: 'v' })) + call assert_equal(['one', 'two'], + \ getpos('.')->getregion(getpos('v'), #{ type: 'V' })) + call assert_equal(['on', 'tw'], + \ getpos('.')->getregion(getpos('v'), #{ type: "\" })) " Line visual mode call cursor(1, 1) call feedkeys("\Vl", 'tx') - call assert_equal(['one'], getregion('v', '.', 'V')) - call assert_equal(['one'], getregion('.', 'v', 'V')) - call assert_equal(['one'], getregion('v', 'v', 'V')) - call assert_equal(['one'], getregion('.', '.', 'V')) - call assert_equal(['on'], '.'->getregion('v', 'v')) - call assert_equal(['on'], '.'->getregion('v', "\")) + call assert_equal(['one'], + \ getregion(getpos('v'), getpos('.'), #{ type: 'V' })) + call assert_equal(['one'], + \ getregion(getpos('.'), getpos('v'), #{ type: 'V' })) + call assert_equal(['one'], + \ getregion(getpos('v'), getpos('v'), #{ type: 'V' })) + call assert_equal(['one'], + \ getregion(getpos('.'), getpos('.'), #{ type: 'V' })) + call assert_equal(['on'], + \ getpos('.')->getregion(getpos('v'), #{ type: 'v' })) + call assert_equal(['on'], + \ getpos('.')->getregion(getpos('v'), #{ type: "\" })) " Block visual mode call cursor(1, 1) call feedkeys("\\ll", 'tx') - call assert_equal(['one'], getregion('v', '.', "\")) - call assert_equal(['one'], getregion('.', 'v', "\")) - call assert_equal(['o'], getregion('v', 'v', "\")) - call assert_equal(['e'], getregion('.', '.', "\")) - call assert_equal(['one'], '.'->getregion('v', 'V')) - call assert_equal(['one'], '.'->getregion('v', 'v')) + call assert_equal(['one'], + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) + call assert_equal(['one'], + \ getregion(getpos('.'), getpos('v'), #{ type: "\" })) + call assert_equal(['o'], + \ getregion(getpos('v'), getpos('v'), #{ type: "\" })) + call assert_equal(['e'], + \ getregion(getpos('.'), getpos('.'), #{ type: "\" })) + call assert_equal(['one'], + \ '.'->getpos()->getregion(getpos('v'), #{ type: 'V' })) + call assert_equal(['one'], + \ '.'->getpos()->getregion(getpos('v'), #{ type: 'v' })) " Using Marks call setpos("'a", [0, 2, 3, 0]) call cursor(1, 1) - call assert_equal(['one', 'two'], "'a"->getregion('.', 'v')) - call assert_equal(['one', 'two'], "."->getregion("'a", 'v')) - call assert_equal(['one', 'two'], "."->getregion("'a", 'V')) - call assert_equal(['two'], "'a"->getregion("'a", 'V')) - call assert_equal(['one', 'two'], "."->getregion("'a", "\")) + call assert_equal(['one', 'two'], + \ "'a"->getpos()->getregion(getpos('.'), #{ type: 'v' })) + call assert_equal(['one', 'two'], + \ "."->getpos()->getregion(getpos("'a"), #{ type: 'v' })) + call assert_equal(['one', 'two'], + \ "."->getpos()->getregion(getpos("'a"), #{ type: 'V' })) + call assert_equal(['two'], + \ "'a"->getpos()->getregion(getpos("'a"), #{ type: 'V' })) + call assert_equal(['one', 'two'], + \ "."->getpos()->getregion(getpos("'a"), #{ type: "\" })) + + " Using List + call cursor(1, 1) + call assert_equal(['one', 'two'], + \ [0, 2, 3, 0]->getregion(getpos('.'), #{ type: 'v' })) + call assert_equal(['one', 'two'], + \ '.'->getpos()->getregion([0, 2, 3, 0], #{ type: 'v' })) + call assert_equal(['one', 'two'], + \ '.'->getpos()->getregion([0, 2, 3, 0], #{ type: 'V' })) + call assert_equal(['two'], + \ [0, 2, 3, 0]->getregion([0, 2, 3, 0], #{ type: 'V' })) + call assert_equal(['one', 'two'], + \ '.'->getpos()->getregion([0, 2, 3, 0], #{ type: "\" })) " Multiline with line visual mode call cursor(1, 1) call feedkeys("\Vjj", 'tx') - call assert_equal(['one', 'two', 'three'], getregion('v', '.', 'V')) + call assert_equal(['one', 'two', 'three'], + \ getregion(getpos('v'), getpos('.'), #{ type: 'V' })) " Multiline with block visual mode call cursor(1, 1) call feedkeys("\\jj", 'tx') - call assert_equal(['o', 't', 't'], getregion('v', '.', "\")) + call assert_equal(['o', 't', 't'], + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) call cursor(1, 1) call feedkeys("\\jj$", 'tx') - call assert_equal(['one', 'two', 'three'], getregion('v', '.', "\")) + call assert_equal(['one', 'two', 'three'], + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) " 'virtualedit' set virtualedit=all call cursor(1, 1) call feedkeys("\\10ljj$", 'tx') call assert_equal(['one ', 'two ', 'three '], - \ getregion('v', '.', "\")) + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) set virtualedit& " Invalid position call cursor(1, 1) call feedkeys("\vjj$", 'tx') - call assert_fails("call getregion(1, 2, 'v')", 'E1174:') - call assert_fails("call getregion('.', {}, 'v')", 'E1174:') - call assert_equal([], getregion('', '.', 'v')) - call assert_equal([], getregion('.', '.', '')) - call feedkeys("\", 'tx') - call assert_equal([], getregion('v', '.', 'v')) - - " using an unset mark - call assert_equal([], "'z"->getregion(".", 'V')) + call assert_fails("call getregion(1, 2)", 'E1211:') + call assert_fails("call getregion(getpos('.'), {})", 'E1211:') + call assert_equal([], getregion(getpos('.'), getpos('.'), #{ type: '' })) + " using the wrong type - call assert_fails(':echo "."->getregion([],"V")', 'E1174:') - call assert_fails(':echo "."->getregion("$", {})', 'E1174:') - call assert_fails(':echo [0, 1, 1, 0]->getregion("$", "v")', 'E1174:') + call assert_fails(':echo "."->getpos()->getregion("$", [])', 'E1211:') + " using a mark in another buffer new let newbuf = bufnr() @@ -1719,8 +1752,8 @@ func Test_visual_getregion() normal! GmA wincmd p call assert_equal([newbuf, 10, 1, 0], getpos("'A")) - call assert_equal([], getregion(".", "'A", 'v')) - call assert_equal([], getregion("'A", ".", 'v')) + call assert_equal([], getregion(getpos('.'), getpos("'A"), #{ type: 'v' })) + call assert_equal([], getregion(getpos("'A"), getpos('.'), #{ type: 'v' })) exe newbuf .. 'bwipe!' bwipe! @@ -1734,26 +1767,47 @@ func Test_visual_getregion() call cursor(1, 3) call feedkeys("\\ljj", 'xt') call assert_equal(['cd', "\u00ab ", '34'], - \ getregion('v', '.', "\")) + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) call cursor(1, 4) call feedkeys("\\ljj", 'xt') call assert_equal(['de', "\U0001f1e7", '45'], - \ getregion('v', '.', "\")) + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) call cursor(1, 5) call feedkeys("\\jj", 'xt') - call assert_equal(['e', ' ', '5'], getregion('v', '.', "\")) + call assert_equal(['e', ' ', '5'], + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) call cursor(1, 1) call feedkeys("\vj", 'xt') - call assert_equal(['abcdefghijk«', "\U0001f1e6"], getregion('v', '.', "v")) + call assert_equal(['abcdefghijk«', "\U0001f1e6"], + \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) " marks on multibyte chars set selection=exclusive call setpos("'a", [0, 1, 11, 0]) call setpos("'b", [0, 2, 16, 0]) call setpos("'c", [0, 2, 0, 0]) call cursor(1, 1) - call assert_equal(['ghijk', '🇨«🇩'], getregion("'a", "'b", "\")) - call assert_equal(['k«', '🇦«🇧«🇨'], getregion("'a", "'b", "v")) - call assert_equal(['k«'], getregion("'a", "'c", "v")) + call assert_equal(['ghijk', '🇨«🇩'], + \ getregion(getpos("'a"), getpos("'b"), #{ type: "\" })) + call assert_equal(['k«', '🇦«🇧«🇨'], + \ getregion(getpos("'a"), getpos("'b"), #{ type: 'v' })) + call assert_equal(['k«'], + \ getregion(getpos("'a"), getpos("'c"), #{ type: 'v' })) + + " use inclusive selection, although 'selection' is exclusive + call setpos("'a", [0, 1, 11, 0]) + call setpos("'b", [0, 1, 1, 0]) + call assert_equal(['abcdefghijk'], + \ getregion(getpos("'a"), getpos("'b"), #{ type: "\", exclusive: v:false })) + call assert_equal(['abcdefghij'], + \ getregion(getpos("'a"), getpos("'b"), #{ type: "\", exclusive: v:true })) + call assert_equal(['abcdefghijk'], + \ getregion(getpos("'a"), getpos("'b"), #{ type: 'v', exclusive: 0 })) + call assert_equal(['abcdefghij'], + \ getregion(getpos("'a"), getpos("'b"), #{ type: 'v', exclusive: 1 })) + call assert_equal(['abcdefghijk«'], + \ getregion(getpos("'a"), getpos("'b"), #{ type: 'V', exclusive: 0 })) + call assert_equal(['abcdefghijk«'], + \ getregion(getpos("'a"), getpos("'b"), #{ type: 'V', exclusive: 1 })) bwipe! @@ -1763,31 +1817,71 @@ func Test_visual_getregion() call setline(1, ["a\tc", "x\tz", '', '']) call cursor(1, 1) call feedkeys("\v2l", 'xt') - call assert_equal(["a\t"], getregion('v', '.', 'v')) + call assert_equal(["a\t"], + \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) call cursor(1, 1) call feedkeys("\v$G", 'xt') - call assert_equal(["a\tc", "x\tz", ''], getregion('v', '.', 'v')) + call assert_equal(["a\tc", "x\tz", ''], + \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) call cursor(1, 1) call feedkeys("\v$j", 'xt') - call assert_equal(["a\tc", "x\tz"], getregion('v', '.', 'v')) + call assert_equal(["a\tc", "x\tz"], + \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) call cursor(1, 1) call feedkeys("\\$j", 'xt') - call assert_equal(["a\tc", "x\tz"], getregion('v', '.', "\")) + call assert_equal(["a\tc", "x\tz"], + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) call cursor(1, 1) call feedkeys("\\$G", 'xt') - call assert_equal(["a", "x", '', ''], getregion('v', '.', "\")) + call assert_equal(["a", "x", '', ''], + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) call cursor(1, 1) call feedkeys("\wv2j", 'xt') - call assert_equal(["c", "x\tz"], getregion('v', '.', 'v')) + call assert_equal(["c", "x\tz"], + \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) + set selection& + + " Exclusive selection 2 + new + call setline(1, ["a\tc", "x\tz", '', '']) + call cursor(1, 1) + call feedkeys("\v2l", 'xt') + call assert_equal(["a\t"], + \ getregion(getpos('v'), getpos('.'), #{ exclusive: v:true })) + call cursor(1, 1) + call feedkeys("\v$G", 'xt') + call assert_equal(["a\tc", "x\tz", ''], + \ getregion(getpos('v'), getpos('.'), #{ exclusive: v:true })) + call cursor(1, 1) + call feedkeys("\v$j", 'xt') + call assert_equal(["a\tc", "x\tz"], + \ getregion(getpos('v'), getpos('.'), #{ exclusive: v:true })) + call cursor(1, 1) + call feedkeys("\\$j", 'xt') + call assert_equal(["a\tc", "x\tz"], + \ getregion(getpos('v'), getpos('.'), + \ #{ exclusive: v:true, type: "\" })) + call cursor(1, 1) + call feedkeys("\\$G", 'xt') + call assert_equal(["a", "x", '', ''], + \ getregion(getpos('v'), getpos('.'), + \ #{ exclusive: v:true, type: "\" })) + call cursor(1, 1) + call feedkeys("\wv2j", 'xt') + call assert_equal(["c", "x\tz"], + \ getregion(getpos('v'), getpos('.'), #{ exclusive: v:true })) " virtualedit + set selection=exclusive set virtualedit=all call cursor(1, 1) call feedkeys("\2lv2lj", 'xt') - call assert_equal([' c', 'x '], getregion('v', '.', 'v')) + call assert_equal([' c', 'x '], + \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) call cursor(1, 1) call feedkeys("\2l\2l2j", 'xt') - call assert_equal([' ', ' ', ' '], getregion('v', '.', "\")) + call assert_equal([' ', ' ', ' '], + \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) set virtualedit& set selection& diff --git a/src/version.c b/src/version.c index 5a6f4c13c9..c6c536ab19 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 142, /**/ 141, /**/ From 0fdd18596f504774bc5993d029d68eecea827439 Mon Sep 17 00:00:00 2001 From: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed, 28 Feb 2024 23:25:08 +0100 Subject: [PATCH 109/426] CI: enable apt upgrade on github runners again to fix i386 build This reverts commit 7f630e6f358275d0bce9fea2665a2763edbf6a0e which reverted 7349c5160ab63d0737050a6b4da3e407ab0cfeb0 Let's see how many more iterations of reverting a commit we can achieve... closes: #14113 Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com> Signed-off-by: Christian Brabandt --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a641ef563e..d2148f7f1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,7 +124,7 @@ jobs: libattr1-dev ) fi - sudo apt-get update && sudo apt-get install -y "${PKGS[@]}" + sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y "${PKGS[@]}" - name: Install gcc-${{ env.GCC_VER }} if: matrix.compiler == 'gcc' From 55f8bba73be5f9c3a5a4d0d6c5f56e65f2c7d3fc Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 28 Feb 2024 23:32:00 +0100 Subject: [PATCH 110/426] patch 9.1.0143: [security]: autocmd causes use-after-free in set_curbuf() Problem: [security]: autocmd cause use-after-free in set_curbuf() (kawarimidoll) Solution: check side-effect of BufLeave autocommand, when the number of windows changed, close windows containing buffers that will be wiped, if curbuf changed unexpectedly make sure b_nwindows is decremented otherwise it cannot be wiped set_curbuf() already makes some efforts to ensure the BufLeave autocommands do not cause issues. However there are still 2 issues that are not taken care of: 1) If a BufLeave autocommand opens a new window containing the same buffer as that is going got be closed in close_buffer() a bit later, we suddenly have another window open, containing a free'd buffer. So we must check if the number of windows changed and if it does (and the current buffer is going to be wiped (according to the 'bufhidden' setting), let's immediately close all windows containing the current buffer using close_windows() 2) If a BufLeave autocommand changes our current buffer (displays it in the current window), buf->b_nwindow will be incremented. As part of set_curbuf() we will however enter another buffer soon, which means, the newly created curbuf will have b_nwindows still have set, even so the buffer is no longer displayed in a window. This causes later problems, because it will no longer be possible to wipe such a buffer. So just before entering the final buffer, check if the curbuf changed when calling the BufLeave autocommand and if it does (and curbuf is still valid), decrement curbuf->b_nwindows. Both issues can be verified using the provided test (however the second issue only because such an impacted buffer won't be wiped, causing futher issues in later tests). fixes: #13839 closes: #14104 Signed-off-by: Christian Brabandt --- src/buffer.c | 11 ++++++++++- src/proto/window.pro | 1 + src/testdir/test_autocmd.vim | 12 ++++++++++++ src/version.c | 2 ++ src/window.c | 6 ++++++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/buffer.c b/src/buffer.c index b17ae16521..8d62e64368 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1790,6 +1790,7 @@ set_curbuf(buf_T *buf, int action) bufref_T newbufref; bufref_T prevbufref; int valid; + int last_winid = get_last_winid(); setpcmark(); if ((cmdmod.cmod_flags & CMOD_KEEPALT) == 0) @@ -1818,7 +1819,11 @@ set_curbuf(buf_T *buf, int action) if (prevbuf == curwin->w_buffer) reset_synblock(curwin); #endif - if (unload) + // autocommands may have opened a new window + // with prevbuf, grr + if (unload || + (last_winid != get_last_winid() && + strchr((char *)"wdu", prevbuf->b_p_bh[0]) != NULL)) close_windows(prevbuf, FALSE); #if defined(FEAT_EVAL) if (bufref_valid(&prevbufref) && !aborting()) @@ -1854,6 +1859,10 @@ set_curbuf(buf_T *buf, int action) #endif ) || curwin->w_buffer == NULL) { + // autocommands changed curbuf and we will move to another + // buffer soon, so decrement curbuf->b_nwindows + if (curbuf != NULL && prevbuf != curbuf) + curbuf->b_nwindows--; // If the buffer is not valid but curwin->w_buffer is NULL we must // enter some buffer. Using the last one is hopefully OK. if (!valid) diff --git a/src/proto/window.pro b/src/proto/window.pro index a91a51190b..e5c03969fb 100644 --- a/src/proto/window.pro +++ b/src/proto/window.pro @@ -96,4 +96,5 @@ int win_hasvertsplit(void); int get_win_number(win_T *wp, win_T *first_win); int get_tab_number(tabpage_T *tp); char *check_colorcolumn(win_T *wp); +int get_last_winid(void); /* vim: set ft=c : */ diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 90dc3c1d32..f4e3c15a61 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -4441,4 +4441,16 @@ func Test_autocmd_invalidates_undo_on_textchanged() call StopVimInTerminal(buf) endfunc +func Test_autocmd_creates_new_buffer_on_bufleave() + e a.txt + e b.txt + setlocal bufhidden=wipe + autocmd BufLeave diffsplit c.txt + bn + call assert_equal(1, winnr('$')) + call assert_equal('a.txt', bufname('%')) + bw a.txt + bw c.txt +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index c6c536ab19..cc2d412471 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 143, /**/ 142, /**/ diff --git a/src/window.c b/src/window.c index 7123780c52..bda24fc4e5 100644 --- a/src/window.c +++ b/src/window.c @@ -7941,3 +7941,9 @@ check_colorcolumn(win_T *wp) return NULL; // no error } #endif + + int +get_last_winid(void) +{ + return last_win_id; +} From b4eb3f1e44896b12fdfa3885a78c6eaa181eaeff Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 29 Feb 2024 17:23:51 +0100 Subject: [PATCH 111/426] runtime(yaml): disable multiline_scalar detection by default There have been many complaints about Yaml indenting too much, because it considers values to be multi-line by default, which leads to unintended indenting for (apparently most) users. So let's hide this feature behind the new feature flag, keep it simple and prefer single line value key pairs by default. If you want the old behaviour, set the following value: > :let g:yaml_indent_multiline_scalar = 1 If not set, it will indent the same as the previous line. closes #13845 Signed-off-by: Christian Brabandt --- runtime/doc/indent.txt | 6 ++++++ runtime/doc/tags | 1 + runtime/indent/yaml.vim | 7 +++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 7865bb6893..9fb6dd9f25 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1255,5 +1255,11 @@ Example of configuration: > This variable is equivalent to `g:vim_indent.line_continuation`. It's supported for backward compatibility. +YAML *ft-yaml-indent* + +By default, the yaml indent script does not try to detect multiline scalars. +If you want to enable this, set the following variable: > + + let g:yaml_indent_multiline_scalar = 1 vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/tags b/runtime/doc/tags index fb0b540535..8af0b573a5 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -7364,6 +7364,7 @@ ft-xhtml-omni insert.txt /*ft-xhtml-omni* ft-xml-omni insert.txt /*ft-xml-omni* ft-xml-syntax syntax.txt /*ft-xml-syntax* ft-xpm-syntax syntax.txt /*ft-xpm-syntax* +ft-yaml-indent indent.txt /*ft-yaml-indent* ft-yaml-syntax syntax.txt /*ft-yaml-syntax* ft-zimbu-plugin filetype.txt /*ft-zimbu-plugin* ft-zsh-syntax syntax.txt /*ft-zsh-syntax* diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim index 93fd8ea6f6..e5daf9f219 100644 --- a/runtime/indent/yaml.vim +++ b/runtime/indent/yaml.vim @@ -3,6 +3,7 @@ " Maintainer: Nikolai Pavlov " Last Updates: Lukas Reineke, "lacygoill" " Last Change: 2022 Jun 17 +" 2024 Feb 29 disable mulitline indent by default (The Vim project) " Only load this indent file when no other was loaded. if exists('b:did_indent') @@ -138,11 +139,13 @@ function GetYAMLIndent(lnum) else return indent(prevmapline) endif - elseif prevline =~# '^\s*- ' + elseif get(g:, 'yaml_indent_multiline_scalar', 0) && + \ prevline =~# '^\s*- ' " - List with " multiline scalar return previndent+2 - elseif prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property .. + elseif get(g:, 'yaml_indent_multiline_scalar', 0) && + \ prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property .. \ '\v|' .. s:c_ns_anchor_property .. \ '\v|' .. s:block_scalar_header .. \ '\v)%(\s+|\s*%(\#.*)?$))*' From 4d55c54e307c27600c644c6631ff673ed89dd53a Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Thu, 29 Feb 2024 17:30:43 +0100 Subject: [PATCH 112/426] patch 9.1.0144: getregion() needs more tests Problem: getregion() needs more tests Solution: Run the getregion() test in both the legacy and Vim9 contexts (Yegappan Lakshmanan) closes: #14114 Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt --- src/testdir/test_visual.vim | 519 +++++++++++++++++++----------------- src/version.c | 2 + 2 files changed, 271 insertions(+), 250 deletions(-) diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index fdc19827b5..795f63e49f 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -3,6 +3,7 @@ source shared.vim source check.vim source screendump.vim +import './vim9.vim' as v9 func Test_block_shift_multibyte() " Uses double-wide character. @@ -1631,261 +1632,279 @@ func Test_visual_substitute_visual() endfunc func Test_visual_getregion() - new - - call setline(1, ['one', 'two', 'three']) - - " Visual mode - call cursor(1, 1) - call feedkeys("\vjl", 'tx') - call assert_equal(['one', 'tw'], - \ 'v'->getpos()->getregion(getpos('.'))) - call assert_equal(['one', 'tw'], - \ '.'->getpos()->getregion(getpos('v'))) - call assert_equal(['o'], - \ 'v'->getpos()->getregion(getpos('v'))) - call assert_equal(['w'], - \ '.'->getpos()->getregion(getpos('.'), #{ type: 'v' })) - call assert_equal(['one', 'two'], - \ getpos('.')->getregion(getpos('v'), #{ type: 'V' })) - call assert_equal(['on', 'tw'], - \ getpos('.')->getregion(getpos('v'), #{ type: "\" })) - - " Line visual mode - call cursor(1, 1) - call feedkeys("\Vl", 'tx') - call assert_equal(['one'], - \ getregion(getpos('v'), getpos('.'), #{ type: 'V' })) - call assert_equal(['one'], - \ getregion(getpos('.'), getpos('v'), #{ type: 'V' })) - call assert_equal(['one'], - \ getregion(getpos('v'), getpos('v'), #{ type: 'V' })) - call assert_equal(['one'], - \ getregion(getpos('.'), getpos('.'), #{ type: 'V' })) - call assert_equal(['on'], - \ getpos('.')->getregion(getpos('v'), #{ type: 'v' })) - call assert_equal(['on'], - \ getpos('.')->getregion(getpos('v'), #{ type: "\" })) - - " Block visual mode - call cursor(1, 1) - call feedkeys("\\ll", 'tx') - call assert_equal(['one'], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - call assert_equal(['one'], - \ getregion(getpos('.'), getpos('v'), #{ type: "\" })) - call assert_equal(['o'], - \ getregion(getpos('v'), getpos('v'), #{ type: "\" })) - call assert_equal(['e'], - \ getregion(getpos('.'), getpos('.'), #{ type: "\" })) - call assert_equal(['one'], - \ '.'->getpos()->getregion(getpos('v'), #{ type: 'V' })) - call assert_equal(['one'], - \ '.'->getpos()->getregion(getpos('v'), #{ type: 'v' })) - - " Using Marks - call setpos("'a", [0, 2, 3, 0]) - call cursor(1, 1) - call assert_equal(['one', 'two'], - \ "'a"->getpos()->getregion(getpos('.'), #{ type: 'v' })) - call assert_equal(['one', 'two'], - \ "."->getpos()->getregion(getpos("'a"), #{ type: 'v' })) - call assert_equal(['one', 'two'], - \ "."->getpos()->getregion(getpos("'a"), #{ type: 'V' })) - call assert_equal(['two'], - \ "'a"->getpos()->getregion(getpos("'a"), #{ type: 'V' })) - call assert_equal(['one', 'two'], - \ "."->getpos()->getregion(getpos("'a"), #{ type: "\" })) - - " Using List - call cursor(1, 1) - call assert_equal(['one', 'two'], - \ [0, 2, 3, 0]->getregion(getpos('.'), #{ type: 'v' })) - call assert_equal(['one', 'two'], - \ '.'->getpos()->getregion([0, 2, 3, 0], #{ type: 'v' })) - call assert_equal(['one', 'two'], - \ '.'->getpos()->getregion([0, 2, 3, 0], #{ type: 'V' })) - call assert_equal(['two'], - \ [0, 2, 3, 0]->getregion([0, 2, 3, 0], #{ type: 'V' })) - call assert_equal(['one', 'two'], - \ '.'->getpos()->getregion([0, 2, 3, 0], #{ type: "\" })) - - " Multiline with line visual mode - call cursor(1, 1) - call feedkeys("\Vjj", 'tx') - call assert_equal(['one', 'two', 'three'], - \ getregion(getpos('v'), getpos('.'), #{ type: 'V' })) - - " Multiline with block visual mode - call cursor(1, 1) - call feedkeys("\\jj", 'tx') - call assert_equal(['o', 't', 't'], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - - call cursor(1, 1) - call feedkeys("\\jj$", 'tx') - call assert_equal(['one', 'two', 'three'], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - - " 'virtualedit' - set virtualedit=all - call cursor(1, 1) - call feedkeys("\\10ljj$", 'tx') - call assert_equal(['one ', 'two ', 'three '], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - set virtualedit& - - " Invalid position - call cursor(1, 1) - call feedkeys("\vjj$", 'tx') - call assert_fails("call getregion(1, 2)", 'E1211:') - call assert_fails("call getregion(getpos('.'), {})", 'E1211:') - call assert_equal([], getregion(getpos('.'), getpos('.'), #{ type: '' })) - - " using the wrong type - call assert_fails(':echo "."->getpos()->getregion("$", [])', 'E1211:') - - " using a mark in another buffer - new - let newbuf = bufnr() - call setline(1, range(10)) - normal! GmA - wincmd p - call assert_equal([newbuf, 10, 1, 0], getpos("'A")) - call assert_equal([], getregion(getpos('.'), getpos("'A"), #{ type: 'v' })) - call assert_equal([], getregion(getpos("'A"), getpos('.'), #{ type: 'v' })) - exe newbuf .. 'bwipe!' - - bwipe! - " Selection in starts or ends in the middle of a multibyte character - new - call setline(1, [ - \ "abcdefghijk\u00ab", - \ "\U0001f1e6\u00ab\U0001f1e7\u00ab\U0001f1e8\u00ab\U0001f1e9", - \ "1234567890" - \ ]) - call cursor(1, 3) - call feedkeys("\\ljj", 'xt') - call assert_equal(['cd', "\u00ab ", '34'], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - call cursor(1, 4) - call feedkeys("\\ljj", 'xt') - call assert_equal(['de', "\U0001f1e7", '45'], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - call cursor(1, 5) - call feedkeys("\\jj", 'xt') - call assert_equal(['e', ' ', '5'], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - call cursor(1, 1) - call feedkeys("\vj", 'xt') - call assert_equal(['abcdefghijk«', "\U0001f1e6"], - \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) - " marks on multibyte chars - set selection=exclusive - call setpos("'a", [0, 1, 11, 0]) - call setpos("'b", [0, 2, 16, 0]) - call setpos("'c", [0, 2, 0, 0]) - call cursor(1, 1) - call assert_equal(['ghijk', '🇨«🇩'], - \ getregion(getpos("'a"), getpos("'b"), #{ type: "\" })) - call assert_equal(['k«', '🇦«🇧«🇨'], - \ getregion(getpos("'a"), getpos("'b"), #{ type: 'v' })) - call assert_equal(['k«'], - \ getregion(getpos("'a"), getpos("'c"), #{ type: 'v' })) - - " use inclusive selection, although 'selection' is exclusive - call setpos("'a", [0, 1, 11, 0]) - call setpos("'b", [0, 1, 1, 0]) - call assert_equal(['abcdefghijk'], - \ getregion(getpos("'a"), getpos("'b"), #{ type: "\", exclusive: v:false })) - call assert_equal(['abcdefghij'], - \ getregion(getpos("'a"), getpos("'b"), #{ type: "\", exclusive: v:true })) - call assert_equal(['abcdefghijk'], - \ getregion(getpos("'a"), getpos("'b"), #{ type: 'v', exclusive: 0 })) - call assert_equal(['abcdefghij'], - \ getregion(getpos("'a"), getpos("'b"), #{ type: 'v', exclusive: 1 })) - call assert_equal(['abcdefghijk«'], - \ getregion(getpos("'a"), getpos("'b"), #{ type: 'V', exclusive: 0 })) - call assert_equal(['abcdefghijk«'], - \ getregion(getpos("'a"), getpos("'b"), #{ type: 'V', exclusive: 1 })) + let lines =<< trim END + new + + call setline(1, ['one', 'two', 'three']) + + #" Visual mode + call cursor(1, 1) + call feedkeys("\vjl", 'tx') + call assert_equal(['one', 'tw'], + \ 'v'->getpos()->getregion(getpos('.'))) + call assert_equal(['one', 'tw'], + \ '.'->getpos()->getregion(getpos('v'))) + call assert_equal(['o'], + \ 'v'->getpos()->getregion(getpos('v'))) + call assert_equal(['w'], + \ '.'->getpos()->getregion(getpos('.'), {'type': 'v' })) + call assert_equal(['one', 'two'], + \ getpos('.')->getregion(getpos('v'), {'type': 'V' })) + call assert_equal(['on', 'tw'], + \ getpos('.')->getregion(getpos('v'), {'type': "\" })) + + #" Line visual mode + call cursor(1, 1) + call feedkeys("\Vl", 'tx') + call assert_equal(['one'], + \ getregion(getpos('v'), getpos('.'), {'type': 'V' })) + call assert_equal(['one'], + \ getregion(getpos('.'), getpos('v'), {'type': 'V' })) + call assert_equal(['one'], + \ getregion(getpos('v'), getpos('v'), {'type': 'V' })) + call assert_equal(['one'], + \ getregion(getpos('.'), getpos('.'), {'type': 'V' })) + call assert_equal(['on'], + \ getpos('.')->getregion(getpos('v'), {'type': 'v' })) + call assert_equal(['on'], + \ getpos('.')->getregion(getpos('v'), {'type': "\" })) + + #" Block visual mode + call cursor(1, 1) + call feedkeys("\\ll", 'tx') + call assert_equal(['one'], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + call assert_equal(['one'], + \ getregion(getpos('.'), getpos('v'), {'type': "\" })) + call assert_equal(['o'], + \ getregion(getpos('v'), getpos('v'), {'type': "\" })) + call assert_equal(['e'], + \ getregion(getpos('.'), getpos('.'), {'type': "\" })) + call assert_equal(['one'], + \ '.'->getpos()->getregion(getpos('v'), {'type': 'V' })) + call assert_equal(['one'], + \ '.'->getpos()->getregion(getpos('v'), {'type': 'v' })) + + #" Using Marks + call setpos("'a", [0, 2, 3, 0]) + call cursor(1, 1) + call assert_equal(['one', 'two'], + \ "'a"->getpos()->getregion(getpos('.'), {'type': 'v' })) + call assert_equal(['one', 'two'], + \ "."->getpos()->getregion(getpos("'a"), {'type': 'v' })) + call assert_equal(['one', 'two'], + \ "."->getpos()->getregion(getpos("'a"), {'type': 'V' })) + call assert_equal(['two'], + \ "'a"->getpos()->getregion(getpos("'a"), {'type': 'V' })) + call assert_equal(['one', 'two'], + \ "."->getpos()->getregion(getpos("'a"), {'type': "\" })) + + #" Using List + call cursor(1, 1) + call assert_equal(['one', 'two'], + \ [0, 2, 3, 0]->getregion(getpos('.'), {'type': 'v' })) + call assert_equal(['one', 'two'], + \ '.'->getpos()->getregion([0, 2, 3, 0], {'type': 'v' })) + call assert_equal(['one', 'two'], + \ '.'->getpos()->getregion([0, 2, 3, 0], {'type': 'V' })) + call assert_equal(['two'], + \ [0, 2, 3, 0]->getregion([0, 2, 3, 0], {'type': 'V' })) + call assert_equal(['one', 'two'], + \ '.'->getpos()->getregion([0, 2, 3, 0], {'type': "\" })) + + #" Multiline with line visual mode + call cursor(1, 1) + call feedkeys("\Vjj", 'tx') + call assert_equal(['one', 'two', 'three'], + \ getregion(getpos('v'), getpos('.'), {'type': 'V' })) + + #" Multiline with block visual mode + call cursor(1, 1) + call feedkeys("\\jj", 'tx') + call assert_equal(['o', 't', 't'], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + + call cursor(1, 1) + call feedkeys("\\jj$", 'tx') + call assert_equal(['one', 'two', 'three'], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + + #" 'virtualedit' + set virtualedit=all + call cursor(1, 1) + call feedkeys("\\10ljj$", 'tx') + call assert_equal(['one ', 'two ', 'three '], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + set virtualedit& + + #" Invalid position + call cursor(1, 1) + call feedkeys("\vjj$", 'tx') + call assert_fails("call getregion(1, 2)", 'E1211:') + call assert_fails("call getregion(getpos('.'), {})", 'E1211:') + call assert_equal([], getregion(getpos('.'), getpos('.'), {'type': '' })) + + #" using the wrong type + call assert_fails(':echo "."->getpos()->getregion("$", [])', 'E1211:') + + #" using a mark in another buffer + new + VAR newbuf = bufnr() + call setline(1, range(10)) + normal! GmA + wincmd p + call assert_equal([newbuf, 10, 1, 0], getpos("'A")) + call assert_equal([], getregion(getpos('.'), getpos("'A"), {'type': 'v' })) + call assert_equal([], getregion(getpos("'A"), getpos('.'), {'type': 'v' })) + exe $':{newbuf}bwipe!' + END + call v9.CheckLegacyAndVim9Success(lines) bwipe! - " Exclusive selection - new - set selection=exclusive - call setline(1, ["a\tc", "x\tz", '', '']) - call cursor(1, 1) - call feedkeys("\v2l", 'xt') - call assert_equal(["a\t"], - \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) - call cursor(1, 1) - call feedkeys("\v$G", 'xt') - call assert_equal(["a\tc", "x\tz", ''], - \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) - call cursor(1, 1) - call feedkeys("\v$j", 'xt') - call assert_equal(["a\tc", "x\tz"], - \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) - call cursor(1, 1) - call feedkeys("\\$j", 'xt') - call assert_equal(["a\tc", "x\tz"], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - call cursor(1, 1) - call feedkeys("\\$G", 'xt') - call assert_equal(["a", "x", '', ''], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - call cursor(1, 1) - call feedkeys("\wv2j", 'xt') - call assert_equal(["c", "x\tz"], - \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) - set selection& - - " Exclusive selection 2 - new - call setline(1, ["a\tc", "x\tz", '', '']) - call cursor(1, 1) - call feedkeys("\v2l", 'xt') - call assert_equal(["a\t"], - \ getregion(getpos('v'), getpos('.'), #{ exclusive: v:true })) - call cursor(1, 1) - call feedkeys("\v$G", 'xt') - call assert_equal(["a\tc", "x\tz", ''], - \ getregion(getpos('v'), getpos('.'), #{ exclusive: v:true })) - call cursor(1, 1) - call feedkeys("\v$j", 'xt') - call assert_equal(["a\tc", "x\tz"], - \ getregion(getpos('v'), getpos('.'), #{ exclusive: v:true })) - call cursor(1, 1) - call feedkeys("\\$j", 'xt') - call assert_equal(["a\tc", "x\tz"], - \ getregion(getpos('v'), getpos('.'), - \ #{ exclusive: v:true, type: "\" })) - call cursor(1, 1) - call feedkeys("\\$G", 'xt') - call assert_equal(["a", "x", '', ''], - \ getregion(getpos('v'), getpos('.'), - \ #{ exclusive: v:true, type: "\" })) - call cursor(1, 1) - call feedkeys("\wv2j", 'xt') - call assert_equal(["c", "x\tz"], - \ getregion(getpos('v'), getpos('.'), #{ exclusive: v:true })) - - " virtualedit - set selection=exclusive - set virtualedit=all - call cursor(1, 1) - call feedkeys("\2lv2lj", 'xt') - call assert_equal([' c', 'x '], - \ getregion(getpos('v'), getpos('.'), #{ type: 'v' })) - call cursor(1, 1) - call feedkeys("\2l\2l2j", 'xt') - call assert_equal([' ', ' ', ' '], - \ getregion(getpos('v'), getpos('.'), #{ type: "\" })) - set virtualedit& - set selection& + let lines =<< trim END + #" Selection in starts or ends in the middle of a multibyte character + new + call setline(1, [ + \ "abcdefghijk\u00ab", + \ "\U0001f1e6\u00ab\U0001f1e7\u00ab\U0001f1e8\u00ab\U0001f1e9", + \ "1234567890" + \ ]) + call cursor(1, 3) + call feedkeys("\\ljj", 'xt') + call assert_equal(['cd', "\u00ab ", '34'], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + call cursor(1, 4) + call feedkeys("\\ljj", 'xt') + call assert_equal(['de', "\U0001f1e7", '45'], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + call cursor(1, 5) + call feedkeys("\\jj", 'xt') + call assert_equal(['e', ' ', '5'], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + call cursor(1, 1) + call feedkeys("\vj", 'xt') + call assert_equal(['abcdefghijk«', "\U0001f1e6"], + \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) + + #" marks on multibyte chars + :set selection=exclusive + call setpos("'a", [0, 1, 11, 0]) + call setpos("'b", [0, 2, 16, 0]) + call setpos("'c", [0, 2, 0, 0]) + call cursor(1, 1) + call assert_equal(['ghijk', '🇨«🇩'], + \ getregion(getpos("'a"), getpos("'b"), {'type': "\" })) + call assert_equal(['k«', '🇦«🇧«🇨'], + \ getregion(getpos("'a"), getpos("'b"), {'type': 'v' })) + call assert_equal(['k«'], + \ getregion(getpos("'a"), getpos("'c"), {'type': 'v' })) + + #" use inclusive selection, although 'selection' is exclusive + call setpos("'a", [0, 1, 11, 0]) + call setpos("'b", [0, 1, 1, 0]) + call assert_equal(['abcdefghijk'], + \ getregion(getpos("'a"), getpos("'b"), + \ {'type': "\", 'exclusive': v:false })) + call assert_equal(['abcdefghij'], + \ getregion(getpos("'a"), getpos("'b"), + \ {'type': "\", 'exclusive': v:true })) + call assert_equal(['abcdefghijk'], + \ getregion(getpos("'a"), getpos("'b"), + \ {'type': 'v', 'exclusive': 0 })) + call assert_equal(['abcdefghij'], + \ getregion(getpos("'a"), getpos("'b"), + \ {'type': 'v', 'exclusive': 1 })) + call assert_equal(['abcdefghijk«'], + \ getregion(getpos("'a"), getpos("'b"), + \ {'type': 'V', 'exclusive': 0 })) + call assert_equal(['abcdefghijk«'], + \ getregion(getpos("'a"), getpos("'b"), + \ {'type': 'V', 'exclusive': 1 })) + :set selection& + END + call v9.CheckLegacyAndVim9Success(lines) bwipe! + + let lines =<< trim END + #" Exclusive selection + new + set selection=exclusive + call setline(1, ["a\tc", "x\tz", '', '']) + call cursor(1, 1) + call feedkeys("\v2l", 'xt') + call assert_equal(["a\t"], + \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) + call cursor(1, 1) + call feedkeys("\v$G", 'xt') + call assert_equal(["a\tc", "x\tz", ''], + \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) + call cursor(1, 1) + call feedkeys("\v$j", 'xt') + call assert_equal(["a\tc", "x\tz"], + \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) + call cursor(1, 1) + call feedkeys("\\$j", 'xt') + call assert_equal(["a\tc", "x\tz"], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + call cursor(1, 1) + call feedkeys("\\$G", 'xt') + call assert_equal(["a", "x", '', ''], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + call cursor(1, 1) + call feedkeys("\wv2j", 'xt') + call assert_equal(["c", "x\tz"], + \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) + set selection& + + #" Exclusive selection 2 + new + call setline(1, ["a\tc", "x\tz", '', '']) + call cursor(1, 1) + call feedkeys("\v2l", 'xt') + call assert_equal(["a\t"], + \ getregion(getpos('v'), getpos('.'), {'exclusive': v:true })) + call cursor(1, 1) + call feedkeys("\v$G", 'xt') + call assert_equal(["a\tc", "x\tz", ''], + \ getregion(getpos('v'), getpos('.'), {'exclusive': v:true })) + call cursor(1, 1) + call feedkeys("\v$j", 'xt') + call assert_equal(["a\tc", "x\tz"], + \ getregion(getpos('v'), getpos('.'), {'exclusive': v:true })) + call cursor(1, 1) + call feedkeys("\\$j", 'xt') + call assert_equal(["a\tc", "x\tz"], + \ getregion(getpos('v'), getpos('.'), + \ {'exclusive': v:true, 'type': "\" })) + call cursor(1, 1) + call feedkeys("\\$G", 'xt') + call assert_equal(["a", "x", '', ''], + \ getregion(getpos('v'), getpos('.'), + \ {'exclusive': v:true, 'type': "\" })) + call cursor(1, 1) + call feedkeys("\wv2j", 'xt') + call assert_equal(["c", "x\tz"], + \ getregion(getpos('v'), getpos('.'), {'exclusive': v:true })) + + #" virtualedit + set selection=exclusive + set virtualedit=all + call cursor(1, 1) + call feedkeys("\2lv2lj", 'xt') + call assert_equal([' c', 'x '], + \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) + call cursor(1, 1) + call feedkeys("\2l\2l2j", 'xt') + call assert_equal([' ', ' ', ' '], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + set virtualedit& + set selection& + + bwipe! + END + call v9.CheckLegacyAndVim9Success(lines) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index cc2d412471..a17f3271e7 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 144, /**/ 143, /**/ From 062141b1a70cf5364e6983ec901282e0111745c1 Mon Sep 17 00:00:00 2001 From: Sam-programs <130783534+Sam-programs@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:40:29 +0100 Subject: [PATCH 113/426] patch 9.1.0145: v:echospace not correct when 'showcmdloc' != last Problem: the amount of available space (v:echospace) on the command line is not correct when showcmdloc is drawn into the statusline or tabline. Solution: only add SHOWCMD_COLS to the shown command column when 'showcmdloc' is set to last (Sam-programs) closes: #14108 Co-authored-by: zeertzjq Signed-off-by: Sam-programs <130783534+Sam-programs@users.noreply.github.com> Signed-off-by: Christian Brabandt --- src/optionstr.c | 1 + src/screen.c | 2 +- src/testdir/test_messages.vim | 6 +++++- src/version.c | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/optionstr.c b/src/optionstr.c index 7f6225fd2f..771423c641 100644 --- a/src/optionstr.c +++ b/src/optionstr.c @@ -3440,6 +3440,7 @@ did_set_showbreak(optset_T *args) char * did_set_showcmdloc(optset_T *args UNUSED) { + comp_col(); return did_set_opt_strings(p_sloc, p_sloc_values, FALSE); } diff --git a/src/screen.c b/src/screen.c index 939a335999..208b182541 100644 --- a/src/screen.c +++ b/src/screen.c @@ -4536,7 +4536,7 @@ comp_col(void) if (!last_has_status) sc_col = ru_col; } - if (p_sc) + if (p_sc && *p_sloc == 'l') { sc_col += SHOWCMD_COLS; if (!p_ru || last_has_status) // no need for separating space diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim index 48f1bab45b..8d0a422809 100644 --- a/src/testdir/test_messages.vim +++ b/src/testdir/test_messages.vim @@ -162,8 +162,12 @@ func Test_echospace() call assert_equal(&columns - 12, v:echospace) set showcmd ruler call assert_equal(&columns - 29, v:echospace) + set showcmdloc=statusline + call assert_equal(&columns - 19, v:echospace) + set showcmdloc=tabline + call assert_equal(&columns - 19, v:echospace) - set ruler& showcmd& + set ruler& showcmd& showcmdloc& endfunc func Test_warning_scroll() diff --git a/src/version.c b/src/version.c index a17f3271e7..5842f46d5a 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 145, /**/ 144, /**/ From 56b7da3c051fe1a5fd76534998c17b22d83c0899 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 29 Feb 2024 17:48:14 +0100 Subject: [PATCH 114/426] runtime(netrw): handle file/dir symlinks specifically in tree mode fixes: #2386 related: #3609 Signed-off-by: Christian Brabandt --- runtime/autoload/netrw.vim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 0508dcae3b..850e5a40f4 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -9476,7 +9476,7 @@ fun! s:NetrwTreeDir(islocal) " call Decho("treedir<".treedir.">",'~'.expand("")) elseif curline =~ '@$' " call Decho("handle symbolic link from current line",'~'.expand("")) - let treedir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e')) + let potentialdir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e')) " call Decho("treedir<".treedir.">",'~'.expand("")) else " call Decho("do not extract tree subdirectory from current line and set treedir to empty",'~'.expand("")) @@ -9501,7 +9501,6 @@ fun! s:NetrwTreeDir(islocal) " call Decho("COMBAK#23 : mod=".&mod." win#".winnr()) " call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("")) - let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1','')) " call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir),'~'.expand("")) " call Decho("COMBAK#24 : mod=".&mod." win#".winnr()) @@ -9514,8 +9513,15 @@ fun! s:NetrwTreeDir(islocal) " " call Decho("newdir <".newdir.">",'~'.expand("")) " else " call Decho("apply NetrwTreePath to treetop<".w:netrw_treetop.">",'~'.expand("")) - let treedir = s:NetrwTreePath(w:netrw_treetop) -" endif + if a:islocal && curline =~ '@$' + if isdirectory(s:NetrwFile(potentialdir)) + let treedir = w:netrw_treetop.'/'.potentialdir.'/' + let w:netrw_treetop = treedir + endif + else + let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1','')) + let treedir = s:NetrwTreePath(w:netrw_treetop) + endif endif " call Decho("COMBAK#25 : mod=".&mod." win#".winnr()) From 8fad5d58874ed724f673ac8a83739164cead3961 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 29 Feb 2024 18:12:30 +0100 Subject: [PATCH 115/426] runtime(doc,netrw): update "Last Change header", remove trailing whitespace Update Last-Change Header for netrw and doc/indent.txt, fix a trailing whitespace in indent.txt and make CI happy. Signed-off-by: Christian Brabandt --- runtime/autoload/netrw.vim | 3 ++- runtime/doc/indent.txt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 850e5a40f4..2206c21ada 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -6,7 +6,8 @@ " Last Change: " 2023 Nov 21 by Vim Project: ignore wildignore when expanding $COMSPEC (v173a) " 2023 Nov 22 by Vim Project: fix handling of very long filename on longlist style (v173a) -" 2024 Feb 19 by Vim Project (announce adoption) +" 2024 Feb 19 by Vim Project: (announce adoption) +" 2024 Feb 29 by Vim Project: handle symlinks in tree mode correctly " Former Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 9fb6dd9f25..fe24505ed1 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1,4 +1,4 @@ -*indent.txt* For Vim version 9.1. Last change: 2023 Dec 27 +*indent.txt* For Vim version 9.1. Last change: 2024 Feb 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1257,7 +1257,7 @@ It's supported for backward compatibility. YAML *ft-yaml-indent* -By default, the yaml indent script does not try to detect multiline scalars. +By default, the yaml indent script does not try to detect multiline scalars. If you want to enable this, set the following variable: > let g:yaml_indent_multiline_scalar = 1 From 87410ab3f556121dfb3b30515f40c5f079edd004 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 2 Mar 2024 06:00:23 +0800 Subject: [PATCH 116/426] runtime(doc): some improvements to getregion() docs (#14122) - Mention the default selection behavior - Remove useless sentence - Correct description about space padding Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 6d1d372cfd..dbad8802e1 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 28 +*builtin.txt* For Vim version 9.1. Last change: 2024 Mar 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4281,32 +4281,31 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()* The optional argument {opts} is a Dict and supports the following items: - type Specify the selection type + type Specify the region's selection type (default: "v"): "v" for |characterwise| mode "V" for |linewise| mode "" for |blockwise-visual| mode - exclusive If |true|, use exclusive selection - for the end position 'selection'. + exclusive If |TRUE|, use exclusive selection + for the end position + (default: follow 'selection') You can get the last selection type by |visualmode()|. If Visual mode is active, use |mode()| to get the Visual mode (e.g., in a |:vmap|). - This function uses the line and column number from the - specified position. - It is useful to get text starting and ending in different - columns, such as |characterwise-visual| selection. + This function is useful to get text starting and ending in + different columns, such as a |characterwise-visual| selection. Note that: - Order of {pos1} and {pos2} doesn't matter, it will always return content from the upper left position to the lower right position. - - If 'virtualedit' is enabled and selection is past the end of - line, resulting lines are filled with blanks. - - If the selection starts or ends in the middle of a multibyte - character, it is not included but its selected part is - substituted with spaces. + - If 'virtualedit' is enabled and the region is past the end + of the lines, resulting lines are padded with spaces. + - If the region is blockwise and it starts or ends in the + middle of a multi-cell character, it is not included but + its selected part is substituted with spaces. - If {pos1} or {pos2} is not current in the buffer, an empty list is returned. From c27fcf4857228bc650943246ffbba444a085b3e7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 1 Mar 2024 23:01:43 +0100 Subject: [PATCH 117/426] patch 9.1.0146: v:echospace wrong with invalid value of 'showcmdloc' Problem: v:echospace wrong after setting invalid value to 'showcmdloc'. Solution: Only call comp_col() if value is valid. (zeertzjq) closes: #14119 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt --- src/optionstr.c | 8 ++++++-- src/testdir/test_messages.vim | 6 ++++++ src/version.c | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/optionstr.c b/src/optionstr.c index 771423c641..e5f4946b44 100644 --- a/src/optionstr.c +++ b/src/optionstr.c @@ -3440,8 +3440,12 @@ did_set_showbreak(optset_T *args) char * did_set_showcmdloc(optset_T *args UNUSED) { - comp_col(); - return did_set_opt_strings(p_sloc, p_sloc_values, FALSE); + char *errmsg = did_set_opt_strings(p_sloc, p_sloc_values, FALSE); + + if (errmsg == NULL) + comp_col(); + + return errmsg; } int diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim index 8d0a422809..46f3368346 100644 --- a/src/testdir/test_messages.vim +++ b/src/testdir/test_messages.vim @@ -166,6 +166,12 @@ func Test_echospace() call assert_equal(&columns - 19, v:echospace) set showcmdloc=tabline call assert_equal(&columns - 19, v:echospace) + call assert_fails('set showcmdloc=leap', 'E474:') + call assert_equal(&columns - 19, v:echospace) + set showcmdloc=last + call assert_equal(&columns - 29, v:echospace) + call assert_fails('set showcmdloc=jump', 'E474:') + call assert_equal(&columns - 29, v:echospace) set ruler& showcmd& showcmdloc& endfunc diff --git a/src/version.c b/src/version.c index 5842f46d5a..e7ee9466b3 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 146, /**/ 145, /**/ From 100a665634a0a2edbc755daf453c4915800684dd Mon Sep 17 00:00:00 2001 From: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com> Date: Sat, 2 Mar 2024 01:11:14 +0300 Subject: [PATCH 118/426] runtime(java): Improve the recognition of literals (#14120) * Emend the Unicode and octal escape sequence patterns; * Accept the (repeated) underscore separators in all numerical literals; * Recognise hexadecimal floating-point literals. (The space escape sequence '\s' will be introduced along with text blocks in another PR.) References: https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.3 https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.1 https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.2 https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.7 Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com> Signed-off-by: Christian Brabandt --- runtime/syntax/java.vim | 43 +++--- .../syntax/testdir/dumps/java_escapes_00.dump | 20 +++ .../syntax/testdir/dumps/java_escapes_01.dump | 20 +++ .../syntax/testdir/dumps/java_escapes_02.dump | 20 +++ .../syntax/testdir/dumps/java_escapes_03.dump | 20 +++ .../syntax/testdir/dumps/java_escapes_04.dump | 20 +++ .../syntax/testdir/dumps/java_escapes_05.dump | 20 +++ .../syntax/testdir/dumps/java_escapes_06.dump | 20 +++ .../syntax/testdir/dumps/java_escapes_99.dump | 20 +++ .../syntax/testdir/dumps/java_numbers_00.dump | 20 +++ .../syntax/testdir/dumps/java_numbers_01.dump | 20 +++ .../syntax/testdir/dumps/java_numbers_02.dump | 20 +++ .../syntax/testdir/dumps/java_numbers_03.dump | 20 +++ .../syntax/testdir/dumps/java_numbers_04.dump | 20 +++ .../syntax/testdir/dumps/java_numbers_99.dump | 20 +++ .../syntax/testdir/input/java_escapes.java | 123 ++++++++++++++++++ .../syntax/testdir/input/java_numbers.java | 88 +++++++++++++ 17 files changed, 518 insertions(+), 16 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/java_escapes_00.dump create mode 100644 runtime/syntax/testdir/dumps/java_escapes_01.dump create mode 100644 runtime/syntax/testdir/dumps/java_escapes_02.dump create mode 100644 runtime/syntax/testdir/dumps/java_escapes_03.dump create mode 100644 runtime/syntax/testdir/dumps/java_escapes_04.dump create mode 100644 runtime/syntax/testdir/dumps/java_escapes_05.dump create mode 100644 runtime/syntax/testdir/dumps/java_escapes_06.dump create mode 100644 runtime/syntax/testdir/dumps/java_escapes_99.dump create mode 100644 runtime/syntax/testdir/dumps/java_numbers_00.dump create mode 100644 runtime/syntax/testdir/dumps/java_numbers_01.dump create mode 100644 runtime/syntax/testdir/dumps/java_numbers_02.dump create mode 100644 runtime/syntax/testdir/dumps/java_numbers_03.dump create mode 100644 runtime/syntax/testdir/dumps/java_numbers_04.dump create mode 100644 runtime/syntax/testdir/dumps/java_numbers_99.dump create mode 100644 runtime/syntax/testdir/input/java_escapes.java create mode 100644 runtime/syntax/testdir/input/java_numbers.java diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index 1b940ebd39..aec2955533 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -2,7 +2,7 @@ " Language: Java " Maintainer: Claudio Fleiner " URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim -" Last Change: 2024 Feb 27 +" Last Change: 2024 Mar 01 " Please check :help java.vim for comments on some of the options available. @@ -226,20 +226,28 @@ syn match javaComment "/\*\*/" " Strings and constants syn match javaSpecialError contained "\\." syn match javaSpecialCharError contained "[^']" -syn match javaSpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)" +" Escape Sequences (JLS-17, §3.10.7): +syn match javaSpecialChar contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[btnfr"'\\]\)" syn region javaString start=+"+ end=+"+ end=+$+ contains=javaSpecialChar,javaSpecialError,@Spell -" next line disabled, it can cause a crash for a long line +" The next line is commented out, it can cause a crash for a long line "syn match javaStringError +"\([^"\\]\|\\.\)*$+ syn match javaCharacter "'[^']*'" contains=javaSpecialChar,javaSpecialCharError syn match javaCharacter "'\\''" contains=javaSpecialChar syn match javaCharacter "'[^\\]'" -syn match javaNumber "\<\(0[bB][0-1]\+\|0[0-7]*\|0[xX]\x\+\|\d\(\d\|_\d\)*\)[lL]\=\>" -syn match javaNumber "\(\<\d\(\d\|_\d\)*\.\(\d\(\d\|_\d\)*\)\=\|\.\d\(\d\|_\d\)*\)\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\=" -syn match javaNumber "\<\d\(\d\|_\d\)*[eE][-+]\=\d\(\d\|_\d\)*[fFdD]\=\>" -syn match javaNumber "\<\d\(\d\|_\d\)*\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\>" - -" unicode characters -syn match javaSpecial "\\u\d\{4\}" +" Integer literals (JLS-17, §3.10.1): +syn keyword javaNumber 0 0l 0L +syn match javaNumber "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)[lL]\=\>" +" Decimal floating-point literals (JLS-17, §3.10.2): +" Against "\<\d\+\>\.": +syn match javaNumber "\<\d\%(_*\d\)*\." +syn match javaNumber "\%(\<\d\%(_*\d\)*\.\%(\d\%(_*\d\)*\)\=\|\.\d\%(_*\d\)*\)\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\=\>" +syn match javaNumber "\<\d\%(_*\d\)*[eE][-+]\=\d\%(_*\d\)*[fFdD]\=\>" +syn match javaNumber "\<\d\%(_*\d\)*\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\>" +" Hexadecimal floating-point literals (JLS-17, §3.10.2): +syn match javaNumber "\<0[xX]\%(\x\%(_*\x\)*\.\=\|\%(\x\%(_*\x\)*\)\=\.\x\%(_*\x\)*\)[pP][-+]\=\d\%(_*\d\)*[fFdD]\=\>" + +" Unicode characters +syn match javaSpecial "\\u\x\x\x\x" syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStringError @@ -265,16 +273,19 @@ endif if exists("java_highlight_debug") " Strings and constants - syn match javaDebugSpecial contained "\\\d\d\d\|\\." + syn match javaDebugSpecial contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[btnfr"'\\]\)" syn region javaDebugString contained start=+"+ end=+"+ contains=javaDebugSpecial - syn match javaDebugStringError +"\([^"\\]\|\\.\)*$+ + syn match javaDebugStringError contained +"\%([^"\\]\|\\.\)*$+ syn match javaDebugCharacter contained "'[^\\]'" syn match javaDebugSpecialCharacter contained "'\\.'" syn match javaDebugSpecialCharacter contained "'\\''" - syn match javaDebugNumber contained "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" - syn match javaDebugNumber contained "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" - syn match javaDebugNumber contained "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" - syn match javaDebugNumber contained "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" + syn keyword javaDebugNumber contained 0 0l 0L + syn match javaNumber contained "\<\d\%(_*\d\)*\." + syn match javaDebugNumber contained "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)[lL]\=\>" + syn match javaDebugNumber contained "\%(\<\d\%(_*\d\)*\.\%(\d\%(_*\d\)*\)\=\|\.\d\%(_*\d\)*\)\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\=\>" + syn match javaDebugNumber contained "\<\d\%(_*\d\)*[eE][-+]\=\d\%(_*\d\)*[fFdD]\=\>" + syn match javaDebugNumber contained "\<\d\%(_*\d\)*\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\>" + syn match javaDebugNumber contained "\<0[xX]\%(\x\%(_*\x\)*\.\=\|\%(\x\%(_*\x\)*\)\=\.\x\%(_*\x\)*\)[pP][-+]\=\d\%(_*\d\)*[fFdD]\=\>" syn keyword javaDebugBoolean contained true false syn keyword javaDebugType contained null this super syn region javaDebugParen start=+(+ end=+)+ contained contains=javaDebug.*,javaDebugParen diff --git a/runtime/syntax/testdir/dumps/java_escapes_00.dump b/runtime/syntax/testdir/dumps/java_escapes_00.dump new file mode 100644 index 0000000000..3db803d41e --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_escapes_00.dump @@ -0,0 +1,20 @@ +>c+0#00e0003#ffffff0|l|a|s@1| +0#0000000&|E|s|c|a|p|e|s|T|e|s|t|s| @56 +|{| @2|/+0#0000e05&@1| |j|a|v|a|p| |-|c|o|n|s|t|a|n|t|s| |E|s|c|a|p|e|s|T|e|s|t|s|.|c|l|a|s@1| +0#0000000&@32 +@4|/+0#0000e05&@1| |s|t|a|t|i|c| |f|i|n|a|l| |S|t|r|i|n|g| |h|e|l@1|o| |=| |"|h|e|l@1|o|"|;| +0#0000000&@31 +@4|\+0#e000e06&|u|0@1|7|3|\|u|0@1|7|4|\|u|0@1|6|1|\|u|0@1|7|4|\|u|0@1|6|9|\|u|0@1|6|3| +0#0000000&@34 +@4|\+0#e000e06&|u|0@1|6@1|\|u|0@1|6|9|\|u|0@1|6|e|\|u|0@1|6|1|\|u|0@1|6|c| +0#0000000&@40 +@4|\+0#e000e06&|u|0@1|5|3|\|u|0@1|7|4|\|u|0@1|7|2|\|u|0@1|6|9|\|u|0@1|6|e|\|u|0@1|6|7| +0#0000000&@34 +@4|\+0#e000e06&|u|0@1|6|8|\|u|0@1|6|5|\|u|0@1|6|c|\|u|0@1|6|c|\|u|0@1|6|f| +0#0000000&@40 +@4|\+0#e000e06&|u|0@1|3|d| +0#0000000&@64 +@4|\+0#e000e06&|u|0@1|2@1|\|u|0@1|6|8|\|u|0@1|6|5|\|u|0@1|6|c|\|u|0@1|6|c|\|u|0@1|6|f|\|u|0@1|2@1| +0#0000000&@28 +@4|\+0#e000e06&|u|0@1|3|b| +0#0000000&@64 +@75 +@4|s+0#00e0003&|t|a|t|i|c| +0#0000000&|{| @62 +@8|c+0#00e0003&|h|a|r| +0#0000000&|e@1|[|]| |=| |{| @53 +@12|'+0#e000002&|\+0#e000e06&|b|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|t|'+0#e000002&|,+0#0000000&| @51 +@12|'+0#e000002&|\+0#e000e06&|n|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|f|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|r|'+0#e000002&|,+0#0000000&| @45 +@12|'+0#e000002&|\+0#e000e06&|"|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|'|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&@1|'+0#e000002&|,+0#0000000&| @45 +@8|}|;| @64 +@75 +@8|S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|n+0#af5f00255&|e|w| +0#0000000&|S|t|r|i|n|g|[|]| |{| @33 +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/java_escapes_01.dump b/runtime/syntax/testdir/dumps/java_escapes_01.dump new file mode 100644 index 0000000000..8d2c395ad7 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_escapes_01.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@11|'+0#e000002&|\+0#e000e06&|b|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|t|'+0#e000002&|,+0#0000000&| @51 +@12|'+0#e000002&|\+0#e000e06&|n|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|f|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|r|'+0#e000002&|,+0#0000000&| @45 +@12|'+0#e000002&|\+0#e000e06&|"|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|'|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&@1|'+0#e000002&|,+0#0000000&| @45 +@8|}|;| @64 +@75 +@8>S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|n+0#af5f00255&|e|w| +0#0000000&|S|t|r|i|n|g|[|]| |{| @33 +@12|"+0#e000002&|\+0#e000e06&|b|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|t|"+0#e000002&|,+0#0000000&| @51 +@12|"+0#e000002&|\+0#e000e06&|n|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|f|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|r|"+0#e000002&|,+0#0000000&| @45 +@12|"+0#e000002&|\+0#e000e06&|"|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|'|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&@1|"+0#e000002&|,+0#0000000&| @45 +@8|}|)|;| @63 +@75 +@8|c+0#00e0003&|h|a|r| +0#0000000&|o@1|[|]| |=| |{| @53 +@12|'+0#e000002&|\+0#e000e06&|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|7|'+0#e000002&|,+0#0000000&| @15 +@75 +@8|'+0#e000002&|\+0#e000e06&|0@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|7|'+0#e000002&|,+0#0000000&| @11 +@75 +@4|'+0#e000002&|\+0#e000e06&|0@2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0@1|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0@1|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0@1|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0@1|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0@1|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0@1|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0@1|7|'+0#e000002&|,+0#0000000&| @7 +@75 +@8|'+0#e000002&|\+0#e000e06&|1|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|7|'+0#e000002&|,+0#0000000&| @11 +@57|1|9|,|3|-|9| @7|1|2|%| diff --git a/runtime/syntax/testdir/dumps/java_escapes_02.dump b/runtime/syntax/testdir/dumps/java_escapes_02.dump new file mode 100644 index 0000000000..da8b1a975a --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_escapes_02.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|'+0#e000002&|\+0#e000e06&|1|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|7|'+0#e000002&|,+0#0000000&| @11 +@8|'+0#e000002&|\+0#e000e06&|2|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|7|'+0#e000002&|,+0#0000000&| @11 +@8|'+0#e000002&|\+0#e000e06&|3|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|7|'+0#e000002&|,+0#0000000&| @11 +@8|'+0#e000002&|\+0#e000e06&|4|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|4|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|4|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|4|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|4@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|4|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|4|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|4|7|'+0#e000002&|,+0#0000000&| @11 +@8|'+0#e000002&|\+0#e000e06&|5|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|5|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|5|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|5|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|5|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|5@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|5|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|5|7|'+0#e000002&|,+0#0000000&| @11 +@8>'+0#e000002&|\+0#e000e06&|6|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|6|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|6|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|6|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|6|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|6|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|6@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|6|7|'+0#e000002&|,+0#0000000&| @11 +@8|'+0#e000002&|\+0#e000e06&|7|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|7|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|7|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|7|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|7|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|7|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|7|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|7@1|'+0#e000002&|,+0#0000000&| @11 +@75 +@4|'+0#e000002&|\+0#e000e06&|0|1|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|1@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|1|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|1|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|1|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|1|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|1|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|1|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|0|2|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|2|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|2@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|2|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|2|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|2|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|2|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|2|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|0|3|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|3|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|3|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|3@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|3|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|3|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|3|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|3|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|0|4|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|4|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|4|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|4|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|4@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|4|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|4|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|4|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|0|5|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|5|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|5|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|5|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|5|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|5@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|5|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|5|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|0|6|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|6|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|6|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|6|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|6|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|6|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|6@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|6|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|0|7|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|7|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|7|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|7|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|7|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|7|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|7|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|0|7@1|'+0#e000002&|,+0#0000000&| @7 +@75 +@4|'+0#e000002&|\+0#e000e06&|1|0@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|0|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|0|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|0|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|0|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|0|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|0|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|0|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|1@1|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1@2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1@1|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1@1|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1@1|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1@1|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1@1|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1@1|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|1|2|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|7|'+0#e000002&|,+0#0000000&| @7 +@57|3|7|,|3|-|9| @7|2|9|%| diff --git a/runtime/syntax/testdir/dumps/java_escapes_03.dump b/runtime/syntax/testdir/dumps/java_escapes_03.dump new file mode 100644 index 0000000000..920ab1c338 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_escapes_03.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@3|'+0#e000002&|\+0#e000e06&|1|2|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|2|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|1|3|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|3|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|3|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|3@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|3|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|3|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|3|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|3|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|1|4|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|4|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|4|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|4|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|4@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|4|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|4|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|4|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|1|5|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|5|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|5|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|5|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|5|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|5@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|5|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|5|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|1|6|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|6|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|6|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|6|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|6|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|6|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|6@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|6|7|'+0#e000002&|,+0#0000000&| @7 +@4>'+0#e000002&|\+0#e000e06&|1|7|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|7|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|7|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|7|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|7|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|7|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|7|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|1|7@1|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|2|0@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|0|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|0|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|0|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|0|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|0|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|0|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|0|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|2|1|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|1@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|1|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|1|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|1|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|1|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|1|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|1|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|2@1|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2@1|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2@2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2@1|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2@1|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2@1|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2@1|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2@1|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|2|3|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|3|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|3|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|3@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|3|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|3|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|3|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|3|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|2|4|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|4|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|4|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|4|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|4@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|4|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|4|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|4|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|2|5|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|5|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|5|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|5|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|5|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|5@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|5|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|5|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|2|6|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|6|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|6|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|6|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|6|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|6|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|6@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|6|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|2|7|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|7|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|7|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|7|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|7|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|7|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|7|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|2|7@1|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|3|0@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|0|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|0|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|0|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|0|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|0|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|0|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|0|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|3|1|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|1@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|1|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|1|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|1|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|1|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|1|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|1|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|3|2|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|2|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|2@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|2|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|2|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|2|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|2|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|2|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|3@1|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3@1|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3@1|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3@2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3@1|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3@1|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3@1|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3@1|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|3|4|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|7|'+0#e000002&|,+0#0000000&| @7 +@57|5@1|,|2|-|5| @7|4|7|%| diff --git a/runtime/syntax/testdir/dumps/java_escapes_04.dump b/runtime/syntax/testdir/dumps/java_escapes_04.dump new file mode 100644 index 0000000000..79f11f1f03 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_escapes_04.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@3|'+0#e000002&|\+0#e000e06&|3|4|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|4|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|3|5|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|5|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|5|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|5|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|5|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|5@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|5|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|5|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|3|6|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|6|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|6|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|6|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|6|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|6|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|6@1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|6|7|'+0#e000002&|,+0#0000000&| @7 +@4|'+0#e000002&|\+0#e000e06&|3|7|0|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|7|1|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|7|2|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|7|3|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|7|4|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|7|5|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|7|6|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|3|7@1|'+0#e000002&|,+0#0000000&| @7 +@8|}|;| @64 +> @74 +@8|S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|n+0#af5f00255&|e|w| +0#0000000&|S|t|r|i|n|g|[|]| |{| @33 +@12|"+0#e000002&|\+0#e000e06&|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|7|"+0#e000002&|,+0#0000000&| @15 +@75 +@8|"+0#e000002&|\+0#e000e06&|0@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|7|"+0#e000002&|,+0#0000000&| @11 +@75 +@4|"+0#e000002&|\+0#e000e06&|0@2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0@1|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0@1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0@1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0@1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0@1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0@1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0@1|7|"+0#e000002&|,+0#0000000&| @7 +@75 +@8|"+0#e000002&|\+0#e000e06&|1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|"+0#e000002&|,+0#0000000&| @11 +@8|"+0#e000002&|\+0#e000e06&|2|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|"+0#e000002&|,+0#0000000&| @11 +@8|"+0#e000002&|\+0#e000e06&|3|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|"+0#e000002&|,+0#0000000&| @11 +@8|"+0#e000002&|\+0#e000e06&|4|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|4|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|4|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|4|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|4@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|4|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|4|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|4|7|"+0#e000002&|,+0#0000000&| @11 +@8|"+0#e000002&|\+0#e000e06&|5|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|5|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|5|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|5|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|5|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|5@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|5|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|5|7|"+0#e000002&|,+0#0000000&| @11 +@8|"+0#e000002&|\+0#e000e06&|6|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|7|"+0#e000002&|,+0#0000000&| @11 +@57|7|3|,|0|-|1| @7|6|4|%| diff --git a/runtime/syntax/testdir/dumps/java_escapes_05.dump b/runtime/syntax/testdir/dumps/java_escapes_05.dump new file mode 100644 index 0000000000..487198affc --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_escapes_05.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|"+0#e000002&|\+0#e000e06&|6|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|6|7|"+0#e000002&|,+0#0000000&| @11 +@8|"+0#e000002&|\+0#e000e06&|7|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|7|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|7|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|7|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|7|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|7|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|7|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|7@1|"+0#e000002&|,+0#0000000&| @11 +@75 +@4|"+0#e000002&|\+0#e000e06&|0|1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|1@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|0|2|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|2|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|2@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|2|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|2|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|2|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|2|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|2|7|"+0#e000002&|,+0#0000000&| @7 +@4>"+0#e000002&|\+0#e000e06&|0|3|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|3|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|3|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|3@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|3|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|3|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|3|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|3|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|0|4|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|4|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|4|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|4|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|4@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|4|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|4|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|4|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|0|5|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|5|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|5|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|5|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|5|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|5@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|5|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|5|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|0|6|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|6|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|6|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|6|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|6|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|6|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|6@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|6|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|0|7|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|7|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|7|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|7|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|7|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|7|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|7|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|0|7@1|"+0#e000002&|,+0#0000000&| @7 +@75 +@4|"+0#e000002&|\+0#e000e06&|1|0@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|0|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|0|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|0|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|0|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|0|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|0|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|0|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|1@1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1@2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1@1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1@1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1@1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1@1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1@1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1@1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|1|2|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|2|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|2@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|2|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|2|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|2|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|2|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|2|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|1|3|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|3|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|3|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|3@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|3|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|3|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|3|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|3|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|1|4|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|4|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|4|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|4|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|4@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|4|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|4|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|4|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|1|5|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|5|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|5|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|5|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|5|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|5@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|5|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|5|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|1|6|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|6|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|6|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|6|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|6|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|6|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|6@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|6|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|1|7|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7@1|"+0#e000002&|,+0#0000000&| @7 +@57|9|1|,|2|-|5| @7|8|1|%| diff --git a/runtime/syntax/testdir/dumps/java_escapes_06.dump b/runtime/syntax/testdir/dumps/java_escapes_06.dump new file mode 100644 index 0000000000..01d73c54e6 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_escapes_06.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@3|"+0#e000002&|\+0#e000e06&|1|7|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|1|7@1|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|0@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2@1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|3|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|7|"+0#e000002&|,+0#0000000&| @7 +@4>"+0#e000002&|\+0#e000e06&|2|4|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|5|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|6|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|7|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7@1|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|0@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|2|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3@1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|4|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|5|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|6|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|7|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7@1|"+0#e000002&|,+0#0000000&| @7 +@8|}|)|;| @63 +@4|}| @69 +@57|1|0|9|,|2|-|5| @6|9@1|%| diff --git a/runtime/syntax/testdir/dumps/java_escapes_99.dump b/runtime/syntax/testdir/dumps/java_escapes_99.dump new file mode 100644 index 0000000000..617317c23c --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_escapes_99.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@3|"+0#e000002&|\+0#e000e06&|2|0@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|0|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2@1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2@1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|3|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|3|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|4|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|4|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|5|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|5|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|6|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|6|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|2|7|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|2|7@1|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|0@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|0|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|2|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|2|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3@1|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3@1|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|4|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|4|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|5|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|5|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|6|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6@1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|6|7|"+0#e000002&|,+0#0000000&| @7 +@4|"+0#e000002&|\+0#e000e06&|3|7|0|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|1|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|2|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|3|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|4|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|5|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7|6|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|3|7@1|"+0#e000002&|,+0#0000000&| @7 +@8|}|)|;| @63 +@4|}| @69 +>}| @73 +@57|1|2|3|,|1| @8|B|o|t| diff --git a/runtime/syntax/testdir/dumps/java_numbers_00.dump b/runtime/syntax/testdir/dumps/java_numbers_00.dump new file mode 100644 index 0000000000..6ffb5d1275 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_numbers_00.dump @@ -0,0 +1,20 @@ +>c+0#00e0003#ffffff0|l|a|s@1| +0#0000000&|N|u|m|b|e|r|s|T|e|s|t|s| @56 +|{| @73 +@4|s+0#00e0003&|t|a|t|i|c| +0#0000000&|{| @62 +@8|d+0#00e0003&|o|u|b|l|e|[+0#0000000&|]| |d@1| |=| |{| @51 +@12|0+0#e000002&|x|.|0|p|0|,+0#0000000&| |0+0#e000002&|x|0|.|p|0|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|0|,+0#0000000&| |0+0#e000002&|x|0|P|0|,+0#0000000&| @31 +@12|0+0#e000002&|x|.|0|p|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|p|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|0|d|,+0#0000000&| |0+0#e000002&|x|0|P|0|D|,+0#0000000&| @27 +@12|0+0#e000002&|x|.|0|p|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|p|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|0|f|,+0#0000000&| |0+0#e000002&|x|0|P|0|F|,+0#0000000&| @27 +@12|0+0#e000002&|x|.|0|p|0|,+0#0000000&| |0+0#e000002&|x|0|.|p|0|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|0|,+0#0000000&| |0+0#e000002&|x|0|P|0|,+0#0000000&| @31 +@12|0+0#e000002&|x|.|0|p|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|p|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|0|d|,+0#0000000&| |0+0#e000002&|x|0|P|0|D|,+0#0000000&| @27 +@12|0+0#e000002&|x|.|0|p|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|p|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|0|f|,+0#0000000&| |0+0#e000002&|x|0|P|0|F|,+0#0000000&| @27 +@12|0+0#e000002&|x|.|0|p|-|0|,+0#0000000&| |0+0#e000002&|x|0|.|p|-|0|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|-|0|,+0#0000000&| |0+0#e000002&|x|0|P|-|0|,+0#0000000&| @27 +@12|0+0#e000002&|x|.|0|p|-|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|p|-|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|-|0|d|,+0#0000000&| |0+0#e000002&|x|0|P|-|0|D|,+0#0000000&| @23 +@12|0+0#e000002&|x|.|0|p|-|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|p|-|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|-|0|f|,+0#0000000&| |0+0#e000002&|x|0|P|-|0|F|,+0#0000000&| @23 +@12|0+0#e000002&|x|.|0|p|+|0|,+0#0000000&| |0+0#e000002&|x|0|.|p|+|0|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|+|0|,+0#0000000&| |0+0#e000002&|x|0|P|+|0|,+0#0000000&| @27 +@12|0+0#e000002&|x|.|0|p|+|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|p|+|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|+|0|d|,+0#0000000&| |0+0#e000002&|x|0|P|+|0|D|,+0#0000000&| @23 +@12|0+0#e000002&|x|.|0|p|+|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|p|+|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|+|0|f|,+0#0000000&| |0+0#e000002&|x|0|P|+|0|F|,+0#0000000&| @23 +@75 +@12|1+0#e000002&|.|,+0#0000000&| |1+0#e000002&|.|2|,+0#0000000&| |1+0#e000002&|.|2|e|3|,+0#0000000&| |1+0#e000002&|.|2|e|3|d|,+0#0000000&| |1+0#e000002&|.|2|e|3|f|,+0#0000000&| @31 +@16|1+0#e000002&|.|2|e|-|3|,+0#0000000&| |1+0#e000002&|.|2|e|-|3|d|,+0#0000000&| |1+0#e000002&|.|2|E|-|3|F|,+0#0000000&| @33 +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/java_numbers_01.dump b/runtime/syntax/testdir/dumps/java_numbers_01.dump new file mode 100644 index 0000000000..a66487ace7 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_numbers_01.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@11|0+0#e000002&|x|.|0|p|+|0|,+0#0000000&| |0+0#e000002&|x|0|.|p|+|0|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|+|0|,+0#0000000&| |0+0#e000002&|x|0|P|+|0|,+0#0000000&| @27 +@12|0+0#e000002&|x|.|0|p|+|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|p|+|0|d|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|+|0|d|,+0#0000000&| |0+0#e000002&|x|0|P|+|0|D|,+0#0000000&| @23 +@12|0+0#e000002&|x|.|0|p|+|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|p|+|0|f|,+0#0000000&| |0+0#e000002&|x|0|.|0|p|+|0|f|,+0#0000000&| |0+0#e000002&|x|0|P|+|0|F|,+0#0000000&| @23 +@75 +@12|1+0#e000002&|.|,+0#0000000&| |1+0#e000002&|.|2|,+0#0000000&| |1+0#e000002&|.|2|e|3|,+0#0000000&| |1+0#e000002&|.|2|e|3|d|,+0#0000000&| |1+0#e000002&|.|2|e|3|f|,+0#0000000&| @31 +@16>1+0#e000002&|.|2|e|-|3|,+0#0000000&| |1+0#e000002&|.|2|e|-|3|d|,+0#0000000&| |1+0#e000002&|.|2|E|-|3|F|,+0#0000000&| @33 +@16|1+0#e000002&|.|2|e|+|3|,+0#0000000&| |1+0#e000002&|.|2|E|+|3|D|,+0#0000000&| |1+0#e000002&|.|2|e|+|3|f|,+0#0000000&| @33 +@12|.+0#e000002&|2|,+0#0000000&| |.+0#e000002&|2|e|3|,+0#0000000&| |.+0#e000002&|2|e|3|d|,+0#0000000&| |.+0#e000002&|2|e|3|f|,+0#0000000&| @39 +@16|.+0#e000002&|2|e|-|3|,+0#0000000&| |.+0#e000002&|2|e|-|3|d|,+0#0000000&| |.+0#e000002&|2|E|-|3|F|,+0#0000000&| @36 +@16|.+0#e000002&|2|e|+|3|,+0#0000000&| |.+0#e000002&|2|E|+|3|D|,+0#0000000&| |.+0#e000002&|2|e|+|3|f|,+0#0000000&| @36 +@12|1+0#e000002&|e|3|,+0#0000000&| |1+0#e000002&|e|3|d|,+0#0000000&| |1+0#e000002&|e|3|f|,+0#0000000&| @46 +@16|1+0#e000002&|e|-|3|,+0#0000000&| |1+0#e000002&|e|-|3|d|,+0#0000000&| |1+0#e000002&|E|-|3|F|,+0#0000000&| @39 +@16|1+0#e000002&|e|+|3|,+0#0000000&| |1+0#e000002&|E|+|3|D|,+0#0000000&| |1+0#e000002&|e|+|3|f|,+0#0000000&| @39 +@12|1+0#e000002&|d|,+0#0000000&| |1+0#e000002&|D|,+0#0000000&| |1+0#e000002&|f|,+0#0000000&| |1+0#e000002&|F|,+0#0000000&| @47 +@75 +|/+0#0000e05&@3| |M|A|L|F|O|R|M|E|D|:| |:|l|e|t| |g|:|j|a|v|a|_|c|o|m@1|e|n|t|_|s|t|r|i|n|g|s| |=| |1| ||| |d|o|a|u|t|o|c|m|d| |S|y|n|t|a|x| +0#0000000&@8 +|/+0#0000e05&@1| @9|0|_|x|.|0|p|0|,| |0|x|.|_|0|p|0|,| |0|x|.|0|_|p|0|,| |0|x|.|0|p|_|0|,| |0|x|.|0|p|0|_|,| +0#0000000&@18 +|/+0#0000e05&@1| @9|0|x|0|_|.|0|p|0|,| |0|x|_|0|.|0|p|0|,| |0|x|p|0|,| +0#0000000&@37 +@8|}|;| @64 +@57|1|9|,|5|-|1|7| @6|1|8|%| diff --git a/runtime/syntax/testdir/dumps/java_numbers_02.dump b/runtime/syntax/testdir/dumps/java_numbers_02.dump new file mode 100644 index 0000000000..73f2e8e2d2 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_numbers_02.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|}|;| @64 +@75 +@8|i+0#00e0003&|n|t| +0#0000000&|O| |=| |0+0#e000002&|;+0#0000000&| @56 +@8|i+0#00e0003&|n|t| +0#0000000&|O@1| |=| |0+0#e000002&@1|;+0#0000000&| @54 +@8|i+0#00e0003&|n|t| +0#0000000&|O|x|O| |=| |0+0#e000002&|x|0|;+0#0000000&| @52 +> @74 +@8|i+0#00e0003&|n|t| +0#0000000&|x| |=| |0+0#e000002&|x|1|2|_|3|4|5|_|6|7|8|;+0#0000000&| @45 +@8|i+0#00e0003&|n|t| +0#0000000&|y| |=| |0+0#e000002&|b|0|1|_|0|1|_|0|1|_|0|1|_|0|1|;+0#0000000&| @41 +@8|i+0#00e0003&|n|t| +0#0000000&|z| |=| |0+0#e000002&|_@1|1|_@1|2|_@1|3|_@1|4|_@1|5|_@1|6|_@1|7|;+0#0000000&| @35 +@75 +@8|/+0#0000e05&@1| |S|t|r|i|n|g|.|f|o|r|m|a|t|(|"|%|a|"|,| |-|1|.|0|)| +0#0000000&@38 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|m|i|n|u|s|_|o|n|e|_|d| |=| |-|0+0#e000002&|x|1|.|0|p|0|;+0#0000000&| @36 +@75 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|z|_|d| |=| |-|0+0#e000002&|x|.|0|p|0|;+0#0000000&| @45 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|y|_|d| |=| |0+0#e000002&|x|a|p|1|_@1|0|_@1|0|;+0#0000000&| @41 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|x|_|d| |=| |.+0#e000002&|0|_@1|1|_@1|2|_@1|3|_@1|4|_@1|5|_@1|6|_@1|7|_@1|8|_@1|9|;+0#0000000&| @23 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|d|o|t|_|O| |=| |.+0#e000002&|0|;+0#0000000&| @48 +@75 +@8|/+0#0000e05&@1| |J|L|S|,| |§|3|.|1|0|.|2|:| +0#0000000&@50 +@57|3|7|,|0|-|1| @7|4@1|%| diff --git a/runtime/syntax/testdir/dumps/java_numbers_03.dump b/runtime/syntax/testdir/dumps/java_numbers_03.dump new file mode 100644 index 0000000000..e3b5dba14e --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_numbers_03.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|/+0#0000e05&@1| |J|L|S|,| |§|3|.|1|0|.|2|:| +0#0000000&@50 +@8|f+0#00e0003&|l|o|a|t| +0#0000000&|m|a|x|_|d|e|c|_|f| |=| |3+0#e000002&|.|4|0|2|8|2|3|5|e|3|8|f|;+0#0000000&| @34 +@8|f+0#00e0003&|l|o|a|t| +0#0000000&|m|a|x|_|h|e|x|_|f| |=| |0+0#e000002&|x|1|.|f@4|e|P|+|1|2|7|f|;+0#0000000&| @31 +@8|f+0#00e0003&|l|o|a|t| +0#0000000&|m|i|n|_|d|e|c|_|f| |=| |1+0#e000002&|.|4|e|-|4|5|f|;+0#0000000&| @39 +@8|f+0#00e0003&|l|o|a|t| +0#0000000&|m|i|n|_|h|e|x|_|f|_|a| |=| |0+0#e000002&|x|0|.|0@4|2|P|-|1|2|6|f|;+0#0000000&| @29 +@8>f+0#00e0003&|l|o|a|t| +0#0000000&|m|i|n|_|h|e|x|_|f|_|b| |=| |0+0#e000002&|x|1|.|0|P|-|1|4|9|f|;+0#0000000&| @34 +@75 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|m|a|x|_|d|e|c|_|d| |=| |1+0#e000002&|.|7|9|7|6|9|3|1|3|4|8|6|2|3|1|5|7|e|3|_@1|0|_@1|8|;+0#0000000&| @20 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|m|a|x|_|h|e|x|_|d| |=| |0+0#e000002&|x|1|.|f|_|f@3|_|f@3|_|f@3|P|+|1|0|2|3|;+0#0000000&| @20 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|m|i|n|_|d|e|c|_|d| |=| |4+0#e000002&|.|9|e|-|3|_@1|2|_@1|4|;+0#0000000&| @34 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|m|i|n|_|h|e|x|_|d|_|a| |=| |0+0#e000002&|x|0|.|0|_|0@3|_|0@3|_|0@2|1|P|-|1|0|2@1|;+0#0000000&| @18 +@8|d+0#00e0003&|o|u|b|l|e| +0#0000000&|m|i|n|_|h|e|x|_|d|_|b| |=| |0+0#e000002&|x|1|.|0|P|-|1|0|7|4|;+0#0000000&| @33 +@75 +@8|/+0#0000e05&@1| |J|L|S|,| |§|3|.|1|0|.|1|:| +0#0000000&@50 +@8|i+0#00e0003&|n|t| +0#0000000&|m|a|x|_|h|e|x| |=| |0+0#e000002&|x|7|f@2|_|f@3|;+0#0000000&| @40 +@8|i+0#00e0003&|n|t| +0#0000000&|m|a|x|_|o|c|t| |=| |0+0#e000002&|1|7@1|_|7@3|_|7@3|;+0#0000000&| @37 +@8|i+0#00e0003&|n|t| +0#0000000&|m|a|x|_|b|i|n| |=| |0+0#e000002&|b|0|1@2|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|;+0#0000000&| @10 +@75 +@8|i+0#00e0003&|n|t| +0#0000000&|m|i|n|_|h|e|x| |=| |0+0#e000002&|x|8|0@2|_|0@3|;+0#0000000&| @40 +@57|5@1|,|3|-|9| @7|7|1|%| diff --git a/runtime/syntax/testdir/dumps/java_numbers_04.dump b/runtime/syntax/testdir/dumps/java_numbers_04.dump new file mode 100644 index 0000000000..d03904dd1f --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_numbers_04.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|i+0#00e0003&|n|t| +0#0000000&|m|i|n|_|h|e|x| |=| |0+0#e000002&|x|8|0@2|_|0@3|;+0#0000000&| @40 +@8|i+0#00e0003&|n|t| +0#0000000&|m|i|n|_|o|c|t| |=| |0+0#e000002&|2|0@1|_|0@3|_|0@3|;+0#0000000&| @37 +@8|i+0#00e0003&|n|t| +0#0000000&|m|i|n|_|b|i|n| |=| |0+0#e000002&|b|1|0@2|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|;+0#0000000&| @10 +@75 +@8|i+0#00e0003&|n|t| +0#0000000&|m|i|n|u|s|_|o|n|e|_|h|e|x| |=| |0+0#e000002&|x|f@3|_|f@3|;+0#0000000&| @34 +@8>i+0#00e0003&|n|t| +0#0000000&|m|i|n|u|s|_|o|n|e|_|o|c|t| |=| |0+0#e000002&|3|7@1|_|7@3|_|7@3|;+0#0000000&| @31 +@8|i+0#00e0003&|n|t| +0#0000000&|m|i|n|u|s|_|o|n|e|_|b|i|n| |=| |0+0#e000002&|b|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|;+0#0000000&| @4 +@75 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|a|x|_|h|e|x|_|l| |=| |0+0#e000002&|x|7|f@2|_|f@3|_|f@3|_|f@3|L|;+0#0000000&| @26 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|a|x|_|o|c|t|_|l| |=| |0+0#e000002&|7|_|7@3|_|7@3|_|7@3|_|7@3|_|7@3|L|;+0#0000000&| @20 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|a|x|_|b|i|n|_|l| |=| |0+0#e000002&|b|0|1@2|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@2 +@1|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|L|;+0#0000000&| @41 +@75 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|_|h|e|x|_|l| |=| |0+0#e000002&|x|8|0@2|_|0@3|_|0@3|_|0@3|L|;+0#0000000&| @26 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|_|o|c|t|_|l| |=| |0+0#e000002&|1|0|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|L|;+0#0000000&| @19 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|_|b|i|n|_|l| |=| |0+0#e000002&|b|1|0@2|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@2 +@1|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|L|;+0#0000000&| @41 +@75 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|u|s|_|o|n|e|_|h|e|x|_|l| |=| |0+0#e000002&|x|f@3|_|f@3|_|f@3|_|f@3|L|;+0#0000000&| @20 +@57|7|3|,|3|-|9| @7|9|4|%| diff --git a/runtime/syntax/testdir/dumps/java_numbers_99.dump b/runtime/syntax/testdir/dumps/java_numbers_99.dump new file mode 100644 index 0000000000..7637b85ff4 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_numbers_99.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@7|i+0#00e0003&|n|t| +0#0000000&|m|i|n|u|s|_|o|n|e|_|o|c|t| |=| |0+0#e000002&|3|7@1|_|7@3|_|7@3|;+0#0000000&| @31 +@8|i+0#00e0003&|n|t| +0#0000000&|m|i|n|u|s|_|o|n|e|_|b|i|n| |=| |0+0#e000002&|b|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|;+0#0000000&| @4 +@75 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|a|x|_|h|e|x|_|l| |=| |0+0#e000002&|x|7|f@2|_|f@3|_|f@3|_|f@3|L|;+0#0000000&| @26 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|a|x|_|o|c|t|_|l| |=| |0+0#e000002&|7|_|7@3|_|7@3|_|7@3|_|7@3|_|7@3|L|;+0#0000000&| @20 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|a|x|_|b|i|n|_|l| |=| |0+0#e000002&|b|0|1@2|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@2 +@1|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|L|;+0#0000000&| @41 +@75 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|_|h|e|x|_|l| |=| |0+0#e000002&|x|8|0@2|_|0@3|_|0@3|_|0@3|L|;+0#0000000&| @26 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|_|o|c|t|_|l| |=| |0+0#e000002&|1|0|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|L|;+0#0000000&| @19 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|_|b|i|n|_|l| |=| |0+0#e000002&|b|1|0@2|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@2 +@1|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|_|0@3|L|;+0#0000000&| @41 +@75 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|u|s|_|o|n|e|_|h|e|x|_|l| |=| |0+0#e000002&|x|f@3|_|f@3|_|f@3|_|f@3|L|;+0#0000000&| @20 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|u|s|_|o|n|e|_|o|c|t|_|l| |=| |0+0#e000002&|1|7|_|7@3|_|7@3|_|7@3|_|7@3|_|7@3|L|;+0#0000000&| @13 +@8|l+0#00e0003&|o|n|g| +0#0000000&|m|i|n|u|s|_|o|n|e|_|b|i|n|_|l| |=| |0+0#e000002&|b|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@1 +@2|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|_|1@3|L|;+0#0000000&| @35 +@4|}| @69 +>}| @73 +@57|8@1|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/input/java_escapes.java b/runtime/syntax/testdir/input/java_escapes.java new file mode 100644 index 0000000000..624d4fcd89 --- /dev/null +++ b/runtime/syntax/testdir/input/java_escapes.java @@ -0,0 +1,123 @@ +class EscapesTests +{ // javap -constants EscapesTests.class + // static final String hello = "hello"; + \u0073\u0074\u0061\u0074\u0069\u0063 + \u0066\u0069\u006e\u0061\u006c + \u0053\u0074\u0072\u0069\u006e\u0067 + \u0068\u0065\u006c\u006c\u006f + \u003d + \u0022\u0068\u0065\u006c\u006c\u006f\u0022 + \u003b + + static { + char ee[] = { + '\b', '\t', + '\n', '\f', '\r', + '\"', '\'', '\\', + }; + + System.out.println(new String[] { + "\b", "\t", + "\n", "\f", "\r", + "\"", "\'", "\\", + }); + + char oo[] = { + '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7', + + '\00', '\01', '\02', '\03', '\04', '\05', '\06', '\07', + + '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', + + '\10', '\11', '\12', '\13', '\14', '\15', '\16', '\17', + '\20', '\21', '\22', '\23', '\24', '\25', '\26', '\27', + '\30', '\31', '\32', '\33', '\34', '\35', '\36', '\37', + '\40', '\41', '\42', '\43', '\44', '\45', '\46', '\47', + '\50', '\51', '\52', '\53', '\54', '\55', '\56', '\57', + '\60', '\61', '\62', '\63', '\64', '\65', '\66', '\67', + '\70', '\71', '\72', '\73', '\74', '\75', '\76', '\77', + + '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', + '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', + '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', + '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', + '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', + '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', + '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', + + '\100', '\101', '\102', '\103', '\104', '\105', '\106', '\107', + '\110', '\111', '\112', '\113', '\114', '\115', '\116', '\117', + '\120', '\121', '\122', '\123', '\124', '\125', '\126', '\127', + '\130', '\131', '\132', '\133', '\134', '\135', '\136', '\137', + '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', + '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', + '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', + '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', + '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', + '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', + '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', + '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', + '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', + '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', + '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', + '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', + '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', + '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', + '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', + }; + + System.out.println(new String[] { + "\0", "\1", "\2", "\3", "\4", "\5", "\6", "\7", + + "\00", "\01", "\02", "\03", "\04", "\05", "\06", "\07", + + "\000", "\001", "\002", "\003", "\004", "\005", "\006", "\007", + + "\10", "\11", "\12", "\13", "\14", "\15", "\16", "\17", + "\20", "\21", "\22", "\23", "\24", "\25", "\26", "\27", + "\30", "\31", "\32", "\33", "\34", "\35", "\36", "\37", + "\40", "\41", "\42", "\43", "\44", "\45", "\46", "\47", + "\50", "\51", "\52", "\53", "\54", "\55", "\56", "\57", + "\60", "\61", "\62", "\63", "\64", "\65", "\66", "\67", + "\70", "\71", "\72", "\73", "\74", "\75", "\76", "\77", + + "\010", "\011", "\012", "\013", "\014", "\015", "\016", "\017", + "\020", "\021", "\022", "\023", "\024", "\025", "\026", "\027", + "\030", "\031", "\032", "\033", "\034", "\035", "\036", "\037", + "\040", "\041", "\042", "\043", "\044", "\045", "\046", "\047", + "\050", "\051", "\052", "\053", "\054", "\055", "\056", "\057", + "\060", "\061", "\062", "\063", "\064", "\065", "\066", "\067", + "\070", "\071", "\072", "\073", "\074", "\075", "\076", "\077", + + "\100", "\101", "\102", "\103", "\104", "\105", "\106", "\107", + "\110", "\111", "\112", "\113", "\114", "\115", "\116", "\117", + "\120", "\121", "\122", "\123", "\124", "\125", "\126", "\127", + "\130", "\131", "\132", "\133", "\134", "\135", "\136", "\137", + "\140", "\141", "\142", "\143", "\144", "\145", "\146", "\147", + "\150", "\151", "\152", "\153", "\154", "\155", "\156", "\157", + "\160", "\161", "\162", "\163", "\164", "\165", "\166", "\167", + "\170", "\171", "\172", "\173", "\174", "\175", "\176", "\177", + "\200", "\201", "\202", "\203", "\204", "\205", "\206", "\207", + "\210", "\211", "\212", "\213", "\214", "\215", "\216", "\217", + "\220", "\221", "\222", "\223", "\224", "\225", "\226", "\227", + "\230", "\231", "\232", "\233", "\234", "\235", "\236", "\237", + "\240", "\241", "\242", "\243", "\244", "\245", "\246", "\247", + "\250", "\251", "\252", "\253", "\254", "\255", "\256", "\257", + "\260", "\261", "\262", "\263", "\264", "\265", "\266", "\267", + "\270", "\271", "\272", "\273", "\274", "\275", "\276", "\277", + "\300", "\301", "\302", "\303", "\304", "\305", "\306", "\307", + "\310", "\311", "\312", "\313", "\314", "\315", "\316", "\317", + "\320", "\321", "\322", "\323", "\324", "\325", "\326", "\327", + "\330", "\331", "\332", "\333", "\334", "\335", "\336", "\337", + "\340", "\341", "\342", "\343", "\344", "\345", "\346", "\347", + "\350", "\351", "\352", "\353", "\354", "\355", "\356", "\357", + "\360", "\361", "\362", "\363", "\364", "\365", "\366", "\367", + "\370", "\371", "\372", "\373", "\374", "\375", "\376", "\377", + }); + } +} diff --git a/runtime/syntax/testdir/input/java_numbers.java b/runtime/syntax/testdir/input/java_numbers.java new file mode 100644 index 0000000000..e9265349a4 --- /dev/null +++ b/runtime/syntax/testdir/input/java_numbers.java @@ -0,0 +1,88 @@ +class NumbersTests +{ + static { + double[] dd = { + 0x.0p0, 0x0.p0, 0x0.0p0, 0x0P0, + 0x.0p0d, 0x0.p0d, 0x0.0p0d, 0x0P0D, + 0x.0p0f, 0x0.p0f, 0x0.0p0f, 0x0P0F, + 0x.0p0, 0x0.p0, 0x0.0p0, 0x0P0, + 0x.0p0d, 0x0.p0d, 0x0.0p0d, 0x0P0D, + 0x.0p0f, 0x0.p0f, 0x0.0p0f, 0x0P0F, + 0x.0p-0, 0x0.p-0, 0x0.0p-0, 0x0P-0, + 0x.0p-0d, 0x0.p-0d, 0x0.0p-0d, 0x0P-0D, + 0x.0p-0f, 0x0.p-0f, 0x0.0p-0f, 0x0P-0F, + 0x.0p+0, 0x0.p+0, 0x0.0p+0, 0x0P+0, + 0x.0p+0d, 0x0.p+0d, 0x0.0p+0d, 0x0P+0D, + 0x.0p+0f, 0x0.p+0f, 0x0.0p+0f, 0x0P+0F, + + 1., 1.2, 1.2e3, 1.2e3d, 1.2e3f, + 1.2e-3, 1.2e-3d, 1.2E-3F, + 1.2e+3, 1.2E+3D, 1.2e+3f, + .2, .2e3, .2e3d, .2e3f, + .2e-3, .2e-3d, .2E-3F, + .2e+3, .2E+3D, .2e+3f, + 1e3, 1e3d, 1e3f, + 1e-3, 1e-3d, 1E-3F, + 1e+3, 1E+3D, 1e+3f, + 1d, 1D, 1f, 1F, + +//// MALFORMED: :let g:java_comment_strings = 1 | doautocmd Syntax +// 0_x.0p0, 0x._0p0, 0x.0_p0, 0x.0p_0, 0x.0p0_, +// 0x0_.0p0, 0x_0.0p0, 0xp0, + }; + + int O = 0; + int OO = 00; + int OxO = 0x0; + + int x = 0x12_345_678; + int y = 0b01_01_01_01_01; + int z = 0__1__2__3__4__5__6__7; + + // String.format("%a", -1.0) + double minus_one_d = -0x1.0p0; + + double z_d = -0x.0p0; + double y_d = 0xap1__0__0; + double x_d = .0__1__2__3__4__5__6__7__8__9; + double dot_O = .0; + + // JLS, §3.10.2: + float max_dec_f = 3.4028235e38f; + float max_hex_f = 0x1.fffffeP+127f; + float min_dec_f = 1.4e-45f; + float min_hex_f_a = 0x0.000002P-126f; + float min_hex_f_b = 0x1.0P-149f; + + double max_dec_d = 1.7976931348623157e3__0__8; + double max_hex_d = 0x1.f_ffff_ffff_ffffP+1023; + double min_dec_d = 4.9e-3__2__4; + double min_hex_d_a = 0x0.0_0000_0000_0001P-1022; + double min_hex_d_b = 0x1.0P-1074; + + // JLS, §3.10.1: + int max_hex = 0x7fff_ffff; + int max_oct = 0177_7777_7777; + int max_bin = 0b0111_1111_1111_1111_1111_1111_1111_1111; + + int min_hex = 0x8000_0000; + int min_oct = 0200_0000_0000; + int min_bin = 0b1000_0000_0000_0000_0000_0000_0000_0000; + + int minus_one_hex = 0xffff_ffff; + int minus_one_oct = 0377_7777_7777; + int minus_one_bin = 0b1111_1111_1111_1111_1111_1111_1111_1111; + + long max_hex_l = 0x7fff_ffff_ffff_ffffL; + long max_oct_l = 07_7777_7777_7777_7777_7777L; + long max_bin_l = 0b0111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L; + + long min_hex_l = 0x8000_0000_0000_0000L; + long min_oct_l = 010_0000_0000_0000_0000_0000L; + long min_bin_l = 0b1000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000L; + + long minus_one_hex_l = 0xffff_ffff_ffff_ffffL; + long minus_one_oct_l = 017_7777_7777_7777_7777_7777L; + long minus_one_bin_l = 0b1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L; + } +} From e93afc2e612647e79e1082096ffd6c61e01ac691 Mon Sep 17 00:00:00 2001 From: dkearns Date: Sun, 3 Mar 2024 05:27:47 +1100 Subject: [PATCH 119/426] runtime(r,rhelp,rmd,rnoweb,rrst): Update ftplugin, browsefilter labels (#14126) Use the standard format for browsefilter labels: "File Description (*.ext1, *.ext2, *.ext3)" Signed-off-by: Doug Kearns Signed-off-by: Christian Brabandt --- runtime/ftplugin/r.vim | 14 ++++++-------- runtime/ftplugin/rhelp.vim | 12 ++++++------ runtime/ftplugin/rmd.vim | 12 ++++++------ runtime/ftplugin/rnoweb.vim | 14 ++++++-------- runtime/ftplugin/rrst.vim | 14 ++++++-------- 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim index b3ffc91abc..6b07744c4a 100644 --- a/runtime/ftplugin/r.vim +++ b/runtime/ftplugin/r.vim @@ -1,11 +1,9 @@ " Vim filetype plugin file -" Language: R -" Maintainer: This runtime file is looking for a new maintainer. -" Former Maintainer: Jakson Alves de Aquino -" Former Repository: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2022 Apr 24 09:14AM -" 2024 Jan 14 by Vim Project (browsefilter) -" 2024 Feb 19 by Vim Project (announce adoption) +" Language: R +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -25,7 +23,7 @@ setlocal comments=:#',:###,:##,:# if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R)\t*.R\n" . - \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + \ "Files that include R (*.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim index 6086b440f0..0fa1e56573 100644 --- a/runtime/ftplugin/rhelp.vim +++ b/runtime/ftplugin/rhelp.vim @@ -1,9 +1,9 @@ " Vim filetype plugin file -" Language: R help file -" Maintainer: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2022 Apr 24 09:12AM -" 2024 Jan 14 by Vim Project (browsefilter) +" Language: R help file +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -19,7 +19,7 @@ set cpo&vim setlocal iskeyword=@,48-57,_,. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim index 74b920f19a..a537017aad 100644 --- a/runtime/ftplugin/rmd.vim +++ b/runtime/ftplugin/rmd.vim @@ -1,9 +1,9 @@ " Vim filetype plugin file -" Language: R Markdown file -" Maintainer: Jakson Alves de Aquino -" Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2023 May 29 06:31AM -" 2024 Jan 14 by Vim Project (browsefilter) +" Language: R Markdown file +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann) " Only do this when not yet done for this buffer @@ -65,7 +65,7 @@ runtime ftplugin/pandoc.vim let b:did_ftplugin = 1 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim index 3bed4b42cb..8dfdf1e80f 100644 --- a/runtime/ftplugin/rnoweb.vim +++ b/runtime/ftplugin/rnoweb.vim @@ -1,11 +1,9 @@ " Vim filetype plugin file -" Language: Rnoweb -" Maintainer: This runtime file is looking for a new maintainer. -" Former Maintainer: Jakson Alves de Aquino -" Former Repository: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2023 Feb 27 07:16PM -" 2024 Jan 14 by Vim Project (browsefilter) -" 2024 Feb 19 by Vim Project (announce adoption) +" Language: Rnoweb +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -28,7 +26,7 @@ setlocal suffixesadd=.bib,.tex setlocal comments=b:%,b:#,b:##,b:###,b:#' if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim index 04a9737e42..d088f98224 100644 --- a/runtime/ftplugin/rrst.vim +++ b/runtime/ftplugin/rrst.vim @@ -1,11 +1,9 @@ " Vim filetype plugin file -" Language: reStructuredText documentation format with R code -" Maintainer: This runtime file is looking for a new maintainer. -" Former Maintainer: Jakson Alves de Aquino -" Former Repository: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: 2023 Feb 27 07:16PM -" 2024 Jan 14 by Vim Project (browsefilter) -" 2024 Feb 19 by Vim Project (announce adoption) +" Language: reStructuredText documentation format with R code +" Maintainer: This runtime file is looking for a new maintainer. +" Former Maintainer: Jakson Alves de Aquino +" Former Repository: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: 2024 Feb 28 by Vim Project " Original work by Alex Zvoleff " Only do this when not yet done for this buffer @@ -41,7 +39,7 @@ if !exists("g:rrst_dynamic_comments") || (exists("g:rrst_dynamic_comments") && g endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" + let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" if has("win32") let b:browsefilter .= "All Files (*.*)\t*\n" else From b3030b653bbdc08c91138001d1987d804f6ebf46 Mon Sep 17 00:00:00 2001 From: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com> Date: Sun, 3 Mar 2024 17:51:01 +0300 Subject: [PATCH 120/426] runtime(java): Recognise text blocks (#14128) Also, accept as valid the space escape sequence `\s`. Also, consistently use the claimed `javaDebug` prefix for syntax group definitions kept under `g:java_highlight_debug`. Since `javaStringError` is commented out for its generality, let's comment out `javaDebugStringError`, its copy, as well. References: https://openjdk.org/jeps/378 https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.7 Closes #10910. Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com> Signed-off-by: Christian Brabandt --- runtime/syntax/java.vim | 27 ++++++++---- .../syntax/testdir/dumps/java_escapes_00.dump | 2 +- .../syntax/testdir/dumps/java_escapes_01.dump | 4 +- .../syntax/testdir/dumps/java_string_00.dump | 20 +++++++++ .../syntax/testdir/dumps/java_string_01.dump | 20 +++++++++ .../syntax/testdir/dumps/java_string_02.dump | 20 +++++++++ .../syntax/testdir/dumps/java_string_99.dump | 20 +++++++++ .../syntax/testdir/input/java_escapes.java | 4 +- runtime/syntax/testdir/input/java_string.java | 44 +++++++++++++++++++ 9 files changed, 147 insertions(+), 14 deletions(-) create mode 100644 runtime/syntax/testdir/dumps/java_string_00.dump create mode 100644 runtime/syntax/testdir/dumps/java_string_01.dump create mode 100644 runtime/syntax/testdir/dumps/java_string_02.dump create mode 100644 runtime/syntax/testdir/dumps/java_string_99.dump create mode 100644 runtime/syntax/testdir/input/java_string.java diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index aec2955533..f6d2660277 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -2,7 +2,7 @@ " Language: Java " Maintainer: Claudio Fleiner " URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim -" Last Change: 2024 Mar 01 +" Last Change: 2024 Mar 02 " Please check :help java.vim for comments on some of the options available. @@ -179,15 +179,18 @@ syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaCo " Comments syn keyword javaTodo contained TODO FIXME XXX + if exists("java_comment_strings") syn region javaCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=javaSpecial,javaCommentStar,javaSpecialChar,@Spell - syn region javaComment2String contained start=+"+ end=+$\|"+ contains=javaSpecial,javaSpecialChar,@Spell + syn region javaCommentString contained start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaSpecial,javaCommentStar,javaSpecialChar,@Spell,javaSpecialError,javaTextBlockError + syn region javaComment2String contained start=+"+ end=+$\|"+ contains=javaSpecial,javaSpecialChar,@Spell syn match javaCommentCharacter contained "'\\[^']\{1,6\}'" contains=javaSpecialChar syn match javaCommentCharacter contained "'\\''" contains=javaSpecialChar syn match javaCommentCharacter contained "'[^\\]'" syn cluster javaCommentSpecial add=javaCommentString,javaCommentCharacter,javaNumber syn cluster javaCommentSpecial2 add=javaComment2String,javaCommentCharacter,javaNumber endif + syn region javaComment start="/\*" end="\*/" contains=@javaCommentSpecial,javaTodo,@Spell syn match javaCommentStar contained "^\s*\*[^/]"me=e-1 syn match javaCommentStar contained "^\s*\*$" @@ -227,10 +230,12 @@ syn match javaComment "/\*\*/" syn match javaSpecialError contained "\\." syn match javaSpecialCharError contained "[^']" " Escape Sequences (JLS-17, §3.10.7): -syn match javaSpecialChar contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[btnfr"'\\]\)" +syn match javaSpecialChar contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[bstnfr"'\\]\)" syn region javaString start=+"+ end=+"+ end=+$+ contains=javaSpecialChar,javaSpecialError,@Spell +syn region javaString start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell +syn match javaTextBlockError +"""\s*"""+ " The next line is commented out, it can cause a crash for a long line -"syn match javaStringError +"\([^"\\]\|\\.\)*$+ +"syn match javaStringError +"\%([^"\\]\|\\.\)*$+ syn match javaCharacter "'[^']*'" contains=javaSpecialChar,javaSpecialCharError syn match javaCharacter "'\\''" contains=javaSpecialChar syn match javaCharacter "'[^\\]'" @@ -249,7 +254,7 @@ syn match javaNumber "\<0[xX]\%(\x\%(_*\x\)*\.\=\|\%(\x\%(_*\x\)*\)\=\.\x\%( " Unicode characters syn match javaSpecial "\\u\x\x\x\x" -syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStringError +syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStringError,javaTextBlockError if exists("java_highlight_functions") if java_highlight_functions == "indent" @@ -271,16 +276,18 @@ if exists("java_highlight_functions") endif if exists("java_highlight_debug") - " Strings and constants - syn match javaDebugSpecial contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[btnfr"'\\]\)" + syn match javaDebugSpecial contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[bstnfr"'\\]\)" syn region javaDebugString contained start=+"+ end=+"+ contains=javaDebugSpecial - syn match javaDebugStringError contained +"\%([^"\\]\|\\.\)*$+ + syn region javaDebugString contained start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaDebugSpecial,javaDebugTextBlockError +" The next line is commented out, it can cause a crash for a long line +" syn match javaDebugStringError contained +"\%([^"\\]\|\\.\)*$+ + syn match javaDebugTextBlockError contained +"""\s*"""+ syn match javaDebugCharacter contained "'[^\\]'" syn match javaDebugSpecialCharacter contained "'\\.'" syn match javaDebugSpecialCharacter contained "'\\''" syn keyword javaDebugNumber contained 0 0l 0L - syn match javaNumber contained "\<\d\%(_*\d\)*\." + syn match javaDebugNumber contained "\<\d\%(_*\d\)*\." syn match javaDebugNumber contained "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)[lL]\=\>" syn match javaDebugNumber contained "\%(\<\d\%(_*\d\)*\.\%(\d\%(_*\d\)*\)\=\|\.\d\%(_*\d\)*\)\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\=\>" syn match javaDebugNumber contained "\<\d\%(_*\d\)*[eE][-+]\=\d\%(_*\d\)*[fFdD]\=\>" @@ -301,6 +308,7 @@ if exists("java_highlight_debug") hi def link javaDebug Debug hi def link javaDebugString DebugString hi def link javaDebugStringError javaError + hi def link javaDebugTextBlockError javaDebugStringError hi def link javaDebugType DebugType hi def link javaDebugBoolean DebugBoolean hi def link javaDebugNumber Debug @@ -373,6 +381,7 @@ hi def link javaSpecialChar SpecialChar hi def link javaNumber Number hi def link javaError Error hi def link javaStringError Error +hi def link javaTextBlockError javaStringError hi def link javaStatement Statement hi def link javaOperator Operator hi def link javaComment Comment diff --git a/runtime/syntax/testdir/dumps/java_escapes_00.dump b/runtime/syntax/testdir/dumps/java_escapes_00.dump index 3db803d41e..d47fb4c01e 100644 --- a/runtime/syntax/testdir/dumps/java_escapes_00.dump +++ b/runtime/syntax/testdir/dumps/java_escapes_00.dump @@ -11,7 +11,7 @@ @75 @4|s+0#00e0003&|t|a|t|i|c| +0#0000000&|{| @62 @8|c+0#00e0003&|h|a|r| +0#0000000&|e@1|[|]| |=| |{| @53 -@12|'+0#e000002&|\+0#e000e06&|b|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|t|'+0#e000002&|,+0#0000000&| @51 +@12|'+0#e000002&|\+0#e000e06&|b|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|s|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|t|'+0#e000002&|,+0#0000000&| @45 @12|'+0#e000002&|\+0#e000e06&|n|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|f|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|r|'+0#e000002&|,+0#0000000&| @45 @12|'+0#e000002&|\+0#e000e06&|"|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|'|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&@1|'+0#e000002&|,+0#0000000&| @45 @8|}|;| @64 diff --git a/runtime/syntax/testdir/dumps/java_escapes_01.dump b/runtime/syntax/testdir/dumps/java_escapes_01.dump index 8d2c395ad7..e5080e96d5 100644 --- a/runtime/syntax/testdir/dumps/java_escapes_01.dump +++ b/runtime/syntax/testdir/dumps/java_escapes_01.dump @@ -1,10 +1,10 @@ -| +0&#ffffff0@11|'+0#e000002&|\+0#e000e06&|b|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|t|'+0#e000002&|,+0#0000000&| @51 +| +0&#ffffff0@11|'+0#e000002&|\+0#e000e06&|b|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|s|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|t|'+0#e000002&|,+0#0000000&| @45 @12|'+0#e000002&|\+0#e000e06&|n|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|f|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|r|'+0#e000002&|,+0#0000000&| @45 @12|'+0#e000002&|\+0#e000e06&|"|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&|'|'+0#e000002&|,+0#0000000&| |'+0#e000002&|\+0#e000e06&@1|'+0#e000002&|,+0#0000000&| @45 @8|}|;| @64 @75 @8>S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|n+0#af5f00255&|e|w| +0#0000000&|S|t|r|i|n|g|[|]| |{| @33 -@12|"+0#e000002&|\+0#e000e06&|b|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|t|"+0#e000002&|,+0#0000000&| @51 +@12|"+0#e000002&|\+0#e000e06&|b|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|s|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|t|"+0#e000002&|,+0#0000000&| @45 @12|"+0#e000002&|\+0#e000e06&|n|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|f|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|r|"+0#e000002&|,+0#0000000&| @45 @12|"+0#e000002&|\+0#e000e06&|"|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&|'|"+0#e000002&|,+0#0000000&| |"+0#e000002&|\+0#e000e06&@1|"+0#e000002&|,+0#0000000&| @45 @8|}|)|;| @63 diff --git a/runtime/syntax/testdir/dumps/java_string_00.dump b/runtime/syntax/testdir/dumps/java_string_00.dump new file mode 100644 index 0000000000..b973226f13 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_string_00.dump @@ -0,0 +1,20 @@ +>c+0#00e0003#ffffff0|l|a|s@1| +0#0000000&|S|t|r|i|n|g|T|e|s|t|s| @57 +|{| @73 +@4|s+0#00e0003&|t|a|t|i|c| +0#0000000&|{| @62 +@8|S|t|r|i|n|g| |s|1| |=| |"+0#e000002&|A| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g|"|;+0#0000000&| @10 +@8|S|t|r|i|n|g| |s|2| |=| |"+0#e000002&|\+0#e000e06&|"|W+0#e000002&|o@1|f|\+0#e000e06&|s|!+0#e000002&|\+0#e000e06&|"|"+0#e000002&|;+0#0000000&| @40 +@8|S|t|r|i|n|g| |s|3| |=| |"@2| @51 +| +0#e000002&@11|A|\+0#e000e06&|s|\+0#e000002&| +0#0000000&@58 +| +0#e000002&@11|q|u|i|c|k| |\| +0#0000000&@55 +| +0#e000002&@11|b|r|o|w|n|\+0#e000e06&|s|\+0#e000002&| +0#0000000&@54 +| +0#e000002&@11|f|o|x| |\| +0#0000000&@57 +| +0#e000002&@11|j|u|m|p|s|\+0#e000e06&|s|\+0#e000002&| +0#0000000&@54 +| +0#e000002&@11|o|v|e|r| |\| +0#0000000&@56 +| +0#e000002&@11|t|h|e|\+0#e000e06&|s|\+0#e000002&| +0#0000000&@56 +| +0#e000002&@11|l|a|z|y| |\| +0#0000000&@56 +| +0#e000002&@11|d|o|g|"+0#0000000&@2|;| @55 +@8|S|t|r|i|n|g| |s|4| |=| |"@2| @51 +| +0#e000002&@11|"|W|o@1|f|\+0#e000e06&|s|!+0#e000002&|\+0#e000e06&|"|"+0#0000000&@2|;| @48 +@8|S|t|r|i|n|g| |s|5| |=| |"@2| @51 +| +0#e000002&@7|S|t|r|i|n|g| |s|3| |=| |\+0#e000e06&|"|"+0#e000002&@1| +0#0000000&@50 +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/java_string_01.dump b/runtime/syntax/testdir/dumps/java_string_01.dump new file mode 100644 index 0000000000..d7035611a7 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_string_01.dump @@ -0,0 +1,20 @@ +| +0#e000002#ffffff0@11|l|a|z|y| |\| +0#0000000&@56 +| +0#e000002&@11|d|o|g|"+0#0000000&@2|;| @55 +@8|S|t|r|i|n|g| |s|4| |=| |"@2| @51 +| +0#e000002&@11|"|W|o@1|f|\+0#e000e06&|s|!+0#e000002&|\+0#e000e06&|"|"+0#0000000&@2|;| @48 +@8|S|t|r|i|n|g| |s|5| |=| |"@2| @51 +| +0#e000002&@7>S|t|r|i|n|g| |s|3| |=| |\+0#e000e06&|"|"+0#e000002&@1| +0#0000000&@50 +| +0#e000002&@11|A|\+0#e000e06&@1|s+0#e000002&|\+0#e000e06&@1| +0#0000000&@56 +| +0#e000002&@11|q|u|i|c|k| |\+0#e000e06&@1| +0#0000000&@54 +| +0#e000002&@11|b|r|o|w|n|\+0#e000e06&@1|s+0#e000002&|\+0#e000e06&@1| +0#0000000&@52 +| +0#e000002&@11|f|o|x| |\+0#e000e06&@1| +0#0000000&@56 +| +0#e000002&@11|j|u|m|p|s|\+0#e000e06&@1|s+0#e000002&|\+0#e000e06&@1| +0#0000000&@52 +| +0#e000002&@11|o|v|e|r| |\+0#e000e06&@1| +0#0000000&@55 +| +0#e000002&@11|t|h|e|\+0#e000e06&@1|s+0#e000002&|\+0#e000e06&@1| +0#0000000&@54 +| +0#e000002&@11|l|a|z|y| |\+0#e000e06&@1| +0#0000000&@55 +| +0#e000002&@11|d|o|g|\+0#e000e06&|"|"+0#e000002&@1|;|"+0#0000000&@2|;| @50 +@75 +@8|/+0#0000e05&@1| |T|h|e|r|e| |a|r|e| |S|P|A|C|E|,| |F@1|,| |H|T|,| |C|R|,| |a|n|d| |L|F| |a|f|t|e|r| |"@2|.| +0#0000000&@17 +@8|S|t|r|i|n|g| |e|m|p|t|y| |=| |"@2| |^+0#0000e05&|L| +0#0000000&@2|^+0#0000e05&|M| +0#0000000&@40 +| +0#e000002&@11|"+0#0000000&@2|;| @58 +@57|1|9|,|3|-|9| @7|5|2|%| diff --git a/runtime/syntax/testdir/dumps/java_string_02.dump b/runtime/syntax/testdir/dumps/java_string_02.dump new file mode 100644 index 0000000000..e0b0ae08e3 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_string_02.dump @@ -0,0 +1,20 @@ +| +0#e000002#ffffff0@11|"+0#0000000&@2|;| @58 +@75 +@8|S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|"@2| @44 +| +0#e000002&@7|"| +0#0000000&@65 +| +0#e000002&@7|"@1| +0#0000000&@64 +| +0#e000002&@7>"@1|\+0#e000e06&|u|0@1|5|c|"+0#e000002&| +0#0000000&@57 +| +0#e000002&@7|"@1|\+0#e000e06&|u|0@1|5|c|"+0#e000002&@1| +0#0000000&@56 +| +0#e000002&@7|"@1|\+0#e000e06&|"|\|u|0@1|2@1|\|u|0@1|2@1| +0#0000000&@50 +| +0#e000002&@7|"@1|\+0#e000e06&|"|"+0#e000002&@1|\+0#e000e06&|u|0@1|5|c|\|u|0@1|2@1| +0#0000000&@48 +| +0#e000002&@7|"@1|\+0#e000e06&|"|"+0#e000002&@1|\+0#e000e06&|"|"+0#e000002&| +0#0000000&@57 +| +0#e000002&@7|"@1|\+0#e000e06&|"|"+0#e000002&@1|\+0#e000e06&|"|"+0#e000002&|\+0#e000e06&|"|"+0#0000000&@2|)|;| @50 +@4|}| @69 +|}| @73 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|3|7|,|3|-|9| @7|B|o|t| diff --git a/runtime/syntax/testdir/dumps/java_string_99.dump b/runtime/syntax/testdir/dumps/java_string_99.dump new file mode 100644 index 0000000000..f147db8095 --- /dev/null +++ b/runtime/syntax/testdir/dumps/java_string_99.dump @@ -0,0 +1,20 @@ +| +0#e000002#ffffff0@11|t|h|e|\+0#e000e06&@1|s+0#e000002&|\+0#e000e06&@1| +0#0000000&@54 +| +0#e000002&@11|l|a|z|y| |\+0#e000e06&@1| +0#0000000&@55 +| +0#e000002&@11|d|o|g|\+0#e000e06&|"|"+0#e000002&@1|;|"+0#0000000&@2|;| @50 +@75 +@8|/+0#0000e05&@1| |T|h|e|r|e| |a|r|e| |S|P|A|C|E|,| |F@1|,| |H|T|,| |C|R|,| |a|n|d| |L|F| |a|f|t|e|r| |"@2|.| +0#0000000&@17 +@8|S|t|r|i|n|g| |e|m|p|t|y| |=| |"@2| |^+0#0000e05&|L| +0#0000000&@2|^+0#0000e05&|M| +0#0000000&@40 +| +0#e000002&@11|"+0#0000000&@2|;| @58 +@75 +@8|S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|"@2| @44 +| +0#e000002&@7|"| +0#0000000&@65 +| +0#e000002&@7|"@1| +0#0000000&@64 +| +0#e000002&@7|"@1|\+0#e000e06&|u|0@1|5|c|"+0#e000002&| +0#0000000&@57 +| +0#e000002&@7|"@1|\+0#e000e06&|u|0@1|5|c|"+0#e000002&@1| +0#0000000&@56 +| +0#e000002&@7|"@1|\+0#e000e06&|"|\|u|0@1|2@1|\|u|0@1|2@1| +0#0000000&@50 +| +0#e000002&@7|"@1|\+0#e000e06&|"|"+0#e000002&@1|\+0#e000e06&|u|0@1|5|c|\|u|0@1|2@1| +0#0000000&@48 +| +0#e000002&@7|"@1|\+0#e000e06&|"|"+0#e000002&@1|\+0#e000e06&|"|"+0#e000002&| +0#0000000&@57 +| +0#e000002&@7|"@1|\+0#e000e06&|"|"+0#e000002&@1|\+0#e000e06&|"|"+0#e000002&|\+0#e000e06&|"|"+0#0000000&@2|)|;| @50 +@4|}| @69 +>}| @73 +@57|4@1|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/input/java_escapes.java b/runtime/syntax/testdir/input/java_escapes.java index 624d4fcd89..eadaa420b4 100644 --- a/runtime/syntax/testdir/input/java_escapes.java +++ b/runtime/syntax/testdir/input/java_escapes.java @@ -11,13 +11,13 @@ class EscapesTests static { char ee[] = { - '\b', '\t', + '\b', '\s', '\t', '\n', '\f', '\r', '\"', '\'', '\\', }; System.out.println(new String[] { - "\b", "\t", + "\b", "\s", "\t", "\n", "\f", "\r", "\"", "\'", "\\", }); diff --git a/runtime/syntax/testdir/input/java_string.java b/runtime/syntax/testdir/input/java_string.java new file mode 100644 index 0000000000..51c30b9da8 --- /dev/null +++ b/runtime/syntax/testdir/input/java_string.java @@ -0,0 +1,44 @@ +class StringTests +{ + static { + String s1 = "A quick brown fox jumps over the lazy dog"; + String s2 = "\"Woof\s!\""; + String s3 = """ + A\s\ + quick \ + brown\s\ + fox \ + jumps\s\ + over \ + the\s\ + lazy \ + dog"""; + String s4 = """ + "Woof\s!\""""; + String s5 = """ + String s3 = \""" + A\\s\\ + quick \\ + brown\\s\\ + fox \\ + jumps\\s\\ + over \\ + the\\s\\ + lazy \\ + dog\""";"""; + + // There are SPACE, FF, HT, CR, and LF after """. + String empty = """ + """; + + System.out.println(""" + " + "" + ""\u005c" + ""\u005c"" + ""\"\u0022\u0022 + ""\"""\u005c\u0022 + ""\"""\"" + ""\"""\""\""""); + } +} From 353faa373eb132987a1985cf3abe18c006f8cdf0 Mon Sep 17 00:00:00 2001 From: Restorer <69863286+RestorerZ@users.noreply.github.com> Date: Sun, 3 Mar 2024 14:52:37 +0000 Subject: [PATCH 121/426] translation(ru): Updated Russian installer translation (#14134) * translation(ru): Updated Russian translation for NSIS * update CODEOWNERS Signed-off-by: RestorerZ Signed-off-by: Christian Brabandt --- .github/CODEOWNERS | 10 +++++ nsis/lang/russian.nsi | 102 +++++++++++++++++++++++------------------- 2 files changed, 66 insertions(+), 46 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 57b889b322..73b676aacc 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -9,6 +9,7 @@ # So if a pull request only touches javascript files, only these owners # will be requested to review. +nsis/lang/russian.nsi @RestorerZ runtime/autoload/freebasic.vim @dkearns runtime/autoload/haskell.vim @alx741 runtime/autoload/javascript.vim @jsit @@ -303,8 +304,12 @@ runtime/indent/xml.vim @chrisbra runtime/indent/zsh.vim @chrisbra runtime/keymap/armenian-eastern_utf-8.vim @blinskey runtime/keymap/armenian-western_utf-8.vim @blinskey +runtime/keymap/russian-typograph.vim @RestorerZ runtime/keymap/tamil_tscii.vim @yegappan runtime/lang/menu_en_gb.latin1.vim @mrdubya +runtime/lang/menu_ru_ru.cp1251.vim @RestorerZ +runtime/lang/menu_ru_ru.koi8-r.vim @RestorerZ +runtime/lang/menu_ru_ru.utf-8.vim @RestorerZ runtime/pack/dist/opt/cfilter/plugin/cfilter.vim @yegappan runtime/pack/dist/opt/matchit/ @chrisbra runtime/plugin/manpager.vim @Konfekt @@ -379,6 +384,7 @@ runtime/syntax/gyp.vim @ObserverOfTime runtime/syntax/haml.vim @tpope runtime/syntax/hare.vim @rsaihe runtime/syntax/haskell.vim @coot +runtime/syntax/help_ru.vim @RestorerZ runtime/syntax/hgcommit.vim @k-takata runtime/syntax/hitest.vim @lacygoill runtime/syntax/hog.vim @wtfbbqhax @@ -501,6 +507,9 @@ runtime/tutor/tutor.eo @dpelle runtime/tutor/tutor.eo.utf-8 @dpelle runtime/tutor/tutor.fr @dpelle runtime/tutor/tutor.fr.utf-8 @dpelle +runtime/tutor/tutor.ru @RestorerZ +runtime/tutor/tutor.ru.cp1251 @RestorerZ +runtime/tutor/tutor.ru.utf-8 @RestorerZ src/iscygpty.* @k-takata src/libvterm/ @leonerd src/po/ca.po @nfdisco @@ -512,6 +521,7 @@ src/po/fr.po @dpelle src/po/ga.po @kscanne src/po/it.po @azc100 src/po/ja.po @k-takata +src/po/ru.po @RestorerZ src/po/sr.po @eevan78 src/po/tr.po @bitigchi src/po/uk.po @sakhnik diff --git a/nsis/lang/russian.nsi b/nsis/lang/russian.nsi index e4512081a9..e4b01e3ad0 100644 --- a/nsis/lang/russian.nsi +++ b/nsis/lang/russian.nsi @@ -22,20 +22,20 @@ LangString ^UninstallCaption ${LANG_RUSSIAN} \ ############################################################################## #LangString str_dest_folder ${LANG_RUSSIAN} \ -# "Маршрут к каталогу установки (должен оканчиваться каталогом $\"vim$\")" +# "Маршрут установки программы (должен завершаться каталогом $\"vim$\")" LangString str_show_readme ${LANG_RUSSIAN} \ - "После окончания установки ознакомиться с кратким описанием" + " Ознакомиться с кратким описанием программы" # Install types: LangString str_type_typical ${LANG_RUSSIAN} \ - "Стандартная" + "Стандартный" LangString str_type_minimal ${LANG_RUSSIAN} \ - "Минимальная" + "Минимальный" LangString str_type_full ${LANG_RUSSIAN} \ - "Полная" + "Полный" ############################################################################## @@ -50,59 +50,61 @@ LangString str_desc_old_ver ${LANG_RUSSIAN} \ LangString str_section_exe ${LANG_RUSSIAN} \ "Графический интерфейс и вспомогательные файлы" LangString str_desc_exe ${LANG_RUSSIAN} \ - "Графический интерфейс программы Vim и все необходимые для этого файлы. \ + "Исполняемые файлы и все необходимые для работы программы файлы. \ Это обязательный компонент" LangString str_section_console ${LANG_RUSSIAN} \ "Консольная программа Vim" LangString str_desc_console ${LANG_RUSSIAN} \ - "Вариант редактора Vim (vim.exe), используемый в командной оболочке" + "Вариант редактора Vim (vim.exe), используемый для работы в командной \ + оболочке" LangString str_section_batch ${LANG_RUSSIAN} \ "Создать командные файлы" LangString str_desc_batch ${LANG_RUSSIAN} \ - "Создание командных bat-файлов позволяющих работать с редактором \ - Vim из командной строки Windows" + "Создание командных bat-файлов в каталоге Windows для работы с редактором \ + Vim из командной строки" LangString str_group_icons ${LANG_RUSSIAN} \ "Создать ярлыки для редактора Vim" LangString str_desc_icons ${LANG_RUSSIAN} \ - "Создание ярлыков редактора Vim для облегчения запуска программы" + "Создание ярлыков программы для удобного и быстрого запуска редактора Vim" LangString str_section_desktop ${LANG_RUSSIAN} \ "На Рабочем столе" LangString str_desc_desktop ${LANG_RUSSIAN} \ - "Создание ярлыков программы Gvim на Рабочем столе" + "Создание ярлыков редактора Vim на Рабочем столе" LangString str_section_start_menu ${LANG_RUSSIAN} \ "В меню кнопки Пуск" LangString str_desc_start_menu ${LANG_RUSSIAN} \ - "Создание ярлыков программы Gvim в меню кнопки Пуск" + "Создание ярлыков редактора Vim в меню кнопки Пуск" #LangString str_section_quick_launch ${LANG_RUSSIAN} \ # "На панели быстрого запуска" #LangString str_desc_quick_launch ${LANG_RUSSIAN} \ -# "Создание ярлыков программы GVim на панели быстрого запуска" +# "Создание ярлыков редактора Vim на панели быстрого запуска" LangString str_section_edit_with ${LANG_RUSSIAN} \ - "В контекстном меню" + "Запуск редактора Vim из контекстного меню" LangString str_desc_edit_with ${LANG_RUSSIAN} \ - "Добавление вызова программы Gvim в пункт $\"Открыть с помощью...$\" контекстного меню" + "Добавление необходимой строки в пункт контекстного меню \ + «Открыть с помощью...»" #LangString str_section_edit_with32 ${LANG_RUSSIAN} \ -# "32-разрядная версия программы" +# "Для 32-разрядной версии программы" #LangString str_desc_edit_with32 ${LANG_RUSSIAN} \ -# "Добавление вызова программы Gvim в пункт $\"Открыть с помощью...$\" контекстного меню \ -# для 32-разрядных приложений" +# "Добавление в пункт контекстного меню \ +# «Открыть с помощью...» 32-разрядных приложений" #LangString str_section_edit_with64 ${LANG_RUSSIAN} \ -# "64-разрядная версия программы" +# "Для 64-разрядной версии программы" #LangString str_desc_edit_with64 ${LANG_RUSSIAN} \ -# "Добавление вызова программы Gvim в пункт $\"Открыть с помощью...$\" контекстного меню \ -# для 64-разрядных приложений" +# "Добавление в пункт контекстного меню \ +# «Открыть с помощью...» 64-разрядных приложений" LangString str_section_vim_rc ${LANG_RUSSIAN} \ - "Настройки программы по умолчанию" + "Начальная настройка программы" LangString str_desc_vim_rc ${LANG_RUSSIAN} \ "Создание файла _vimrc с предустановленными настройками, если нет других \ файлов настроек" @@ -110,25 +112,31 @@ LangString str_desc_vim_rc ${LANG_RUSSIAN} \ LangString str_group_plugin ${LANG_RUSSIAN} \ "Создать каталог для подключаемых модулей" LangString str_desc_plugin ${LANG_RUSSIAN} \ - "Создание каталога для размещения подключаемых модулей, которые расширяют \ - возможности редактора Vim" + "Создание каталога для подключаемых модулей, которые расширяют возможности \ + редактора Vim" LangString str_section_plugin_home ${LANG_RUSSIAN} \ "Личный каталог" LangString str_desc_plugin_home ${LANG_RUSSIAN} \ - "Создание каталога для подключаемых модулей в домашнем каталоге пользователя" + "В домашнем каталоге пользователя. Модули в этом каталоге доступны только \ + этому пользователю" LangString str_section_plugin_vim ${LANG_RUSSIAN} \ "Общий каталог" LangString str_desc_plugin_vim ${LANG_RUSSIAN} \ - "Создание каталога для подключаемых модулей в каталоге установки редактора Vim. \ - Модули в этом каталоге будут доступны для любого пользователя \ - зарегистрировавшегося в системе" + "В каталоге установки редактора Vim. Модули в этом каталоге доступны для \ + всех пользователей" + +#LangString str_section_vis_vim ${LANG_RUSSIAN} \ +# "Подключаемый модуль VisVim" +#LangString str_desc_vis_vim ${LANG_RUSSIAN} \ +# "Подключаемый модуль VisVim используется для интеграции с \ +# Microsoft Visual Studio" LangString str_section_nls ${LANG_RUSSIAN} \ "Поддержка региональных языков" LangString str_desc_nls ${LANG_RUSSIAN} \ - "Установка файлов для поддержки региональных языков операционной системы" + "Установка файлов для работы программе на различных региональных языках" LangString str_unsection_register ${LANG_RUSSIAN} \ "Отменить регистрацию компонентов программы Vim" @@ -158,8 +166,8 @@ LangString str_desc_rm_plugin_vim ${LANG_RUSSIAN} \ LangString str_unsection_rootdir ${LANG_RUSSIAN} \ "Удалить основной каталог программы Vim" LangString str_desc_rm_rootdir ${LANG_RUSSIAN} \ - "Удаление основного каталога программы Vim. В этом каталоге находятся файлы \ - настроек!" + "Удаление основного каталога программы Vim. В этом каталоге находятся \ + файлы настроек!" ############################################################################## @@ -199,10 +207,11 @@ LangString str_desc_rm_rootdir ${LANG_RUSSIAN} \ # "Произошёл сбой при выполнении удаления следующих версий программы:" #LangString str_msg_no_rm_key ${LANG_RUSSIAN} \ -# "Не удалось найти раздел реестра, содержащий информацию об удалении программы" +# "Не удалось найти раздел реестра, содержащий информацию об удалении \ +# программы" #LangString str_msg_no_rm_reg ${LANG_RUSSIAN} \ -# "Не удалось найти программу выполняющую удаление, указанную в разделе реестра" +# "Не удалось найти указанную в реестре программу, которая выполняет удаление" #LangString str_msg_no_rm_exe ${LANG_RUSSIAN} \ # "Отсутствуют права на доступ к программе, выполняющей удаление" @@ -219,14 +228,15 @@ LangString str_desc_rm_rootdir ${LANG_RUSSIAN} \ LangString str_msg_install_fail ${LANG_RUSSIAN} \ "Произошла ошибка при установке программы. Попробуйте повторить установку \ немного попозже" -# когда луна будет в другой фазе и ветер должен дуть с юго‐запада +# когда Луна будет в другой фазе и ветер должен дуть с юго‐запада LangString str_msg_rm_exe_fail ${LANG_RUSSIAN} \ "Некоторые файлы не были удалены из каталога $0 $\r$\n\ Необходимо выполнить их удаление самостоятельно" #LangString str_msg_rm_root_fail ${LANG_RUSSIAN} \ -# "Внимание! В каталоге $\"$vim_install_root$\" содержатся файлы. Удаление каталога не выполнено" +# "Внимание! В каталоге $\"$vim_install_root$\" содержатся файлы. Удаление \ +# каталога не выполнено" LangString str_msg_uninstalling ${LANG_RUSSIAN} \ "Удаление предыдущих версий программ..." @@ -245,7 +255,8 @@ LangString str_msg_unregistering ${LANG_RUSSIAN} \ LangString str_vimrc_page_title ${LANG_RUSSIAN} \ "Установка параметров программы" LangString str_vimrc_page_subtitle ${LANG_RUSSIAN} \ - "Параметры, используемые для клавиатуры, «мыши» и функциональности программы" + "Параметры, используемые для клавиатуры, манипулятора «мышь» и \ + функциональности программы" LangString str_msg_compat_title ${LANG_RUSSIAN} \ " Варианты использования программы " @@ -256,27 +267,26 @@ LangString str_msg_compat_vi ${LANG_RUSSIAN} \ LangString str_msg_compat_vim ${LANG_RUSSIAN} \ "Работа в варианте функциональности редактора Vim" LangString str_msg_compat_defaults ${LANG_RUSSIAN} \ - "Работа редактора Vim с некоторыми улучшениями (файл defaults.vim)" + "Включить некоторые улучшения (из файла defaults.vim)" LangString str_msg_compat_all ${LANG_RUSSIAN} \ - "Работа редактора Vim со всеми улучшениями (файл vimrc_example.vim). \ - Используется по умолчанию" + "Включить все улучшения (из файла vimrc_example.vim). Стандартно" LangString str_msg_keymap_title ${LANG_RUSSIAN} \ " Клавиатурные команды " LangString str_msg_keymap_desc ${LANG_RUSSIAN} \ - "Клавиатурные команды используемые в ОС Windows (CTRL+V, CTRL+C, CTRL+S, CTRL+F и т. п.)" + "Изменение клавиатурных команд CTRL+V, CTRL+C, CTRL+S, CTRL+F и т. п." LangString str_msg_keymap_default ${LANG_RUSSIAN} \ - "Не изменять клавиатурные команды. Использовать принятые в редакторе Vim" + "Без изменения, использовать как принято в редакторе Vim" LangString str_msg_keymap_windows ${LANG_RUSSIAN} \ - "Изменить указанные клавиатурные команды" + "Изменить и использовать как принято в ОС Windows" LangString str_msg_mouse_title ${LANG_RUSSIAN} \ " Манипулятор «мышь» " LangString str_msg_mouse_desc ${LANG_RUSSIAN} \ - "Действий правой и левой кнопки манипулятора «мышь»" + "Действия правой и левой кнопки манипулятора «мышь»" LangString str_msg_mouse_default ${LANG_RUSSIAN} \ - "Правая кнопка — всплывающее меню, левая кнопка — режим визуальный" + "Правая — всплывающее меню, левая — режим визуальный (Vim)" LangString str_msg_mouse_windows ${LANG_RUSSIAN} \ - "Правая кнопка — всплывающее меню, левая кнопка — режим выборки (как в ОС Windows)" + "Правая — всплывающее меню, левая — режим выборки (Windows)" LangString str_msg_mouse_unix ${LANG_RUSSIAN} \ - "Правая кнопка — расширяемый режим выбора, левая кнопка — режим визуальный (как в UNIX‐подобных ОС)" + "Правая — расширение выборки, левая — режим визуальный (UNIX)" From 215703563757a4464907ead6fb9edaeb7f430bea Mon Sep 17 00:00:00 2001 From: Colin Kennedy Date: Sun, 3 Mar 2024 16:16:47 +0100 Subject: [PATCH 122/426] patch 9.1.0147: Cannot keep a buffer focused in a window Problem: Cannot keep a buffer focused in a window (Amit Levy) Solution: Add the 'winfixbuf' window-local option (Colin Kennedy) fixes: #6445 closes: #13903 Signed-off-by: Colin Kennedy Signed-off-by: Christian Brabandt --- runtime/doc/message.txt | 9 +- runtime/doc/options.txt | 13 +- runtime/doc/quickref.txt | 3 +- runtime/doc/tags | 2 + runtime/doc/tagsrch.txt | 31 +- runtime/doc/version9.txt | 4 +- runtime/optwin.vim | 3 + src/arglist.c | 8 +- src/buffer.c | 7 + src/errors.h | 2 + src/ex_cmds.c | 3 + src/ex_cmds.h | 2 +- src/ex_cmds2.c | 25 + src/ex_docmd.c | 15 +- src/insexpand.c | 2 +- src/normal.c | 6 +- src/option.c | 1 + src/option.h | 1 + src/optiondefs.h | 4 + src/proto/search.pro | 2 +- src/proto/window.pro | 2 + src/quickfix.c | 40 +- src/search.c | 7 +- src/structs.h | 2 + src/tag.c | 6 + src/testdir/Make_all.mak | 1 + src/testdir/test_winfixbuf.vim | 3131 ++++++++++++++++++++++++++++++++ src/version.c | 2 + src/window.c | 33 +- 29 files changed, 3336 insertions(+), 31 deletions(-) create mode 100644 src/testdir/test_winfixbuf.vim diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 133d47ad11..58480740ed 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -1,4 +1,4 @@ -*message.txt* For Vim version 9.1. Last change: 2023 Dec 20 +*message.txt* For Vim version 9.1. Last change: 2024 Mar 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -122,6 +122,13 @@ wiped out a buffer which contains a mark or is referenced in another way. You cannot have two buffers with exactly the same name. This includes the path leading to the file. + *E1513* > + Cannot edit buffer. 'winfixbuf' is enabled + +If a window has 'winfixbuf' enabled, you cannot change that window's current +buffer. You need to set 'nowinfixbuf' before continuing. You may use [!] to +force the window to switch buffers, if your command supports it. + *E72* Close error on swap file ~ diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 210bfdcbd6..e38aa81a80 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 9.1. Last change: 2024 Feb 24 +*options.txt* For Vim version 9.1. Last change: 2024 Mar 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -8021,6 +8021,8 @@ A jump table for the options with a short description can be found at |Q_op|. "split" when both are present. uselast If included, jump to the previously used window when jumping to errors with |quickfix| commands. + If a window has 'winfixbuf' enabled, 'switchbuf' is currently not + applied to the split window. *'synmaxcol'* *'smc'* 'synmaxcol' 'smc' number (default 3000) @@ -9471,6 +9473,15 @@ A jump table for the options with a short description can be found at |Q_op|. Note: Do not confuse this with the height of the Vim window, use 'lines' for that. + *'winfixbuf'* +'winfixbuf' 'wfb' boolean (default off) + local to window + If enabled, the buffer and any window that displays it are paired. + For example, attempting to change the buffer with |:edit| will fail. + Other commands which change a window's buffer such as |:cnext| will + also skip any window with 'winfixbuf' enabled. However if a command + has an "!" option, a window can be forced to switch buffers. + *'winfixheight'* *'wfh'* *'nowinfixheight'* *'nowfh'* 'winfixheight' 'wfh' boolean (default off) local to window |local-noglobal| diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index dcbb52013b..517fa30426 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 9.1. Last change: 2023 Dec 05 +*quickref.txt* For Vim version 9.1. Last change: 2024 Mar 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1005,6 +1005,7 @@ Short explanation of each option: *option-list* 'winaltkeys' 'wak' when the windows system handles ALT keys 'wincolor' 'wcr' window-local highlighting 'window' 'wi' nr of lines to scroll for CTRL-F and CTRL-B +'winfixbuf' 'wfb' keep window focused on a single buffer 'winfixheight' 'wfh' keep window height when opening/closing windows 'winfixwidth' 'wfw' keep window width when opening/closing windows 'winheight' 'wh' minimum number of lines for the current window diff --git a/runtime/doc/tags b/runtime/doc/tags index 8af0b573a5..efecedfb2a 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -1294,6 +1294,7 @@ $quote eval.txt /*$quote* 'winaltkeys' options.txt /*'winaltkeys'* 'wincolor' options.txt /*'wincolor'* 'window' options.txt /*'window'* +'winfixbuf' options.txt /*'winfixbuf'* 'winfixheight' options.txt /*'winfixheight'* 'winfixwidth' options.txt /*'winfixwidth'* 'winheight' options.txt /*'winheight'* @@ -4541,6 +4542,7 @@ E151 helphelp.txt /*E151* E1510 change.txt /*E1510* E1511 options.txt /*E1511* E1512 options.txt /*E1512* +E1513 message.txt /*E1513* E152 helphelp.txt /*E152* E153 helphelp.txt /*E153* E154 helphelp.txt /*E154* diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index aa7b9dd48d..ce6d44634b 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -1,4 +1,4 @@ -*tagsrch.txt* For Vim version 9.1. Last change: 2023 Feb 13 +*tagsrch.txt* For Vim version 9.1. Last change: 2024 Mar 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -409,17 +409,22 @@ If the tag is in the current file this will always work. Otherwise the performed actions depend on whether the current file was changed, whether a ! is added to the command and on the 'autowrite' option: - tag in file autowrite ~ -current file changed ! option action ~ ------------------------------------------------------------------------------ - yes x x x goto tag - no no x x read other file, goto tag - no yes yes x abandon current file, read other file, goto - tag - no yes no on write current file, read other file, goto - tag - no yes no off fail ------------------------------------------------------------------------------ + tag in file autowrite ~ +current file changed ! winfixbuf option action ~ + ----------------------------------------------------------------------------- + yes x x no x goto tag + no no x no x read other file, goto tag + no yes yes no x abandon current file, + read other file, goto tag + no yes no no on write current file, + read other file, goto tag + no yes no no off fail + yes x yes x x goto tag + no no no yes x fail + no yes no yes x fail + no yes no yes on fail + no yes no yes off fail + ----------------------------------------------------------------------------- - If the tag is in the current file, the command will always work. - If the tag is in another file and the current file was not changed, the @@ -435,6 +440,8 @@ current file changed ! option action ~ the changes, use the ":w" command and then use ":tag" without an argument. This works because the tag is put on the stack anyway. If you want to lose the changes you can use the ":tag!" command. +- If the tag is in another file and the window includes 'winfixbuf', the + command will fail. If the tag is in the same file then it may succeed. *tag-security* Note that Vim forbids some commands, for security reasons. This works like diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index 7b9a3664a0..7947cb281c 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -1,4 +1,4 @@ -*version9.txt* For Vim version 9.1. Last change: 2024 Feb 21 +*version9.txt* For Vim version 9.1. Last change: 2024 Mar 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -41575,6 +41575,8 @@ Commands: ~ Options: ~ +'winfixbuf' Keep buffer focused in a window + ============================================================================== INCOMPATIBLE CHANGES *incompatible-9.2* diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 6e133ce673..d3e1605ed0 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -482,6 +482,7 @@ if has("statusline") call AddOption("statusline", gettext("alternate format to be used for a status line")) call OptionG("stl", &stl) endif +call append("$", "\t" .. s:local_to_window) call AddOption("equalalways", gettext("make all windows the same size when adding/removing windows")) call BinOptionG("ea", &ea) call AddOption("eadirection", gettext("in which direction 'equalalways' works: \"ver\", \"hor\" or \"both\"")) @@ -490,6 +491,8 @@ call AddOption("winheight", gettext("minimal number of lines used for the c call append("$", " \tset wh=" . &wh) call AddOption("winminheight", gettext("minimal number of lines used for any window")) call append("$", " \tset wmh=" . &wmh) +call AddOption("winfixbuf", gettext("keep window focused on a single buffer")) +call OptionG("wfb", &wfb) call AddOption("winfixheight", gettext("keep the height of the window")) call append("$", "\t" .. s:local_to_window) call BinOptionL("wfh") diff --git a/src/arglist.c b/src/arglist.c index 723133254a..187e16e835 100644 --- a/src/arglist.c +++ b/src/arglist.c @@ -682,6 +682,7 @@ do_argfile(exarg_T *eap, int argn) int other; char_u *p; int old_arg_idx = curwin->w_arg_idx; + int is_split_cmd = *eap->cmd == 's'; if (ERROR_IF_ANY_POPUP_WINDOW) return; @@ -697,13 +698,18 @@ do_argfile(exarg_T *eap, int argn) return; } + if (!is_split_cmd + && (&ARGLIST[argn])->ae_fnum != curbuf->b_fnum + && !check_can_set_curbuf_forceit(eap->forceit)) + return; + setpcmark(); #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif // split window or create new tab page first - if (*eap->cmd == 's' || cmdmod.cmod_tab != 0) + if (is_split_cmd || cmdmod.cmod_tab != 0) { if (win_split(0, 0) == FAIL) return; diff --git a/src/buffer.c b/src/buffer.c index 8d62e64368..36396e8d28 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1370,6 +1370,13 @@ do_buffer_ext( if ((flags & DOBUF_NOPOPUP) && bt_popup(buf) && !bt_terminal(buf)) return OK; #endif + if ( + action == DOBUF_GOTO + && buf != curbuf + && !check_can_set_curbuf_forceit((flags & DOBUF_FORCEIT) ? TRUE : FALSE)) + // disallow navigating to another buffer when 'winfixbuf' is applied + return FAIL; + if ((action == DOBUF_GOTO || action == DOBUF_SPLIT) && (buf->b_flags & BF_DUMMY)) { diff --git a/src/errors.h b/src/errors.h index dd2bc95b76..65ee4e826e 100644 --- a/src/errors.h +++ b/src/errors.h @@ -3607,3 +3607,5 @@ EXTERN char e_wrong_number_of_characters_for_field_str[] INIT(= N_("E1511: Wrong number of characters for field \"%s\"")); EXTERN char e_wrong_character_width_for_field_str[] INIT(= N_("E1512: Wrong character width for field \"%s\"")); +EXTERN char e_winfixbuf_cannot_go_to_buffer[] + INIT(= N_("E1513: Cannot edit buffer. 'winfixbuf' is enabled")); diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 720e918bb4..a12d819b3f 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -2428,6 +2428,9 @@ getfile( int retval; char_u *free_me = NULL; + if (!check_can_set_curbuf_forceit(forceit)) + return GETFILE_ERROR; + if (text_locked()) return GETFILE_ERROR; if (curbuf_locked()) diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 4ae6cc2293..bd26e81dcc 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -521,7 +521,7 @@ EXCMD(CMD_doautoall, "doautoall", ex_doautoall, EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_drop, "drop", ex_drop, - EX_FILES|EX_CMDARG|EX_NEEDARG|EX_ARGOPT|EX_TRLBAR, + EX_BANG|EX_FILES|EX_CMDARG|EX_NEEDARG|EX_ARGOPT|EX_TRLBAR, ADDR_NONE), EXCMD(CMD_dsearch, "dsearch", ex_findpat, EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK, diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 0bde73070e..c9834d2232 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -457,6 +457,31 @@ ex_listdo(exarg_T *eap) tabpage_T *tp; buf_T *buf = curbuf; int next_fnum = 0; + + if (curwin->w_p_wfb) + { + if ((eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) && !eap->forceit) + { + // Disallow :ldo if 'winfixbuf' is applied + semsg("%s", e_winfixbuf_cannot_go_to_buffer); + return; + } + + if (win_valid(prevwin)) + // Change the current window to another because 'winfixbuf' is enabled + curwin = prevwin; + else + { + // Split the window, which will be 'nowinfixbuf', and set curwin to that + exarg_T new_eap; + CLEAR_FIELD(new_eap); + new_eap.cmdidx = CMD_split; + new_eap.cmd = (char_u *)"split"; + new_eap.arg = (char_u *)""; + ex_splitview(&new_eap); + } + } + #if defined(FEAT_SYN_HL) char_u *save_ei = NULL; #endif diff --git a/src/ex_docmd.c b/src/ex_docmd.c index c18a9107ec..19b1d85c68 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7164,6 +7164,9 @@ ex_resize(exarg_T *eap) static void ex_find(exarg_T *eap) { + if (!check_can_set_curbuf_forceit(eap->forceit)) + return; + char_u *fname; int count; char_u *file_to_find = NULL; @@ -7245,6 +7248,14 @@ ex_open(exarg_T *eap) static void ex_edit(exarg_T *eap) { + // Exclude commands which keep the window's current buffer + if ( + eap->cmdidx != CMD_badd + && eap->cmdidx != CMD_balt + // All other commands must obey 'winfixbuf' / ! rules + && !check_can_set_curbuf_forceit(eap->forceit)) + return; + do_exedit(eap, NULL); } @@ -9031,7 +9042,7 @@ ex_checkpath(exarg_T *eap) { find_pattern_in_path(NULL, 0, 0, FALSE, FALSE, CHECK_PATH, 1L, eap->forceit ? ACTION_SHOW_ALL : ACTION_SHOW, - (linenr_T)1, (linenr_T)MAXLNUM); + (linenr_T)1, (linenr_T)MAXLNUM, eap->forceit); } #if defined(FEAT_QUICKFIX) @@ -9101,7 +9112,7 @@ ex_findpat(exarg_T *eap) find_pattern_in_path(eap->arg, 0, (int)STRLEN(eap->arg), whole, !eap->forceit, *eap->cmd == 'd' ? FIND_DEFINE : FIND_ANY, - n, action, eap->line1, eap->line2); + n, action, eap->line1, eap->line2, eap->forceit); } #endif diff --git a/src/insexpand.c b/src/insexpand.c index 68e970a71a..0847b6c051 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -3407,7 +3407,7 @@ get_next_include_file_completion(int compl_type) (compl_type == CTRL_X_PATH_DEFINES && !(compl_cont_status & CONT_SOL)) ? FIND_DEFINE : FIND_ANY, 1L, ACTION_EXPAND, - (linenr_T)1, (linenr_T)MAXLNUM); + (linenr_T)1, (linenr_T)MAXLNUM, FALSE); } #endif diff --git a/src/normal.c b/src/normal.c index 791b02f1cd..5ef3a9277c 100644 --- a/src/normal.c +++ b/src/normal.c @@ -4073,6 +4073,9 @@ nv_gotofile(cmdarg_T *cap) return; #endif + if (!check_can_set_curbuf_disabled()) + return; + ptr = grab_file_name(cap->count1, &lnum); if (ptr != NULL) @@ -4475,7 +4478,8 @@ nv_brackets(cmdarg_T *cap) SAFE_isupper(cap->nchar) ? ACTION_SHOW_ALL : SAFE_islower(cap->nchar) ? ACTION_SHOW : ACTION_GOTO, cap->cmdchar == ']' ? curwin->w_cursor.lnum + 1 : (linenr_T)1, - (linenr_T)MAXLNUM); + (linenr_T)MAXLNUM, + FALSE); vim_free(ptr); curwin->w_set_curswant = TRUE; } diff --git a/src/option.c b/src/option.c index dd3542f895..8123a2a2c6 100644 --- a/src/option.c +++ b/src/option.c @@ -6420,6 +6420,7 @@ get_varp(struct vimoption *p) #ifdef FEAT_LINEBREAK case PV_NUW: return (char_u *)&(curwin->w_p_nuw); #endif + case PV_WFB: return (char_u *)&(curwin->w_p_wfb); case PV_WFH: return (char_u *)&(curwin->w_p_wfh); case PV_WFW: return (char_u *)&(curwin->w_p_wfw); #if defined(FEAT_QUICKFIX) diff --git a/src/option.h b/src/option.h index 75940cce0a..bf889e47de 100644 --- a/src/option.h +++ b/src/option.h @@ -1309,6 +1309,7 @@ enum #ifdef FEAT_STL_OPT , WV_STL #endif + , WV_WFB , WV_WFH , WV_WFW , WV_WRAP diff --git a/src/optiondefs.h b/src/optiondefs.h index 1a09e1c7fb..4ee2e20de3 100644 --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -215,6 +215,7 @@ # define PV_STL OPT_BOTH(OPT_WIN(WV_STL)) #endif #define PV_UL OPT_BOTH(OPT_BUF(BV_UL)) +# define PV_WFB OPT_WIN(WV_WFB) # define PV_WFH OPT_WIN(WV_WFH) # define PV_WFW OPT_WIN(WV_WFW) #define PV_WRAP OPT_WIN(WV_WRAP) @@ -2850,6 +2851,9 @@ static struct vimoption options[] = {"window", "wi", P_NUM|P_VI_DEF, (char_u *)&p_window, PV_NONE, did_set_window, NULL, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, + {"winfixbuf", "wfb", P_BOOL|P_VI_DEF|P_RWIN, + (char_u *)VAR_WIN, PV_WFB, NULL, NULL, + {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"winfixheight", "wfh", P_BOOL|P_VI_DEF|P_RSTAT, (char_u *)VAR_WIN, PV_WFH, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, diff --git a/src/proto/search.pro b/src/proto/search.pro index 99e279dadf..5b2b889317 100644 --- a/src/proto/search.pro +++ b/src/proto/search.pro @@ -32,7 +32,7 @@ int check_linecomment(char_u *line); void showmatch(int c); int current_search(long count, int forward); int linewhite(linenr_T lnum); -void find_pattern_in_path(char_u *ptr, int dir, int len, int whole, int skip_comments, int type, long count, int action, linenr_T start_lnum, linenr_T end_lnum); +void find_pattern_in_path(char_u *ptr, int dir, int len, int whole, int skip_comments, int type, long count, int action, linenr_T start_lnum, linenr_T end_lnum, int forceit); spat_T *get_spat(int idx); int get_spat_last_idx(void); void f_searchcount(typval_T *argvars, typval_T *rettv); diff --git a/src/proto/window.pro b/src/proto/window.pro index e5c03969fb..9e66db5a7f 100644 --- a/src/proto/window.pro +++ b/src/proto/window.pro @@ -1,4 +1,6 @@ /* window.c */ +int check_can_set_curbuf_disabled(void); +int check_can_set_curbuf_forceit(int forceit); int window_layout_locked(enum CMD_index cmd); win_T *prevwin_curwin(void); win_T *swbuf_goto_win_with_buf(buf_T *buf); diff --git a/src/quickfix.c b/src/quickfix.c index d8bcc1232a..1f4176fe54 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3146,7 +3146,7 @@ qf_goto_win_with_qfl_file(int qf_fnum) // Didn't find it, go to the window before the quickfix // window, unless 'switchbuf' contains 'uselast': in this case we // try to jump to the previously used window first. - if ((swb_flags & SWB_USELAST) && win_valid(prevwin)) + if ((swb_flags & SWB_USELAST) && !prevwin->w_p_wfb && win_valid(prevwin)) win = prevwin; else if (altwin != NULL) win = altwin; @@ -3158,7 +3158,7 @@ qf_goto_win_with_qfl_file(int qf_fnum) } // Remember a usable window. - if (altwin == NULL && !win->w_p_pvw && bt_normal(win->w_buffer)) + if (altwin == NULL && !win->w_p_pvw && !win->w_p_wfb && bt_normal(win->w_buffer)) altwin = win; } @@ -3261,8 +3261,32 @@ qf_jump_edit_buffer( prev_winid == curwin->w_id ? curwin : NULL); } else + { + if (!forceit && curwin->w_p_wfb) + { + if (qi->qfl_type == QFLT_LOCATION) + { + // Location lists cannot split or reassign their window + // so 'winfixbuf' windows must fail + semsg("%s", e_winfixbuf_cannot_go_to_buffer); + return QF_ABORT; + } + + if (!win_valid(prevwin)) + { + // Split the window, which will be 'nowinfixbuf', and set curwin to that + exarg_T new_eap; + CLEAR_FIELD(new_eap); + new_eap.cmdidx = CMD_split; + new_eap.cmd = (char_u *)"split"; + new_eap.arg = (char_u *)""; + ex_splitview(&new_eap); + } + } + retval = buflist_getfile(qf_ptr->qf_fnum, (linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit); + } // If a location list, check whether the associated window is still // present. @@ -4991,6 +5015,11 @@ qf_jump_first(qf_info_T *qi, int_u save_qfid, int forceit) if (qf_restore_list(qi, save_qfid) == FAIL) return; + + if (!check_can_set_curbuf_forceit(forceit)) + return; + + // Autocommands might have cleared the list, check for that. if (!qf_list_empty(qf_get_curlist(qi))) qf_jump(qi, 0, 0, forceit); @@ -5907,7 +5936,7 @@ ex_cfile(exarg_T *eap) // This function is used by the :cfile, :cgetfile and :caddfile // commands. - // :cfile always creates a new quickfix list and jumps to the + // :cfile always creates a new quickfix list and may jump to the // first error. // :cgetfile creates a new quickfix list but doesn't jump to the // first error. @@ -6497,6 +6526,9 @@ ex_vimgrep(exarg_T *eap) char_u *au_name = NULL; int status; + if (!check_can_set_curbuf_forceit(eap->forceit)) + return; + au_name = vgr_get_auname(eap->cmdidx); if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, curbuf->b_fname, TRUE, curbuf)) @@ -6558,7 +6590,7 @@ ex_vimgrep(exarg_T *eap) goto theend; } - // Jump to first match. + // Jump to first match if the current window is not 'winfixbuf' if (!qf_list_empty(qf_get_curlist(qi))) { if ((args.flags & VGR_NOJUMP) == 0) diff --git a/src/search.c b/src/search.c index 1d0542b658..83aaf0ac31 100644 --- a/src/search.c +++ b/src/search.c @@ -3292,7 +3292,8 @@ find_pattern_in_path( long count, int action, // What to do when we find it linenr_T start_lnum, // first line to start searching - linenr_T end_lnum) // last line for searching + linenr_T end_lnum, // last line for searching + int forceit) // If true, always switch to the found path { SearchedFile *files; // Stack of included files SearchedFile *bigger; // When we need more space @@ -3829,7 +3830,7 @@ find_pattern_in_path( break; if (!GETFILE_SUCCESS(getfile( curwin_save->w_buffer->b_fnum, NULL, - NULL, TRUE, lnum, FALSE))) + NULL, TRUE, lnum, forceit))) break; // failed to jump to file } else @@ -3842,7 +3843,7 @@ find_pattern_in_path( { if (!GETFILE_SUCCESS(getfile( 0, files[depth].name, NULL, TRUE, - files[depth].lnum, FALSE))) + files[depth].lnum, forceit))) break; // failed to jump to file // autocommands may have changed the lnum, we don't // want that here diff --git a/src/structs.h b/src/structs.h index 5b88260f35..df2c005e3d 100644 --- a/src/structs.h +++ b/src/structs.h @@ -246,6 +246,8 @@ typedef struct long wo_nuw; # define w_p_nuw w_onebuf_opt.wo_nuw // 'numberwidth' #endif + int wo_wfb; +#define w_p_wfb w_onebuf_opt.wo_wfb // 'winfixbuf' int wo_wfh; # define w_p_wfh w_onebuf_opt.wo_wfh // 'winfixheight' int wo_wfw; diff --git a/src/tag.c b/src/tag.c index 3df767d192..2ac0da2666 100644 --- a/src/tag.c +++ b/src/tag.c @@ -289,6 +289,9 @@ do_tag( static char_u **matches = NULL; static int flags; + if (postponed_split == 0 && !check_can_set_curbuf_forceit(forceit)) + return FALSE; + #ifdef FEAT_EVAL if (tfu_in_use) { @@ -3705,6 +3708,9 @@ jumpto_tag( size_t len; char_u *lbuf; + if (postponed_split == 0 && !check_can_set_curbuf_forceit(forceit)) + return FAIL; + // Make a copy of the line, it can become invalid when an autocommand calls // back here recursively. len = matching_line_len(lbuf_arg) + 1; diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 8dd04e79e3..d365dfc84f 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -325,6 +325,7 @@ NEW_TESTS = \ test_window_cmd \ test_window_id \ test_windows_home \ + test_winfixbuf \ test_wnext \ test_wordcount \ test_writefile \ diff --git a/src/testdir/test_winfixbuf.vim b/src/testdir/test_winfixbuf.vim new file mode 100644 index 0000000000..0b15983932 --- /dev/null +++ b/src/testdir/test_winfixbuf.vim @@ -0,0 +1,3131 @@ +" Test 'winfixbuf' + +source check.vim + +" Find the number of open windows in the current tab +func s:get_windows_count() + return tabpagewinnr(tabpagenr(), '$') +endfunc + +" Create some unnamed buffers. +func s:make_buffers_list() + enew + file first + let l:first = bufnr() + + enew + file middle + let l:middle = bufnr() + + enew + file last + let l:last = bufnr() + + set winfixbuf + + return [l:first, l:last] +endfunc + +" Create some unnamed buffers and add them to an args list +func s:make_args_list() + let [l:first, l:last] = s:make_buffers_list() + + args! first middle last + + return [l:first, l:last] +endfunc + +" Create two buffers and then set the window to 'winfixbuf' +func s:make_buffer_pairs(...) + let l:reversed = get(a:, 1, 0) + + if l:reversed == 1 + enew + file original + + set winfixbuf + + enew! + file other + let l:other = bufnr() + + return l:other + endif + + enew + file other + let l:other = bufnr() + + enew + file current + + set winfixbuf + + return l:other +endfunc + +" Create 3 quick buffers and set the window to 'winfixbuf' +func s:make_buffer_trio() + edit first + let l:first = bufnr() + edit second + let l:second = bufnr() + + set winfixbuf + + edit! third + let l:third = bufnr() + + execute ":buffer! " . l:second + + return [l:first, l:second, l:third] +endfunc + +" Create a location list with at least 2 entries + a 'winfixbuf' window. +func s:make_simple_location_list() + enew + file middle + let l:middle = bufnr() + call append(0, ["winfix search-term", "another line"]) + + enew! + file first + let l:first = bufnr() + call append(0, "first search-term") + + enew! + file last + let l:last = bufnr() + call append(0, "last search-term") + + call setloclist( + \ 0, + \ [ + \ { + \ "filename": "first", + \ "bufnr": l:first, + \ "lnum": 1, + \ }, + \ { + \ "filename": "middle", + \ "bufnr": l:middle, + \ "lnum": 1, + \ }, + \ { + \ "filename": "middle", + \ "bufnr": l:middle, + \ "lnum": 2, + \ }, + \ { + \ "filename": "last", + \ "bufnr": l:last, + \ "lnum": 1, + \ }, + \ ] + \) + + set winfixbuf + + return [l:first, l:middle, l:last] +endfunc + +" Create a quickfix with at least 2 entries that are in the current 'winfixbuf' window. +func s:make_simple_quickfix() + enew + file current + let l:current = bufnr() + call append(0, ["winfix search-term", "another line"]) + + enew! + file first + let l:first = bufnr() + call append(0, "first search-term") + + enew! + file last + let l:last = bufnr() + call append(0, "last search-term") + + call setqflist( + \ [ + \ { + \ "filename": "first", + \ "bufnr": l:first, + \ "lnum": 1, + \ }, + \ { + \ "filename": "current", + \ "bufnr": l:current, + \ "lnum": 1, + \ }, + \ { + \ "filename": "current", + \ "bufnr": l:current, + \ "lnum": 2, + \ }, + \ { + \ "filename": "last", + \ "bufnr": l:last, + \ "lnum": 1, + \ }, + \ ] + \) + + set winfixbuf + + return [l:current, l:last] +endfunc + +" Create a quickfix with at least 2 entries that are in the current 'winfixbuf' window. +func s:make_quickfix_windows() + let [l:current, _] = s:make_simple_quickfix() + execute "buffer! " . l:current + + split + let l:first_window = win_getid() + execute "normal \j" + let l:winfix_window = win_getid() + + " Open the quickfix in a separate split and go to it + copen + let l:quickfix_window = win_getid() + + return [l:first_window, l:winfix_window, l:quickfix_window] +endfunc + +" Revert all changes that occurred in any past test +func s:reset_all_buffers() + %bwipeout! + set nowinfixbuf + + call setqflist([]) + + for l:window_info in getwininfo() + call setloclist(l:window_info["winid"], []) + endfor + + delmarks A-Z0-9 +endfunc + +" Find and set the first quickfix entry that points to `buffer` +func s:set_quickfix_by_buffer(buffer) + let l:index = 1 " quickfix indices start at 1 + for l:entry in getqflist() + if l:entry["bufnr"] == a:buffer + execute l:index . "cc" + + return + endif + + let l:index += 1 + endfor + + echoerr 'No quickfix entry matching "' . a:buffer . '" could be found.' +endfunc + +" Fail to call :Next on a 'winfixbuf' window unless :Next! is used. +func Test_Next() + call s:reset_all_buffers() + + let [l:first, _] = s:make_args_list() + next! + + call assert_fails("Next", "E1513:") + call assert_notequal(l:first, bufnr()) + + Next! + call assert_equal(l:first, bufnr()) +endfunc + +" Call :argdo and choose the next available 'nowinfixbuf' window. +func Test_argdo_choose_available_window() + call s:reset_all_buffers() + + let [_, l:last] = s:make_args_list() + + " Make a split window that is 'nowinfixbuf' but make it the second-to-last + " window so that :argdo will first try the 'winfixbuf' window, pass over it, + " and prefer the other 'nowinfixbuf' window, instead. + " + " +-------------------+ + " | 'nowinfixbuf' | + " +-------------------+ + " | 'winfixbuf' | <-- Cursor is here + " +-------------------+ + split + let l:nowinfixbuf_window = win_getid() + " Move to the 'winfixbuf' window now + execute "normal \j" + let l:winfixbuf_window = win_getid() + let l:expected_windows = s:get_windows_count() + + argdo echo '' + call assert_equal(l:nowinfixbuf_window, win_getid()) + call assert_equal(l:last, bufnr()) + call assert_equal(l:expected_windows, s:get_windows_count()) +endfunc + +" Call :argdo and create a new split window if all available windows are 'winfixbuf'. +func Test_argdo_make_new_window() + call s:reset_all_buffers() + + let [l:first, l:last] = s:make_args_list() + let l:current = win_getid() + let l:current_windows = s:get_windows_count() + + argdo echo '' + call assert_notequal(l:current, win_getid()) + call assert_equal(l:last, bufnr()) + execute "normal \j" + call assert_equal(l:first, bufnr()) + call assert_equal(l:current_windows + 1, s:get_windows_count()) +endfunc + +" Fail :argedit but :argedit! is allowed +func Test_argedit() + call s:reset_all_buffers() + + args! first middle last + enew + file first + let l:first = bufnr() + + enew + file middle + let l:middle = bufnr() + + enew + file last + let l:last = bufnr() + + set winfixbuf + + let l:current = bufnr() + call assert_fails("argedit first middle last", "E1513:") + call assert_equal(l:current, bufnr()) + + argedit! first middle last + call assert_equal(l:first, bufnr()) +endfunc + +" Fail :arglocal but :arglocal! is allowed +func Test_arglocal() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + argglobal! other + execute "buffer! " . l:current + + call assert_fails("arglocal other", "E1513:") + call assert_equal(l:current, bufnr()) + + arglocal! other + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :argglobal but :argglobal! is allowed +func Test_argglobal() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("argglobal other", "E1513:") + call assert_equal(l:current, bufnr()) + + argglobal! other + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :args but :args! is allowed +func Test_args() + call s:reset_all_buffers() + + let [l:first, _] = s:make_buffers_list() + let l:current = bufnr() + + call assert_fails("args first middle last", "E1513:") + call assert_equal(l:current, bufnr()) + + args! first middle last + call assert_equal(l:first, bufnr()) +endfunc + +" Fail :bNext but :bNext! is allowed +func Test_bNext() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + call assert_fails("bNext", "E1513:") + let l:current = bufnr() + + call assert_equal(l:current, bufnr()) + + bNext! + call assert_equal(l:other, bufnr()) +endfunc + +" Allow :badd because it doesn't actually change the current window's buffer +func Test_badd() + call s:reset_all_buffers() + + call s:make_buffer_pairs() + let l:current = bufnr() + + badd other + call assert_equal(l:current, bufnr()) +endfunc + +" Allow :balt because it doesn't actually change the current window's buffer +func Test_balt() + call s:reset_all_buffers() + + call s:make_buffer_pairs() + let l:current = bufnr() + + balt other + call assert_equal(l:current, bufnr()) +endfunc + +" Fail :bfirst but :bfirst! is allowed +func Test_bfirst() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("bfirst", "E1513:") + call assert_equal(l:current, bufnr()) + + bfirst! + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :blast but :blast! is allowed +func Test_blast() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs(1) + bfirst! + let l:current = bufnr() + + call assert_fails("blast", "E1513:") + call assert_equal(l:current, bufnr()) + + blast! + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :bmodified but :bmodified! is allowed +func Test_bmodified() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + execute "buffer! " . l:other + set modified + execute "buffer! " . l:current + + call assert_fails("bmodified", "E1513:") + call assert_equal(l:current, bufnr()) + + bmodified! + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :bnext but :bnext! is allowed +func Test_bnext() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("bnext", "E1513:") + call assert_equal(l:current, bufnr()) + + bnext! + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :bprevious but :bprevious! is allowed +func Test_bprevious() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("bprevious", "E1513:") + call assert_equal(l:current, bufnr()) + + bprevious! + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :brewind but :brewind! is allowed +func Test_brewind() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("brewind", "E1513:") + call assert_equal(l:current, bufnr()) + + brewind! + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :browse edit but :browse edit! is allowed +func Test_browse_edit_fail() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("browse edit other", "E1513:") + call assert_equal(l:current, bufnr()) + + browse edit! other + call assert_equal(l:other, bufnr()) +endfunc + +" Allow :browse w because it doesn't change the buffer in the current file +func Test_browse_edit_pass() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + browse write other + + call delete("other") +endfunc + +" Call :bufdo and choose the next available 'nowinfixbuf' window. +func Test_bufdo_choose_available_window() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + + " Make a split window that is 'nowinfixbuf' but make it the second-to-last + " window so that :bufdo will first try the 'winfixbuf' window, pass over it, + " and prefer the other 'nowinfixbuf' window, instead. + " + " +-------------------+ + " | 'nowinfixbuf' | + " +-------------------+ + " | 'winfixbuf' | <-- Cursor is here + " +-------------------+ + split + let l:nowinfixbuf_window = win_getid() + " Move to the 'winfixbuf' window now + execute "normal \j" + let l:winfixbuf_window = win_getid() + + let l:current = bufnr() + let l:expected_windows = s:get_windows_count() + + call assert_notequal(l:current, l:other) + + bufdo echo '' + call assert_equal(l:nowinfixbuf_window, win_getid()) + call assert_notequal(l:other, bufnr()) + call assert_equal(l:expected_windows, s:get_windows_count()) +endfunc + +" Call :bufdo and create a new split window if all available windows are 'winfixbuf'. +func Test_bufdo_make_new_window() + call s:reset_all_buffers() + + let [l:first, l:last] = s:make_buffers_list() + execute "buffer! " . l:first + let l:current = win_getid() + let l:current_windows = s:get_windows_count() + + bufdo echo '' + call assert_notequal(l:current, win_getid()) + call assert_equal(l:last, bufnr()) + execute "normal \j" + call assert_equal(l:first, bufnr()) + call assert_equal(l:current_windows + 1, s:get_windows_count()) +endfunc + +" Fail :buffer but :buffer! is allowed +func Test_buffer() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("buffer " . l:other, "E1513:") + call assert_equal(l:current, bufnr()) + + execute "buffer! " . l:other + call assert_equal(l:other, bufnr()) +endfunc + +" Allow :buffer on a 'winfixbuf' window if there is no change in buffer +func Test_buffer_same_buffer() + call s:reset_all_buffers() + + call s:make_buffer_pairs() + let l:current = bufnr() + + execute "buffer " . l:current + call assert_equal(l:current, bufnr()) + + execute "buffer! " . l:current + call assert_equal(l:current, bufnr()) +endfunc + +" Allow :cNext but the 'nowinfixbuf' window is selected, instead +func Test_cNext() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + + " The call to `:cNext` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + + cNext + call assert_equal(l:first_window, win_getid()) +endfunc + +" Allow :cNfile but the 'nowinfixbuf' window is selected, instead +func Test_cNfile() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + + " The call to `:cNfile` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + cnext! + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + + cNfile + call assert_equal(l:first_window, win_getid()) +endfunc + +" Allow :caddexpr because it doesn't change the current buffer +func Test_caddexpr() + CheckFeature quickfix + call s:reset_all_buffers() + + let l:file_path = tempname() + call writefile(["Error - bad-thing-found"], l:file_path) + execute "edit " . l:file_path + let l:file_buffer = bufnr() + let l:current = bufnr() + + edit first.unittest + call append(0, ["some-search-term bad-thing-found"]) + + edit! other.unittest + + set winfixbuf + + execute "buffer! " . l:file_buffer + + execute 'caddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")' + call assert_equal(l:current, bufnr()) + + call delete(l:file_path) +endfunc + +" Fail :cbuffer but :cbuffer! is allowed +func Test_cbuffer() + CheckFeature quickfix + call s:reset_all_buffers() + + let l:file_path = tempname() + call writefile(["first.unittest:1:Error - bad-thing-found"], l:file_path) + execute "edit " . l:file_path + let l:file_buffer = bufnr() + let l:current = bufnr() + + edit first.unittest + call append(0, ["some-search-term bad-thing-found"]) + + edit! other.unittest + + set winfixbuf + + execute "buffer! " . l:file_buffer + + call assert_fails("cbuffer " . l:file_buffer) + call assert_equal(l:current, bufnr()) + + execute "cbuffer! " . l:file_buffer + call assert_equal("first.unittest", expand("%:t")) + + call delete(l:file_path) +endfunc + +" Allow :cc but the 'nowinfixbuf' window is selected, instead +func Test_cc() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + + " The call to `:cnext` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + " Go up one line in the quickfix window to an quickfix entry that doesn't + " point to a winfixbuf buffer + normal k + " Attempt to make the previous window, winfixbuf buffer, to go to the + " non-winfixbuf quickfix entry + .cc + + " Confirm that :.cc did not change the winfixbuf-enabled window + call assert_equal(l:first_window, win_getid()) +endfunc + +" Call :cdo and choose the next available 'nowinfixbuf' window. +func Test_cdo_choose_available_window() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:current, l:last] = s:make_simple_quickfix() + execute "buffer! " . l:current + + " Make a split window that is 'nowinfixbuf' but make it the second-to-last + " window so that :cdo will first try the 'winfixbuf' window, pass over it, + " and prefer the other 'nowinfixbuf' window, instead. + " + " +-------------------+ + " | 'nowinfixbuf' | + " +-------------------+ + " | 'winfixbuf' | <-- Cursor is here + " +-------------------+ + split + let l:nowinfixbuf_window = win_getid() + " Move to the 'winfixbuf' window now + execute "normal \j" + let l:winfixbuf_window = win_getid() + let l:expected_windows = s:get_windows_count() + + cdo echo '' + + call assert_equal(l:nowinfixbuf_window, win_getid()) + call assert_equal(l:last, bufnr()) + execute "normal \j" + call assert_equal(l:current, bufnr()) + call assert_equal(l:expected_windows, s:get_windows_count()) +endfunc + +" Call :cdo and create a new split window if all available windows are 'winfixbuf'. +func Test_cdo_make_new_window() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:current_buffer, l:last] = s:make_simple_quickfix() + execute "buffer! " . l:current_buffer + + let l:current_window = win_getid() + let l:current_windows = s:get_windows_count() + + cdo echo '' + call assert_notequal(l:current_window, win_getid()) + call assert_equal(l:last, bufnr()) + execute "normal \j" + call assert_equal(l:current_buffer, bufnr()) + call assert_equal(l:current_windows + 1, s:get_windows_count()) +endfunc + +" Fail :cexpr but :cexpr! is allowed +func Test_cexpr() + CheckFeature quickfix + call s:reset_all_buffers() + + let l:file = tempname() + let l:entry = '["' . l:file . ':1:bar"]' + let l:current = bufnr() + + set winfixbuf + + call assert_fails("cexpr " . l:entry) + call assert_equal(l:current, bufnr()) + + execute "cexpr! " . l:entry + call assert_equal(fnamemodify(l:file, ":t"), expand("%:t")) +endfunc + +" Call :cfdo and choose the next available 'nowinfixbuf' window. +func Test_cfdo_choose_available_window() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:current, l:last] = s:make_simple_quickfix() + execute "buffer! " . l:current + + " Make a split window that is 'nowinfixbuf' but make it the second-to-last + " window so that :cfdo will first try the 'winfixbuf' window, pass over it, + " and prefer the other 'nowinfixbuf' window, instead. + " + " +-------------------+ + " | 'nowinfixbuf' | + " +-------------------+ + " | 'winfixbuf' | <-- Cursor is here + " +-------------------+ + split + let l:nowinfixbuf_window = win_getid() + " Move to the 'winfixbuf' window now + execute "normal \j" + let l:winfixbuf_window = win_getid() + let l:expected_windows = s:get_windows_count() + + cfdo echo '' + + call assert_equal(l:nowinfixbuf_window, win_getid()) + call assert_equal(l:last, bufnr()) + execute "normal \j" + call assert_equal(l:current, bufnr()) + call assert_equal(l:expected_windows, s:get_windows_count()) +endfunc + +" Call :cfdo and create a new split window if all available windows are 'winfixbuf'. +func Test_cfdo_make_new_window() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:current_buffer, l:last] = s:make_simple_quickfix() + execute "buffer! " . l:current_buffer + + let l:current_window = win_getid() + let l:current_windows = s:get_windows_count() + + cfdo echo '' + call assert_notequal(l:current_window, win_getid()) + call assert_equal(l:last, bufnr()) + execute "normal \j" + call assert_equal(l:current_buffer, bufnr()) + call assert_equal(l:current_windows + 1, s:get_windows_count()) +endfunc + +" Fail :cfile but :cfile! is allowed +func Test_cfile() + CheckFeature quickfix + call s:reset_all_buffers() + + edit first.unittest + call append(0, ["some-search-term bad-thing-found"]) + write + let l:first = bufnr() + + edit! second.unittest + call append(0, ["some-search-term"]) + write + + let l:file = tempname() + call writefile(["first.unittest:1:Error - bad-thing-found was detected"], l:file) + + let l:current = bufnr() + + set winfixbuf + + call assert_fails(":cfile " . l:file) + call assert_equal(l:current, bufnr()) + + execute ":cfile! " . l:file + call assert_equal(l:first, bufnr()) + + call delete(l:file) + call delete("first.unittest") + call delete("second.unittest") +endfunc + +" Allow :cfirst but the 'nowinfixbuf' window is selected, instead +func Test_cfirst() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + + " The call to `:cfirst` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + + cfirst + call assert_equal(l:first_window, win_getid()) +endfunc + +" Allow :clast but the 'nowinfixbuf' window is selected, instead +func Test_clast() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + + " The call to `:clast` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + + clast + call assert_equal(l:first_window, win_getid()) +endfunc + +" Allow :cnext but the 'nowinfixbuf' window is selected, instead +" Make sure no new windows are created and previous windows are reused +func Test_cnext() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + let l:expected = s:get_windows_count() + + " The call to `:cnext` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + + cnext! + call assert_equal(l:expected, s:get_windows_count()) + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + + cnext + call assert_equal(l:first_window, win_getid()) + call assert_equal(l:expected, s:get_windows_count()) +endfunc + +" Make sure :cnext creates a split window if no previous window exists +func Test_cnext_no_previous_window() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:current, _] = s:make_simple_quickfix() + execute "buffer! " . l:current + + let l:expected = s:get_windows_count() + + " Open the quickfix in a separate split and go to it + copen + + call assert_equal(l:expected + 1, s:get_windows_count()) +endfunc + +" Allow :cnext and create a 'nowinfixbuf' window if none exists +func Test_cnext_make_new_window() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:current, _] = s:make_simple_quickfix() + let l:current = win_getid() + + cfirst! + + let l:windows = s:get_windows_count() + let l:expected = l:windows + 1 " We're about to create a new split window + + cnext + call assert_equal(l:expected, s:get_windows_count()) + + cnext! + call assert_equal(l:expected, s:get_windows_count()) +endfunc + +" Allow :cprevious but the 'nowinfixbuf' window is selected, instead +func Test_cprevious() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + + " The call to `:cprevious` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + + cprevious + call assert_equal(l:first_window, win_getid()) +endfunc + +" Allow :cnfile but the 'nowinfixbuf' window is selected, instead +func Test_cnfile() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + + " The call to `:cnfile` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + cnext! + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + + cnfile + call assert_equal(l:first_window, win_getid()) +endfunc + +" Allow :cpfile but the 'nowinfixbuf' window is selected, instead +func Test_cpfile() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + + " The call to `:cpfile` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + cnext! + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + + cpfile + call assert_equal(l:first_window, win_getid()) +endfunc + +" Allow :crewind but the 'nowinfixbuf' window is selected, instead +func Test_crewind() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first_window, l:winfix_window, l:quickfix_window] = s:make_quickfix_windows() + + " The call to `:crewind` succeeds but it selects the window with 'nowinfixbuf' instead + call s:set_quickfix_by_buffer(winbufnr(l:winfix_window)) + cnext! + + " Make sure the previous window has 'winfixbuf' so we can test that our + " "skip 'winfixbuf' window" logic works. + call win_gotoid(l:winfix_window) + call win_gotoid(l:quickfix_window) + + crewind + call assert_equal(l:first_window, win_getid()) +endfunc + +" Allow f because it opens in a new split +func Test_ctrl_w_f() + call s:reset_all_buffers() + + enew + let l:file_name = tempname() + call writefile([], l:file_name) + let l:file_buffer = bufnr() + + enew + file other + let l:other_buffer = bufnr() + + set winfixbuf + + call setline(1, l:file_name) + let l:current_windows = s:get_windows_count() + execute "normal \f" + + call assert_equal(l:current_windows + 1, s:get_windows_count()) + + call delete(l:file_name) +endfunc + +" Fail :djump but :djump! is allowed +func Test_djump() + call s:reset_all_buffers() + + let l:include_file = tempname() . ".h" + call writefile(["min(1, 12);", + \ '#include "' . l:include_file . '"' + \ ], + \ "main.c") + call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) + edit main.c + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("djump 1 /min/", "E1513:") + call assert_equal(l:current, bufnr()) + + djump! 1 /min/ + call assert_notequal(l:current, bufnr()) + + call delete("main.c") + call delete(l:include_file) +endfunc + +" Fail :drop but :drop! is allowed +func Test_drop() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("drop other", "E1513:") + call assert_equal(l:current, bufnr()) + + drop! other + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :edit but :edit! is allowed +func Test_edit() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("edit other", "E1513:") + call assert_equal(l:current, bufnr()) + + edit! other + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :enew but :enew! is allowed +func Test_enew() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("enew", "E1513:") + call assert_equal(l:current, bufnr()) + + enew! + call assert_notequal(l:other, bufnr()) + call assert_notequal(3, bufnr()) +endfunc + +" Fail :ex but :ex! is allowed +func Test_ex() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("ex other", "E1513:") + call assert_equal(l:current, bufnr()) + + ex! other + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :find but :find! is allowed +func Test_find() + call s:reset_all_buffers() + + let l:current = bufnr() + let l:file = tempname() + call writefile([], l:file) + let l:directory = fnamemodify(l:file, ":p:h") + let l:name = fnamemodify(l:file, ":p:t") + + let l:original_path = &path + execute "set path=" . l:directory + + set winfixbuf + + call assert_fails("execute 'find " . l:name . "'", "E1513:") + call assert_equal(l:current, bufnr()) + + execute "find! " . l:name + call assert_equal(l:file, expand("%:p")) + + execute "set path=" . l:original_path + call delete(l:file) +endfunc + +" Fail :first but :first! is allowed +func Test_first() + call s:reset_all_buffers() + + let [l:first, _] = s:make_args_list() + next! + + call assert_fails("first", "E1513:") + call assert_notequal(l:first, bufnr()) + + first! + call assert_equal(l:first, bufnr()) +endfunc + +" Fail :grep but :grep! is allowed +func Test_grep() + CheckFeature quickfix + call s:reset_all_buffers() + + edit first.unittest + call append(0, ["some-search-term"]) + write + let l:first = bufnr() + + edit current.unittest + call append(0, ["some-search-term"]) + write + let l:current = bufnr() + + edit! last.unittest + call append(0, ["some-search-term"]) + write + let l:last = bufnr() + + set winfixbuf + + buffer! current.unittest + + call assert_fails("silent! grep some-search-term *.unittest", "E1513:") + call assert_equal(l:current, bufnr()) + execute "edit! " . l:first + + silent! grep! some-search-term *.unittest + call assert_notequal(l:first, bufnr()) + + call delete("first.unittest") + call delete("current.unittest") + call delete("last.unittest") +endfunc + +" Fail :ijump but :ijump! is allowed +func Test_ijump() + call s:reset_all_buffers() + + let l:include_file = tempname() . ".h" + call writefile([ + \ '#include "' . l:include_file . '"' + \ ], + \ "main.c") + call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) + edit main.c + + set winfixbuf + + let l:current = bufnr() + + set define=^\\s*#\\s*define + set include=^\\s*#\\s*include + set path=.,/usr/include,, + + call assert_fails("ijump /min/", "E1513:") + call assert_equal(l:current, bufnr()) + + set nowinfixbuf + + ijump! /min/ + call assert_notequal(l:current, bufnr()) + + set define& + set include& + set path& + call delete("main.c") + call delete(l:include_file) +endfunc + +" Fail :lNext but :lNext! is allowed +func Test_lNext() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, l:middle, _] = s:make_simple_location_list() + lnext! + + call assert_fails("lNext", "E1513:") + call assert_equal(l:middle, bufnr()) + + lnext! " Reset for the next test + + lNext! + call assert_equal(l:first, bufnr()) +endfunc + +" Fail :lNfile but :lNfile! is allowed +func Test_lNfile() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, l:current, _] = s:make_simple_location_list() + lnext! + + call assert_fails("lNfile", "E1513:") + call assert_equal(l:current, bufnr()) + + lnext! " Reset for the next test + + lNfile! + call assert_equal(l:first, bufnr()) +endfunc + +" Allow :laddexpr because it doesn't change the current buffer +func Test_laddexpr() + CheckFeature quickfix + call s:reset_all_buffers() + + let l:file_path = tempname() + call writefile(["Error - bad-thing-found"], l:file_path) + execute "edit " . l:file_path + let l:file_buffer = bufnr() + let l:current = bufnr() + + edit first.unittest + call append(0, ["some-search-term bad-thing-found"]) + + edit! other.unittest + + set winfixbuf + + execute "buffer! " . l:file_buffer + + execute 'laddexpr expand("%") .. ":" .. line(".") .. ":" .. getline(".")' + call assert_equal(l:current, bufnr()) + + call delete(l:file_path) +endfunc + +" Fail :last but :last! is allowed +func Test_last() + call s:reset_all_buffers() + + let [_, l:last] = s:make_args_list() + next! + + call assert_fails("last", "E1513:") + call assert_notequal(l:last, bufnr()) + + last! + call assert_equal(l:last, bufnr()) +endfunc + +" Fail :lbuffer but :lbuffer! is allowed +func Test_lbuffer() + CheckFeature quickfix + call s:reset_all_buffers() + + let l:file_path = tempname() + call writefile(["first.unittest:1:Error - bad-thing-found"], l:file_path) + execute "edit " . l:file_path + let l:file_buffer = bufnr() + let l:current = bufnr() + + edit first.unittest + call append(0, ["some-search-term bad-thing-found"]) + + edit! other.unittest + + set winfixbuf + + execute "buffer! " . l:file_buffer + + call assert_fails("lbuffer " . l:file_buffer) + call assert_equal(l:current, bufnr()) + + execute "lbuffer! " . l:file_buffer + call assert_equal("first.unittest", expand("%:t")) + + call delete(l:file_path) +endfunc + +" Fail :ldo but :ldo! is allowed +func Test_ldo() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, l:middle, l:last] = s:make_simple_location_list() + lnext! + + call assert_fails('execute "ldo buffer ' . l:first . '"', "E1513:") + call assert_equal(l:middle, bufnr()) + execute "ldo! buffer " . l:first + call assert_notequal(l:last, bufnr()) +endfunc + +" Fail :lfdo but :lfdo! is allowed +func Test_lexpr() + CheckFeature quickfix + call s:reset_all_buffers() + + let l:file = tempname() + let l:entry = '["' . l:file . ':1:bar"]' + let l:current = bufnr() + + set winfixbuf + + call assert_fails("lexpr " . l:entry) + call assert_equal(l:current, bufnr()) + + execute "lexpr! " . l:entry + call assert_equal(fnamemodify(l:file, ":t"), expand("%:t")) +endfunc + +" Fail :lfdo but :lfdo! is allowed +func Test_lfdo() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, l:middle, l:last] = s:make_simple_location_list() + lnext! + + call assert_fails('execute "lfdo buffer ' . l:first . '"', "E1513:") + call assert_equal(l:middle, bufnr()) + execute "lfdo! buffer " . l:first + call assert_notequal(l:last, bufnr()) +endfunc + +" Fail :lfile but :lfile! is allowed +func Test_lfile() + CheckFeature quickfix + call s:reset_all_buffers() + + edit first.unittest + call append(0, ["some-search-term bad-thing-found"]) + write + let l:first = bufnr() + + edit! second.unittest + call append(0, ["some-search-term"]) + write + + let l:file = tempname() + call writefile(["first.unittest:1:Error - bad-thing-found was detected"], l:file) + + let l:current = bufnr() + + set winfixbuf + + call assert_fails(":lfile " . l:file) + call assert_equal(l:current, bufnr()) + + execute ":lfile! " . l:file + call assert_equal(l:first, bufnr()) + + call delete(l:file) + call delete("first.unittest") + call delete("second.unittest") +endfunc + +" Fail :ll but :ll! is allowed +func Test_ll() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, l:middle, l:last] = s:make_simple_location_list() + lopen + lfirst! + execute "normal \j" + normal j + + call assert_fails(".ll", "E1513:") + execute "normal \k" + call assert_equal(l:first, bufnr()) + execute "normal \j" + .ll! + execute "normal \k" + call assert_equal(l:middle, bufnr()) +endfunc + +" Fail :llast but :llast! is allowed +func Test_llast() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, _, l:last] = s:make_simple_location_list() + lfirst! + + call assert_fails("llast", "E1513:") + call assert_equal(l:first, bufnr()) + + llast! + call assert_equal(l:last, bufnr()) +endfunc + +" Fail :lnext but :lnext! is allowed +func Test_lnext() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, l:middle, l:last] = s:make_simple_location_list() + ll! + + call assert_fails("lnext", "E1513:") + call assert_equal(l:first, bufnr()) + + lnext! + call assert_equal(l:middle, bufnr()) +endfunc + +" Fail :lnfile but :lnfile! is allowed +func Test_lnfile() + CheckFeature quickfix + call s:reset_all_buffers() + + let [_, l:current, l:last] = s:make_simple_location_list() + lnext! + + call assert_fails("lnfile", "E1513:") + call assert_equal(l:current, bufnr()) + + lprevious! " Reset for the next test call + + lnfile! + call assert_equal(l:last, bufnr()) +endfunc + +" Fail :lpfile but :lpfile! is allowed +func Test_lpfile() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, l:current, _] = s:make_simple_location_list() + lnext! + + call assert_fails("lpfile", "E1513:") + call assert_equal(l:current, bufnr()) + + lnext! " Reset for the next test call + + lpfile! + call assert_equal(l:first, bufnr()) +endfunc + +" Fail :lprevious but :lprevious! is allowed +func Test_lprevious() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, l:middle, _] = s:make_simple_location_list() + lnext! + + call assert_fails("lprevious", "E1513:") + call assert_equal(l:middle, bufnr()) + + lnext! " Reset for the next test call + + lprevious! + call assert_equal(l:first, bufnr()) +endfunc + +" Fail :lrewind but :lrewind! is allowed +func Test_lrewind() + CheckFeature quickfix + call s:reset_all_buffers() + + let [l:first, l:middle, _] = s:make_simple_location_list() + lnext! + + call assert_fails("lrewind", "E1513:") + call assert_equal(l:middle, bufnr()) + + lrewind! + call assert_equal(l:first, bufnr()) +endfunc + +" Fail :ltag but :ltag! is allowed +func Test_ltag() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + execute "normal \" + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("ltag one", "E1513:") + + ltag! one + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail vim.command if we try to change buffers while 'winfixbuf' is set +func Test_lua_command() + call s:reset_all_buffers() + + enew + file first + let l:previous = bufnr() + + enew + file second + let l:current = bufnr() + + set winfixbuf + + call assert_fails('lua vim.command("buffer " .. ' . l:previous . ')') + call assert_equal(l:current, bufnr()) + + execute 'lua vim.command("buffer! " .. ' . l:previous . ')' + call assert_equal(l:previous, bufnr()) +endfunc + +" Fail :lvimgrep but :lvimgrep! is allowed +func Test_lvimgrep() + CheckFeature quickfix + call s:reset_all_buffers() + + edit first.unittest + call append(0, ["some-search-term"]) + write + + edit winfix.unittest + call append(0, ["some-search-term"]) + write + let l:current = bufnr() + + set winfixbuf + + edit! last.unittest + call append(0, ["some-search-term"]) + write + let l:last = bufnr() + + buffer! winfix.unittest + + call assert_fails("lvimgrep /some-search-term/ *.unittest", "E1513:") + call assert_equal(l:current, bufnr()) + + lvimgrep! /some-search-term/ *.unittest + call assert_notequal(l:current, bufnr()) + + call delete("first.unittest") + call delete("winfix.unittest") + call delete("last.unittest") +endfunc + +" Fail :lvimgrepadd but :lvimgrepadd! is allowed +func Test_lvimgrepadd() + CheckFeature quickfix + call s:reset_all_buffers() + + edit first.unittest + call append(0, ["some-search-term"]) + write + + edit winfix.unittest + call append(0, ["some-search-term"]) + write + let l:current = bufnr() + + set winfixbuf + + edit! last.unittest + call append(0, ["some-search-term"]) + write + let l:last = bufnr() + + buffer! winfix.unittest + + call assert_fails("lvimgrepadd /some-search-term/ *.unittest") + call assert_equal(l:current, bufnr()) + + lvimgrepadd! /some-search-term/ *.unittest + call assert_notequal(l:current, bufnr()) + + call delete("first.unittest") + call delete("winfix.unittest") + call delete("last.unittest") +endfunc + +" Don't allow global marks to change the current 'winfixbuf' window +func Test_marks_mappings_fail() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + execute "buffer! " . l:other + normal mA + execute "buffer! " . l:current + normal mB + + call assert_fails("normal `A", "E1513:") + call assert_equal(l:current, bufnr()) + + call assert_fails("normal 'A", "E1513:") + call assert_equal(l:current, bufnr()) + + set nowinfixbuf + + normal `A + call assert_equal(l:other, bufnr()) +endfunc + +" Allow global marks in a 'winfixbuf' window if the jump is the same buffer +func Test_marks_mappings_pass_intra_move() + call s:reset_all_buffers() + + let l:current = bufnr() + call append(0, ["some line", "another line"]) + normal mA + normal j + normal mB + + set winfixbuf + + normal `A + call assert_equal(l:current, bufnr()) +endfunc + +" Fail :next but :next! is allowed +func Test_next() + call s:reset_all_buffers() + + let [l:first, _] = s:make_args_list() + first! + + call assert_fails("next", "E1513:") + call assert_equal(l:first, bufnr()) + + next! + call assert_notequal(l:first, bufnr()) +endfunc + +" Ensure :mksession saves 'winfixbuf' details +func Test_mksession() + CheckFeature mksession + call s:reset_all_buffers() + + set sessionoptions+=options + set winfixbuf + + mksession test_winfixbuf_Test_mksession.vim + + call s:reset_all_buffers() + let l:winfixbuf = &winfixbuf + call assert_equal(0, l:winfixbuf) + + source test_winfixbuf_Test_mksession.vim + + let l:winfixbuf = &winfixbuf + call assert_equal(1, l:winfixbuf) + + set sessionoptions& + call delete("test_winfixbuf_Test_mksession.vim") +endfunc + +" Allow :next if the next index is the same as the current buffer +func Test_next_same_buffer() + call s:reset_all_buffers() + + enew + file foo + enew + file bar + enew + file fizz + enew + file buzz + args foo foo bar fizz buzz + + edit foo + set winfixbuf + let l:current = bufnr() + + " Allow :next because the args list is `[foo] foo bar fizz buzz + next + call assert_equal(l:current, bufnr()) + + " Fail :next because the args list is `foo [foo] bar fizz buzz + " and the next buffer would be bar, which is a different buffer + call assert_fails("next", "E1513:") + call assert_equal(l:current, bufnr()) +endfunc + +" Fail to jump to a tag with g if 'winfixbuf' is enabled +func Test_normal_g_ctrl_square_bracket_right() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal g\", "E1513:") + call assert_equal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail to jump to a tag with g if 'winfixbuf' is enabled +func Test_normal_g_rightmouse() + call s:reset_all_buffers() + set mouse=n + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + execute "normal \" + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal g\", "E1513:") + call assert_equal(l:current, bufnr()) + + set tags& + set mouse& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail to jump to a tag with g] if 'winfixbuf' is enabled +func Test_normal_g_square_bracket_right() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal g]", "E1513:") + call assert_equal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail to jump to a tag with if 'winfixbuf' is enabled +func Test_normal_ctrl_rightmouse() + call s:reset_all_buffers() + set mouse=n + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + execute "normal \" + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal \", "E1513:") + call assert_equal(l:current, bufnr()) + + set tags& + set mouse& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail to jump to a tag with if 'winfixbuf' is enabled +func Test_normal_ctrl_t() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + execute "normal \" + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal \", "E1513:") + call assert_equal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Disallow in 'winfixbuf' windows +func Test_normal_ctrl_hat() + call s:reset_all_buffers() + clearjumps + + enew + file first + let l:first = bufnr() + + enew + file current + let l:current = bufnr() + + set winfixbuf + + call assert_fails("normal \", "E1513:") + call assert_equal(l:current, bufnr()) +endfunc + +" Allow in 'winfixbuf' windows if the movement stays within the buffer +func Test_normal_ctrl_i_pass() + call s:reset_all_buffers() + clearjumps + + enew + file first + let l:first = bufnr() + + enew! + file current + let l:current = bufnr() + " Add some lines so we can populate a jumplist" + call append(0, ["some line", "another line"]) + " Add an entry to the jump list + " Go up another line + normal m` + normal k + execute "normal \" + + set winfixbuf + + let l:line = getcurpos()[1] + execute "normal 1\" + call assert_notequal(l:line, getcurpos()[1]) +endfunc + +" Disallow in 'winfixbuf' windows if it would cause the buffer to switch +func Test_normal_ctrl_o_fail() + call s:reset_all_buffers() + clearjumps + + enew + file first + let l:first = bufnr() + + enew + file current + let l:current = bufnr() + + set winfixbuf + + call assert_fails("normal \", "E1513:") + call assert_equal(l:current, bufnr()) +endfunc + +" Allow in 'winfixbuf' windows if the movement stays within the buffer +func Test_normal_ctrl_o_pass() + call s:reset_all_buffers() + clearjumps + + enew + file first + let l:first = bufnr() + + enew! + file current + let l:current = bufnr() + " Add some lines so we can populate a jumplist + call append(0, ["some line", "another line"]) + " Add an entry to the jump list + " Go up another line + normal m` + normal k + + set winfixbuf + + execute "normal \" + call assert_equal(l:current, bufnr()) +endfunc + +" Fail to jump to a tag with if 'winfixbuf' is enabled +func Test_normal_ctrl_square_bracket_right() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal \", "E1513:") + call assert_equal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Allow with 'winfixbuf' enabled because it runs in a new, split window +func Test_normal_ctrl_w_ctrl_square_bracket_right() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current_windows = s:get_windows_count() + execute "normal \\" + call assert_equal(l:current_windows + 1, s:get_windows_count()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Allow g with 'winfixbuf' enabled because it runs in a new, split window +func Test_normal_ctrl_w_g_ctrl_square_bracket_right() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current_windows = s:get_windows_count() + execute "normal \g\" + call assert_equal(l:current_windows + 1, s:get_windows_count()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail to jump to a tag with if 'winfixbuf' is enabled +func Test_normal_gt() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one", "two", "three"], "Xother") + edit Xother + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal \", "E1513:") + call assert_equal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Prevent gF from switching a 'winfixbuf' window's buffer +func Test_normal_gF() + call s:reset_all_buffers() + + let l:file = tempname() + call append(0, [l:file]) + call writefile([], l:file) + " Place the cursor onto the line that has `l:file` + normal gg + " Prevent Vim from erroring with "No write since last change @ command + " line" when we try to call gF, later. + set hidden + + set winfixbuf + + let l:buffer = bufnr() + + call assert_fails("normal gF", "E1513:") + call assert_equal(l:buffer, bufnr()) + + set nowinfixbuf + + normal gF + call assert_notequal(l:buffer, bufnr()) + + call delete(l:file) +endfunc + +" Prevent gf from switching a 'winfixbuf' window's buffer +func Test_normal_gf() + call s:reset_all_buffers() + + let l:file = tempname() + call append(0, [l:file]) + call writefile([], l:file) + " Place the cursor onto the line that has `l:file` + normal gg + " Prevent Vim from erroring with "No write since last change @ command + " line" when we try to call gf, later. + set hidden + + set winfixbuf + + let l:buffer = bufnr() + + call assert_fails("normal gf", "E1513:") + call assert_equal(l:buffer, bufnr()) + + set nowinfixbuf + + normal gf + call assert_notequal(l:buffer, bufnr()) + + call delete(l:file) +endfunc + +" Fail "goto file under the cursor" (using [f, which is the same as `:normal gf`) +func Test_normal_square_bracket_left_f() + call s:reset_all_buffers() + + let l:file = tempname() + call append(0, [l:file]) + call writefile([], l:file) + " Place the cursor onto the line that has `l:file` + normal gg + " Prevent Vim from erroring with "No write since last change @ command + " line" when we try to call gf, later. + set hidden + + set winfixbuf + + let l:buffer = bufnr() + + call assert_fails("normal [f", "E1513:") + call assert_equal(l:buffer, bufnr()) + + set nowinfixbuf + + normal [f + call assert_notequal(l:buffer, bufnr()) + + call delete(l:file) +endfunc + +" Fail to go to a C macro with [ if 'winfixbuf' is enabled +func Test_normal_square_bracket_left_ctrl_d() + call s:reset_all_buffers() + + let l:include_file = tempname() . ".h" + call writefile(["min(1, 12);", + \ '#include "' . l:include_file . '"' + \ ], + \ "main.c") + call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) + edit main.c + normal ]\ + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal [\", "E1513:") + call assert_equal(l:current, bufnr()) + + set nowinfixbuf + + execute "normal [\" + call assert_notequal(l:current, bufnr()) + + call delete("main.c") + call delete(l:include_file) +endfunc + +" Fail to go to a C macro with ] if 'winfixbuf' is enabled +func Test_normal_square_bracket_right_ctrl_d() + call s:reset_all_buffers() + + let l:include_file = tempname() . ".h" + call writefile(["min(1, 12);", + \ '#include "' . l:include_file . '"' + \ ], + \ "main.c") + call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) + edit main.c + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal ]\", "E1513:") + call assert_equal(l:current, bufnr()) + + set nowinfixbuf + + execute "normal ]\" + call assert_notequal(l:current, bufnr()) + + call delete("main.c") + call delete(l:include_file) +endfunc + +" Fail to go to a C macro with [ if 'winfixbuf' is enabled +func Test_normal_square_bracket_left_ctrl_i() + call s:reset_all_buffers() + + let l:include_file = tempname() . ".h" + call writefile(['#include "' . l:include_file . '"', + \ "min(1, 12);", + \ ], + \ "main.c") + call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) + edit main.c + " Move to the line with `min(1, 12);` on it" + normal j + + set define=^\\s*#\\s*define + set include=^\\s*#\\s*include + set path=.,/usr/include,, + + let l:current = bufnr() + + set winfixbuf + + call assert_fails("normal [\", "E1513:") + + set nowinfixbuf + + execute "normal [\" + call assert_notequal(l:current, bufnr()) + + set define& + set include& + set path& + call delete("main.c") + call delete(l:include_file) +endfunc + +" Fail to go to a C macro with ] if 'winfixbuf' is enabled +func Test_normal_square_bracket_right_ctrl_i() + call s:reset_all_buffers() + + let l:include_file = tempname() . ".h" + call writefile(["min(1, 12);", + \ '#include "' . l:include_file . '"' + \ ], + \ "main.c") + call writefile(["#define min(X, Y) ((X) < (Y) ? (X) : (Y))"], l:include_file) + edit main.c + + set winfixbuf + + set define=^\\s*#\\s*define + set include=^\\s*#\\s*include + set path=.,/usr/include,, + + let l:current = bufnr() + + call assert_fails("normal ]\", "E1513:") + call assert_equal(l:current, bufnr()) + + set nowinfixbuf + + execute "normal ]\" + call assert_notequal(l:current, bufnr()) + + set define& + set include& + set path& + call delete("main.c") + call delete(l:include_file) +endfunc + +" Fail "goto file under the cursor" (using ]f, which is the same as `:normal gf`) +func Test_normal_square_bracket_right_f() + call s:reset_all_buffers() + + let l:file = tempname() + call append(0, [l:file]) + call writefile([], l:file) + " Place the cursor onto the line that has `l:file` + normal gg + " Prevent Vim from erroring with "No write since last change @ command + " line" when we try to call gf, later. + set hidden + + set winfixbuf + + let l:buffer = bufnr() + + call assert_fails("normal ]f", "E1513:") + call assert_equal(l:buffer, bufnr()) + + set nowinfixbuf + + normal ]f + call assert_notequal(l:buffer, bufnr()) + + call delete(l:file) +endfunc + +" Fail to jump to a tag with v if 'winfixbuf' is enabled +func Test_normal_v_ctrl_square_bracket_right() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal v\", "E1513:") + call assert_equal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail to jump to a tag with vg if 'winfixbuf' is enabled +func Test_normal_v_g_ctrl_square_bracket_right() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("normal vg\", "E1513:") + call assert_equal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Allow :pedit because, unlike :edit, it uses a separate window +func Test_pedit() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + + pedit other + + execute "normal \w" + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :pop but :pop! is allowed +func Test_pop() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "thesame\tXfile\t1;\"\td\tfile:", + \ "thesame\tXfile\t2;\"\td\tfile:", + \ "thesame\tXfile\t3;\"\td\tfile:", + \ ], + \ "Xtags") + call writefile(["thesame one", "thesame two", "thesame three"], "Xfile") + call writefile(["thesame one"], "Xother") + edit Xother + + tag thesame + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("pop", "E1513:") + call assert_equal(l:current, bufnr()) + + pop! + call assert_notequal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail :previous but :previous! is allowed +func Test_previous() + call s:reset_all_buffers() + + let [l:first, _] = s:make_args_list() + next! + + call assert_fails("previous", "E1513:") + call assert_notequal(l:first, bufnr()) + + previous! + call assert_equal(l:first, bufnr()) +endfunc + +" Fail pydo if it changes a window with 'winfixbuf' is set +func Test_python_pydo() + CheckFeature pythonx + call s:reset_all_buffers() + + enew + file first + let g:_previous_buffer = bufnr() + + enew + file second + + set winfixbuf + + python << EOF +import vim + +def test_winfixbuf_Test_python_pydo_set_buffer(): + buffer = vim.vars['_previous_buffer'] + vim.current.buffer = vim.buffers[buffer] +EOF + + try + pydo test_winfixbuf_Test_python_pydo_set_buffer() + catch /Vim(pydo):vim.error: Vim:E1513: Cannot edit buffer. 'winfixbuf' is enabled/ + let l:caught = 1 + endtry + + call assert_equal(1, l:caught) + + unlet g:_previous_buffer +endfunc + +" Fail pyfile if it changes a window with 'winfixbuf' is set +func Test_python_pyfile() + CheckFeature pythonx + call s:reset_all_buffers() + + enew + file first + let g:_previous_buffer = bufnr() + + enew + file second + + set winfixbuf + + call writefile(["import vim", + \ "buffer = vim.vars['_previous_buffer']", + \ "vim.current.buffer = vim.buffers[buffer]", + \ ], + \ "file.py") + + try + pyfile file.py + catch /Vim(pyfile):vim.error: Vim:E1513: Cannot edit buffer. 'winfixbuf' is enabled/ + let l:caught = 1 + endtry + + call assert_equal(1, l:caught) + + call delete("file.py") + unlet g:_previous_buffer +endfunc + +" Fail vim.current.buffer if 'winfixbuf' is set +func Test_python_vim_current_buffer() + CheckFeature pythonx + call s:reset_all_buffers() + + enew + file first + let g:_previous_buffer = bufnr() + + enew + file second + + let l:caught = 0 + + set winfixbuf + + try + python << EOF +import vim + +buffer = vim.vars["_previous_buffer"] +vim.current.buffer = vim.buffers[buffer] +EOF + catch /Vim(python):vim\.error: Vim:E1513: Cannot edit buffer. 'winfixbuf' is enabled/ + let l:caught = 1 + endtry + + call assert_equal(1, l:caught) + unlet g:_previous_buffer +endfunc + +" Ensure remapping to a disabled action still triggers failures +func Test_remap_key_fail() + call s:reset_all_buffers() + + enew + file first + let l:first = bufnr() + + enew + file current + let l:current = bufnr() + + set winfixbuf + + nnoremap g + + call assert_fails("normal g", "E1513:") + call assert_equal(l:current, bufnr()) + + nunmap g +endfunc + +" Ensure remapping a disabled key to something valid does trigger any failures +func Test_remap_key_pass() + call s:reset_all_buffers() + + enew + file first + let l:first = bufnr() + + enew + file current + let l:current = bufnr() + + set winfixbuf + + call assert_fails("normal \", "E1513:") + call assert_equal(l:current, bufnr()) + + " Disallow by default but allow it if the command does something else + nnoremap :echo "hello!" + + execute "normal \" + call assert_equal(l:current, bufnr()) + + nunmap +endfunc + +" Fail :rewind but :rewind! is allowed +func Test_rewind() + call s:reset_all_buffers() + + let [l:first, _] = s:make_args_list() + next! + + call assert_fails("rewind", "E1513:") + call assert_notequal(l:first, bufnr()) + + rewind! + call assert_equal(l:first, bufnr()) +endfunc + +" Allow :sblast because it opens the buffer in a new, split window +func Test_sblast() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs(1) + bfirst! + let l:current = bufnr() + + sblast + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :sbprevious but :sbprevious! is allowed +func Test_sbprevious() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + sbprevious + call assert_equal(l:other, bufnr()) +endfunc + +" Make sure 'winfixbuf' can be set using 'winfixbuf' or 'wfb' +func Test_short_option() + call s:reset_all_buffers() + + call s:make_buffer_pairs() + + set winfixbuf + call assert_fails("edit something_else", "E1513") + + set nowinfixbuf + set wfb + call assert_fails("edit another_place", "E1513") + + set nowfb + edit last_place +endfunc + +" Allow :snext because it makes a new window +func Test_snext() + call s:reset_all_buffers() + + let [l:first, _] = s:make_args_list() + first! + + let l:current_window = win_getid() + + snext + call assert_notequal(l:current_window, win_getid()) + call assert_notequal(l:first, bufnr()) +endfunc + +" Ensure the first has 'winfixbuf' and a new split window is 'nowinfixbuf' +func Test_split_window() + call s:reset_all_buffers() + + split + execute "normal \j" + + set winfixbuf + + let l:winfix_window_1 = win_getid() + vsplit + let l:winfix_window_2 = win_getid() + + call assert_equal(1, getwinvar(l:winfix_window_1, "&winfixbuf")) + call assert_equal(0, getwinvar(l:winfix_window_2, "&winfixbuf")) +endfunc + +" Fail :tNext but :tNext! is allowed +func Test_tNext() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "thesame\tXfile\t1;\"\td\tfile:", + \ "thesame\tXfile\t2;\"\td\tfile:", + \ "thesame\tXfile\t3;\"\td\tfile:", + \ ], + \ "Xtags") + call writefile(["thesame one", "thesame two", "thesame three"], "Xfile") + call writefile(["thesame one"], "Xother") + edit Xother + + tag thesame + execute "normal \" + tnext! + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("tNext", "E1513:") + call assert_equal(l:current, bufnr()) + + tNext! + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Call :tabdo and choose the next available 'nowinfixbuf' window. +func Test_tabdo_choose_available_window() + call s:reset_all_buffers() + + let [l:first, _] = s:make_args_list() + + " Make a split window that is 'nowinfixbuf' but make it the second-to-last + " window so that :tabdo will first try the 'winfixbuf' window, pass over it, + " and prefer the other 'nowinfixbuf' window, instead. + " + " +-------------------+ + " | 'nowinfixbuf' | + " +-------------------+ + " | 'winfixbuf' | <-- Cursor is here + " +-------------------+ + split + let l:nowinfixbuf_window = win_getid() + " Move to the 'winfixbuf' window now + execute "normal \j" + let l:winfixbuf_window = win_getid() + + let l:expected_windows = s:get_windows_count() + tabdo echo '' + call assert_equal(l:nowinfixbuf_window, win_getid()) + call assert_equal(l:first, bufnr()) + call assert_equal(l:expected_windows, s:get_windows_count()) +endfunc + +" Call :tabdo and create a new split window if all available windows are 'winfixbuf'. +func Test_tabdo_make_new_window() + call s:reset_all_buffers() + + let [l:first, _] = s:make_buffers_list() + execute "buffer! " . l:first + + let l:current = win_getid() + let l:current_windows = s:get_windows_count() + + tabdo echo '' + call assert_notequal(l:current, win_getid()) + call assert_equal(l:first, bufnr()) + execute "normal \j" + call assert_equal(l:first, bufnr()) + call assert_equal(l:current_windows + 1, s:get_windows_count()) +endfunc + +" Fail :tag but :tag! is allowed +func Test_tag() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("tag one", "E1513:") + call assert_equal(l:current, bufnr()) + + tag! one + call assert_notequal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + + +" Fail :tfirst but :tfirst! is allowed +func Test_tfirst() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("tfirst", "E1513:") + call assert_equal(l:current, bufnr()) + + tfirst! + call assert_notequal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail :tjump but :tjump! is allowed +func Test_tjump() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + call writefile(["one"], "Xother") + edit Xother + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("tjump one", "E1513:") + call assert_equal(l:current, bufnr()) + + tjump! one + call assert_notequal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail :tlast but :tlast! is allowed +func Test_tlast() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "one\tXfile\t1", + \ "three\tXfile\t3", + \ "two\tXfile\t2"], + \ "Xtags") + call writefile(["one", "two", "three"], "Xfile") + edit Xfile + tjump one + edit Xfile + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("tlast", "E1513:") + call assert_equal(l:current, bufnr()) + + tlast! + call assert_equal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") +endfunc + +" Fail :tnext but :tnext! is allowed +func Test_tnext() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "thesame\tXfile\t1;\"\td\tfile:", + \ "thesame\tXfile\t2;\"\td\tfile:", + \ "thesame\tXfile\t3;\"\td\tfile:", + \ ], + \ "Xtags") + call writefile(["thesame one", "thesame two", "thesame three"], "Xfile") + call writefile(["thesame one"], "Xother") + edit Xother + + tag thesame + execute "normal \" + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("tnext", "E1513:") + call assert_equal(l:current, bufnr()) + + tnext! + call assert_notequal(l:current, bufnr()) + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail :tprevious but :tprevious! is allowed +func Test_tprevious() + call s:reset_all_buffers() + + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "thesame\tXfile\t1;\"\td\tfile:", + \ "thesame\tXfile\t2;\"\td\tfile:", + \ "thesame\tXfile\t3;\"\td\tfile:", + \ ], + \ "Xtags") + call writefile(["thesame one", "thesame two", "thesame three"], "Xfile") + call writefile(["thesame one"], "Xother") + edit Xother + + tag thesame + execute "normal \" + tnext! + + set winfixbuf + + let l:current = bufnr() + + call assert_fails("tprevious", "E1513:") + call assert_equal(l:current, bufnr()) + + tprevious! + + set tags& + call delete("Xtags") + call delete("Xfile") + call delete("Xother") +endfunc + +" Fail :view but :view! is allowed +func Test_view() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("view other", "E1513:") + call assert_equal(l:current, bufnr()) + + view! other + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :visual but :visual! is allowed +func Test_visual() + call s:reset_all_buffers() + + let l:other = s:make_buffer_pairs() + let l:current = bufnr() + + call assert_fails("visual other", "E1513:") + call assert_equal(l:current, bufnr()) + + visual! other + call assert_equal(l:other, bufnr()) +endfunc + +" Fail :vimgrep but :vimgrep! is allowed +func Test_vimgrep() + CheckFeature quickfix + call s:reset_all_buffers() + + edit first.unittest + call append(0, ["some-search-term"]) + write + + edit winfix.unittest + call append(0, ["some-search-term"]) + write + let l:current = bufnr() + + set winfixbuf + + edit! last.unittest + call append(0, ["some-search-term"]) + write + let l:last = bufnr() + + buffer! winfix.unittest + + call assert_fails("vimgrep /some-search-term/ *.unittest") + call assert_equal(l:current, bufnr()) + + " Don't error and also do swap to the first match because ! was included + vimgrep! /some-search-term/ *.unittest + call assert_notequal(l:current, bufnr()) + + call delete("first.unittest") + call delete("winfix.unittest") + call delete("last.unittest") +endfunc + +" Fail :vimgrepadd but ::vimgrepadd! is allowed +func Test_vimgrepadd() + CheckFeature quickfix + call s:reset_all_buffers() + + edit first.unittest + call append(0, ["some-search-term"]) + write + + edit winfix.unittest + call append(0, ["some-search-term"]) + write + let l:current = bufnr() + + set winfixbuf + + edit! last.unittest + call append(0, ["some-search-term"]) + write + let l:last = bufnr() + + buffer! winfix.unittest + + call assert_fails("vimgrepadd /some-search-term/ *.unittest") + call assert_equal(l:current, bufnr()) + + vimgrepadd! /some-search-term/ *.unittest + call assert_notequal(l:current, bufnr()) + call delete("first.unittest") + call delete("winfix.unittest") + call delete("last.unittest") +endfunc + +" Fail :wNext but :wNext! is allowed +func Test_wNext() + call s:reset_all_buffers() + + let [l:first, _] = s:make_args_list() + next! + + call assert_fails("wNext", "E1513:") + call assert_notequal(l:first, bufnr()) + + wNext! + call assert_equal(l:first, bufnr()) + + call delete("first") + call delete("middle") + call delete("last") +endfunc + +" Allow :windo unless `:windo foo` would change a 'winfixbuf' window's buffer +func Test_windo() + call s:reset_all_buffers() + + let l:current_window = win_getid() + let l:current_buffer = bufnr() + split + enew + file some_other_buffer + + set winfixbuf + + let l:current = win_getid() + + windo echo '' + call assert_equal(l:current_window, win_getid()) + + call assert_fails('execute "windo buffer ' . l:current_buffer . '"', "E1513:") + call assert_equal(l:current_window, win_getid()) + + execute "windo buffer! " . l:current_buffer + call assert_equal(l:current_window, win_getid()) +endfunc + +" Fail :wnext but :wnext! is allowed +func Test_wnext() + call s:reset_all_buffers() + + let [_, l:last] = s:make_args_list() + next! + + call assert_fails("wnext", "E1513:") + call assert_notequal(l:last, bufnr()) + + wnext! + call assert_equal(l:last, bufnr()) + + call delete("first") + call delete("middle") + call delete("last") +endfunc + +" Fail :wprevious but :wprevious! is allowed +func Test_wprevious() + call s:reset_all_buffers() + + let [l:first, _] = s:make_args_list() + next! + + call assert_fails("wprevious", "E1513:") + call assert_notequal(l:first, bufnr()) + + wprevious! + call assert_equal(l:first, bufnr()) + + call delete("first") + call delete("middle") + call delete("last") +endfunc diff --git a/src/version.c b/src/version.c index e7ee9466b3..fc595f098c 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 147, /**/ 146, /**/ diff --git a/src/window.c b/src/window.c index bda24fc4e5..435bdc9e15 100644 --- a/src/window.c +++ b/src/window.c @@ -158,6 +158,37 @@ log_frame_layout(frame_T *frame) } #endif +/* + * Check if the current window is allowed to move to a different buffer. + * If the window has 'winfixbuf', this function will return FALSE. + */ + int +check_can_set_curbuf_disabled(void) +{ + if (curwin->w_p_wfb) + { + semsg("%s", e_winfixbuf_cannot_go_to_buffer); + return FALSE; + } + return TRUE; +} + +/* + * Check if the current window is allowed to move to a different buffer. + * If the window has 'winfixbuf', then forceit must be TRUE or this function + * will return FALSE. + */ + int +check_can_set_curbuf_forceit(int forceit) +{ + if (!forceit && curwin->w_p_wfb) + { + semsg("%s", e_winfixbuf_cannot_go_to_buffer); + return FALSE; + } + return TRUE; +} + /* * Return the current window, unless in the cmdline window and "prevwin" is * set, then return "prevwin". @@ -667,7 +698,7 @@ do_window( find_pattern_in_path(ptr, 0, len, TRUE, Prenum == 0 ? TRUE : FALSE, type, - Prenum1, ACTION_SPLIT, (linenr_T)1, (linenr_T)MAXLNUM); + Prenum1, ACTION_SPLIT, (linenr_T)1, (linenr_T)MAXLNUM, FALSE); vim_free(ptr); curwin->w_set_curswant = TRUE; break; From d3eae7bc116297f70220f21ded436ed0a88066d8 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sun, 3 Mar 2024 16:26:58 +0100 Subject: [PATCH 123/426] patch 9.1.0148: Vim9: can't call internal methods with objects Problem: Vim9: can't call internal methods with objects Solution: Add support for empty(), len() and string() function calls for objects (Yegappan Lakshmanan) closes: #14129 Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt --- runtime/doc/builtin.txt | 12 +- runtime/doc/tags | 6 + runtime/doc/todo.txt | 3 +- runtime/doc/version9.txt | 5 + runtime/doc/vim9class.txt | 28 +- src/errors.h | 6 +- src/eval.c | 33 +- src/evalfunc.c | 7 +- src/proto/vim9class.pro | 6 + src/structs.h | 14 + src/testdir/test_vim9_class.vim | 557 ++++++++++++++++++++++++-- src/testdir/test_vim9_disassemble.vim | 163 ++++++++ src/userfunc.c | 5 +- src/version.c | 2 + src/vim9class.c | 279 ++++++++++++- src/vim9expr.c | 40 ++ 16 files changed, 1083 insertions(+), 83 deletions(-) diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index dbad8802e1..0d47e36531 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Mar 01 +*builtin.txt* For Vim version 9.1. Last change: 2024 Mar 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2265,6 +2265,8 @@ empty({expr}) *empty()* - A |Job| is empty when it failed to start. - A |Channel| is empty when it is closed. - A |Blob| is empty when its length is zero. + - An |Object| is empty, when the |empty()| builtin method in + the object (if present) returns true. For a long |List| this is much faster than comparing the length with zero. @@ -5476,7 +5478,9 @@ len({expr}) The result is a Number, which is the length of the argument. When {expr} is a |Blob| the number of bytes is returned. When {expr} is a |Dictionary| the number of entries in the |Dictionary| is returned. - Otherwise an error is given and returns zero. + When {expr} is an |Object|, invokes the |len()| method in the + object (if present) to get the length. Otherwise returns + zero. Can also be used as a |method|: > mylist->len() @@ -9587,6 +9591,10 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number, replaced by "[...]" or "{...}". Using eval() on the result will then fail. + For an object, invokes the |string()| method to get a textual + representation of the object. If the method is not present, + then the default representation is used. + Can also be used as a |method|: > mylist->string() diff --git a/runtime/doc/tags b/runtime/doc/tags index efecedfb2a..d6ed03a313 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4518,6 +4518,8 @@ E1409 vim9class.txt /*E1409* E141 message.txt /*E141* E1410 vim9class.txt /*E1410* E1411 vim9class.txt /*E1411* +E1412 vim9class.txt /*E1412* +E1413 vim9class.txt /*E1413* E142 message.txt /*E142* E143 autocmd.txt /*E143* E144 various.txt /*E144* @@ -6183,6 +6185,7 @@ bugs intro.txt /*bugs* builtin-function-details builtin.txt /*builtin-function-details* builtin-function-list builtin.txt /*builtin-function-list* builtin-functions builtin.txt /*builtin-functions* +builtin-object-methods vim9class.txt /*builtin-object-methods* builtin-terms term.txt /*builtin-terms* builtin-tools gui.txt /*builtin-tools* builtin.txt builtin.txt /*builtin.txt* @@ -9153,9 +9156,12 @@ o_object-select motion.txt /*o_object-select* o_v motion.txt /*o_v* object vim9class.txt /*object* object-const-variable vim9class.txt /*object-const-variable* +object-empty() vim9class.txt /*object-empty()* object-final-variable vim9class.txt /*object-final-variable* +object-len() vim9class.txt /*object-len()* object-motions motion.txt /*object-motions* object-select motion.txt /*object-select* +object-string() vim9class.txt /*object-string()* objects index.txt /*objects* obtaining-exted netbeans.txt /*obtaining-exted* ocaml.vim syntax.txt /*ocaml.vim* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 953ae47820..2b4a70a3a6 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 9.1. Last change: 2024 Feb 01 +*todo.txt* For Vim version 9.1. Last change: 2024 Mar 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -132,7 +132,6 @@ Further Vim9 improvements: Possibly issue #11981 can be fixed at the same time (has two examples). - Forward declaration of a class? E.g. for Clone() function. Email lifepillar 2023 Mar 26 - - object empty(), len() - can class define a method to be used for them? - When "Meta" is a class, is "const MetaAlias = Meta" allowed? It should either work or given an error. Possibly give an error now and implement it later (using a typedef). #12006 diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index 7947cb281c..bf16d49534 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -41543,6 +41543,11 @@ and is a work in progress. Support for Wayland UI. +Vim9 script +----------- +Add support for internal builtin functions with vim9 objects, see +|builtin-object-methods| + Other improvements *new-other-9.2* ------------------ diff --git a/runtime/doc/vim9class.txt b/runtime/doc/vim9class.txt index ba821c1b29..a00a5b787d 100644 --- a/runtime/doc/vim9class.txt +++ b/runtime/doc/vim9class.txt @@ -1,4 +1,4 @@ -*vim9class.txt* For Vim version 9.1. Last change: 2024 Jan 12 +*vim9class.txt* For Vim version 9.1. Last change: 2024 Mar 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -710,6 +710,32 @@ The initialization isn't needed, the list is empty by default. *E1330* Some types cannot be used, such as "void", "null" and "v:none". +Builtin Object Methods ~ + *builtin-object-methods* +Some of the builtin functions like |empty()|, |len()| and |string()| can be +used with an object. An object can implement a method with the same name as +these builtin functions to return an object-specific value. + + *E1412* +The following builtin methods are supported: + *object-empty()* + empty() Invoked by the |empty()| function to check whether an object is + empty. If this method is missing, then true is returned. This + method should not accept any arguments and must return a boolean. + *object-len()* + len() Invoked by the |len()| function to return the length of an + object. If this method is missing in the class, then an error is + given and zero is returned. This method should not accept any + arguments and must return a number. + *object-string()* + string() Invoked by the |string()| function to get a textual + representation of an object. Also used by the |:echo| command + for an object. If this method is missing in the class, then a + built-in default textual representation is used. This method + should not accept any arguments and must return a string. + + *E1413* +A class method cannot be used as a builtin method. Defining an interface ~ *Interface* *:interface* *:endinterface* diff --git a/src/errors.h b/src/errors.h index 65ee4e826e..0dbc5a5719 100644 --- a/src/errors.h +++ b/src/errors.h @@ -3579,8 +3579,12 @@ EXTERN char e_const_variable_not_supported_in_interface[] INIT(= N_("E1410: Const variable not supported in an interface")); EXTERN char e_missing_dot_after_object_str[] INIT(= N_("E1411: Missing dot after object \"%s\"")); +EXTERN char e_builtin_object_method_str_not_supported[] + INIT(= N_("E1412: Builtin object method \"%s\" not supported")); +EXTERN char e_builtin_class_method_not_supported[] + INIT(= N_("E1413: Builtin class method not supported")); #endif -// E1412 - E1499 unused (reserved for Vim9 class support) +// E1415 - E1499 unused (reserved for Vim9 class support) EXTERN char e_cannot_mix_positional_and_non_positional_str[] INIT(= N_("E1500: Cannot mix positional and non-positional arguments: %s")); EXTERN char e_fmt_arg_nr_unused_str[] diff --git a/src/eval.c b/src/eval.c index fd44db6f7e..ca5a2685fa 100644 --- a/src/eval.c +++ b/src/eval.c @@ -6318,36 +6318,9 @@ echo_string_core( break; case VAR_OBJECT: - { - garray_T ga; - ga_init2(&ga, 1, 50); - ga_concat(&ga, (char_u *)"object of "); - object_T *obj = tv->vval.v_object; - class_T *cl = obj == NULL ? NULL : obj->obj_class; - ga_concat(&ga, cl == NULL ? (char_u *)"[unknown]" - : cl->class_name); - if (cl != NULL) - { - ga_concat(&ga, (char_u *)" {"); - for (int i = 0; i < cl->class_obj_member_count; ++i) - { - if (i > 0) - ga_concat(&ga, (char_u *)", "); - ocmember_T *m = &cl->class_obj_members[i]; - ga_concat(&ga, m->ocm_name); - ga_concat(&ga, (char_u *)": "); - char_u *tf = NULL; - ga_concat(&ga, echo_string_core( - (typval_T *)(obj + 1) + i, - &tf, numbuf, copyID, echo_style, - restore_copyID, composite_val)); - vim_free(tf); - } - ga_concat(&ga, (char_u *)"}"); - } - - *tofree = r = ga.ga_data; - } + *tofree = r = object_string(tv->vval.v_object, numbuf, copyID, + echo_style, restore_copyID, + composite_val); break; case VAR_FLOAT: diff --git a/src/evalfunc.c b/src/evalfunc.c index b5d8c872ed..5d6664c9a2 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -986,6 +986,7 @@ arg_len1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context) || type->tt_type == VAR_BLOB || type->tt_type == VAR_LIST || type->tt_type == VAR_DICT + || type->tt_type == VAR_OBJECT || type_any_or_unknown(type)) return OK; @@ -3981,7 +3982,7 @@ f_empty(typval_T *argvars, typval_T *rettv) n = argvars[0].vval.v_class != NULL; break; case VAR_OBJECT: - n = argvars[0].vval.v_object != NULL; + n = object_empty(argvars[0].vval.v_object); break; case VAR_BLOB: @@ -7831,6 +7832,9 @@ f_len(typval_T *argvars, typval_T *rettv) case VAR_DICT: rettv->vval.v_number = dict_len(argvars[0].vval.v_dict); break; + case VAR_OBJECT: + rettv->vval.v_number = object_len(argvars[0].vval.v_object); + break; case VAR_UNKNOWN: case VAR_ANY: case VAR_VOID: @@ -7843,7 +7847,6 @@ f_len(typval_T *argvars, typval_T *rettv) case VAR_CHANNEL: case VAR_INSTR: case VAR_CLASS: - case VAR_OBJECT: case VAR_TYPEALIAS: emsg(_(e_invalid_type_for_len)); break; diff --git a/src/proto/vim9class.pro b/src/proto/vim9class.pro index a746eb7729..1ed175e69f 100644 --- a/src/proto/vim9class.pro +++ b/src/proto/vim9class.pro @@ -1,5 +1,7 @@ /* vim9class.c */ int object_index_from_itf_index(class_T *itf, int is_method, int idx, class_T *cl); +int is_valid_builtin_obj_methodname(char_u *funcname); +ufunc_T *class_get_builtin_method(class_T *cl, class_builtin_T builtin_method, int *method_idx); void ex_class(exarg_T *eap); type_T *oc_member_type(class_T *cl, int is_object, char_u *name, char_u *name_end, int *member_idx); type_T *oc_member_type_by_idx(class_T *cl, int is_object, int member_idx); @@ -34,6 +36,10 @@ void member_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t le void defcompile_class(class_T *cl); void defcompile_classes_in_script(void); int is_class_name(char_u *name, typval_T *rettv); +void protected_method_access_errmsg(char_u *method_name); +int object_empty(object_T *obj); +int object_len(object_T *obj); +char_u *object_string(object_T *obj, char_u *numbuf, int copyID, int echo_style, int restore_copyID, int composite_val); int class_instance_of(class_T *cl, class_T *other_cl); void f_instanceof(typval_T *argvars, typval_T *rettv); /* vim: set ft=c : */ diff --git a/src/structs.h b/src/structs.h index df2c005e3d..2c6f553521 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1530,6 +1530,17 @@ typedef enum { #define OCMFLAG_FINAL 0x02 // "final" object/class member #define OCMFLAG_CONST 0x04 // "const" object/class member +/* + * Object methods called by builtin functions (e.g. string(), empty(), etc.) + */ +typedef enum { + CLASS_BUILTIN_INVALID, + CLASS_BUILTIN_STRING, + CLASS_BUILTIN_EMPTY, + CLASS_BUILTIN_LEN, + CLASS_BUILTIN_MAX +} class_builtin_T; + /* * Entry for an object or class member variable. */ @@ -1593,6 +1604,9 @@ struct class_S int class_obj_method_count_child; // count without "extends" ufunc_T **class_obj_methods; // allocated + // index of builtin methods + int class_builtin_methods[CLASS_BUILTIN_MAX]; + garray_T class_type_list; // used for type pointers type_T class_type; // type used for the class type_T class_object_type; // same as class_type but VAR_OBJECT diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index 0bf7e9ceb6..12e3c48a3b 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -9659,33 +9659,6 @@ def Test_const_class_object_variable() v9.CheckSourceFailure(lines, 'E1022: Type or initialization required', 3) enddef -" Test for using double underscore prefix in a class/object method name. -def Test_method_double_underscore_prefix() - # class method - var lines =<< trim END - vim9script - class A - static def __foo() - echo "foo" - enddef - endclass - defcompile - END - v9.CheckSourceFailure(lines, 'E1034: Cannot use reserved name __foo()', 3) - - # object method - lines =<< trim END - vim9script - class A - def __foo() - echo "foo" - enddef - endclass - defcompile - END - v9.CheckSourceFailure(lines, 'E1034: Cannot use reserved name __foo()', 3) -enddef - " Test for compiling class/object methods using :defcompile def Test_defcompile_class() # defcompile all the classes in the current script @@ -9769,4 +9742,534 @@ def Test_defcompile_class() v9.CheckScriptSuccess(lines) enddef +" Test for cases common to all the object builtin methods +def Test_object_builtin_method() + var lines =<< trim END + vim9script + class A + def abc() + enddef + endclass + END + v9.CheckSourceFailure(lines, 'E1267: Function name must start with a capital: abc()', 3) + + for funcname in ["len", "string", "empty"] + lines =<< trim eval END + vim9script + class A + static def {funcname}(): number + enddef + endclass + END + v9.CheckSourceFailure(lines, 'E1413: Builtin class method not supported', 3) + endfor +enddef + +" Test for using the empty() builtin method with an object +" This is a legacy function to use the test_garbagecollect_now() function. +func Test_object_empty() + let lines =<< trim END + vim9script + class A + def empty(): bool + return true + enddef + endclass + + def Foo() + var afoo = A.new() + assert_equal(true, empty(afoo)) + assert_equal(true, afoo->empty()) + enddef + + var a = A.new() + assert_equal(1, empty(a)) + assert_equal(1, a->empty()) + test_garbagecollect_now() + assert_equal(1, empty(a)) + Foo() + test_garbagecollect_now() + Foo() + END + call v9.CheckSourceSuccess(lines) + + " empty() should return 1 without a builtin method + let lines =<< trim END + vim9script + class A + endclass + + def Foo() + var afoo = A.new() + assert_equal(1, empty(afoo)) + enddef + + var a = A.new() + assert_equal(1, empty(a)) + Foo() + END + call v9.CheckSourceSuccess(lines) + + " Unsupported signature for the empty() method + let lines =<< trim END + vim9script + class A + def empty() + enddef + endclass + END + call v9.CheckSourceFailure(lines, 'E1383: Method "empty": type mismatch, expected func(): bool but got func()', 4) + + " Error when calling the empty() method + let lines =<< trim END + vim9script + class A + def empty(): bool + throw "Failed to check emptiness" + enddef + endclass + + def Foo() + var afoo = A.new() + var i = empty(afoo) + enddef + + var a = A.new() + assert_fails('empty(a)', 'Failed to check emptiness') + assert_fails('Foo()', 'Failed to check emptiness') + END + call v9.CheckSourceSuccess(lines) + + " call empty() using an object from a script + let lines =<< trim END + vim9script + class A + def empty(): bool + return true + enddef + endclass + var afoo = A.new() + assert_equal(true, afoo.empty()) + END + call v9.CheckSourceSuccess(lines) + + " call empty() using an object from a method + let lines =<< trim END + vim9script + class A + def empty(): bool + return true + enddef + endclass + def Foo() + var afoo = A.new() + assert_equal(true, afoo.empty()) + enddef + Foo() + END + call v9.CheckSourceSuccess(lines) + + " call empty() using "this" from an object method + let lines =<< trim END + vim9script + class A + def empty(): bool + return true + enddef + def Foo(): bool + return this.empty() + enddef + endclass + def Bar() + var abar = A.new() + assert_equal(true, abar.Foo()) + enddef + Bar() + END + call v9.CheckSourceSuccess(lines) + + " Call empty() from a derived object + let lines =<< trim END + vim9script + class A + def empty(): bool + return false + enddef + endclass + class B extends A + def empty(): bool + return true + enddef + endclass + def Foo(afoo: A) + assert_equal(true, empty(afoo)) + var bfoo = B.new() + assert_equal(true, empty(bfoo)) + enddef + var b = B.new() + assert_equal(1, empty(b)) + Foo(b) + END + call v9.CheckSourceSuccess(lines) + + " Invoking empty method using an interface + let lines =<< trim END + vim9script + interface A + def empty(): bool + endinterface + class B implements A + def empty(): bool + return false + enddef + endclass + def Foo(a: A) + assert_equal(false, empty(a)) + enddef + var b = B.new() + Foo(b) + END + call v9.CheckSourceSuccess(lines) +endfunc + +" Test for using the len() builtin method with an object +" This is a legacy function to use the test_garbagecollect_now() function. +func Test_object_length() + let lines =<< trim END + vim9script + class A + var mylen: number = 0 + def new(n: number) + this.mylen = n + enddef + def len(): number + return this.mylen + enddef + endclass + + def Foo() + var afoo = A.new(12) + assert_equal(12, len(afoo)) + assert_equal(12, afoo->len()) + enddef + + var a = A.new(22) + assert_equal(22, len(a)) + assert_equal(22, a->len()) + test_garbagecollect_now() + assert_equal(22, len(a)) + Foo() + test_garbagecollect_now() + Foo() + END + call v9.CheckSourceSuccess(lines) + + " len() should return 0 without a builtin method + let lines =<< trim END + vim9script + class A + endclass + + def Foo() + var afoo = A.new() + assert_equal(0, len(afoo)) + enddef + + var a = A.new() + assert_equal(0, len(a)) + Foo() + END + call v9.CheckSourceSuccess(lines) + + " Unsupported signature for the len() method + let lines =<< trim END + vim9script + class A + def len() + enddef + endclass + END + call v9.CheckSourceFailure(lines, 'E1383: Method "len": type mismatch, expected func(): number but got func()', 4) + + " Error when calling the len() method + let lines =<< trim END + vim9script + class A + def len(): number + throw "Failed to compute length" + enddef + endclass + + def Foo() + var afoo = A.new() + var i = len(afoo) + enddef + + var a = A.new() + assert_fails('len(a)', 'Failed to compute length') + assert_fails('Foo()', 'Failed to compute length') + END + call v9.CheckSourceSuccess(lines) + + " call len() using an object from a script + let lines =<< trim END + vim9script + class A + def len(): number + return 5 + enddef + endclass + var afoo = A.new() + assert_equal(5, afoo.len()) + END + call v9.CheckSourceSuccess(lines) + + " call len() using an object from a method + let lines =<< trim END + vim9script + class A + def len(): number + return 5 + enddef + endclass + def Foo() + var afoo = A.new() + assert_equal(5, afoo.len()) + enddef + Foo() + END + call v9.CheckSourceSuccess(lines) + + " call len() using "this" from an object method + let lines =<< trim END + vim9script + class A + def len(): number + return 8 + enddef + def Foo(): number + return this.len() + enddef + endclass + def Bar() + var abar = A.new() + assert_equal(8, abar.Foo()) + enddef + Bar() + END + call v9.CheckSourceSuccess(lines) + + " Call len() from a derived object + let lines =<< trim END + vim9script + class A + def len(): number + return 10 + enddef + endclass + class B extends A + def len(): number + return 20 + enddef + endclass + def Foo(afoo: A) + assert_equal(20, len(afoo)) + var bfoo = B.new() + assert_equal(20, len(bfoo)) + enddef + var b = B.new() + assert_equal(20, len(b)) + Foo(b) + END + call v9.CheckSourceSuccess(lines) + + " Invoking len method using an interface + let lines =<< trim END + vim9script + interface A + def len(): number + endinterface + class B implements A + def len(): number + return 123 + enddef + endclass + def Foo(a: A) + assert_equal(123, len(a)) + enddef + var b = B.new() + Foo(b) + END + call v9.CheckSourceSuccess(lines) +endfunc + +" Test for using the string() builtin method with an object +" This is a legacy function to use the test_garbagecollect_now() function. +func Test_object_string() + let lines =<< trim END + vim9script + class A + var name: string + def string(): string + return this.name + enddef + endclass + + def Foo() + var afoo = A.new("foo-A") + assert_equal('foo-A', string(afoo)) + assert_equal('foo-A', afoo->string()) + enddef + + var a = A.new("script-A") + assert_equal('script-A', string(a)) + assert_equal('script-A', a->string()) + assert_equal(['script-A'], execute('echo a')->split("\n")) + test_garbagecollect_now() + assert_equal('script-A', string(a)) + Foo() + test_garbagecollect_now() + Foo() + END + call v9.CheckSourceSuccess(lines) + + " string() should return "object of A {}" without a builtin method + let lines =<< trim END + vim9script + class A + endclass + + def Foo() + var afoo = A.new() + assert_equal('object of A {}', string(afoo)) + enddef + + var a = A.new() + assert_equal('object of A {}', string(a)) + Foo() + END + call v9.CheckSourceSuccess(lines) + + " Unsupported signature for the string() method + let lines =<< trim END + vim9script + class A + def string() + enddef + endclass + END + call v9.CheckSourceFailure(lines, 'E1383: Method "string": type mismatch, expected func(): string but got func()', 4) + + " Error when calling the string() method + let lines =<< trim END + vim9script + class A + def string(): string + throw "Failed to get text" + enddef + endclass + + def Foo() + var afoo = A.new() + var i = string(afoo) + enddef + + var a = A.new() + assert_fails('string(a)', 'Failed to get text') + assert_fails('Foo()', 'Failed to get text') + END + call v9.CheckSourceSuccess(lines) + + " call string() using an object from a script + let lines =<< trim END + vim9script + class A + def string(): string + return 'A' + enddef + endclass + var afoo = A.new() + assert_equal('A', afoo.string()) + END + call v9.CheckSourceSuccess(lines) + + " call string() using an object from a method + let lines =<< trim END + vim9script + class A + def string(): string + return 'A' + enddef + endclass + def Foo() + var afoo = A.new() + assert_equal('A', afoo.string()) + enddef + Foo() + END + call v9.CheckSourceSuccess(lines) + + " call string() using "this" from an object method + let lines =<< trim END + vim9script + class A + def string(): string + return 'A' + enddef + def Foo(): string + return this.string() + enddef + endclass + def Bar() + var abar = A.new() + assert_equal('A', abar.string()) + enddef + Bar() + END + call v9.CheckSourceSuccess(lines) + + " Call string() from a derived object + let lines =<< trim END + vim9script + class A + def string(): string + return 'A' + enddef + endclass + class B extends A + def string(): string + return 'B' + enddef + endclass + def Foo(afoo: A) + assert_equal('B', string(afoo)) + var bfoo = B.new() + assert_equal('B', string(bfoo)) + enddef + var b = B.new() + assert_equal('B', string(b)) + Foo(b) + END + call v9.CheckSourceSuccess(lines) + + " Invoking string method using an interface + let lines =<< trim END + vim9script + interface A + def string(): string + endinterface + class B implements A + def string(): string + return 'B' + enddef + endclass + def Foo(a: A) + assert_equal('B', string(a)) + enddef + var b = B.new() + Foo(b) + END + call v9.CheckSourceSuccess(lines) +endfunc + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim index 1a192cc092..645b04bdd0 100644 --- a/src/testdir/test_vim9_disassemble.vim +++ b/src/testdir/test_vim9_disassemble.vim @@ -3273,4 +3273,167 @@ def Test_funcref_with_class() unlet g:instr enddef +" Disassemble instructions for calls to a string() function in an object +def Test_disassemble_object_string() + var lines =<< trim END + vim9script + class A + def string(): string + return 'A' + enddef + endclass + def Bar() + var a = A.new() + var s = string(a) + s = string(A) + enddef + g:instr = execute('disassemble Bar') + END + v9.CheckScriptSuccess(lines) + assert_match('\d*_Bar\_s*' .. + 'var a = A.new()\_s*' .. + '0 DCALL new(argc 0)\_s*' .. + '1 STORE $0\_s*' .. + 'var s = string(a)\_s*' .. + '2 LOAD $0\_s*' .. + '3 METHODCALL A.string(argc 0)\_s*' .. + '4 STORE $1\_s*' .. + 's = string(A)\_s*' .. + '5 LOADSCRIPT A-0 from .*\_s*' .. + '6 BCALL string(argc 1)\_s*' .. + '7 STORE $1\_s*' .. + '8 RETURN void', g:instr) + unlet g:instr + + # Use the default string() function for a class + lines =<< trim END + vim9script + class A + endclass + def Bar() + var a = A.new() + var s = string(a) + s = string(A) + enddef + g:instr = execute('disassemble Bar') + END + v9.CheckScriptSuccess(lines) + assert_match('\d*_Bar\_s*' .. + 'var a = A.new()\_s*' .. + '0 DCALL new(argc 0)\_s*' .. + '1 STORE $0\_s*' .. + 'var s = string(a)\_s*' .. + '2 LOAD $0\_s*' .. + '3 BCALL string(argc 1)\_s*' .. + '4 STORE $1\_s*' .. + 's = string(A)\_s*' .. + '5 LOADSCRIPT A-0 from .*\_s*' .. + '6 BCALL string(argc 1)\_s*' .. + '7 STORE $1\_s*' .. + '8 RETURN void', g:instr) + unlet g:instr +enddef + +" Disassemble instructions for calls to a empty() function in an object +def Test_disassemble_object_empty() + var lines =<< trim END + vim9script + class A + def empty(): bool + return true + enddef + endclass + def Bar() + var a = A.new() + var s = empty(a) + enddef + g:instr = execute('disassemble Bar') + END + v9.CheckScriptSuccess(lines) + assert_match('\d*_Bar\_s*' .. + 'var a = A.new()\_s*' .. + '0 DCALL new(argc 0)\_s*' .. + '1 STORE $0\_s*' .. + 'var s = empty(a)\_s*' .. + '2 LOAD $0\_s*' .. + '3 METHODCALL A.empty(argc 0)\_s*' .. + '4 STORE $1\_s*' .. + '5 RETURN void', g:instr) + unlet g:instr + + # Use the default empty() function for a class + lines =<< trim END + vim9script + class A + endclass + def Bar() + var a = A.new() + var s = empty(a) + enddef + g:instr = execute('disassemble Bar') + END + v9.CheckScriptSuccess(lines) + assert_match('\d*_Bar\_s*' .. + 'var a = A.new()\_s*' .. + '0 DCALL new(argc 0)\_s*' .. + '1 STORE $0\_s*' .. + 'var s = empty(a)\_s*' .. + '2 LOAD $0\_s*' .. + '3 BCALL empty(argc 1)\_s*' .. + '4 STORE $1\_s*' .. + '5 RETURN void', g:instr) + unlet g:instr +enddef + +" Disassemble instructions for calls to a len() function in an object +def Test_disassemble_object_len() + var lines =<< trim END + vim9script + class A + def len(): number + return 10 + enddef + endclass + def Bar() + var a = A.new() + var s = len(a) + enddef + g:instr = execute('disassemble Bar') + END + v9.CheckScriptSuccess(lines) + assert_match('\d*_Bar\_s*' .. + 'var a = A.new()\_s*' .. + '0 DCALL new(argc 0)\_s*' .. + '1 STORE $0\_s*' .. + 'var s = len(a)\_s*' .. + '2 LOAD $0\_s*' .. + '3 METHODCALL A.len(argc 0)\_s*' .. + '4 STORE $1\_s*' .. + '5 RETURN void', g:instr) + unlet g:instr + + # Use the default len() function for a class + lines =<< trim END + vim9script + class A + endclass + def Bar() + var a = A.new() + var s = len(a) + enddef + g:instr = execute('disassemble Bar') + END + v9.CheckScriptSuccess(lines) + assert_match('\d*_Bar\_s*' .. + 'var a = A.new()\_s*' .. + '0 DCALL new(argc 0)\_s*' .. + '1 STORE $0\_s*' .. + 'var s = len(a)\_s*' .. + '2 LOAD $0\_s*' .. + '3 BCALL len(argc 1)\_s*' .. + '4 STORE $1\_s*' .. + '5 RETURN void', g:instr) + unlet g:instr +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/userfunc.c b/src/userfunc.c index e39ce6e492..00e499fd0f 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -4459,12 +4459,13 @@ trans_function_name_ext( } } // The function name must start with an upper case letter (unless it is a - // Vim9 class new() function or a Vim9 class private method) + // Vim9 class new() function or a Vim9 class private method or one of the + // supported Vim9 object builtin functions) else if (!(flags & TFN_INT) && (builtin_function(lv.ll_name, len) || (vim9script && *lv.ll_name == '_')) && !((flags & TFN_IN_CLASS) - && (STRNCMP(lv.ll_name, "new", 3) == 0 + && (is_valid_builtin_obj_methodname(lv.ll_name) || (*lv.ll_name == '_')))) { semsg(_(vim9script ? e_function_name_must_start_with_capital_str diff --git a/src/version.c b/src/version.c index fc595f098c..cecf0892b3 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 148, /**/ 147, /**/ diff --git a/src/vim9class.c b/src/vim9class.c index 525f8d0389..7357520199 100644 --- a/src/vim9class.c +++ b/src/vim9class.c @@ -973,6 +973,100 @@ is_valid_constructor(ufunc_T *uf, int is_abstract, int has_static) return TRUE; } +/* + * Returns TRUE if 'uf' is a supported builtin method and has the correct + * method signature. + */ + static int +object_check_builtin_method_sig(ufunc_T *uf) +{ + char_u *name = uf->uf_name; + int valid = FALSE; + type_T method_sig; + type_T method_rt; + where_T where = WHERE_INIT; + + // validate the method signature + CLEAR_FIELD(method_sig); + CLEAR_FIELD(method_rt); + method_sig.tt_type = VAR_FUNC; + + if (STRCMP(name, "len") == 0) + { + // def __len(): number + method_rt.tt_type = VAR_NUMBER; + method_sig.tt_member = &method_rt; + valid = TRUE; + } + else if (STRCMP(name, "empty") == 0) + { + // def __empty(): bool + method_rt.tt_type = VAR_BOOL; + method_sig.tt_member = &method_rt; + valid = TRUE; + } + else if (STRCMP(name, "string") == 0) + { + // def __string(): string + method_rt.tt_type = VAR_STRING; + method_sig.tt_member = &method_rt; + valid = TRUE; + } + else + semsg(_(e_builtin_object_method_str_not_supported), uf->uf_name); + + where.wt_func_name = (char *)uf->uf_name; + where.wt_kind = WT_METHOD; + if (valid && !check_type(&method_sig, uf->uf_func_type, TRUE, where)) + valid = FALSE; + + return valid; +} + +/* + * Returns TRUE if "funcname" is a supported builtin object method name + */ + int +is_valid_builtin_obj_methodname(char_u *funcname) +{ + switch (funcname[0]) + { + case 'e': + return STRNCMP(funcname, "empty", 5) == 0; + + case 'l': + return STRNCMP(funcname, "len", 3) == 0; + + case 'n': + return STRNCMP(funcname, "new", 3) == 0; + + case 's': + return STRNCMP(funcname, "string", 6) == 0; + } + + return FALSE; +} + + +/* + * Returns the builtin method "name" in object "obj". Returns NULL if the + * method is not found. + */ + ufunc_T * +class_get_builtin_method( + class_T *cl, + class_builtin_T builtin_method, + int *method_idx) +{ + *method_idx = -1; + + if (cl == NULL) + return NULL; + + *method_idx = cl->class_builtin_methods[builtin_method]; + return *method_idx != -1 ? cl->class_obj_methods[*method_idx] : NULL; +} + /* * Update the interface class lookup table for the member index on the * interface to the member index in the class implementing the interface. @@ -1326,6 +1420,33 @@ add_classfuncs_objmethods( return OK; } +/* + * Update the index of object methods called by builtin functions. + */ + static void +update_builtin_method_index(class_T *cl) +{ + int i; + + for (i = 0; i < CLASS_BUILTIN_MAX; i++) + cl->class_builtin_methods[i] = -1; + + for (i = 0; i < cl->class_obj_method_count; i++) + { + ufunc_T *uf = cl->class_obj_methods[i]; + + if (cl->class_builtin_methods[CLASS_BUILTIN_STRING] == -1 + && STRCMP(uf->uf_name, "string") == 0) + cl->class_builtin_methods[CLASS_BUILTIN_STRING] = i; + else if (cl->class_builtin_methods[CLASS_BUILTIN_EMPTY] == -1 && + STRCMP(uf->uf_name, "empty") == 0) + cl->class_builtin_methods[CLASS_BUILTIN_EMPTY] = i; + else if (cl->class_builtin_methods[CLASS_BUILTIN_LEN] == -1 && + STRCMP(uf->uf_name, "len") == 0) + cl->class_builtin_methods[CLASS_BUILTIN_LEN] = i; + } +} + /* * Return the end of the class name starting at "arg". Valid characters in a * class name are alphanumeric characters and "_". Also handles imported class @@ -1721,13 +1842,10 @@ ex_class(exarg_T *eap) &varname_end, &has_type, &type_list, &type, is_class ? &init_expr: NULL) == FAIL) break; - if (is_reserved_varname(varname, varname_end)) - { - vim_free(init_expr); - break; - } - if (is_duplicate_variable(&classmembers, &objmembers, varname, - varname_end)) + + if (is_reserved_varname(varname, varname_end) + || is_duplicate_variable(&classmembers, &objmembers, + varname, varname_end)) { vim_free(init_expr); break; @@ -1758,6 +1876,7 @@ ex_class(exarg_T *eap) { exarg_T ea; garray_T lines_to_free; + int is_new = STRNCMP(p, "new", 3) == 0; if (has_public) { @@ -1774,12 +1893,17 @@ ex_class(exarg_T *eap) break; } - if (*p == '_' && *(p + 1) == '_') + if (!is_class && *p == '_') { - // double underscore prefix for a method name is currently - // reserved. This could be used in the future to support - // object methods called by Vim builtin functions. - semsg(_(e_cannot_use_reserved_name_str), p); + // private methods are not supported in an interface + semsg(_(e_protected_method_not_supported_in_interface), p); + break; + } + + if (has_static && !is_new && SAFE_islower(*p) && + is_valid_builtin_obj_methodname(p)) + { + semsg(_(e_builtin_class_method_not_supported), p); break; } @@ -1803,9 +1927,9 @@ ex_class(exarg_T *eap) if (uf != NULL) { char_u *name = uf->uf_name; - int is_new = STRNCMP(name, "new", 3) == 0; - if (!is_class && *name == '_') + if (is_new && !is_valid_constructor(uf, is_abstract, + has_static)) { // private variables are not supported in an interface semsg(_(e_protected_method_not_supported_in_interface), @@ -1813,8 +1937,10 @@ ex_class(exarg_T *eap) func_clear_free(uf, FALSE); break; } - if (is_new && !is_valid_constructor(uf, is_abstract, - has_static)) + + // check for builtin method + if (!is_new && SAFE_islower(*name) && + !object_check_builtin_method_sig(uf)) { func_clear_free(uf, FALSE); break; @@ -1997,6 +2123,8 @@ ex_class(exarg_T *eap) &objmethods) == FAIL) goto cleanup; + update_builtin_method_index(cl); + cl->class_type.tt_type = VAR_CLASS; cl->class_type.tt_class = cl; cl->class_object_type.tt_type = VAR_OBJECT; @@ -3272,6 +3400,125 @@ is_class_name(char_u *name, typval_T *rettv) return FALSE; } +/* + * Calls the object builtin method "name" with arguments "argv". The value + * returned by the builtin method is in "rettv". Returns OK or FAIL. + */ + static int +object_call_builtin_method( + object_T *obj, + class_builtin_T builtin_method, + int argc, + typval_T *argv, + typval_T *rettv) +{ + ufunc_T *uf; + int midx; + + if (obj == NULL) + return FAIL; + + uf = class_get_builtin_method(obj->obj_class, builtin_method, &midx); + if (uf == NULL) + return FAIL; + + funccall_T *fc = create_funccal(uf, rettv); + int r; + + if (fc == NULL) + return FAIL; + + ++obj->obj_refcount; + + r = call_def_function(uf, argc, argv, 0, NULL, obj, fc, rettv); + + remove_funccal(); + + return r; +} + +/* + * Calls the object "empty()" method and returns the method retun value. In + * case of an error, returns TRUE. + */ + int +object_empty(object_T *obj) +{ + typval_T rettv; + + if (object_call_builtin_method(obj, CLASS_BUILTIN_EMPTY, 0, NULL, &rettv) + == FAIL) + return TRUE; + + return tv_get_bool(&rettv); +} + +/* + * Use the object "len()" method to get an object length. Returns 0 if the + * method is not found or there is an error. + */ + int +object_len(object_T *obj) +{ + typval_T rettv; + + if (object_call_builtin_method(obj, CLASS_BUILTIN_LEN, 0, NULL, &rettv) + == FAIL) + return 0; + + return tv_to_number(&rettv); +} + +/* + * Return a textual representation of object "obj" + */ + char_u * +object_string( + object_T *obj, + char_u *numbuf, + int copyID, + int echo_style, + int restore_copyID, + int composite_val) +{ + typval_T rettv; + + if (object_call_builtin_method(obj, CLASS_BUILTIN_STRING, 0, NULL, &rettv) + == OK + && rettv.vval.v_string != NULL) + return rettv.vval.v_string; + else + { + garray_T ga; + ga_init2(&ga, 1, 50); + + ga_concat(&ga, (char_u *)"object of "); + class_T *cl = obj == NULL ? NULL : obj->obj_class; + ga_concat(&ga, cl == NULL ? (char_u *)"[unknown]" + : cl->class_name); + if (cl != NULL) + { + ga_concat(&ga, (char_u *)" {"); + for (int i = 0; i < cl->class_obj_member_count; ++i) + { + if (i > 0) + ga_concat(&ga, (char_u *)", "); + ocmember_T *m = &cl->class_obj_members[i]; + ga_concat(&ga, m->ocm_name); + ga_concat(&ga, (char_u *)": "); + char_u *tf = NULL; + ga_concat(&ga, echo_string_core( + (typval_T *)(obj + 1) + i, + &tf, numbuf, copyID, echo_style, + restore_copyID, composite_val)); + vim_free(tf); + } + ga_concat(&ga, (char_u *)"}"); + } + return ga.ga_data; + } +} + /* * Return TRUE when the class "cl", its base class or one of the implemented * interfaces matches the class "other_cl". diff --git a/src/vim9expr.c b/src/vim9expr.c index 38a65d4424..ee9712bfd9 100644 --- a/src/vim9expr.c +++ b/src/vim9expr.c @@ -1013,6 +1013,32 @@ compile_arguments( return FAIL; } +/* + * Compile a builtin method call of an object (e.g. string(), len(), empty(), + * etc.) if the class implements it. + */ + static int +compile_builtin_method_call(cctx_T *cctx, class_builtin_T builtin_method) +{ + type_T *type = get_decl_type_on_stack(cctx, 0); + int res = FAIL; + + // If the built in function is invoked on an object and the class + // implements the corresponding built in method, then invoke the object + // method. + if (type->tt_type == VAR_OBJECT) + { + int method_idx; + ufunc_T *uf = class_get_builtin_method(type->tt_class, builtin_method, + &method_idx); + if (uf != NULL) + res = generate_CALL(cctx, uf, type->tt_class, method_idx, 0); + } + + return res; +} + + /* * Compile a function call: name(arg1, arg2) * "arg" points to "name", "arg + varlen" to the "(". @@ -1170,6 +1196,20 @@ compile_call( idx = -1; } + class_builtin_T builtin_method = CLASS_BUILTIN_INVALID; + if (STRCMP(name, "string") == 0) + builtin_method = CLASS_BUILTIN_STRING; + else if (STRCMP(name, "empty") == 0) + builtin_method = CLASS_BUILTIN_EMPTY; + else if (STRCMP(name, "len") == 0) + builtin_method = CLASS_BUILTIN_LEN; + if (builtin_method != CLASS_BUILTIN_INVALID) + { + res = compile_builtin_method_call(cctx, builtin_method); + if (res == OK) + idx = -1; + } + if (idx >= 0) res = generate_BCALL(cctx, idx, argcount, argcount_init == 1); } From d9ebd46bd090c598adc82e683b4462909f2d4ea5 Mon Sep 17 00:00:00 2001 From: Shixian Li <34830785+znsoooo@users.noreply.github.com> Date: Sun, 3 Mar 2024 23:41:46 +0800 Subject: [PATCH 124/426] runtime(mswin): Use unnamed register when clipboard not working (#13813) * Use unnamed register while clipboard not exist * Do not need to specify the unnamed register explicitly fixes: #13809 Signed-off-by: Shixian Li Signed-off-by: Christian Brabandt --- runtime/mswin.vim | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/runtime/mswin.vim b/runtime/mswin.vim index 1c28cadac0..3c10c0a6d8 100644 --- a/runtime/mswin.vim +++ b/runtime/mswin.vim @@ -1,7 +1,7 @@ " Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: The Vim Project -" Last Change: 2023 Aug 10 +" Last Change: 2024 Mar 3 " Former Maintainer: Bram Moolenaar " Bail out if this isn't wanted. @@ -24,7 +24,7 @@ set backspace=indent,eol,start whichwrap+=<,>,[,] " backspace in Visual mode deletes selection vnoremap d -if has("clipboard") +if has("clipboard_working") " CTRL-X and SHIFT-Del are Cut vnoremap "+x vnoremap "+x @@ -39,6 +39,23 @@ if has("clipboard") cmap + cmap + +else + " Use unnamed register while clipboard not exist + + " CTRL-X and SHIFT-Del are Cut + vnoremap x + vnoremap x + + " CTRL-C and CTRL-Insert are Copy + vnoremap y + vnoremap y + + " CTRL-V and SHIFT-Insert are Paste + noremap gP + noremap gP + + inoremap " + inoremap " endif " Pasting blockwise and linewise selections is not possible in Insert and @@ -47,7 +64,7 @@ endif " Uses the paste.vim autoload script. " Use CTRL-G u to have CTRL-Z only undo the paste. -if 1 +if has("clipboard_working") exe 'inoremap