From b3de6c4a769986e6eb4e228519a6483d2999ad8f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 13:02:28 +0200 Subject: [PATCH 01/97] patch 8.1.1271: compiler warnings for use of STRNCPY() Problem: Compiler warnings for use of STRNCPY(). (John Marriott) Solution: Use mch_memmove() instead of STRNCPY(). --- src/search.c | 6 +++--- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/search.c b/src/search.c index 3df3ca61d9..1fa52b443c 100644 --- a/src/search.c +++ b/src/search.c @@ -1415,10 +1415,10 @@ do_search( { // Use a space to draw the composing char on. msgbuf[1] = ' '; - STRNCPY(msgbuf + 2, p, STRLEN(p)); + mch_memmove(msgbuf + 2, p, STRLEN(p)); } else - STRNCPY(msgbuf + 1, p, STRLEN(p)); + mch_memmove(msgbuf + 1, p, STRLEN(p)); if (spats[0].off.line || spats[0].off.end || spats[0].off.off) { p = msgbuf + STRLEN(p) + 1; @@ -5006,7 +5006,7 @@ search_stat( else vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cur, cnt); } - STRNCPY(msgbuf + STRLEN(msgbuf) - STRLEN(t), t, STRLEN(t)); + mch_memmove(msgbuf + STRLEN(msgbuf) - STRLEN(t), t, STRLEN(t)); if (dirc == '?' && cur == 100) cur = -1; diff --git a/src/version.c b/src/version.c index 8dee65efac..0fa3c41194 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1271, /**/ 1270, /**/ From 711f02da6559a3557a9d626d5923c6ea17bd1477 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 13:14:28 +0200 Subject: [PATCH 02/97] patch 8.1.1272: click on WinBar of other window not tested Problem: Click on WinBar of other window not tested. Solution: Add a test case. --- src/testdir/test_winbar.vim | 49 +++++++++++++++++++++++++++++++++---- src/version.c | 2 ++ 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/testdir/test_winbar.vim b/src/testdir/test_winbar.vim index ada8f6ba2d..a34c29e412 100644 --- a/src/testdir/test_winbar.vim +++ b/src/testdir/test_winbar.vim @@ -27,20 +27,24 @@ func Test_add_remove_menu() close endfunc -func Test_click_in_winbar() - new +" Create a WinBar with three buttons. +" Columns of the button edges: +" _Next_ _Cont_ _Close_ +" 2 7 10 15 18 24 +func SetupWinbar() amenu 1.10 WinBar.Next :let g:did_next = 11 amenu 1.20 WinBar.Cont :let g:did_cont = 12 amenu 1.30 WinBar.Close :close redraw call assert_match('Next Cont Close', Screenline(1)) +endfunc +func Test_click_in_winbar() + new + call SetupWinbar() let save_mouse = &mouse set mouse=a - " Columns of the button edges: - " _Next_ _Cont_ _Close_ - " 2 7 10 15 18 24 let g:did_next = 0 let g:did_cont = 0 for col in [1, 8, 9, 16, 17, 25, 26] @@ -71,3 +75,38 @@ func Test_click_in_winbar() let &mouse = save_mouse endfunc + +func Test_click_in_other_winbar() + new + call SetupWinbar() + let save_mouse = &mouse + set mouse=a + let winid = win_getid() + + split + let [row, col] = win_screenpos(winid) + + " Click on Next button in other window + let g:did_next = 0 + call test_setmouse(row, 5) + call feedkeys("\", "xt") + call assert_equal(11, g:did_next) + + " Click on Cont button in other window from Visual mode + let g:did_cont = 0 + call setline(1, 'select XYZ here') + call test_setmouse(row, 12) + call feedkeys("0fXvfZ\x", "xt") + call assert_equal(12, g:did_cont) + call assert_equal('select here', getline(1)) + + " Click on Close button in other window + let wincount = winnr('$') + let winid = win_getid() + call test_setmouse(row, 20) + call feedkeys("\", "xt") + call assert_equal(wincount - 1, winnr('$')) + call assert_equal(winid, win_getid()) + + bwipe! +endfunc diff --git a/src/version.c b/src/version.c index 0fa3c41194..db12cd3916 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1272, /**/ 1271, /**/ From f653a6bcff48161b56eeb3a584011aab6665f1e7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 13:20:02 +0200 Subject: [PATCH 03/97] patch 8.1.1273: compiler warning in direct write code Problem: Compiler warning in direct write code. Solution: Add a type cast. --- src/gui_dwrite.cpp | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui_dwrite.cpp b/src/gui_dwrite.cpp index 3c477d0527..8767dc1af9 100644 --- a/src/gui_dwrite.cpp +++ b/src/gui_dwrite.cpp @@ -949,7 +949,7 @@ DWriteContext::SetDrawingMode(DrawingMode mode) if (mDrawing) { hr = mRT->EndDraw(); - if (hr == D2DERR_RECREATE_TARGET) + if (hr == (HRESULT)D2DERR_RECREATE_TARGET) { hr = S_OK; DiscardDeviceResources(); diff --git a/src/version.c b/src/version.c index db12cd3916..c8038f36f4 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1273, /**/ 1272, /**/ From ce79353ace9e21238f13655089363cd23cbb6b32 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 14:19:20 +0200 Subject: [PATCH 04/97] patch 8.1.1274: after :unmenu can still execute the menu with :emenu Problem: After :unmenu can still execute the menu with :emenu. Solution: Do not execute a menu that was disabled for the specified mode. --- src/menu.c | 3 ++- src/testdir/test_menu.vim | 17 ++++++++++++++++- src/version.c | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/menu.c b/src/menu.c index 21d3e11766..6e0c02ec3b 100644 --- a/src/menu.c +++ b/src/menu.c @@ -2337,7 +2337,8 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx) if (idx == -1 || eap == NULL) idx = MENU_INDEX_NORMAL; - if (idx != MENU_INDEX_INVALID && menu->strings[idx] != NULL) + if (idx != MENU_INDEX_INVALID && menu->strings[idx] != NULL + && (menu->modes & (1 << idx))) { /* When executing a script or function execute the commands right now. * Also for the window toolbar. diff --git a/src/testdir/test_menu.vim b/src/testdir/test_menu.vim index 6462d5196c..b57fdc3de2 100644 --- a/src/testdir/test_menu.vim +++ b/src/testdir/test_menu.vim @@ -54,8 +54,23 @@ func Test_menu_commands() emenu c Test.FooBar call assert_equal('cmdline', g:did_menu) - aunmenu Test.FooBar + nunmenu Test.FooBar + call assert_fails('emenu n Test.FooBar', 'E335: Menu not defined for Normal mode') + vunmenu Test.FooBar + call assert_fails('emenu v Test.FooBar', 'E335: Menu not defined for Visual mode') + vmenu 2 Test.FooBar :let g:did_menu = 'visual' + sunmenu Test.FooBar + call assert_fails('emenu s Test.FooBar', 'E335: Menu not defined for Select mode') + ounmenu Test.FooBar + call assert_fails('emenu o Test.FooBar', 'E335: Menu not defined for Op-pending mode') + iunmenu Test.FooBar + call assert_fails('emenu i Test.FooBar', 'E335: Menu not defined for Insert mode') + cunmenu Test.FooBar + call assert_fails('emenu c Test.FooBar', 'E335: Menu not defined for Cmdline mode') tlunmenu Test.FooBar + call assert_fails('emenu t Test.FooBar', 'E335: Menu not defined for Terminal mode') + + aunmenu Test.FooBar call assert_fails('emenu n Test.FooBar', 'E334:') nmenu 2 Test.FooBar.Child :let g:did_menu = 'foobar' diff --git a/src/version.c b/src/version.c index c8038f36f4..a2e23978db 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1274, /**/ 1273, /**/ From cf6a55c4b0cbf38b0c3fbed5ffd9a3fd0d2ede0e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 15:02:30 +0200 Subject: [PATCH 05/97] patch 8.1.1275: cannot navigate to errors before/after the cursor Problem: Cannot navigate to errors before/after the cursor. Solution: Add the :cbefore and :cafter commands. (Yegappan Lakshmanan, closes #4340) --- runtime/doc/index.txt | 8 +- runtime/doc/quickfix.txt | 32 +++++- src/ex_cmdidxs.h | 52 ++++----- src/ex_cmds.h | 12 ++ src/quickfix.c | 201 +++++++++++++++++++++++++--------- src/testdir/test_quickfix.vim | 71 +++++++++++- src/version.c | 2 + 7 files changed, 297 insertions(+), 81 deletions(-) diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 7192905561..9b5663e1e4 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1192,9 +1192,11 @@ tag command action ~ |:caddbuffer| :cad[dbuffer] add errors from buffer |:caddexpr| :cadde[xpr] add errors from expr |:caddfile| :caddf[ile] add error message to current quickfix list +|:cafter| :caf[ter] go to error after current cursor |:call| :cal[l] call a function |:catch| :cat[ch] part of a :try command -|:cbelow| :cbe[low] got to error below current line +|:cbefore| :cbef[ore] go to error before current cursor +|:cbelow| :cbel[ow] go to error below current line |:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window |:cbuffer| :cb[uffer] parse error messages and jump to first error |:cc| :cc go to specific error @@ -1356,10 +1358,12 @@ tag command action ~ |:laddexpr| :lad[dexpr] add locations from expr |:laddbuffer| :laddb[uffer] add locations from buffer |:laddfile| :laddf[ile] add locations to current location list +|:lafter| :laf[ter] go to location after current cursor |:last| :la[st] go to the last file in the argument list |:language| :lan[guage] set the language (locale) |:later| :lat[er] go to newer change, redo -|:lbelow| :lbe[low] go to location below current line +|:lbefore| :lbef[ore] go to location before current cursor +|:lbelow| :lbel[ow] go to location below current line |:lbottom| :lbo[ttom] scroll to the bottom of the location window |:lbuffer| :lb[uffer] parse locations and jump to first location |:lcd| :lc[d] change directory locally diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 1f28f9bf7e..ef084fac57 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -152,8 +152,36 @@ processing a quickfix or location list command, it will be aborted. exceeds the number of entries below the current line, then the last error in the file is selected. - *:lbe* *:lbelow* -:[count]lbe[low] Same as ":cbelow", except the location list for the + *:lbel* *:lbelow* +:[count]lbel[ow] Same as ":cbelow", except the location list for the + current window is used instead of the quickfix list. + + *:cbe* *:cbefore* +:[count]cbe[fore] Go to the [count] error before the current cursor + position in the current buffer. If [count] is + omitted, then 1 is used. If there are no errors, then + an error message is displayed. Assumes that the + entries in a quickfix list are sorted by their buffer, + line and column numbers. If [count] exceeds the + number of entries before the current position, then + the first error in the file is selected. + + *:lbef* *:lbefore* +:[count]lbef[ore] Same as ":cbefore", except the location list for the + current window is used instead of the quickfix list. + + *:caf* *:cafter* +:[count]caf[ter] Go to the [count] error after the current cursor + position in the current buffer. If [count] is + omitted, then 1 is used. If there are no errors, then + an error message is displayed. Assumes that the + entries in a quickfix list are sorted by their buffer, + line and column numbers. If [count] exceeds the + number of entries after the current position, then + the last error in the file is selected. + + *:laf* *:lafter* +:[count]laf[ter] Same as ":cafter", except the location list for the current window is used instead of the quickfix list. *:cnf* *:cnfile* diff --git a/src/ex_cmdidxs.h b/src/ex_cmdidxs.h index c63aa46f5a..6b96c6cfa1 100644 --- a/src/ex_cmdidxs.h +++ b/src/ex_cmdidxs.h @@ -8,29 +8,29 @@ static const unsigned short cmdidxs1[26] = /* a */ 0, /* b */ 19, /* c */ 42, - /* d */ 105, - /* e */ 127, - /* f */ 147, - /* g */ 163, - /* h */ 169, - /* i */ 178, - /* j */ 196, - /* k */ 198, - /* l */ 203, - /* m */ 263, - /* n */ 281, - /* o */ 301, - /* p */ 313, - /* q */ 352, - /* r */ 355, - /* s */ 375, - /* t */ 443, - /* u */ 488, - /* v */ 499, - /* w */ 517, - /* x */ 531, - /* y */ 540, - /* z */ 541 + /* d */ 107, + /* e */ 129, + /* f */ 149, + /* g */ 165, + /* h */ 171, + /* i */ 180, + /* j */ 198, + /* k */ 200, + /* l */ 205, + /* m */ 267, + /* n */ 285, + /* o */ 305, + /* p */ 317, + /* q */ 356, + /* r */ 359, + /* s */ 379, + /* t */ 447, + /* u */ 492, + /* v */ 503, + /* w */ 521, + /* x */ 535, + /* y */ 544, + /* z */ 545 }; /* @@ -43,7 +43,7 @@ static const unsigned char cmdidxs2[26][26] = { /* a b c d e f g h i j k l m n o p q r s t u v w x y z */ /* a */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 7, 15, 0, 16, 0, 0, 0, 0, 0 }, /* b */ { 2, 0, 0, 4, 5, 7, 0, 0, 0, 0, 0, 8, 9, 10, 11, 12, 0, 13, 0, 0, 0, 0, 22, 0, 0, 0 }, - /* c */ { 3, 11, 14, 16, 18, 20, 23, 0, 0, 0, 0, 31, 35, 38, 44, 53, 55, 56, 57, 0, 59, 0, 62, 0, 0, 0 }, + /* c */ { 3, 12, 16, 18, 20, 22, 25, 0, 0, 0, 0, 33, 37, 40, 46, 55, 57, 58, 59, 0, 61, 0, 64, 0, 0, 0 }, /* d */ { 0, 0, 0, 0, 0, 0, 0, 0, 6, 15, 0, 16, 0, 0, 17, 0, 0, 19, 20, 0, 0, 0, 0, 0, 0, 0 }, /* e */ { 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0 }, /* f */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0 }, @@ -52,7 +52,7 @@ static const unsigned char cmdidxs2[26][26] = /* i */ { 1, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 5, 6, 0, 0, 0, 0, 0, 13, 0, 15, 0, 0, 0, 0, 0 }, /* j */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }, /* k */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - /* l */ { 3, 10, 13, 17, 18, 22, 25, 30, 0, 0, 0, 32, 35, 38, 42, 48, 0, 50, 59, 51, 52, 56, 58, 0, 0, 0 }, + /* l */ { 3, 11, 15, 19, 20, 24, 27, 32, 0, 0, 0, 34, 37, 40, 44, 50, 0, 52, 61, 53, 54, 58, 60, 0, 0, 0 }, /* m */ { 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 }, /* n */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0 }, /* o */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, 9, 0, 11, 0, 0, 0 }, @@ -69,4 +69,4 @@ static const unsigned char cmdidxs2[26][26] = /* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -static const int command_count = 554; +static const int command_count = 558; diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 58aa8c313f..9e420b3fd1 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -266,6 +266,9 @@ EX(CMD_caddexpr, "caddexpr", ex_cexpr, EX(CMD_caddfile, "caddfile", ex_cfile, TRLBAR|FILE1, ADDR_NONE), +EX(CMD_cafter, "cafter", ex_cbelow, + RANGE|COUNT|TRLBAR, + ADDR_UNSIGNED), EX(CMD_call, "call", ex_call, RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN, ADDR_LINES), @@ -275,6 +278,9 @@ EX(CMD_catch, "catch", ex_catch, EX(CMD_cbuffer, "cbuffer", ex_cbuffer, BANG|RANGE|WORD1|TRLBAR, ADDR_OTHER), +EX(CMD_cbefore, "cbefore", ex_cbelow, + RANGE|COUNT|TRLBAR, + ADDR_UNSIGNED), EX(CMD_cbelow, "cbelow", ex_cbelow, RANGE|COUNT|TRLBAR, ADDR_UNSIGNED), @@ -749,12 +755,18 @@ EX(CMD_laddbuffer, "laddbuffer", ex_cbuffer, EX(CMD_laddfile, "laddfile", ex_cfile, TRLBAR|FILE1, ADDR_NONE), +EX(CMD_lafter, "lafter", ex_cbelow, + RANGE|COUNT|TRLBAR, + ADDR_UNSIGNED), EX(CMD_later, "later", ex_later, TRLBAR|EXTRA|NOSPC|CMDWIN, ADDR_NONE), EX(CMD_lbuffer, "lbuffer", ex_cbuffer, BANG|RANGE|WORD1|TRLBAR, ADDR_OTHER), +EX(CMD_lbefore, "lbefore", ex_cbelow, + RANGE|COUNT|TRLBAR, + ADDR_UNSIGNED), EX(CMD_lbelow, "lbelow", ex_cbelow, RANGE|COUNT|TRLBAR, ADDR_UNSIGNED), diff --git a/src/quickfix.c b/src/quickfix.c index c11436a006..b4497ae754 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -5128,36 +5128,100 @@ qf_find_last_entry_on_line(qfline_T *entry, int *errornr) } /* - * Find the first quickfix entry below line 'lnum' in buffer 'bnr'. + * Returns TRUE if the specified quickfix entry is + * after the given line (linewise is TRUE) + * or after the line and column. + */ + static int +qf_entry_after_pos(qfline_T *qfp, pos_T *pos, int linewise) +{ + if (linewise) + return qfp->qf_lnum > pos->lnum; + else + return (qfp->qf_lnum > pos->lnum || + (qfp->qf_lnum == pos->lnum && qfp->qf_col > pos->col)); +} + +/* + * Returns TRUE if the specified quickfix entry is + * before the given line (linewise is TRUE) + * or before the line and column. + */ + static int +qf_entry_before_pos(qfline_T *qfp, pos_T *pos, int linewise) +{ + if (linewise) + return qfp->qf_lnum < pos->lnum; + else + return (qfp->qf_lnum < pos->lnum || + (qfp->qf_lnum == pos->lnum && qfp->qf_col < pos->col)); +} + +/* + * Returns TRUE if the specified quickfix entry is + * on or after the given line (linewise is TRUE) + * or on or after the line and column. + */ + static int +qf_entry_on_or_after_pos(qfline_T *qfp, pos_T *pos, int linewise) +{ + if (linewise) + return qfp->qf_lnum >= pos->lnum; + else + return (qfp->qf_lnum > pos->lnum || + (qfp->qf_lnum == pos->lnum && qfp->qf_col >= pos->col)); +} + +/* + * Returns TRUE if the specified quickfix entry is + * on or before the given line (linewise is TRUE) + * or on or before the line and column. + */ + static int +qf_entry_on_or_before_pos(qfline_T *qfp, pos_T *pos, int linewise) +{ + if (linewise) + return qfp->qf_lnum <= pos->lnum; + else + return (qfp->qf_lnum < pos->lnum || + (qfp->qf_lnum == pos->lnum && qfp->qf_col <= pos->col)); +} + +/* + * Find the first quickfix entry after position 'pos' in buffer 'bnr'. + * If 'linewise' is TRUE, returns the entry after the specified line and treats + * multiple entries on a single line as one. Otherwise returns the entry after + * the specified line and column. * 'qfp' points to the very first entry in the buffer and 'errornr' is the * index of the very first entry in the quickfix list. - * Returns NULL if an entry is not found after 'lnum'. + * Returns NULL if an entry is not found after 'pos'. */ static qfline_T * -qf_find_entry_on_next_line( +qf_find_entry_after_pos( int bnr, - linenr_T lnum, + pos_T *pos, + int linewise, qfline_T *qfp, int *errornr) { - if (qfp->qf_lnum > lnum) - // First entry is after line 'lnum' + if (qf_entry_after_pos(qfp, pos, linewise)) + // First entry is after postion 'pos' return qfp; - // Find the entry just before or at the line 'lnum' + // Find the entry just before or at the position 'pos' while (qfp->qf_next != NULL && qfp->qf_next->qf_fnum == bnr - && qfp->qf_next->qf_lnum <= lnum) + && qf_entry_on_or_before_pos(qfp->qf_next, pos, linewise)) { qfp = qfp->qf_next; ++*errornr; } if (qfp->qf_next == NULL || qfp->qf_next->qf_fnum != bnr) - // No entries found after 'lnum' + // No entries found after position 'pos' return NULL; - // Use the entry just after line 'lnum' + // Use the entry just after position 'pos' qfp = qfp->qf_next; ++*errornr; @@ -5165,46 +5229,52 @@ qf_find_entry_on_next_line( } /* - * Find the first quickfix entry before line 'lnum' in buffer 'bnr'. + * Find the first quickfix entry before position 'pos' in buffer 'bnr'. + * If 'linewise' is TRUE, returns the entry before the specified line and + * treats multiple entries on a single line as one. Otherwise returns the entry + * before the specified line and column. * 'qfp' points to the very first entry in the buffer and 'errornr' is the * index of the very first entry in the quickfix list. - * Returns NULL if an entry is not found before 'lnum'. + * Returns NULL if an entry is not found before 'pos'. */ static qfline_T * -qf_find_entry_on_prev_line( +qf_find_entry_before_pos( int bnr, - linenr_T lnum, + pos_T *pos, + int linewise, qfline_T *qfp, int *errornr) { - // Find the entry just before the line 'lnum' + // Find the entry just before the position 'pos' while (qfp->qf_next != NULL && qfp->qf_next->qf_fnum == bnr - && qfp->qf_next->qf_lnum < lnum) + && qf_entry_before_pos(qfp->qf_next, pos, linewise)) { qfp = qfp->qf_next; ++*errornr; } - if (qfp->qf_lnum >= lnum) // entry is after 'lnum' + if (qf_entry_on_or_after_pos(qfp, pos, linewise)) return NULL; - // If multiple entries are on the same line, then use the first entry - qfp = qf_find_first_entry_on_line(qfp, errornr); + if (linewise) + // If multiple entries are on the same line, then use the first entry + qfp = qf_find_first_entry_on_line(qfp, errornr); return qfp; } /* - * Find a quickfix entry in 'qfl' closest to line 'lnum' in buffer 'bnr' in + * Find a quickfix entry in 'qfl' closest to position 'pos' in buffer 'bnr' in * the direction 'dir'. */ static qfline_T * qf_find_closest_entry( qf_list_T *qfl, int bnr, - linenr_T lnum, + pos_T *pos, int dir, + int linewise, int *errornr) { qfline_T *qfp; @@ -5217,35 +5287,40 @@ qf_find_closest_entry( return NULL; // no entry in this file if (dir == FORWARD) - qfp = qf_find_entry_on_next_line(bnr, lnum, qfp, errornr); + qfp = qf_find_entry_after_pos(bnr, pos, linewise, qfp, errornr); else - qfp = qf_find_entry_on_prev_line(bnr, lnum, qfp, errornr); + qfp = qf_find_entry_before_pos(bnr, pos, linewise, qfp, errornr); return qfp; } /* - * Get the nth quickfix entry below the specified entry treating multiple - * entries on a single line as one. Searches forward in the list. + * Get the nth quickfix entry below the specified entry. Searches forward in + * the list. If linewise is TRUE, then treat multiple entries on a single line + * as one. */ static qfline_T * -qf_get_nth_below_entry(qfline_T *entry, int *errornr, int n) +qf_get_nth_below_entry(qfline_T *entry, int n, int linewise, int *errornr) { while (n-- > 0 && !got_int) { qfline_T *first_entry = entry; int first_errornr = *errornr; - // Treat all the entries on the same line in this file as one - entry = qf_find_last_entry_on_line(entry, errornr); + if (linewise) + // Treat all the entries on the same line in this file as one + entry = qf_find_last_entry_on_line(entry, errornr); if (entry->qf_next == NULL || entry->qf_next->qf_fnum != entry->qf_fnum) { - // If multiple entries are on the same line, then use the first - // entry - entry = first_entry; - *errornr = first_errornr; + if (linewise) + { + // If multiple entries are on the same line, then use the first + // entry + entry = first_entry; + *errornr = first_errornr; + } break; } @@ -5257,11 +5332,12 @@ qf_get_nth_below_entry(qfline_T *entry, int *errornr, int n) } /* - * Get the nth quickfix entry above the specified entry treating multiple - * entries on a single line as one. Searches backwards in the list. + * Get the nth quickfix entry above the specified entry. Searches backwards in + * the list. If linewise is TRUE, then treat multiple entries on a single line + * as one. */ static qfline_T * -qf_get_nth_above_entry(qfline_T *entry, int *errornr, int n) +qf_get_nth_above_entry(qfline_T *entry, int n, int linewise, int *errornr) { while (n-- > 0 && !got_int) { @@ -5273,25 +5349,32 @@ qf_get_nth_above_entry(qfline_T *entry, int *errornr, int n) --*errornr; // If multiple entries are on the same line, then use the first entry - entry = qf_find_first_entry_on_line(entry, errornr); + if (linewise) + entry = qf_find_first_entry_on_line(entry, errornr); } return entry; } /* - * Find the n'th quickfix entry adjacent to line 'lnum' in buffer 'bnr' in the - * specified direction. - * Returns the error number in the quickfix list or 0 if an entry is not found. + * Find the n'th quickfix entry adjacent to position 'pos' in buffer 'bnr' in + * the specified direction. Returns the error number in the quickfix list or 0 + * if an entry is not found. */ static int -qf_find_nth_adj_entry(qf_list_T *qfl, int bnr, linenr_T lnum, int n, int dir) +qf_find_nth_adj_entry( + qf_list_T *qfl, + int bnr, + pos_T *pos, + int n, + int dir, + int linewise) { qfline_T *adj_entry; int errornr; - // Find an entry closest to the specified line - adj_entry = qf_find_closest_entry(qfl, bnr, lnum, dir, &errornr); + // Find an entry closest to the specified position + adj_entry = qf_find_closest_entry(qfl, bnr, pos, dir, linewise, &errornr); if (adj_entry == NULL) return 0; @@ -5299,17 +5382,21 @@ qf_find_nth_adj_entry(qf_list_T *qfl, int bnr, linenr_T lnum, int n, int dir) { // Go to the n'th entry in the current buffer if (dir == FORWARD) - adj_entry = qf_get_nth_below_entry(adj_entry, &errornr, n); + adj_entry = qf_get_nth_below_entry(adj_entry, n, linewise, + &errornr); else - adj_entry = qf_get_nth_above_entry(adj_entry, &errornr, n); + adj_entry = qf_get_nth_above_entry(adj_entry, n, linewise, + &errornr); } return errornr; } /* - * Jump to a quickfix entry in the current file nearest to the current line. - * ":cabove", ":cbelow", ":labove" and ":lbelow" commands + * Jump to a quickfix entry in the current file nearest to the current line or + * current line/col. + * ":cabove", ":cbelow", ":labove", ":lbelow", ":cafter", ":cbefore", + * ":lafter" and ":lbefore" commands */ void ex_cbelow(exarg_T *eap) @@ -5319,6 +5406,7 @@ ex_cbelow(exarg_T *eap) int dir; int buf_has_flag; int errornr = 0; + pos_T pos; if (eap->addr_count > 0 && eap->line2 <= 0) { @@ -5327,7 +5415,8 @@ ex_cbelow(exarg_T *eap) } // Check whether the current buffer has any quickfix entries - if (eap->cmdidx == CMD_cabove || eap->cmdidx == CMD_cbelow) + if (eap->cmdidx == CMD_cabove || eap->cmdidx == CMD_cbelow + || eap->cmdidx == CMD_cbefore || eap->cmdidx == CMD_cafter) buf_has_flag = BUF_HAS_QF_ENTRY; else buf_has_flag = BUF_HAS_LL_ENTRY; @@ -5348,13 +5437,25 @@ ex_cbelow(exarg_T *eap) return; } - if (eap->cmdidx == CMD_cbelow || eap->cmdidx == CMD_lbelow) + if (eap->cmdidx == CMD_cbelow + || eap->cmdidx == CMD_lbelow + || eap->cmdidx == CMD_cafter + || eap->cmdidx == CMD_lafter) + // Forward motion commands dir = FORWARD; else dir = BACKWARD; - errornr = qf_find_nth_adj_entry(qfl, curbuf->b_fnum, curwin->w_cursor.lnum, - eap->addr_count > 0 ? eap->line2 : 0, dir); + pos = curwin->w_cursor; + // A quickfix entry column number is 1 based whereas cursor column + // number is 0 based. Adjust the column number. + pos.col++; + errornr = qf_find_nth_adj_entry(qfl, curbuf->b_fnum, &pos, + eap->addr_count > 0 ? eap->line2 : 0, dir, + eap->cmdidx == CMD_cbelow + || eap->cmdidx == CMD_lbelow + || eap->cmdidx == CMD_cabove + || eap->cmdidx == CMD_labove); if (errornr > 0) qf_jump(qi, 0, errornr, FALSE); diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 092853c500..ae3aec5222 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -39,6 +39,8 @@ func s:setup_commands(cchar) command! -nargs=0 -count Xcc cc command! -count=1 -nargs=0 Xbelow cbelow command! -count=1 -nargs=0 Xabove cabove + command! -count=1 -nargs=0 Xbefore cbefore + command! -count=1 -nargs=0 Xafter cafter let g:Xgetlist = function('getqflist') let g:Xsetlist = function('setqflist') call setqflist([], 'f') @@ -74,6 +76,8 @@ func s:setup_commands(cchar) command! -nargs=0 -count Xcc ll command! -count=1 -nargs=0 Xbelow lbelow command! -count=1 -nargs=0 Xabove labove + command! -count=1 -nargs=0 Xbefore lbefore + command! -count=1 -nargs=0 Xafter lafter let g:Xgetlist = function('getloclist', [0]) let g:Xsetlist = function('setloclist', [0]) call setloclist(0, [], 'f') @@ -4041,17 +4045,22 @@ func Test_empty_qfbuf() endfunc " Test for the :cbelow, :cabove, :lbelow and :labove commands. +" And for the :cafter, :cbefore, :lafter and :lbefore commands. func Xtest_below(cchar) call s:setup_commands(a:cchar) " No quickfix/location list call assert_fails('Xbelow', 'E42:') call assert_fails('Xabove', 'E42:') + call assert_fails('Xbefore', 'E42:') + call assert_fails('Xafter', 'E42:') " Empty quickfix/location list call g:Xsetlist([]) call assert_fails('Xbelow', 'E42:') call assert_fails('Xabove', 'E42:') + call assert_fails('Xbefore', 'E42:') + call assert_fails('Xafter', 'E42:') call s:create_test_file('X1') call s:create_test_file('X2') @@ -4065,39 +4074,74 @@ func Xtest_below(cchar) call assert_fails('Xabove', 'E42:') call assert_fails('3Xbelow', 'E42:') call assert_fails('4Xabove', 'E42:') + call assert_fails('Xbefore', 'E42:') + call assert_fails('Xafter', 'E42:') + call assert_fails('3Xbefore', 'E42:') + call assert_fails('4Xafter', 'E42:') " Test the commands with various arguments - Xexpr ["X1:5:L5", "X2:5:L5", "X2:10:L10", "X2:15:L15", "X3:3:L3"] + Xexpr ["X1:5:3:L5", "X2:5:2:L5", "X2:10:3:L10", "X2:15:4:L15", "X3:3:5:L3"] edit +7 X2 Xabove call assert_equal(['X2', 5], [bufname(''), line('.')]) call assert_fails('Xabove', 'E553:') + normal 7G + Xbefore + call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')]) + call assert_fails('Xbefore', 'E553:') + normal 2j Xbelow call assert_equal(['X2', 10], [bufname(''), line('.')]) + normal 7G + Xafter + call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')]) + " Last error in this file Xbelow 99 call assert_equal(['X2', 15], [bufname(''), line('.')]) call assert_fails('Xbelow', 'E553:') + normal gg + Xafter 99 + call assert_equal(['X2', 15, 4], [bufname(''), line('.'), col('.')]) + call assert_fails('Xafter', 'E553:') + " First error in this file Xabove 99 call assert_equal(['X2', 5], [bufname(''), line('.')]) call assert_fails('Xabove', 'E553:') + normal G + Xbefore 99 + call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')]) + call assert_fails('Xbefore', 'E553:') + normal gg Xbelow 2 call assert_equal(['X2', 10], [bufname(''), line('.')]) + normal gg + Xafter 2 + call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')]) + normal G Xabove 2 call assert_equal(['X2', 10], [bufname(''), line('.')]) + normal G + Xbefore 2 + call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')]) + edit X4 call assert_fails('Xabove', 'E42:') call assert_fails('Xbelow', 'E42:') + call assert_fails('Xbefore', 'E42:') + call assert_fails('Xafter', 'E42:') if a:cchar == 'l' " If a buffer has location list entries from some other window but not " from the current window, then the commands should fail. edit X1 | split | call setloclist(0, [], 'f') call assert_fails('Xabove', 'E776:') call assert_fails('Xbelow', 'E776:') + call assert_fails('Xbefore', 'E776:') + call assert_fails('Xafter', 'E776:') close endif @@ -4108,27 +4152,52 @@ func Xtest_below(cchar) edit +1 X2 Xbelow 2 call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')]) + normal 1G + Xafter 2 + call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')]) + normal gg Xbelow 99 call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')]) + normal gg + Xafter 99 + call assert_equal(['X2', 15, 3], [bufname(''), line('.'), col('.')]) + normal G Xabove 2 call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')]) + normal G + Xbefore 2 + call assert_equal(['X2', 15, 2], [bufname(''), line('.'), col('.')]) + normal G Xabove 99 call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')]) + normal G + Xbefore 99 + call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')]) + normal 10G Xabove call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')]) + normal 10G$ + 2Xbefore + call assert_equal(['X2', 10, 2], [bufname(''), line('.'), col('.')]) + normal 10G Xbelow call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')]) + normal 9G + 5Xafter + call assert_equal(['X2', 15, 2], [bufname(''), line('.'), col('.')]) " Invalid range if a:cchar == 'c' call assert_fails('-2cbelow', 'E16:') + call assert_fails('-2cafter', 'E16:') else call assert_fails('-2lbelow', 'E16:') + call assert_fails('-2lafter', 'E16:') endif call delete('X1') diff --git a/src/version.c b/src/version.c index a2e23978db..6838624550 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1275, /**/ 1274, /**/ From de24a8701328b1cce7cad0ee11b415369b482420 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 15:48:00 +0200 Subject: [PATCH 06/97] patch 8.1.1276: cannot combine text properties with syntax highlighting Problem: Cannot combine text properties with syntax highlighting. Solution: Add the "combine" field to prop_type_add(). (closes #4343) --- runtime/doc/eval.txt | 3 +++ runtime/doc/textprop.txt | 6 +++++- src/screen.c | 34 +++++++++++++++++++++++----------- src/structs.h | 1 + src/testdir/test_textprop.vim | 17 +++++++++++++++-- src/version.c | 2 ++ 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index bc18daaca2..e1ce00fa63 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -7218,6 +7218,9 @@ prop_type_add({name}, {props}) *prop_type_add()* *E969* *E970* properties the one with the highest priority will be used; negative values can be used, the default priority is zero + combine when TRUE combine the highlight with any + syntax highlight; when omitted of FALSE syntax + highlight will not be used start_incl when TRUE inserts at the start position will be included in the text property end_incl when TRUE inserts at the end position will be diff --git a/runtime/doc/textprop.txt b/runtime/doc/textprop.txt index 375255134a..263c40eb1c 100644 --- a/runtime/doc/textprop.txt +++ b/runtime/doc/textprop.txt @@ -1,4 +1,4 @@ -*textprop.txt* For Vim version 8.1. Last change: 2019 Jan 08 +*textprop.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -57,6 +57,10 @@ Property Types ~ A text property normally has the name of a property type, which defines how to highlight the text. The property type can have these entries: "highlight" name of the highlight group to use + "combine" when TRUE the text property highlighting is combined + with any syntax highligting, when omitted or FALSE the + text property highlighting replaces the syntax + highlighting "priority" when properties overlap, the one with the highest priority will be used. "start_incl" when TRUE inserts at the start position will be diff --git a/src/screen.c b/src/screen.c index 862a635842..eb81bee84a 100644 --- a/src/screen.c +++ b/src/screen.c @@ -3059,6 +3059,7 @@ win_line( int text_props_active = 0; proptype_T *text_prop_type = NULL; int text_prop_attr = 0; + int text_prop_combine = FALSE; #endif #ifdef FEAT_SPELL int has_spell = FALSE; /* this buffer has spell checking */ @@ -4261,6 +4262,7 @@ win_line( text_prop_idxs[text_props_active++] = text_prop_next++; text_prop_attr = 0; + text_prop_combine = FALSE; if (text_props_active > 0) { // Sort the properties on priority and/or starting last. @@ -4273,17 +4275,17 @@ win_line( for (pi = 0; pi < text_props_active; ++pi) { int tpi = text_prop_idxs[pi]; - proptype_T *pt = text_prop_type_by_id(wp->w_buffer, text_props[tpi].tp_type); + proptype_T *pt = text_prop_type_by_id( + wp->w_buffer, text_props[tpi].tp_type); if (pt != NULL) { int pt_attr = syn_id2attr(pt->pt_hl_id); text_prop_type = pt; - if (text_prop_attr == 0) - text_prop_attr = pt_attr; - else - text_prop_attr = hl_combine_attr(text_prop_attr, pt_attr); + text_prop_attr = + hl_combine_attr(text_prop_attr, pt_attr); + text_prop_combine = pt->pt_flags & PT_FLAG_COMBINE; } } } @@ -4314,7 +4316,13 @@ win_line( attr_pri = FALSE; #ifdef FEAT_TEXT_PROP if (text_prop_type != NULL) - char_attr = text_prop_attr; + { + if (text_prop_combine) + char_attr = hl_combine_attr( + syntax_attr, text_prop_attr); + else + char_attr = text_prop_attr; + } else #endif #ifdef FEAT_SYN_HL @@ -4664,14 +4672,18 @@ win_line( ptr = line + v; # ifdef FEAT_TEXT_PROP - // Text properties overrule syntax highlighting. - if (text_prop_attr == 0) -#endif + // Text properties overrule syntax highlighting or combine. + if (text_prop_attr == 0 || text_prop_combine) +# endif { + int comb_attr = syntax_attr; +# ifdef FEAT_TEXT_PROP + comb_attr = hl_combine_attr(text_prop_attr, comb_attr); +# endif if (!attr_pri) - char_attr = syntax_attr; + char_attr = comb_attr; else - char_attr = hl_combine_attr(syntax_attr, char_attr); + char_attr = hl_combine_attr(comb_attr, char_attr); } # ifdef FEAT_CONCEAL /* no concealing past the end of the line, it interferes diff --git a/src/structs.h b/src/structs.h index c992e2a7ff..fa8a7655fa 100644 --- a/src/structs.h +++ b/src/structs.h @@ -727,6 +727,7 @@ typedef struct proptype_S #define PT_FLAG_INS_START_INCL 1 // insert at start included in property #define PT_FLAG_INS_END_INCL 2 // insert at end included in property +#define PT_FLAG_COMBINE 4 // combine with syntax highlight // Sign group typedef struct signgroup_S diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index eab7aaab79..a48aa91a43 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -559,14 +559,23 @@ funct Test_textprop_screenshots() return endif call writefile([ - \ "call setline(1, ['One two', 'Numbér 123 änd thœn 4¾7.', '--aa--bb--cc--dd--'])", + \ "call setline(1, [" + \ .. "'One two'," + \ .. "'Numbér 123 änd thœn 4¾7.'," + \ .. "'--aa--bb--cc--dd--'," + \ .. "'// comment with error in it'," + \ .. "])", \ "hi NumberProp ctermfg=blue", \ "hi LongProp ctermbg=yellow", + \ "hi BackgroundProp ctermbg=lightgrey", + \ "hi UnderlineProp cterm=underline", \ "call prop_type_add('number', {'highlight': 'NumberProp'})", \ "call prop_type_add('long', {'highlight': 'LongProp'})", \ "call prop_type_add('start', {'highlight': 'NumberProp', 'start_incl': 1})", \ "call prop_type_add('end', {'highlight': 'NumberProp', 'end_incl': 1})", \ "call prop_type_add('both', {'highlight': 'NumberProp', 'start_incl': 1, 'end_incl': 1})", + \ "call prop_type_add('background', {'highlight': 'BackgroundProp', 'combine': 1})", + \ "call prop_type_add('error', {'highlight': 'UnderlineProp', 'combine': 1})", \ "call prop_add(1, 4, {'end_lnum': 3, 'end_col': 3, 'type': 'long'})", \ "call prop_add(2, 9, {'length': 3, 'type': 'number'})", \ "call prop_add(2, 24, {'length': 4, 'type': 'number'})", @@ -574,13 +583,17 @@ funct Test_textprop_screenshots() \ "call prop_add(3, 7, {'length': 2, 'type': 'start'})", \ "call prop_add(3, 11, {'length': 2, 'type': 'end'})", \ "call prop_add(3, 15, {'length': 2, 'type': 'both'})", + \ "call prop_add(4, 12, {'length': 10, 'type': 'background'})", + \ "call prop_add(4, 17, {'length': 5, 'type': 'error'})", \ "set number", \ "hi clear SpellBad", \ "set spell", + \ "syn match Comment '//.*'", + \ "hi Comment ctermfg=green", \ "normal 3G0llix\lllix\lllix\lllix\lllix\lllix\lllix\lllix\", \ "normal 3G0lli\\", \], 'XtestProp') - let buf = RunVimInTerminal('-S XtestProp', {'rows': 6}) + let buf = RunVimInTerminal('-S XtestProp', {'rows': 7}) call VerifyScreenDump(buf, 'Test_textprop_01', {}) " clean up diff --git a/src/version.c b/src/version.c index 6838624550..3e2f472467 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1276, /**/ 1275, /**/ From 8fc0271e9a5b67b849abb861f630f50e612b330b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 16:10:32 +0200 Subject: [PATCH 07/97] patch 8.1.1277: missing screenshot update Problem: Missing screenshot update. Solution: Update the screenshot. --- src/testdir/dumps/Test_textprop_01.dump | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/testdir/dumps/Test_textprop_01.dump b/src/testdir/dumps/Test_textprop_01.dump index 8687a0ab88..002062e2c8 100644 --- a/src/testdir/dumps/Test_textprop_01.dump +++ b/src/testdir/dumps/Test_textprop_01.dump @@ -1,6 +1,7 @@ | +0#af5f00255#ffffff0@1|1| |O+0#0000000&|n|e| +0&#ffff4012|t|w|o| +0&#ffffff0@63 | +0#af5f00255&@1|2| |N+0#0000000#ffff4012|u|m|b|é|r| |1+0#4040ff13&|2|3| +0#0000000&|ä|n|d| |t|h|œ|n| |4+0#4040ff13&|¾|7|.+0#0000000&| +0&#ffffff0@46 | +0#af5f00255&@1|3| >-+0#0000000#ffff4012|x+0&#ffffff0|a+0#4040ff13&@1|x+0#0000000&|-@1|x+0#4040ff13&|b@1|x+0#0000000&|-@1|x|c+0#4040ff13&@1|x|-+0#0000000&@1|x+0#4040ff13&|d@1|x|-+0#0000000&@1| @45 +| +0#af5f00255&@1|4| |/+0#40ff4011&@1| |c|o|m@1|e|n|t| |w+0&#e0e0e08|i|t|h| |e+8&&|r@1|o|r| +0&#ffffff0|i|n| |i|t| +0#0000000&@43 |~+0#4040ff13&| @73 |~| @73 | +0#0000000&@56|3|,|1| @10|A|l@1| diff --git a/src/version.c b/src/version.c index 3e2f472467..7930e3c907 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1277, /**/ 1276, /**/ From 58187f1c8a7095dbe0237a8208fa7f7bc899f246 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 16:33:47 +0200 Subject: [PATCH 08/97] patch 8.1.1278: missing change for "combine" field Problem: Missing change for "combine" field. Solution: Also change the textprop implementation. --- src/textprop.c | 11 +++++++++++ src/version.c | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/textprop.c b/src/textprop.c index 34738adc40..b44810a827 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -733,6 +733,15 @@ prop_type_set(typval_T *argvars, int add) prop->pt_hl_id = hl_id; } + di = dict_find(dict, (char_u *)"combine", -1); + if (di != NULL) + { + if (tv_get_number(&di->di_tv)) + prop->pt_flags |= PT_FLAG_COMBINE; + else + prop->pt_flags &= ~PT_FLAG_COMBINE; + } + di = dict_find(dict, (char_u *)"priority", -1); if (di != NULL) prop->pt_priority = tv_get_number(&di->di_tv); @@ -845,6 +854,8 @@ f_prop_type_get(typval_T *argvars, typval_T *rettv UNUSED) if (prop->pt_hl_id > 0) dict_add_string(d, "highlight", syn_id2name(prop->pt_hl_id)); dict_add_number(d, "priority", prop->pt_priority); + dict_add_number(d, "combine", + (prop->pt_flags & PT_FLAG_COMBINE) ? 1 : 0); dict_add_number(d, "start_incl", (prop->pt_flags & PT_FLAG_INS_START_INCL) ? 1 : 0); dict_add_number(d, "end_incl", diff --git a/src/version.c b/src/version.c index 7930e3c907..0b47695ee4 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1278, /**/ 1277, /**/ From 9a061cb78ccbf78ec9ae454d37a49edccb4e94fc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 16:55:03 +0200 Subject: [PATCH 09/97] patch 8.1.1279: cannot set 'spellang' to "sr@latin" Problem: Cannot set 'spellang' to "sr@latin". (Bojan Stipic) Solution: Allow using '@' in 'spellang'. (closes #4342) --- src/option.c | 2 +- src/testdir/gen_opt_test.vim | 1 + src/version.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/option.c b/src/option.c index 9583aa3697..657c011b1f 100644 --- a/src/option.c +++ b/src/option.c @@ -6057,7 +6057,7 @@ valid_filetype(char_u *val) int valid_spellang(char_u *val) { - return valid_name(val, ".-_,"); + return valid_name(val, ".-_,@"); } /* diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim index bd3f80ce6c..74c725fb8b 100644 --- a/src/testdir/gen_opt_test.vim +++ b/src/testdir/gen_opt_test.vim @@ -125,6 +125,7 @@ let test_values = { \ 'sessionoptions': [['', 'blank', 'help,options,slash'], ['xxx']], \ 'signcolumn': [['', 'auto', 'no'], ['xxx', 'no,yes']], \ 'spellfile': [['', 'file.en.add'], ['xxx', '/tmp/file']], + \ 'spelllang': [['', 'xxx', 'sr@latin'], ['not&lang', "that\\\rthere"]], \ 'spellsuggest': [['', 'best', 'double,33'], ['xxx']], \ 'switchbuf': [['', 'useopen', 'split,newtab'], ['xxx']], \ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']], diff --git a/src/version.c b/src/version.c index 0b47695ee4..8ab83c363b 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1279, /**/ 1278, /**/ From 25c9c680ec4dfbb51f4ef21c3460a48d3c67ffc8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 18:13:34 +0200 Subject: [PATCH 10/97] patch 8.1.1280: remarks about functionality not in Vi clutters the help Problem: Remarks about functionality not in Vi clutters the help. Solution: Move all info about what is new in Vim or already existed in Vi to vi_diff.txt. Remove {not in Vi} remarks. (closes #4268) Add "noet" to the help files modeline. Also include many other help file improvements. --- runtime/doc/arabic.txt | 3 +- runtime/doc/autocmd.txt | 3 +- runtime/doc/change.txt | 140 +++++++++------------ runtime/doc/channel.txt | 3 +- runtime/doc/cmdline.txt | 16 +-- runtime/doc/debugger.txt | 3 +- runtime/doc/diff.txt | 4 +- runtime/doc/digraph.txt | 3 +- runtime/doc/editing.txt | 93 ++++++-------- runtime/doc/eval.txt | 4 +- runtime/doc/farsi.txt | 3 +- runtime/doc/filetype.txt | 3 +- runtime/doc/fold.txt | 3 +- runtime/doc/gui.txt | 3 +- runtime/doc/gui_w32.txt | 5 +- runtime/doc/gui_x11.txt | 3 +- runtime/doc/hebrew.txt | 7 +- runtime/doc/helphelp.txt | 12 +- runtime/doc/if_cscop.txt | 3 +- runtime/doc/if_lua.txt | 14 +-- runtime/doc/if_mzsch.txt | 11 +- runtime/doc/if_ole.txt | 8 +- runtime/doc/if_perl.txt | 6 +- runtime/doc/if_pyth.txt | 7 +- runtime/doc/if_ruby.txt | 5 +- runtime/doc/if_tcl.txt | 10 +- runtime/doc/index.txt | 6 +- runtime/doc/insert.txt | 46 +++---- runtime/doc/intro.txt | 7 +- runtime/doc/map.txt | 46 +++---- runtime/doc/mbyte.txt | 2 +- runtime/doc/message.txt | 16 ++- runtime/doc/mlang.txt | 3 +- runtime/doc/motion.txt | 90 ++++++-------- runtime/doc/netbeans.txt | 3 +- runtime/doc/options.txt | 14 +-- runtime/doc/os_mac.txt | 2 +- runtime/doc/pattern.txt | 115 ++++++++---------- runtime/doc/pi_gzip.txt | 4 +- runtime/doc/pi_netrw.txt | 4 +- runtime/doc/print.txt | 3 +- runtime/doc/quickfix.txt | 8 +- runtime/doc/quickref.txt | 10 +- runtime/doc/remote.txt | 4 +- runtime/doc/repeat.txt | 18 +-- runtime/doc/rileft.txt | 4 +- runtime/doc/scroll.txt | 26 ++-- runtime/doc/sign.txt | 3 +- runtime/doc/spell.txt | 7 +- runtime/doc/starting.txt | 98 ++++++--------- runtime/doc/tabpage.txt | 4 +- runtime/doc/tags | 39 +++++- runtime/doc/tagsrch.txt | 101 +++++++-------- runtime/doc/terminal.txt | 3 +- runtime/doc/textprop.txt | 1 - runtime/doc/todo.txt | 114 ++++++++--------- runtime/doc/undo.txt | 15 +-- runtime/doc/usr_21.txt | 7 +- runtime/doc/usr_22.txt | 2 +- runtime/doc/various.txt | 35 ++---- runtime/doc/vi_diff.txt | 256 ++++++++++++++++++++++++++++++++++++--- runtime/doc/visual.txt | 4 +- runtime/doc/windows.txt | 9 +- src/version.c | 2 + 64 files changed, 755 insertions(+), 751 deletions(-) diff --git a/runtime/doc/arabic.txt b/runtime/doc/arabic.txt index 2303a2b862..b3b61a1341 100644 --- a/runtime/doc/arabic.txt +++ b/runtime/doc/arabic.txt @@ -1,4 +1,4 @@ -*arabic.txt* For Vim version 8.1. Last change: 2010 Nov 13 +*arabic.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Nadim Shaikli @@ -6,7 +6,6 @@ Arabic Language support (options & mappings) for Vim *Arabic* -{Vi does not have any of these commands} *E800* In order to use right-to-left and Arabic mapping support, it is diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 5d60fbeea6..01d718f1f1 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 8.1. Last change: 2019 Apr 27 +*autocmd.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -20,7 +20,6 @@ For a basic explanation, see section |40.3| in the user manual. 10. Using autocommands |autocmd-use| 11. Disabling autocommands |autocmd-disable| -{Vi does not have any of these commands} ============================================================================== 1. Introduction *autocmd-intro* diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 4c5b402a7e..a904aec387 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 8.1. Last change: 2019 Feb 05 +*change.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,7 +34,7 @@ For inserting text see |insert.txt|. deletes the last character of the count. See |:fixdel| if the key does not do what you want. See |'whichwrap'| for deleting a line break - (join lines). {Vi does not support } + (join lines). *X* *dh* ["x]X Delete [count] characters before the cursor [into @@ -59,7 +59,7 @@ For inserting text see |insert.txt|. {Visual}["x]x or *v_x* *v_d* *v_* {Visual}["x]d or {Visual}["x] Delete the highlighted text [into register x] (for - {Visual} see |Visual-mode|). {not in Vi} + {Visual} see |Visual-mode|). {Visual}["x]CTRL-H or *v_CTRL-H* *v_* {Visual}["x] When in Select mode: Delete the highlighted text [into @@ -69,7 +69,7 @@ For inserting text see |insert.txt|. {Visual}["x]D Delete the highlighted lines [into register x] (for {Visual} see |Visual-mode|). In Visual block mode, "D" deletes the highlighted text plus all text until - the end of the line. {not in Vi} + the end of the line. *:d* *:de* *:del* *:delete* *:dl* *:dp* :[range]d[elete] [x] Delete [range] lines (default: current line) [into @@ -116,16 +116,15 @@ J Join [count] lines, with a minimum of two lines. *v_J* {Visual}J Join the highlighted lines, with a minimum of two lines. Remove the indent and insert up to two spaces - (see below). {not in Vi} + (see below). *gJ* gJ Join [count] lines, with a minimum of two lines. - Don't insert or remove any spaces. {not in Vi} + Don't insert or remove any spaces. *v_gJ* {Visual}gJ Join the highlighted lines, with a minimum of two - lines. Don't insert or remove any spaces. {not in - Vi} + lines. Don't insert or remove any spaces. *:j* *:join* :[range]j[oin][!] [flags] @@ -134,7 +133,6 @@ gJ Join [count] lines, with a minimum of two lines. If a [range] has equal start and end values, this command does nothing. The default behavior is to join the current line with the line below it. - {not in Vi: !} See |ex-flags| for [flags]. :[range]j[oin][!] {count} [flags] @@ -142,7 +140,6 @@ gJ Join [count] lines, with a minimum of two lines. current line |cmdline-ranges|). Same as "J", except with [!] the join does not insert or delete any spaces. - {not in Vi: !} See |ex-flags| for [flags]. These commands delete the between lines. This has the effect of joining @@ -209,8 +206,7 @@ gR Enter Virtual Replace mode: Each character you type {Visual}["x]c or *v_c* *v_s* {Visual}["x]s Delete the highlighted text [into register x] and - start insert (for {Visual} see |Visual-mode|). {not - in Vi} + start insert (for {Visual} see |Visual-mode|). *v_r* {Visual}["x]r{char} Replace all selected characters by {char}. @@ -218,14 +214,13 @@ gR Enter Virtual Replace mode: Each character you type *v_C* {Visual}["x]C Delete the highlighted lines [into register x] and start insert. In Visual block mode it works - differently |v_b_C|. {not in Vi} + differently |v_b_C|. *v_S* {Visual}["x]S Delete the highlighted lines [into register x] and - start insert (for {Visual} see |Visual-mode|). {not - in Vi} + start insert (for {Visual} see |Visual-mode|). *v_R* {Visual}["x]R Currently just like {Visual}["x]S. In a next version - it might work differently. {not in Vi} + it might work differently. Notes: - You can end Insert and Replace mode with . @@ -322,21 +317,21 @@ The following commands change the case of letters. The currently active tilde cannot be used as an operator} *g~* -g~{motion} Switch case of {motion} text. {not in Vi} +g~{motion} Switch case of {motion} text. g~g~ *g~g~* *g~~* -g~~ Switch case of current line. {not in Vi}. +g~~ Switch case of current line. *v_~* {Visual}~ Switch case of highlighted text (for {Visual} see - |Visual-mode|). {not in Vi} + |Visual-mode|). *v_U* {Visual}U Make highlighted text uppercase (for {Visual} see - |Visual-mode|). {not in Vi} + |Visual-mode|). *gU* *uppercase* -gU{motion} Make {motion} text uppercase. {not in Vi} +gU{motion} Make {motion} text uppercase. Example: > :map! gUiw`]a < This works in Insert mode: press CTRL-F to make the @@ -345,27 +340,27 @@ gU{motion} Make {motion} text uppercase. {not in Vi} gUgU *gUgU* *gUU* -gUU Make current line uppercase. {not in Vi}. +gUU Make current line uppercase. *v_u* {Visual}u Make highlighted text lowercase (for {Visual} see - |Visual-mode|). {not in Vi} + |Visual-mode|). *gu* *lowercase* -gu{motion} Make {motion} text lowercase. {not in Vi} +gu{motion} Make {motion} text lowercase. gugu *gugu* *guu* -guu Make current line lowercase. {not in Vi}. +guu Make current line lowercase. *g?* *rot13* -g?{motion} Rot13 encode {motion} text. {not in Vi} +g?{motion} Rot13 encode {motion} text. *v_g?* {Visual}g? Rot13 encode the highlighted text (for {Visual} see - |Visual-mode|). {not in Vi} + |Visual-mode|). g?g? *g?g?* *g??* -g?? Rot13 encode current line. {not in Vi}. +g?? Rot13 encode current line. To turn one line into title caps, make every first letter of a word uppercase: > @@ -375,18 +370,18 @@ uppercase: > Adding and subtracting ~ *CTRL-A* CTRL-A Add [count] to the number or alphabetic character at - or after the cursor. {not in Vi} + or after the cursor. *v_CTRL-A* {Visual}CTRL-A Add [count] to the number or alphabetic character in - the highlighted text. {not in Vi} + the highlighted text. *v_g_CTRL-A* {Visual}g CTRL-A Add [count] to the number or alphabetic character in the highlighted text. If several lines are highlighted, each one will be incremented by an additional [count] (so effectively creating a - [count] incrementing sequence). {not in Vi} + [count] incrementing sequence). For Example, if you have this list of numbers: 1. ~ 1. ~ @@ -401,11 +396,11 @@ CTRL-A Add [count] to the number or alphabetic character at *CTRL-X* CTRL-X Subtract [count] from the number or alphabetic - character at or after the cursor. {not in Vi} + character at or after the cursor. *v_CTRL-X* {Visual}CTRL-X Subtract [count] from the number or alphabetic - character in the highlighted text. {not in Vi} + character in the highlighted text. On MS-Windows, this is mapped to cut Visual text |dos-standard-mappings|. If you want to disable the @@ -417,7 +412,7 @@ CTRL-X Subtract [count] from the number or alphabetic character in the highlighted text. If several lines are highlighted, each value will be decremented by an additional [count] (so effectively creating a [count] - decrementing sequence). {not in Vi} + decrementing sequence). The CTRL-A and CTRL-X commands can work for: - signed and unsigned decimal numbers @@ -485,8 +480,7 @@ SHIFTING LINES LEFT OR RIGHT *shift-left-right* *v_<* {Visual}[count]< Shift the highlighted lines [count] 'shiftwidth' - leftwards (for {Visual} see |Visual-mode|). {not in - Vi} + leftwards (for {Visual} see |Visual-mode|). *>* >{motion} Shift {motion} lines one 'shiftwidth' rightwards. @@ -500,8 +494,7 @@ SHIFTING LINES LEFT OR RIGHT *shift-left-right* *v_>* {Visual}[count]> Shift the highlighted lines [count] 'shiftwidth' - rightwards (for {Visual} see |Visual-mode|). {not in - Vi} + rightwards (for {Visual} see |Visual-mode|). *:<* :[range]< Shift [range] lines one 'shiftwidth' left. Repeat '<' @@ -512,7 +505,7 @@ SHIFTING LINES LEFT OR RIGHT *shift-left-right* Repeat '<' for shifting multiple 'shiftwidth's. :[range]le[ft] [indent] left align lines in [range]. Sets the indent in the - lines to [indent] (default 0). {not in Vi} + lines to [indent] (default 0). *:>* :[range]> [flags] Shift {count} [range] lines one 'shiftwidth' right. @@ -579,7 +572,6 @@ comment (starting with '"') after the `:!` command. *v_!* {Visual}!{filter} Filter the highlighted lines through the external program {filter} (for {Visual} see |Visual-mode|). - {not in Vi} :{range}![!]{filter} [!][arg] *:range!* Filter {range} lines through the external program @@ -613,7 +605,6 @@ comment (starting with '"') after the `:!` command. *v_=* {Visual}= Filter the highlighted lines like with ={motion}. - {not in Vi} *tempfile* *setuid* @@ -678,15 +669,13 @@ g& Synonym for `:%s//~/&` (repeat last substitute with For example, when you first do a substitution with `:s/pattern/repl/flags` and then `/search` for something else, `g&` will do `:%s/search/repl/flags`. - Mnemonic: global substitute. {not in Vi} + Mnemonic: global substitute. *:snomagic* *:sno* :[range]sno[magic] ... Same as `:substitute`, but always use 'nomagic'. - {not in Vi} *:smagic* *:sm* :[range]sm[agic] ... Same as `:substitute`, but always use 'magic'. - {not in Vi} *:s_flags* The flags that you can use for the substitute commands: @@ -697,7 +686,6 @@ The flags that you can use for the substitute commands: :&& :s/this/that/& < Note that `:s` and `:&` don't keep the flags. - {not in Vi} [c] Confirm each substitution. Vim highlights the matching string (with |hl-IncSearch|). You can type: *:s_c* @@ -705,16 +693,15 @@ The flags that you can use for the substitute commands: 'l' to substitute this match and then quit ("last") 'n' to skip this match to quit substituting - 'a' to substitute this and all remaining matches {not in Vi} - 'q' to quit substituting {not in Vi} - CTRL-E to scroll the screen up {not in Vi, not available when - compiled without the |+insert_expand| feature} - CTRL-Y to scroll the screen down {not in Vi, not available when - compiled without the |+insert_expand| feature} + 'a' to substitute this and all remaining matches + 'q' to quit substituting + CTRL-E to scroll the screen up {not available when compiled + without the |+insert_expand| feature} + CTRL-Y to scroll the screen down {not available when compiled + without the |+insert_expand| feature} If the 'edcompatible' option is on, Vim remembers the [c] flag and toggles it each time you use it, but resets it when you give a new search pattern. - {not in Vi: highlighting of the match, other responses than 'y' or 'n'} *:s_e* [e] When the search pattern fails, do not issue an error message and, in @@ -726,7 +713,6 @@ The flags that you can use for the substitute commands: No previous substitute regular expression Trailing characters Interrupted - {not in Vi} *:s_g* [g] Replace all occurrences in the line. Without this argument, @@ -739,12 +725,10 @@ The flags that you can use for the substitute commands: *:s_i* [i] Ignore case for the pattern. The 'ignorecase' and 'smartcase' options are not used. - {not in Vi} *:s_I* [I] Don't ignore case for the pattern. The 'ignorecase' and 'smartcase' options are not used. - {not in Vi} *:s_n* [n] Report the number of matches, do not actually substitute. The [c] @@ -776,7 +760,6 @@ The flags that you can use for the substitute commands: /green :& < The last command will replace "blue" with "red". - {not in Vi} Note that there is no flag to change the "magicness" of the pattern. A different command is used instead, or you can use |/\v| and friends. The @@ -1002,7 +985,6 @@ This replaces each 'E' character with a euro sign. Read more in ||. a single tabstop. Each value in the list represents the width of one tabstop, except the final value which applies to all following tabstops. - {not in Vi} *retab-example* Example for using autocommands and ":retab" to edit a file which is stored @@ -1026,17 +1008,16 @@ inside of strings can change! Also see 'softtabstop' option. > :reg[isters] Display the contents of all numbered and named registers. If a register is written to for |:redir| it will not be listed. - {not in Vi} :reg[isters] {arg} Display the contents of the numbered and named registers that are mentioned in {arg}. For example: > :reg 1a < to display registers '1' and 'a'. Spaces are allowed - in {arg}. {not in Vi} + in {arg}. *:di* *:display* -:di[splay] [arg] Same as :registers. {not in Vi} +:di[splay] [arg] Same as :registers. *y* *yank* ["x]y{motion} Yank {motion} text [into register x]. When no @@ -1055,11 +1036,11 @@ inside of strings can change! Also see 'softtabstop' option. > *v_y* {Visual}["x]y Yank the highlighted text [into register x] (for - {Visual} see |Visual-mode|). {not in Vi} + {Visual} see |Visual-mode|). *v_Y* {Visual}["x]Y Yank the highlighted lines [into register x] (for - {Visual} see |Visual-mode|). {not in Vi} + {Visual} see |Visual-mode|). *:y* *:yank* *E850* :[range]y[ank] [x] Yank [range] lines [into register x]. Yanking to the @@ -1086,7 +1067,6 @@ inside of strings can change! Also see 'softtabstop' option. > Leaves the cursor at the end of the new text. Using the mouse only works when 'mouse' contains 'n' or 'a'. - {not in Vi} If you have a scrollwheel and often accidentally paste text, you can use these mappings to disable the pasting with the middle mouse button: > @@ -1097,11 +1077,11 @@ inside of strings can change! Also see 'softtabstop' option. > *gp* ["x]gp Just like "p", but leave the cursor just after the new - text. {not in Vi} + text. *gP* ["x]gP Just like "P", but leave the cursor just after the new - text. {not in Vi} + text. *:pu* *:put* :[line]pu[t] [x] Put the text [from register x] after [line] (default @@ -1129,14 +1109,14 @@ inside of strings can change! Also see 'softtabstop' option. > ["x]]p or *]p* *]* ["x]] Like "p", but adjust the indent to the current line. Using the mouse only works when 'mouse' contains 'n' - or 'a'. {not in Vi} + or 'a'. ["x][P or *[P* ["x]]P or *]P* ["x][p or *[p* *[* ["x][ Like "P", but adjust the indent to the current line. Using the mouse only works when 'mouse' contains 'n' - or 'a'. {not in Vi} + or 'a'. You can use these commands to copy text from one place to another. Do this by first getting the text into a register with a yank, delete or change @@ -1246,7 +1226,6 @@ not exist} 3. Small delete register "- *quote_-* *quote-* This register contains text from commands that delete less than one line, except when the command specifies a register with ["x]. -{not in Vi} 4. Named registers "a to "z or "A to "Z *quote_alpha* *quotea* Vim fills these registers only when you say so. Specify them as lowercase @@ -1256,7 +1235,7 @@ a line break is inserted before the appended text. 5. Read-only registers ":, ". and "% These are '%', '#', ':' and '.'. You can use them only with the "p", "P", -and ":put" commands and with CTRL-R. {not in Vi} +and ":put" commands and with CTRL-R. *quote_.* *quote.* *E29* ". Contains the last inserted text (the same as what is inserted with the insert mode commands CTRL-A and CTRL-@). Note: this @@ -1310,13 +1289,13 @@ an error message (use string() to convert). If the "= register is used for the "p" command, the String is split up at characters. If the String ends in a , it is regarded as a linewise -register. {not in Vi} +register. 8. Selection and drop registers "*, "+ and "~ Use these registers for storing and retrieving the selected text for the GUI. See |quotestar| and |quoteplus|. When the clipboard is not available or not working, the unnamed register is used instead. For Unix systems the clipboard -is only available when the |+xterm_clipboard| feature is present. {not in Vi} +is only available when the |+xterm_clipboard| feature is present. Note that there is only a distinction between "* and "+ for X11 systems. For an explanation of the difference, see |x11-selection|. Under MS-Windows, use @@ -1327,7 +1306,7 @@ The read-only "~ register stores the dropped text from the last drag'n'drop operation. When something has been dropped onto Vim, the "~ register is filled in and the pseudo key is sent for notification. You can remap this key if you want; the default action (for all modes) is to insert the -contents of the "~ register at the cursor position. {not in Vi} +contents of the "~ register at the cursor position. {only available when compiled with the |+dnd| feature, currently only with the GTK GUI} @@ -1337,7 +1316,7 @@ Drag'n'drop of URI lists is handled internally. 9. Black hole register "_ *quote_* When writing to this register, nothing happens. This can be used to delete text without affecting the normal registers. When reading from this register, -nothing is returned. {not in Vi} +nothing is returned. 10. Last search pattern register "/ *quote_/* *quote/* Contains the most recent search-pattern. This is used for "n" and 'hlsearch'. @@ -1346,7 +1325,6 @@ other matches without actually searching. You can't yank or delete into this register. The search direction is available in |v:searchforward|. Note that the value is restored when returning from a function |function-search-undo|. -{not in Vi} *@/* You can write to a register with a `:let` command |:let-@|. Example: > @@ -1377,17 +1355,15 @@ The next three commands always work on whole lines. :[range]ce[nter] [width] *:ce* *:center* Center lines in [range] between [width] columns (default 'textwidth' or 80 when 'textwidth' is 0). - {not in Vi} :[range]ri[ght] [width] *:ri* *:right* Right-align lines in [range] at [width] columns (default 'textwidth' or 80 when 'textwidth' is 0). - {not in Vi} *:le* *:left* :[range]le[ft] [indent] Left-align lines in [range]. Sets the indent in the - lines to [indent] (default 0). {not in Vi} + lines to [indent] (default 0). *gq* gq{motion} Format the lines that {motion} moves over. @@ -1414,24 +1390,24 @@ gq{motion} Format the lines that {motion} moves over. gqgq *gqgq* *gqq* gqq Format the current line. With a count format that - many lines. {not in Vi} + many lines. *v_gq* {Visual}gq Format the highlighted text. (for {Visual} see - |Visual-mode|). {not in Vi} + |Visual-mode|). *gw* gw{motion} Format the lines that {motion} moves over. Similar to |gq| but puts the cursor back at the same position in the text. However, 'formatprg' and 'formatexpr' are - not used. {not in Vi} + not used. gwgw *gwgw* *gww* -gww Format the current line as with "gw". {not in Vi} +gww Format the current line as with "gw". *v_gw* {Visual}gw Format the highlighted text as with "gw". (for - {Visual} see |Visual-mode|). {not in Vi} + {Visual} see |Visual-mode|). Example: To format the current paragraph use: *gqap* > gqap diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt index cb6f781804..ea0274f401 100644 --- a/runtime/doc/channel.txt +++ b/runtime/doc/channel.txt @@ -1,4 +1,4 @@ -*channel.txt* For Vim version 8.1. Last change: 2019 Mar 21 +*channel.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -24,7 +24,6 @@ The Netbeans interface also uses a channel. |netbeans| 11. Controlling a job |job-control| 12. Using a prompt buffer |prompt-buffer| -{Vi does not have any of these features} {only when compiled with the |+channel| feature for channel stuff} You can check this with: `has('channel')` {only when compiled with the |+job| feature for job stuff} diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index e229532ac1..ed085ef62b 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 8.1. Last change: 2018 May 14 +*cmdline.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -66,7 +66,6 @@ Notes: - All searches are put in the search history, including the ones that come from commands like "*" and "#". But for a mapping, only the last search is remembered (to avoid that long mappings trash the history). -{Vi: no history} {not available when compiled without the |+cmdline_hist| feature} There is an automatic completion of names on the command-line; see @@ -124,12 +123,12 @@ CTRL-U Remove all characters between the cursor position and :cnoremap < *c_* *c_Insert* - Toggle between insert and overstrike. {not in Vi} + Toggle between insert and overstrike. {char1} {char2} or *c_digraph* CTRL-K {char1} {char2} *c_CTRL-K* enter digraph (see |digraphs|). When {char1} is a special - key, the code for that key is inserted in <> form. {not in Vi} + key, the code for that key is inserted in <> form. CTRL-R {0-9a-z"%#:-=.} *c_CTRL-R* *c_* Insert the contents of a numbered or named register. Between @@ -165,7 +164,7 @@ CTRL-R {0-9a-z"%#:-=.} *c_CTRL-R* *c_* too. When the result is a Float it's automatically converted to a String. - See |registers| about registers. {not in Vi} + See |registers| about registers. Implementation detail: When using the |expression| register and invoking setcmdpos(), this sets the position before inserting the resulting string. Use CTRL-R CTRL-R to set the @@ -188,7 +187,6 @@ CTRL-R CTRL-L *c_CTRL-R_CTRL-L* *c__* currently displayed match is used. With CTRL-W the part of the word that was already typed is not inserted again. - {not in Vi} CTRL-F and CTRL-P: {only when |+file_in_path| feature is included} @@ -313,11 +311,9 @@ CTRL-^ Toggle the use of language |:lmap| mappings and/or Input off, since you are expected to type a command. After switching it on with CTRL-^, the new state is not used again for the next command or Search pattern. - {not in Vi} *c_CTRL-]* -CTRL-] Trigger abbreviation, without inserting a character. {not in - Vi} +CTRL-] Trigger abbreviation, without inserting a character. For Emacs-style editing on the command-line see |emacs-keys|. @@ -332,7 +328,6 @@ terminals) *:his* *:history* :his[tory] Print the history of last entered commands. - {not in Vi} {not available when compiled without the |+cmdline_hist| feature} @@ -344,7 +339,6 @@ terminals) i[nput] or @ input line history d[ebug] or > debug command history a[ll] all of the above - {not in Vi} If the numbers {first} and/or {last} are given, the respective range of entries from a history is listed. These numbers can diff --git a/runtime/doc/debugger.txt b/runtime/doc/debugger.txt index 3370cf0988..cbf2009a5d 100644 --- a/runtime/doc/debugger.txt +++ b/runtime/doc/debugger.txt @@ -1,4 +1,4 @@ -*debugger.txt* For Vim version 8.1. Last change: 2017 Nov 21 +*debugger.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Gordon Prieur @@ -10,7 +10,6 @@ Debugger Support Features *debugger-support* 2. Vim Compile Options |debugger-compilation| 3. Integrated Debuggers |debugger-integration| -{Vi does not have any of these features} ============================================================================== 1. Debugger Features *debugger-features* diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 6b638fae3b..60ebb4fa69 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -1,4 +1,4 @@ -*diff.txt* For Vim version 8.1. Last change: 2019 Feb 27 +*diff.txt* For Vim version 8.1. Last change: 2019 May 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -16,8 +16,6 @@ The basics are explained in section |08.7| of the user manual. 4. Copying diffs |copy-diffs| 5. Diff options |diff-options| -{not in Vi} - ============================================================================== 1. Starting diff mode *start-vimdiff* diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index a174d3cfca..b87dc0d8ed 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -1,4 +1,4 @@ -*digraph.txt* For Vim version 8.1. Last change: 2019 Feb 17 +*digraph.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -18,7 +18,6 @@ An alternative is using the 'keymap' option. 2. Using digraphs |digraphs-use| 3. Default digraphs |digraphs-default| -{Vi does not have any of these commands} ============================================================================== 1. Defining digraphs *digraphs-define* diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 60ac959b58..4d01e49a1b 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 8.1. Last change: 2018 Dec 16 +*editing.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -44,7 +44,7 @@ An alternate file name is remembered for each window. :keepalt {cmd} Execute {cmd} while keeping the current alternate file name. Note that commands invoked indirectly (e.g., with a function) may still set the alternate file - name. {not in Vi} + name. All file names are remembered in the buffer list. When you enter a file name, for editing (e.g., with ":e filename") or writing (e.g., with ":w filename"), @@ -60,14 +60,13 @@ CTRL-G or *CTRL-G* *:f* *:fi* *:file* option is set), and the file status (readonly, modified, read errors, new file). See the 'shortmess' option about how to make this message shorter. - {Vi does not include column number} :f[ile]! like |:file|, but don't truncate the name even when 'shortmess' indicates this. {count}CTRL-G Like CTRL-G, but prints the current file name with full path. If the count is higher than 1 the current - buffer number is also given. {not in Vi} + buffer number is also given. *g_CTRL-G* *word-count* *byte-count* g CTRL-G Prints the current position of the cursor in five @@ -80,7 +79,6 @@ g CTRL-G Prints the current position of the cursor in five column are shown, separated with a dash. Also see the 'ruler' option and the |wordcount()| function. - {not in Vi} *v_g_CTRL-G* {Visual}g CTRL-G Similar to "g CTRL-G", but Word, Character, Line, and @@ -88,7 +86,6 @@ g CTRL-G Prints the current position of the cursor in five displayed. In Blockwise mode, Column count is also shown. (For {Visual} see |Visual-mode|.) - {not in VI} *:file_f* :f[ile][!] {name} Sets the current file name to {name}. The optional ! @@ -98,14 +95,12 @@ g CTRL-G Prints the current position of the cursor in five to hold the old name. *:0file* :0f[ile][!] Remove the name of the current buffer. The optional ! - avoids truncating the message, as with |:file|. {not - in Vi} + avoids truncating the message, as with |:file|. :buffers :files :ls List all the currently known file names. See - 'windows.txt' |:files| |:buffers| |:ls|. {not in - Vi} + 'windows.txt' |:files| |:buffers| |:ls|. Vim will remember the full path name of a file name that you enter. In most cases when the file name is displayed only the name you typed is shown, but @@ -244,19 +239,17 @@ If you want to keep the changed buffer without saving it, switch on the If 'fileformats' is not empty, the first format given will be used for the new buffer. If 'fileformats' is empty, the 'fileformat' of the current buffer is used. - {not in Vi} *:ene!* *:enew!* :ene[w]! Edit a new, unnamed buffer. Discard any changes to the current buffer. Set 'fileformat' like |:enew|. - {not in Vi} *:fin* *:find* :fin[d][!] [++opt] [+cmd] {file} Find {file} in 'path' and then |:edit| it. - {not in Vi} {not available when the |+file_in_path| - feature was disabled at compile time} + {not available when the |+file_in_path| feature was + disabled at compile time} :{count}fin[d][!] [++opt] [+cmd] {file} Just like ":find", but use the {count} match in @@ -278,7 +271,7 @@ If you want to keep the changed buffer without saving it, switch on the :vie[w][!] [++opt] [+cmd] file When used in Ex mode: Leave |Ex-mode|, go back to Normal mode. Otherwise same as |:edit|, but set - 'readonly' option for this buffer. {not in Vi} + 'readonly' option for this buffer. *CTRL-^* *CTRL-6* CTRL-^ Edit the alternate file. Mostly the alternate file is @@ -297,7 +290,6 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is ":e #[count]"). This is a quick way to switch between files. See |CTRL-^| above for further details. - {not in Vi} [count]]f *]f* *[f* [count][f Same as "gf". Deprecated. @@ -331,7 +323,6 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is For Unix the '~' character is expanded, like in "~user/file". Environment variables are expanded too |expand-env|. - {not in Vi} {not available when the |+file_in_path| feature was disabled at compile time} @@ -341,7 +332,6 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is Leading blanks are skipped, otherwise all blanks and special characters are included in the file name. (For {Visual} see |Visual-mode|.) - {not in VI} *gF* [count]gF Same as "gf", except if a number follows the file @@ -637,7 +627,6 @@ list of the current window. still be added to the argument list, but won't be edited. No check for duplicates is done. Also see |++opt| and |+cmd|. - {not in Vi} :[count]arga[dd] {name} .. *:arga* *:argadd* *E479* :[count]arga[dd] @@ -659,7 +648,6 @@ list of the current window. There is no check for duplicates, it is possible to add a file to the argument list twice. The currently edited file is not changed. - {not in Vi} Note: you can also use this method: > :args ## x < This will add the "x" item and sort the new list. @@ -673,7 +661,6 @@ list of the current window. when it's deleted from the argument list. Example: > :argdel *.obj -< {not in Vi} :[range]argd[elete] Delete the {range} files from the argument list. Example: > @@ -688,7 +675,6 @@ list of the current window. < Removes all the files from the arglist. When the last number in the range is too high, up to the last argument is deleted. - {not in Vi} *:argu* *:argument* :[count]argu[ment] [count] [++opt] [+cmd] @@ -697,14 +683,12 @@ list of the current window. when changes have been made and Vim does not want to |abandon| the current buffer. Also see |++opt| and |+cmd|. - {not in Vi} :[count]argu[ment]! [count] [++opt] [+cmd] Edit file [count] in the argument list, discard any changes to the current buffer. When [count] is omitted the current entry is used. Also see |++opt| and |+cmd|. - {not in Vi} :[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163* Edit [count] next file. This fails when changes have @@ -727,7 +711,7 @@ list of the current window. Edit [count] previous file in argument list. This fails when changes have been made and Vim does not want to |abandon| the current buffer. - Also see |++opt| and |+cmd|. {Vi: no count or ++opt}. + Also see |++opt| and |+cmd|. :[count]N[ext]! [count] [++opt] [+cmd] Edit [count] previous file in argument list. Discard @@ -748,44 +732,43 @@ list of the current window. :rew[ind]! [++opt] [+cmd] Start editing the first file in the argument list. Discard any changes to the buffer. Also see |++opt| - and |+cmd|. {Vi: no ++opt} + and |+cmd|. *:fir* *:first* :fir[st][!] [++opt] [+cmd] - Other name for ":rewind". {not in Vi} + Other name for ":rewind". *:la* *:last* :la[st] [++opt] [+cmd] Start editing the last file in the argument list. This fails when changes have been made and Vim does not want to |abandon| the current buffer. - Also see |++opt| and |+cmd|. {not in Vi} + Also see |++opt| and |+cmd|. :la[st]! [++opt] [+cmd] Start editing the last file in the argument list. Discard any changes to the buffer. Also see |++opt| - and |+cmd|. {not in Vi} + and |+cmd|. *:wn* *:wnext* :[count]wn[ext] [++opt] Write current file and start editing the [count] - next file. Also see |++opt| and |+cmd|. {not in Vi} + next file. Also see |++opt| and |+cmd|. :[count]wn[ext] [++opt] {file} Write current file to {file} and start editing the [count] next file, unless {file} already exists and the 'writeany' option is off. Also see |++opt| and - |+cmd|. {not in Vi} + |+cmd|. :[count]wn[ext]! [++opt] {file} Write current file to {file} and start editing the - [count] next file. Also see |++opt| and |+cmd|. {not - in Vi} + [count] next file. Also see |++opt| and |+cmd|. :[count]wN[ext][!] [++opt] [file] *:wN* *:wNext* :[count]wp[revious][!] [++opt] [file] *:wp* *:wprevious* Same as :wnext, but go to previous file instead of - next. {not in Vi} + next. The [count] in the commands above defaults to one. For some commands it is possible to use two counts. The last one (rightmost one) is used. @@ -826,8 +809,6 @@ fourth file in the argument list. This happens when you do ":e file". LOCAL ARGUMENT LIST -{not in Vi} - *:arglocal* :argl[ocal] Make a local copy of the global argument list. Doesn't start editing another file. @@ -878,7 +859,6 @@ USING THE ARGUMENT LIST autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each file. - {not in Vi} Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, |:cfdo| and |:lfdo| @@ -970,12 +950,11 @@ slower (but safer). When 'filetype' is empty filetype detection is done with the new name, before the file is written. When the write was successful 'readonly' is reset. - {not in Vi} *:up* *:update* :[range]up[date][!] [++opt] [>>] [file] Like ":write", but only write when the buffer has been - modified. {not in Vi} + modified. WRITING WITH MULTIPLE BUFFERS *buffer-write* @@ -983,11 +962,11 @@ WRITING WITH MULTIPLE BUFFERS *buffer-write* *:wa* *:wall* :wa[ll] Write all changed buffers. Buffers without a file name cause an error message. Buffers which are - readonly are not written. {not in Vi} + readonly are not written. :wa[ll]! Write all changed buffers, even the ones that are readonly. Buffers without a file name are not - written and cause an error message. {not in Vi} + written and cause an error message. Vim will warn you if you try to overwrite a file that has been changed @@ -1118,7 +1097,7 @@ The names can be in upper- or lowercase. :conf[irm] q[uit] Quit, but give prompt when changes have been made, or the last file in the argument list has not been - edited. See |:confirm| and 'confirm'. {not in Vi} + edited. See |:confirm| and 'confirm'. :q[uit]! Quit without writing, also when the current buffer has changes. The buffer is unloaded, also when it has @@ -1131,7 +1110,7 @@ The names can be in upper- or lowercase. :cq[uit] Quit always, without writing, and return an error code. See |:cq|. Used for Manx's QuickFix mode (see - |quickfix|). {not in Vi} + |quickfix|). *:wq* :wq [++opt] Write the current file and quit. Writing fails when @@ -1169,7 +1148,7 @@ ZZ Write current file, if modified, and quit (same as *ZQ* ZQ Quit without checking for changes (same as ":q!"). - {not in Vi} + MULTIPLE WINDOWS AND BUFFERS *window-exit* @@ -1177,36 +1156,35 @@ MULTIPLE WINDOWS AND BUFFERS *window-exit* :qa[ll] Exit Vim, unless there are some buffers which have been changed. (Use ":bmod" to go to the next modified buffer). When 'autowriteall' is set all changed buffers will be - written, like |:wqall|. {not in Vi} + written, like |:wqall|. :conf[irm] qa[ll] Exit Vim. Bring up a prompt when some buffers have been - changed. See |:confirm|. {not in Vi} + changed. See |:confirm|. -:qa[ll]! Exit Vim. Any changes to buffers are lost. {not in Vi} +:qa[ll]! Exit Vim. Any changes to buffers are lost. Also see |:cquit|, it does the same but exits with a non-zero value. *:quita* *:quitall* -:quita[ll][!] Same as ":qall". {not in Vi} +:quita[ll][!] Same as ":qall". :wqa[ll] [++opt] *:wqa* *:wqall* *:xa* *:xall* :xa[ll] Write all changed buffers and exit Vim. If there are buffers without a file name, which are readonly or which cannot be - written for another reason, Vim will not quit. {not in Vi} + written for another reason, Vim will not quit. :conf[irm] wqa[ll] [++opt] :conf[irm] xa[ll] Write all changed buffers and exit Vim. Bring up a prompt when some buffers are readonly or cannot be written for - another reason. See |:confirm|. {not in Vi} + another reason. See |:confirm|. :wqa[ll]! [++opt] :xa[ll]! Write all changed buffers, even the ones that are readonly, and exit Vim. If there are buffers without a file name or which cannot be written for another reason, or there is a terminal with a running job, Vim will not quit. - {not in Vi} ============================================================================== 6. Dialogs *edit-dialogs* @@ -1317,10 +1295,12 @@ present in 'cpoptions' and "!" is not used in the command. name. On Unix systems: Change the current directory to the home directory. Use |:pwd| to print the current directory on all systems. + On Unix systems: clear any window-local directory. :cd[!] {path} Change the current directory to {path}. If {path} is relative, it is searched for in the directories listed in |'cdpath'|. + Clear any window-local directory. Does not change the meaning of an already opened file, because its full path name is remembered. Files from the |arglist| may change though! @@ -1330,7 +1310,7 @@ present in 'cpoptions' and "!" is not used in the command. < *:cd-* *E186* :cd[!] - Change to the previous current directory (before the - previous ":cd {path}" command). {not in Vi} + previous ":cd {path}" command). *:chd* *:chdir* :chd[ir][!] [path] Same as |:cd|. @@ -1341,20 +1321,18 @@ present in 'cpoptions' and "!" is not used in the command. The current directory is not changed for windows in other tabs and for windows in the current tab that have their own window-local directory. - {not in Vi} *:tch* *:tchdir* -:tch[dir][!] Same as |:tcd|. {not in Vi} +:tch[dir][!] Same as |:tcd|. *:lc* *:lcd* :lc[d][!] {path} Like |:cd|, but only set the current directory when the cursor is in the current window. The current directory for other windows is not changed, switching to another window will stop using {path}. - {not in Vi} *:lch* *:lchdir* -:lch[dir][!] Same as |:lcd|. {not in Vi} +:lch[dir][!] Same as |:lcd|. *:pw* *:pwd* *E187* :pw[d] Print the current directory name. {Vi: no pwd} @@ -1416,8 +1394,7 @@ There are a few things to remember when editing binary files: file. Otherwise both and are considered to end a line and when the file is written the will be replaced with . - characters are shown on the screen as ^@. You can enter them with - "CTRL-V CTRL-@" or "CTRL-V 000" {Vi cannot handle characters in the - file} + "CTRL-V CTRL-@" or "CTRL-V 000" - To insert a character in the file split a line. When writing the buffer to a file a will be written for the . - Vim normally appends an at the end of the file if there is none. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index e1ce00fa63..a39f72b551 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.1. Last change: 2019 Apr 27 +*eval.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -33,8 +33,6 @@ done, the features in this document are not available. See |+eval| and 13. Textlock |textlock| 14. Testing |testing| -{Vi does not have any of these commands} - ============================================================================== 1. Variables *variables* diff --git a/runtime/doc/farsi.txt b/runtime/doc/farsi.txt index 27298593f0..da47a0cfb8 100644 --- a/runtime/doc/farsi.txt +++ b/runtime/doc/farsi.txt @@ -1,4 +1,4 @@ -*farsi.txt* For Vim version 8.1. Last change: 2019 Feb 16 +*farsi.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Mortaza Ghassab Shiran @@ -6,7 +6,6 @@ Right to Left and Farsi Mapping for Vim *farsi* *Farsi* -{Vi does not have any of these commands} *E27* Farsi support has been removed in patch 8.1.0932. At that time it was diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 7a36804b33..68acf4d09d 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 8.1. Last change: 2018 Apr 18 +*filetype.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -12,7 +12,6 @@ Filetypes *filetype* *file-type* Also see |autocmd.txt|. -{Vi does not have any of these commands} ============================================================================== 1. Filetypes *filetypes* *file-types* diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index c3ee97e162..fb62d28dea 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -1,4 +1,4 @@ -*fold.txt* For Vim version 8.1. Last change: 2017 Mar 18 +*fold.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -14,7 +14,6 @@ You can find an introduction on folding in chapter 28 of the user manual. 3. Fold options |fold-options| 4. Behavior of folds |fold-behavior| -{Vi has no Folding} {not available when compiled without the |+folding| feature} ============================================================================== diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 2a8a70d443..c24d672738 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -1,4 +1,4 @@ -*gui.txt* For Vim version 8.1. Last change: 2019 Apr 28 +*gui.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -19,7 +19,6 @@ Other GUI documentation: |gui_x11.txt| For specific items of the X11 GUI. |gui_w32.txt| For specific items of the Win32 GUI. -{Vi does not have any of these commands} ============================================================================== 1. Starting the GUI *gui-start* *E229* *E233* diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt index 5ce3dc8c46..d139d5203c 100644 --- a/runtime/doc/gui_w32.txt +++ b/runtime/doc/gui_w32.txt @@ -1,4 +1,4 @@ -*gui_w32.txt* For Vim version 8.1. Last change: 2019 Apr 28 +*gui_w32.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -19,7 +19,6 @@ Other relevant documentation: |gui.txt| For generic items of the GUI. |os_win32.txt| For Win32 specific items. -{Vi does not have a Windows GUI} ============================================================================== 1. Starting the GUI *gui-w32-start* @@ -414,7 +413,7 @@ be opened as normal. See |drag-n-drop|. *:simalt* *:sim* :sim[alt] {key} simulate pressing {key} while holding Alt pressed. - {not in Vi} {only for Win32 versions} + {only for Win32 versions} Note: ":si" means ":s" with the "i" flag. Normally, Vim takes control of all Alt- combinations, to increase the diff --git a/runtime/doc/gui_x11.txt b/runtime/doc/gui_x11.txt index 28e9b91b5b..ed65b77aea 100644 --- a/runtime/doc/gui_x11.txt +++ b/runtime/doc/gui_x11.txt @@ -1,4 +1,4 @@ -*gui_x11.txt* For Vim version 8.1. Last change: 2019 Apr 12 +*gui_x11.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -19,7 +19,6 @@ Vim's Graphical User Interface *gui-x11* *GUI-X11* Other relevant documentation: |gui.txt| For generic items of the GUI. -{Vi does not have any of these commands} ============================================================================== 1. Starting the X11 GUI *gui-x11-start* *E665* diff --git a/runtime/doc/hebrew.txt b/runtime/doc/hebrew.txt index f2c3a3db44..8612c0bd9b 100644 --- a/runtime/doc/hebrew.txt +++ b/runtime/doc/hebrew.txt @@ -1,4 +1,4 @@ -*hebrew.txt* For Vim version 8.1. Last change: 2007 Jun 14 +*hebrew.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Ron Aaron (and Avner Lottem) @@ -10,10 +10,7 @@ The supporting 'rightleft' functionality was originally created by Avner Lottem. Ron Aaron is currently helping support these features. -{Vi does not have any of these commands} - -All this is only available when the |+rightleft| feature was enabled at -compile time. +{only available when the |+rightleft| feature was enabled at compile time} Introduction diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index f6c6ab7444..ce73f8c556 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -1,4 +1,4 @@ -*helphelp.txt* For Vim version 8.1. Last change: 2017 Mar 19 +*helphelp.txt* For Vim version 8.1. Last change: 2019 May 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -24,7 +24,6 @@ Help on help files *helphelp* the very top. The 'helplang' option is used to select a language, if the main help file is available in several languages. - {not in Vi} *{subject}* *E149* *E661* :h[elp] {subject} Like ":help", additionally jump to the tag {subject}. @@ -97,7 +96,6 @@ Help on help files *helphelp* command from a following command. You need to type CTRL-V first to insert the or . Example: > :help soonly -< {not in Vi} :h[elp]! [subject] Like ":help", but in non-English help files prefer to find a tag in a file with the same language as the @@ -133,7 +131,6 @@ Help on help files *helphelp* |:execute| when needed. Compressed help files will not be searched (Fedora compresses the help files). - {not in Vi} *:lh* *:lhelpgrep* :lh[elpgrep] {pattern}[@xx] @@ -147,11 +144,11 @@ Help on help files *helphelp* *:exu* *:exusage* :exu[sage] Show help on Ex commands. Added to simulate the Nvi - command. {not in Vi} + command. *:viu* *:viusage* :viu[sage] Show help on Normal mode commands. Added to simulate - the Nvi command. {not in Vi} + the Nvi command. When no argument is given to |:help| the file given with the 'helpfile' option will be opened. Otherwise the specified tag is searched for in all "doc/tags" @@ -199,7 +196,6 @@ command: > Only for backwards compatibility. It now executes the ToolBar.FindHelp menu entry instead of using a builtin dialog. {only when compiled with |+GUI_GTK|} - {not in Vi} *:helpt* *:helptags* *E154* *E150* *E151* *E152* *E153* *E670* @@ -224,8 +220,6 @@ command: > To rebuild the help tags in the runtime directory (requires write permission there): > :helptags $VIMRUNTIME/doc -< {not in Vi} - ============================================================================== 2. Translated help files *help-translated* diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index ba0f1d5d13..ed00a85d8a 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -1,4 +1,4 @@ -*if_cscop.txt* For Vim version 8.1. Last change: 2018 Jan 21 +*if_cscop.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Andy Kahn @@ -21,7 +21,6 @@ functions as you normally would with |tags|. 7. Availability & Information |cscope-info| This is currently for Unix and Win32 only. -{Vi does not have any of these commands} ============================================================================== 1. Cscope introduction *cscope-intro* diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index d3576100e7..24c53fa95b 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -1,4 +1,4 @@ -*if_lua.txt* For Vim version 8.1. Last change: 2015 Oct 16 +*if_lua.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Luis Carvalho @@ -17,17 +17,14 @@ The Lua Interface to Vim *lua* *Lua* 9. luaeval() Vim function |lua-luaeval| 10. Dynamic loading |lua-dynamic| -{Vi does not have any of these commands} - -The Lua interface is available only when Vim was compiled with the -|+lua| feature. +{only available when Vim was compiled with the |+lua| feature} ============================================================================== 1. Commands *lua-commands* *:lua* :[range]lua {chunk} - Execute Lua chunk {chunk}. {not in Vi} + Execute Lua chunk {chunk}. Examples: > @@ -38,7 +35,7 @@ Examples: :[range]lua << {endmarker} {script} {endmarker} - Execute Lua script {script}. {not in Vi} + Execute Lua script {script}. Note: This command doesn't work when the Lua feature wasn't compiled in. To avoid errors, see |script-here|. @@ -75,7 +72,6 @@ If you use LuaJIT you can also use this: > If the value returned by the function is a string it becomes the text of the line in the current turn. The default for [range] is the whole file: "1,$". - {not in Vi} Examples: > @@ -89,7 +85,7 @@ Examples: *:luafile* :[range]luafile {file} - Execute Lua script in {file}. {not in Vi} + Execute Lua script in {file}. The whole argument is used as a single file name. Examples: diff --git a/runtime/doc/if_mzsch.txt b/runtime/doc/if_mzsch.txt index 9d27683f7f..7b7e6b1a5c 100644 --- a/runtime/doc/if_mzsch.txt +++ b/runtime/doc/if_mzsch.txt @@ -1,4 +1,4 @@ -*if_mzsch.txt* For Vim version 8.1. Last change: 2017 Oct 08 +*if_mzsch.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Sergey Khorev @@ -15,10 +15,7 @@ The MzScheme Interface to Vim *mzscheme* *MzScheme* 7. Dynamic loading |mzscheme-dynamic| 8. MzScheme setup |mzscheme-setup| -{Vi does not have any of these commands} - -The MzScheme interface is available only if Vim was compiled with the -|+mzscheme| feature. +{only available when Vim was compiled with the |+mzscheme| feature} Based on the work of Brent Fulgham. Dynamic loading added by Sergey Khorev @@ -40,7 +37,7 @@ To speed up the process, you might also want to use --disable-gracket and *:mzscheme* *:mz* :[range]mz[scheme] {stmt} - Execute MzScheme statement {stmt}. {not in Vi} + Execute MzScheme statement {stmt}. :[range]mz[scheme] << {endmarker} {script} @@ -51,7 +48,7 @@ To speed up the process, you might also want to use --disable-gracket and |script-here|. *:mzfile* *:mzf* -:[range]mzf[ile] {file} Execute the MzScheme script in {file}. {not in Vi} +:[range]mzf[ile] {file} Execute the MzScheme script in {file}. All of these commands do essentially the same thing - they execute a piece of MzScheme code, with the "current range" set to the given line diff --git a/runtime/doc/if_ole.txt b/runtime/doc/if_ole.txt index e734df9847..46a8a5f382 100644 --- a/runtime/doc/if_ole.txt +++ b/runtime/doc/if_ole.txt @@ -1,4 +1,4 @@ -*if_ole.txt* For Vim version 8.1. Last change: 2008 Aug 16 +*if_ole.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Paul Moore @@ -12,10 +12,8 @@ The OLE Interface to Vim *ole-interface* 4. Registration |ole-registration| 5. MS Visual Studio integration |MSVisualStudio| -{Vi does not have any of these commands} - -OLE is only available when compiled with the |+ole| feature. See -src/if_ole.INSTALL. +{only available when compiled with the |+ole| feature. See +src/if_ole.INSTALL} An alternative is using the client-server communication |clientserver|. ============================================================================== diff --git a/runtime/doc/if_perl.txt b/runtime/doc/if_perl.txt index db0a92cc28..7e33af24a1 100644 --- a/runtime/doc/if_perl.txt +++ b/runtime/doc/if_perl.txt @@ -1,4 +1,4 @@ -*if_perl.txt* For Vim version 8.1. Last change: 2019 Jan 29 +*if_perl.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Sven Verdoolaege @@ -11,9 +11,7 @@ Perl and Vim *perl* *Perl* 3. Using the Perl interface |perl-using| 4. Dynamic loading |perl-dynamic| -{Vi does not have any of these commands} - -The Perl interface only works when Vim was compiled with the |+perl| feature. +{only available when Vim was compiled with the |+perl| feature} ============================================================================== 1. Editing Perl files *perl-editing* diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index 86d9ac2615..9e2d3017ce 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -1,4 +1,4 @@ -*if_pyth.txt* For Vim version 8.1. Last change: 2018 Jan 30 +*if_pyth.txt* For Vim version 8.1. Last change: 2019 May 04 VIM REFERENCE MANUAL by Paul Moore @@ -19,8 +19,6 @@ The Python Interface to Vim *python* *Python* 11. Python X |python_x| 12. Building with Python support |python-building| -{Vi does not have any of these commands} - The Python 2.x interface is available only when Vim was compiled with the |+python| feature. The Python 3 interface is available only when Vim was compiled with the @@ -76,7 +74,6 @@ and "EOF" do not have any indent. None. If a string is returned, it becomes the text of the line in the current turn. The default for [range] is the whole file: "1,$". - {not in Vi} Examples: > @@ -98,7 +95,7 @@ python. For example: > *:pyfile* *:pyf* :[range]pyf[ile] {file} Execute the Python script in {file}. The whole - argument is used as a single file name. {not in Vi} + argument is used as a single file name. Both of these commands do essentially the same thing - they execute a piece of Python code, with the "current range" |python-range| set to the given line diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt index e2e7742151..de36c0131a 100644 --- a/runtime/doc/if_ruby.txt +++ b/runtime/doc/if_ruby.txt @@ -1,4 +1,4 @@ -*if_ruby.txt* For Vim version 8.1. Last change: 2019 Jan 29 +*if_ruby.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Shugo Maeda @@ -14,10 +14,9 @@ The Ruby Interface to Vim *ruby* *Ruby* 6. rubyeval() Vim function |ruby-rubyeval| 7. Dynamic loading |ruby-dynamic| -{Vi does not have any of these commands} *E266* *E267* *E268* *E269* *E270* *E271* *E272* *E273* -The Ruby interface only works when Vim was compiled with the |+ruby| feature. +{only available when Vim was compiled with the |+ruby| feature} The home page for ruby is http://www.ruby-lang.org/. You can find links for downloading Ruby there. diff --git a/runtime/doc/if_tcl.txt b/runtime/doc/if_tcl.txt index e822dfd170..4a5379ddb0 100644 --- a/runtime/doc/if_tcl.txt +++ b/runtime/doc/if_tcl.txt @@ -1,4 +1,4 @@ -*if_tcl.txt* For Vim version 8.1. Last change: 2016 Jan 01 +*if_tcl.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Ingo Wilken @@ -16,9 +16,8 @@ The Tcl Interface to Vim *tcl* *Tcl* *TCL* 8. Examples |tcl-examples| 9. Dynamic loading |tcl-dynamic| -{Vi does not have any of these commands} *E280* - -The Tcl interface only works when Vim was compiled with the |+tcl| feature. +*E280* +{only available when Vim was compiled with the |+tcl| feature} WARNING: There are probably still some bugs. Please send bug reports, comments, ideas etc to @@ -66,12 +65,11 @@ To see what version of Tcl you have: > possible to add or delete lines using this command. If {cmd} returns an error, the command is interrupted. The default for [range] is the whole file: "1,$". - See |tcl-var-line| and |tcl-var-lnum|. {not in Vi} + See |tcl-var-line| and |tcl-var-lnum|. *:tclfile* *:tclf* :tclf[ile] {file} Execute the Tcl script in {file}. This is the same as ":tcl source {file}", but allows file name completion. - {not in Vi} Note that Tcl objects (like variables) persist from one command to the next, diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 9b5663e1e4..792a71569e 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 8.1. Last change: 2019 Apr 19 +*index.txt* For Vim version 8.1. Last change: 2019 Apr 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -862,6 +862,10 @@ tag char note action in Normal mode ~ position the cursor at the start (left side) of the screen |zt| zt redraw, cursor line at top of window +|zuw| zuw undo |zw| +|zug| zug undo |zg| +|zuW| zuW undo |zW| +|zuG| zuG undo |zG| |zv| zv open enough folds to view the cursor line |zw| zw mark word as wrong (bad) spelled word |zx| zx re-apply 'foldlevel' and do "zv" diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 9d7e4ced45..e962343a07 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.1. Last change: 2019 Apr 06 +*insert.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -62,7 +62,7 @@ CTRL-C Quit insert mode, go back to Normal mode. Do not check for CTRL-@ Insert previously inserted text and stop insert. {Vi: only when typed as first char, only up to 128 chars} *i_CTRL-A* -CTRL-A Insert previously inserted text. {not in Vi} +CTRL-A Insert previously inserted text. *i_CTRL-H* *i_* *i_BS* or CTRL-H Delete the character before the cursor (see |i_backspacing| @@ -75,7 +75,6 @@ CTRL-A Insert previously inserted text. {not in Vi} "eol", delete the ; the next line is appended after the current one. See |:fixdel| if your key does not do what you want. - {not in Vi} *i_CTRL-W* CTRL-W Delete the word before the cursor (see |i_backspacing| about joining lines). See the section "word motions", @@ -102,10 +101,10 @@ CTRL-K {char1} [char2] key, the code for that key is inserted in <> form. For example, the string "" can be entered by typing (two keys). Neither char is considered for - mapping. {not in Vi} + mapping. -CTRL-N Find next keyword (see |i_CTRL-N|). {not in Vi} -CTRL-P Find previous keyword (see |i_CTRL-P|). {not in Vi} +CTRL-N Find next keyword (see |i_CTRL-N|). +CTRL-P Find previous keyword (see |i_CTRL-P|). CTRL-R {0-9a-z"%#*+:.-=} *i_CTRL-R* Insert the contents of a register. Between typing CTRL-R and @@ -142,7 +141,7 @@ CTRL-R {0-9a-z"%#*+:.-=} *i_CTRL-R* converted to a String. When append() or setline() is invoked the undo sequence will be broken. - See |registers| about registers. {not in Vi} + See |registers| about registers. CTRL-R CTRL-R {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-R* Insert the contents of a register. Works like using a single @@ -154,7 +153,7 @@ CTRL-R CTRL-R {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-R* < Options 'textwidth', 'formatoptions', etc. still apply. If you also want to avoid these, use CTRL-R CTRL-O, see below. The '.' register (last inserted text) is still inserted as - typed. {not in Vi} + typed. CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O* Insert the contents of a register literally and don't @@ -163,14 +162,14 @@ CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O* insert the text above the current line, like with `P`. Does not replace characters! The '.' register (last inserted text) is still inserted as - typed. {not in Vi} + typed. CTRL-R CTRL-P {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-P* Insert the contents of a register literally and fix the indent, like |[|. Does not replace characters! The '.' register (last inserted text) is still inserted as - typed. {not in Vi} + typed. *i_CTRL-T* CTRL-T Insert one shiftwidth of indent at the start of the current @@ -206,12 +205,12 @@ CTRL-Q Same as CTRL-V. CTRL-X Enter CTRL-X mode. This is a sub-mode where commands can be given to complete words or scroll the window. See - |i_CTRL-X| and |ins-completion|. {not in Vi} + |i_CTRL-X| and |ins-completion|. *i_CTRL-E* -CTRL-E Insert the character which is below the cursor. {not in Vi} +CTRL-E Insert the character which is below the cursor. *i_CTRL-Y* -CTRL-Y Insert the character which is above the cursor. {not in Vi} +CTRL-Y Insert the character which is above the cursor. Note that for CTRL-E and CTRL-Y 'textwidth' is not used, to be able to copy characters from a long line. @@ -228,7 +227,6 @@ CTRL-_ Switch between languages, as follows: is set. Please refer to |rileft.txt| for more information about right-to-left mode. - {not in Vi} Only if compiled with the |+rightleft| feature. *i_CTRL-^* @@ -248,14 +246,12 @@ CTRL-^ Toggle the use of typing language characters. The language mappings are normally used to type characters that are different from what the keyboard produces. The 'keymap' option can be used to install a whole number of them. - {not in Vi} *i_CTRL-]* -CTRL-] Trigger abbreviation, without inserting a character. {not in - Vi} +CTRL-] Trigger abbreviation, without inserting a character. *i_* - Toggle between Insert and Replace mode. {not in Vi} + Toggle between Insert and Replace mode. ----------------------------------------------------------------------- *i_backspacing* @@ -519,15 +515,14 @@ The 'expandtab' option is off by default. Note that in Replace mode, a single character is replaced with several spaces. The result of this is that the number of characters in the line increases. Backspacing will delete one space at a time. The original character will be put back for only one space -that you backspace over (the last one). {Vi does not have the 'expandtab' -option} +that you backspace over (the last one). *ins-smarttab* When the 'smarttab' option is on, a inserts 'shiftwidth' positions at the beginning of a line and 'tabstop' positions in other places. This means that often spaces instead of a character are inserted. When 'smarttab' is off, a always inserts 'tabstop' positions, and 'shiftwidth' is only -used for ">>" and the like. {not in Vi} +used for ">>" and the like. *ins-softtabstop* When the 'softtabstop' option is non-zero, a inserts 'softtabstop' @@ -567,14 +562,13 @@ If the 'expandtab' option is on, a will replace one character with several spaces. The result of this is that the number of characters in the line increases. Backspacing will delete one space at a time. The original character will be put back for only one space that you backspace over (the -last one). {Vi does not have the 'expandtab' option} +last one). ============================================================================== 6. Virtual Replace mode *vreplace-mode* *Virtual-Replace-mode* Enter Virtual Replace mode with the "gR" command in normal mode. {not available when compiled without the |+vreplace| feature} -{Vi does not have Virtual Replace mode} Virtual Replace mode is similar to Replace mode, but instead of replacing actual characters in the file, you are replacing screen real estate, so that @@ -1807,7 +1801,7 @@ I Insert text before the first non-blank in the line the last blank. *gI* -gI Insert text in column 1 [count] times. {not in Vi} +gI Insert text in column 1 [count] times. *gi* gi Insert text in the same position as where Insert mode @@ -1818,7 +1812,6 @@ gi Insert text in the same position as where Insert mode but NOT for inserted/deleted characters. When the |:keepjumps| command modifier is used the |'^| mark won't be changed. - {not in Vi} *o* o Begin a new line below the cursor and insert text, @@ -1885,7 +1878,6 @@ NOTE: These commands cannot be used with |:global| or |:vglobal|. script, the insertion only starts after the function or script is finished. This command does not work from |:normal|. - {not in Vi} *:stopi* *:stopinsert* :stopi[nsert] Stop Insert mode as soon as possible. Works like @@ -1902,12 +1894,10 @@ NOTE: These commands cannot be used with |:global| or |:vglobal|. Note that when using this command in a function or script that the replacement will only start after the function or script is finished. - {not in Vi} *:startgreplace* :startg[replace][!] Just like |:startreplace|, but use Virtual Replace mode, like with |gR|. - {not in Vi} ============================================================================== 10. Inserting a file *inserting-file* diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 106245b838..198ff18600 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -1,4 +1,4 @@ -*intro.txt* For Vim version 8.1. Last change: 2019 Jan 07 +*intro.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,9 +34,7 @@ It can be accessed from within Vim with the or key and with the is not located in the default place. You can jump to subjects like with tags: Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back. -Throughout this manual the differences between Vi and Vim are mentioned in -curly braces, like this: {Vi does not have on-line help}. See |vi_diff.txt| -for a summary of the differences between Vim and Vi. +The differences between Vi and Vim are mentioned in |vi_diff.txt|. This manual refers to Vim on various machines. There may be small differences between different computers and terminals. Besides the remarks given in this @@ -703,7 +701,6 @@ gQ Switch to "Ex" mode like with "Q", but really behave like typing ":" commands after another. All command line editing, completion etc. is available. Use the ":vi" command |:visual| to exit "Ex" mode. - {not in Vi} ============================================================================== 7. The window contents *window-contents* diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 4121fbd1c6..7a74bb0abb 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 8.1. Last change: 2019 Apr 25 +*map.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -76,7 +76,7 @@ modes. Map the key sequence {lhs} to {rhs} for the modes where the map command applies. Disallow mapping of {rhs}, to avoid nested and recursive mappings. Often - used to redefine a command. {not in Vi} + used to redefine a command. :unm[ap] {lhs} |mapmode-nvo| *:unm* *:unmap* @@ -110,7 +110,7 @@ modes. :cmapc[lear] |mapmode-c| *:cmapc* *:cmapclear* :tmapc[lear] |mapmode-t| *:tmapc* *:tmapclear* Remove ALL mappings for the modes where the map - command applies. {not in Vi} + command applies. Use the argument to remove buffer-local mappings |:map-| Warning: This also removes the default mappings. @@ -143,7 +143,6 @@ modes. :tma[p] {lhs} |mapmode-t| *:tmap_l* List the key mappings for the key sequences starting with {lhs} in the modes where the map command applies. - {not in Vi} These commands are used to map a key or key sequence to a string of characters. You can use this to put command sequences under function keys, @@ -160,7 +159,6 @@ decide if "aa" or "aaa" should be mapped. This means that after typing "aa" that mapping won't get expanded yet, Vim is waiting for another character. If you type a space, then "foo" will get inserted, plus the space. If you type "a", then "bar" will get inserted. -{Vi does not allow ambiguous mappings} 1.2 SPECIAL ARGUMENTS *:map-arguments* @@ -1016,45 +1014,40 @@ See |:verbose-cmd| for more information. *:norea* *:noreabbrev* :norea[bbrev] [] [] [lhs] [rhs] - same as ":ab", but no remapping for this {rhs} {not - in Vi} + Same as ":ab", but no remapping for this {rhs}. *:ca* *:cabbrev* :ca[bbrev] [] [] [lhs] [rhs] - same as ":ab", but for Command-line mode only. {not - in Vi} + Same as ":ab", but for Command-line mode only. *:cuna* *:cunabbrev* -:cuna[bbrev] {lhs} same as ":una", but for Command-line mode only. {not - in Vi} +:cuna[bbrev] {lhs} Same as ":una", but for Command-line mode only. *:cnorea* *:cnoreabbrev* :cnorea[bbrev] [] [] [lhs] [rhs] same as ":ab", but for Command-line mode only and no - remapping for this {rhs} {not in Vi} + remapping for this {rhs} *:ia* *:iabbrev* :ia[bbrev] [] [] [lhs] [rhs] - same as ":ab", but for Insert mode only. {not in Vi} + Same as ":ab", but for Insert mode only. *:iuna* *:iunabbrev* -:iuna[bbrev] {lhs} same as ":una", but for insert mode only. {not in - Vi} +:iuna[bbrev] {lhs} Same as ":una", but for insert mode only. *:inorea* *:inoreabbrev* :inorea[bbrev] [] [] [lhs] [rhs] - same as ":ab", but for Insert mode only and no - remapping for this {rhs} {not in Vi} + Same as ":ab", but for Insert mode only and no + remapping for this {rhs}. *:abc* *:abclear* -:abc[lear] [] Remove all abbreviations. {not in Vi} +:abc[lear] [] Remove all abbreviations. *:iabc* *:iabclear* -:iabc[lear] [] Remove all abbreviations for Insert mode. {not in Vi} +:iabc[lear] [] Remove all abbreviations for Insert mode. *:cabc* *:cabclear* -:cabc[lear] [] Remove all abbreviations for Command-line mode. {not - in Vi} +:cabc[lear] [] Remove all abbreviations for Command-line mode. *using_CTRL-V* It is possible to use special characters in the rhs of an abbreviation. @@ -1147,8 +1140,7 @@ to find out what they are defined to. The |:scriptnames| command can be used to see which scripts have been sourced and what their number is. -This is all {not in Vi} and {not available when compiled without the |+eval| -feature}. +This is all {not available when compiled without the |+eval| feature}. ============================================================================== 4. User-defined commands *user-commands* @@ -1391,7 +1383,7 @@ Possible attributes are: number. -count=N A count (default N) which is specified either in the line number position, or as an initial argument (like |:Next|). - Specifying -count (without a default) acts like -count=0 + -count acts like -count=0 Note that -range=N and -count=N are mutually exclusive - only one should be specified. @@ -1402,14 +1394,16 @@ by default correspond to the current line, last line and the whole buffer, relate to arguments, (loaded) buffers, windows or tab pages. Possible values are (second column is the short name used in listing): - -addr=lines Range of lines (this is the default) + -addr=lines Range of lines (this is the default for -range) -addr=arguments arg Range for arguments -addr=buffers buf Range for buffers (also not loaded buffers) -addr=loaded_buffers load Range for loaded buffers -addr=windows win Range for windows -addr=tabs tab Range for tab pages -addr=quickfix qf Range for quickfix entries - -addr=other ? other kind of range + -addr=other ? other kind of range; can use ".", "$" and "%" + as with "lines" (this is the default for + -count) Special cases ~ diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt index 15198f6b67..7b8c21f3ff 100644 --- a/runtime/doc/mbyte.txt +++ b/runtime/doc/mbyte.txt @@ -1,4 +1,4 @@ -*mbyte.txt* For Vim version 8.1. Last change: 2018 Jan 21 +*mbyte.txt* For Vim version 8.1. Last change: 2019 Apr 28 VIM REFERENCE MANUAL by Bram Moolenaar et al. diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 65cd8df08a..7a4543fc48 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -1,4 +1,4 @@ -*message.txt* For Vim version 8.1. Last change: 2019 Apr 04 +*message.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -830,10 +830,10 @@ Type effect ~ G down all the way, until the hit-enter prompt - or k or one line back (*) - u up a page (half a screen) (*) - b or back a screen (*) - g back to the start (*) + or k or one line back + u up a page (half a screen) + b or back a screen + g back to the start q, or CTRL-C stop the listing : stop the listing and enter a @@ -842,13 +842,11 @@ Type effect ~ the clipboard ("* and "+ registers) {menu-entry} what the menu is defined to in Cmdline-mode. - (**) next page + next page (*) Any other key causes the meaning of the keys to be displayed. -(*) backwards scrolling is {not in Vi}. Only scrolls back to where messages - started to scroll. -(**) Clicking the left mouse button only works: +(*) Clicking the left mouse button only works: - For the GUI: in the last line of the screen. - When 'r' is included in 'mouse' (but then selecting text won't work). diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt index f25aef2751..9cc12f10c7 100644 --- a/runtime/doc/mlang.txt +++ b/runtime/doc/mlang.txt @@ -1,4 +1,4 @@ -*mlang.txt* For Vim version 8.1. Last change: 2018 May 06 +*mlang.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -17,7 +17,6 @@ The basics are explained in the user manual: |usr_45.txt|. Also see |help-translated| for multi-language help. -{Vi does not have any of these features} {not available when compiled without the |+multi_lang| feature} ============================================================================== diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 7ebdee666e..bc015a3ac4 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -1,4 +1,4 @@ -*motion.txt* For Vim version 8.1. Last change: 2019 Mar 02 +*motion.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -185,7 +185,7 @@ l or *l* TEXT column (if possible). Most other commands stay in the same SCREEN column. works like "1|", which differs from "0" when the line starts with a - . {not in Vi} + . *^* ^ To the first non-blank character of the line. @@ -202,7 +202,7 @@ $ or To the end of the line. When a count is given also go *g_* g_ To the last non-blank character of the line and - [count - 1] lines downward |inclusive|. {not in Vi} + [count - 1] lines downward |inclusive|. *g0* *g* g0 or g When lines wrap ('wrap' on): To the first character of @@ -211,7 +211,7 @@ g0 or g When lines wrap ('wrap' on): To the first character of When lines don't wrap ('wrap' off): To the leftmost character of the current line that is on the screen. Differs from "0" when the first character of the line - is not on the screen. {not in Vi} + is not on the screen. *g^* g^ When lines wrap ('wrap' on): To the first non-blank @@ -220,12 +220,11 @@ g^ When lines wrap ('wrap' on): To the first non-blank When lines don't wrap ('wrap' off): To the leftmost non-blank character of the current line that is on the screen. Differs from "^" when the first non-blank - character of the line is not on the screen. {not in - Vi} + character of the line is not on the screen. *gm* gm Like "g0", but half a screenwidth to the right (or as - much as possible). {not in Vi} + much as possible). *g$* *g* g$ or g When lines wrap ('wrap' on): To the last character of @@ -240,7 +239,6 @@ g$ or g When lines wrap ('wrap' on): To the last character of instead of going to the end of the line. When 'virtualedit' is enabled moves to the end of the screen line. - {not in Vi} *bar* | To screen column [count] in the current line. @@ -296,12 +294,12 @@ CTRL-N [count] lines downward |linewise|. gk or *gk* *g* g [count] display lines upward. |exclusive| motion. Differs from 'k' when lines wrap, and when used with - an operator, because it's not linewise. {not in Vi} + an operator, because it's not linewise. gj or *gj* *g* g [count] display lines downward. |exclusive| motion. Differs from 'j' when lines wrap, and when used with - an operator, because it's not linewise. {not in Vi} + an operator, because it's not linewise. *-* - [count] lines upward, on the first non-blank @@ -324,7 +322,7 @@ G Goto line [count], default last line, on the first ** Goto line [count], default last line, on the last - character |inclusive|. {not in Vi} + character |inclusive|. or *gg* ** gg Goto line [count], default first line, on the first @@ -342,7 +340,7 @@ gg Goto line [count], default first line, on the first non-blank in the line |linewise|. To compute the new line number this formula is used: ({count} * number-of-lines + 99) / 100 - See also 'startofline' option. {not in Vi} + See also 'startofline' option. :[range]go[to] [count] *:go* *:goto* *go* [count]go Go to [count] byte in the buffer. Default [count] is @@ -352,7 +350,6 @@ gg Goto line [count], default first line, on the first 'fileformat' setting. Also see the |line2byte()| function, and the 'o' option in 'statusline'. - {not in Vi} {not available when compiled without the |+byte_offset| feature} @@ -516,7 +513,6 @@ including white space, the commands starting with "i" select an "inner" object without white space, or just the white space. Thus the "inner" commands always select less text than the "a" commands. -These commands are {not in Vi}. These commands are not available when the |+textobjects| feature has been disabled at compile time. Also see `gn` and `gN`, operating on the last search pattern. @@ -780,7 +776,7 @@ m< or m> Set the |'<| or |'>| mark. Useful to change what the *'A* *'0* *`A* *`0* '{A-Z0-9} `{A-Z0-9} To the mark {A-Z0-9} in the file where it was set (not - a motion command when in another file). {not in Vi} + a motion command when in another file). *g'* *g'a* *g`* *g`a* g'{mark} g`{mark} @@ -790,18 +786,17 @@ g'{mark} g`{mark} < jumps to the last known position in a file. See $VIMRUNTIME/vimrc_example.vim. Also see |:keepjumps|. - {not in Vi} *:marks* :marks List all the current marks (not a motion command). The |'(|, |')|, |'{| and |'}| marks are not listed. The first column has number zero. - {not in Vi} + *E283* :marks {arg} List the marks that are mentioned in {arg} (not a motion command). For example: > :marks aB -< to list marks 'a' and 'B'. {not in Vi} +< to list marks 'a' and 'B'. *:delm* *:delmarks* :delm[arks] {marks} Delete the specified marks. Marks that can be deleted @@ -815,11 +810,9 @@ g'{mark} g`{mark} :delmarks p-z deletes marks in the range p to z :delmarks ^.[] deletes marks ^ . [ ] :delmarks \" deletes mark " -< {not in Vi} :delm[arks]! Delete all marks for the current buffer, but not marks A-Z or 0-9. - {not in Vi} A mark is not visible in any way. It is just a position in the file that is remembered. Do not confuse marks with named registers, they are totally @@ -854,11 +847,11 @@ Numbered mark should be stored. See |viminfo-file-marks|. *'[* *`[* '[ `[ To the first character of the previously changed - or yanked text. {not in Vi} + or yanked text. *']* *`]* '] `] To the last character of the previously changed or - yanked text. {not in Vi} + yanked text. After executing an operator the Cursor is put at the beginning of the text that was operated upon. After a put command ("p" or "P") the cursor is @@ -876,7 +869,7 @@ was made yet in the current file. '< `< To the first line or character of the last selected Visual area in the current buffer. For block mode it may also be the last character in the first line (to - be able to define the block). {not in Vi}. + be able to define the block). *'>* *`>* '> `> To the last line or character of the last selected @@ -884,7 +877,7 @@ was made yet in the current file. may also be the first character of the last line (to be able to define the block). Note that 'selection' applies, the position may be just after the Visual - area. {not in Vi}. + area. *''* *``* '' `` To the position before the latest jump, or where the @@ -900,13 +893,12 @@ was made yet in the current file. Only one position is remembered per buffer, not one for each window. As long as the buffer is visible in a window the position won't be changed. - {not in Vi}. *'^* *`^* '^ `^ To the position where the cursor was the last time when Insert mode was stopped. This is used by the |gi| command. Not set when the |:keepjumps| command - modifier was used. {not in Vi} + modifier was used. *'.* *`.* '. `. To the position where the last change was made. The @@ -916,30 +908,29 @@ was made yet in the current file. command changed. For example when inserting a word, the position will be on the last character. To jump to older changes use |g;|. - {not in Vi} *'(* *`(* '( `( To the start of the current sentence, like the |(| - command. {not in Vi} + command. *')* *`)* ') `) To the end of the current sentence, like the |)| - command. {not in Vi} + command. *'{* *`{* '{ `{ To the start of the current paragraph, like the |{| - command. {not in Vi} + command. *'}* *`}* '} `} To the end of the current paragraph, like the |}| - command. {not in Vi} + command. These commands are not marks themselves, but jump to a mark: *]'* ]' [count] times to next line with a lowercase mark below the cursor, on the first non-blank character in the - line. {not in Vi} + line. *]`* ]` [count] times to lowercase mark after the cursor. {not @@ -948,11 +939,10 @@ These commands are not marks themselves, but jump to a mark: *['* [' [count] times to previous line with a lowercase mark before the cursor, on the first non-blank character in - the line. {not in Vi} + the line. *[`* [` [count] times to lowercase mark before the cursor. - {not in Vi} :loc[kmarks] {command} *:loc* *:lockmarks* @@ -1030,23 +1020,19 @@ commands that start editing a new file. *CTRL-O* CTRL-O Go to [count] Older cursor position in jump list (not a motion command). - {not in Vi} {not available without the |+jumplist| feature} or *CTRL-I* ** CTRL-I Go to [count] newer cursor position in jump list (not a motion command). - {not in Vi} {not available without the |+jumplist| feature} *:ju* *:jumps* :ju[mps] Print the jump list (not a motion command). - {not in Vi} {not available without the |+jumplist| feature} *:cle* *:clearjumps* :cle[arjumps] Clear the jump list of the current window. - {not in Vi} {not available without the |+jumplist| feature} *jumplist* @@ -1131,14 +1117,12 @@ g; Go to [count] older position in change list. positions go to the oldest change. If there is no older change an error message is given. (not a motion command) - {not in Vi} {not available without the |+jumplist| feature} *g,* *E663* g, Go to [count] newer cursor position in change list. Just like |g;| but in the opposite direction. (not a motion command) - {not in Vi} {not available without the |+jumplist| feature} When using a count you jump as far back or forward as possible. Thus you can @@ -1229,19 +1213,19 @@ remembered. *[(* [( go to [count] previous unmatched '('. - |exclusive| motion. {not in Vi} + |exclusive| motion. *[{* [{ go to [count] previous unmatched '{'. - |exclusive| motion. {not in Vi} + |exclusive| motion. *])* ]) go to [count] next unmatched ')'. - |exclusive| motion. {not in Vi} + |exclusive| motion. *]}* ]} go to [count] next unmatched '}'. - |exclusive| motion. {not in Vi} + |exclusive| motion. The above four commands can be used to go to the start or end of the current code block. It is like doing "%" on the '(', ')', '{' or '}' at the other @@ -1254,25 +1238,25 @@ bring you back to the switch statement. similar structured language). When not before the start of a method, jump to the start or end of the class. When no '{' is found after the cursor, this is - an error. |exclusive| motion. {not in Vi} + an error. |exclusive| motion. *]M* ]M Go to [count] next end of a method (for Java or similar structured language). When not before the end of a method, jump to the start or end of the class. When no '}' is found after the cursor, this is an - error. |exclusive| motion. {not in Vi} + error. |exclusive| motion. *[m* [m Go to [count] previous start of a method (for Java or similar structured language). When not after the start of a method, jump to the start or end of the class. When no '{' is found before the cursor this is - an error. |exclusive| motion. {not in Vi} + an error. |exclusive| motion. *[M* [M Go to [count] previous end of a method (for Java or similar structured language). When not after the end of a method, jump to the start or end of the class. When no '}' is found before the cursor this is - an error. |exclusive| motion. {not in Vi} + an error. |exclusive| motion. The above two commands assume that the file contains a class with methods. The class definition is surrounded in '{' and '}'. Each method in the class @@ -1295,11 +1279,11 @@ Using "3[m" will jump to the start of the class. *[#* [# go to [count] previous unmatched "#if" or "#else". - |exclusive| motion. {not in Vi} + |exclusive| motion. *]#* ]# go to [count] next unmatched "#else" or "#endif". - |exclusive| motion. {not in Vi} + |exclusive| motion. These two commands work in C programs that contain #if/#else/#endif constructs. It brings you to the start or end of the #if/#else/#endif where @@ -1307,11 +1291,11 @@ the current line is included. You can then use "%" to go to the matching line. *[star* *[/* [* or [/ go to [count] previous start of a C comment "/*". - |exclusive| motion. {not in Vi} + |exclusive| motion. *]star* *]/* ]* or ]/ go to [count] next end of a C comment "*/". - |exclusive| motion. {not in Vi} + |exclusive| motion. *H* @@ -1339,6 +1323,6 @@ L To line [count] from bottom of window (default: Last Moves to the position on the screen where the mouse click is |exclusive|. See also ||. If the position is in a status line, that window is made the - active window and the cursor is not moved. {not in Vi} + active window and the cursor is not moved. vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/netbeans.txt b/runtime/doc/netbeans.txt index 495f0d4baf..31d6907412 100644 --- a/runtime/doc/netbeans.txt +++ b/runtime/doc/netbeans.txt @@ -1,4 +1,4 @@ -*netbeans.txt* For Vim version 8.1. Last change: 2019 Jan 17 +*netbeans.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Gordon Prieur et al. @@ -24,7 +24,6 @@ Vim NetBeans Protocol: a socket interface for Vim integration into an IDE. 10.4. Obtaining the External Editor Module |obtaining-exted| 10.5. Setting up NetBeans to run with Vim |netbeans-setup| -{Vi does not have any of these features} {only available when compiled with the |+netbeans_intg| feature} ============================================================================== diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 6a73180d0a..c17842f3cd 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.1. Last change: 2019 Apr 28 +*options.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -6163,9 +6163,7 @@ A jump table for the options with a short description can be found at |Q_op|. set to half the number of lines in the window when the window size changes. If you give a count to the CTRL-U or CTRL-D command it will be used as the new value for 'scroll'. Reset to half the window - height with ":set scroll=0". {Vi is a bit different: 'scroll' gives - the number of screen lines instead of file lines, makes a difference - when lines wrap} + height with ":set scroll=0". *'scrollbind'* *'scb'* *'noscrollbind'* *'noscb'* 'scrollbind' 'scb' boolean (default off) @@ -7787,7 +7785,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'timeoutlen'* *'tm'* 'timeoutlen' 'tm' number (default 1000) global - {not in all versions of Vi} + *'ttimeoutlen'* *'ttm'* 'ttimeoutlen' 'ttm' number (default -1, set to 100 in |defaults.vim|) global @@ -7990,9 +7988,10 @@ A jump table for the options with a short description can be found at |Q_op|. work. See below for how Vim detects this automatically. *netterm-mouse* - netterm NetTerm mouse handling. The mouse generates + netterm NetTerm mouse handling. A left mouse click generates "}r,c", where "r,c" are two decimal numbers - for the row and column. + for the row and column. No other mouse events are + supported. *dec-mouse* dec DEC terminal mouse handling. The mouse generates a rather complex sequence, starting with "[". @@ -8653,7 +8652,6 @@ A jump table for the options with a short description can be found at |Q_op|. in a much smarter way, taking care of wrapping lines. When resizing the Vim window, the value is smaller than 1 or more than or equal to 'lines' it will be set to 'lines' minus 1. - {Vi also uses the option to specify the number of displayed lines} *'winheight'* *'wh'* *E591* 'winheight' 'wh' number (default 1) diff --git a/runtime/doc/os_mac.txt b/runtime/doc/os_mac.txt index 28ebe66014..77d1f89696 100644 --- a/runtime/doc/os_mac.txt +++ b/runtime/doc/os_mac.txt @@ -1,4 +1,4 @@ -*os_mac.txt* For Vim version 8.1. Last change: 2018 Jan 21 +*os_mac.txt* For Vim version 8.1. Last change: 2019 Apr 21 VIM REFERENCE MANUAL by Bram Moolenaar et al. diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index fc4502d0cf..8babf0b236 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 8.1. Last change: 2019 Feb 21 +*pattern.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -78,24 +78,24 @@ N Repeat the latest "/" or "?" [count] times in 4. the first non-blank word after the cursor, in the current line Only whole keywords are searched for, like with the - command "/\". |exclusive| {not in Vi} + command "/\". |exclusive| 'ignorecase' is used, 'smartcase' is not. *#* # Same as "*", but search backward. The pound sign (character 163) also works. If the "#" key works as backspace, try using "stty erase " before starting - Vim ( is CTRL-H or a real backspace). {not in Vi} + Vim ( is CTRL-H or a real backspace). *gstar* g* Like "*", but don't put "\<" and "\>" around the word. This makes the search also find matches that are not a - whole word. {not in Vi} + whole word. *g#* g# Like "#", but don't put "\<" and "\>" around the word. This makes the search also find matches that are not a - whole word. {not in Vi} + whole word. *gd* gd Goto local Declaration. When the cursor is on a local @@ -113,22 +113,21 @@ gd Goto local Declaration. When the cursor is on a local searched use the commands listed in |include-search|. After this command |n| searches forward for the next match (not backward). - {not in Vi} *gD* gD Goto global Declaration. When the cursor is on a global variable that is defined in the file, this command will jump to its declaration. This works just like "gd", except that the search for the keyword - always starts in line 1. {not in Vi} + always starts in line 1. *1gd* 1gd Like "gd", but ignore matches inside a {} block that - ends before the cursor position. {not in Vi} + ends before the cursor position. *1gD* 1gD Like "gD", but ignore matches inside a {} block that - ends before the cursor position. {not in Vi} + ends before the cursor position. *CTRL-C* CTRL-C Interrupt current (search) command. Use CTRL-Break on @@ -171,7 +170,7 @@ error message |:s_flags|. *search-offset* *{offset}* These commands search for the specified pattern. With "/" and "?" an additional offset may be given. There are two types of offsets: line offsets -and character offsets. {the character offsets are not in Vi} +and character offsets. The offset gives the cursor position relative to the found match: [num] [num] lines downwards, in column 1 @@ -310,14 +309,6 @@ when executing a pattern takes a long time and when checking for messages on channels a callback is invoked that also uses a pattern or an autocommand is triggered. In most cases this should be fine, but if a pattern is in use when it's used again it fails. Usually this means there is something wrong with -the pattern. - - *E956* -In very rare cases a regular expression is used recursively. This can happen -when executing a pattern takes a long time and when checking for messages on -channels a callback is invoked that also uses a pattern or an autocommand is -triggered. In most cases this should be fine, but if a pattern is in use when -it's used again it fails. Usually this means there is something wrong with the pattern. ============================================================================== @@ -455,30 +446,28 @@ More explanation and examples below, follow the links. *E64* *E871* multi ~ 'magic' 'nomagic' matches of the preceding atom ~ |/star| * \* 0 or more as many as possible -|/\+| \+ \+ 1 or more as many as possible (*) -|/\=| \= \= 0 or 1 as many as possible (*) -|/\?| \? \? 0 or 1 as many as possible (*) +|/\+| \+ \+ 1 or more as many as possible +|/\=| \= \= 0 or 1 as many as possible +|/\?| \? \? 0 or 1 as many as possible -|/\{| \{n,m} \{n,m} n to m as many as possible (*) - \{n} \{n} n exactly (*) - \{n,} \{n,} at least n as many as possible (*) - \{,m} \{,m} 0 to m as many as possible (*) - \{} \{} 0 or more as many as possible (same as *) (*) +|/\{| \{n,m} \{n,m} n to m as many as possible + \{n} \{n} n exactly + \{n,} \{n,} at least n as many as possible + \{,m} \{,m} 0 to m as many as possible + \{} \{} 0 or more as many as possible (same as *) -|/\{-| \{-n,m} \{-n,m} n to m as few as possible (*) - \{-n} \{-n} n exactly (*) - \{-n,} \{-n,} at least n as few as possible (*) - \{-,m} \{-,m} 0 to m as few as possible (*) - \{-} \{-} 0 or more as few as possible (*) +|/\{-| \{-n,m} \{-n,m} n to m as few as possible + \{-n} \{-n} n exactly + \{-n,} \{-n,} at least n as few as possible + \{-,m} \{-,m} 0 to m as few as possible + \{-} \{-} 0 or more as few as possible *E59* -|/\@>| \@> \@> 1, like matching a whole pattern (*) -|/\@=| \@= \@= nothing, requires a match |/zero-width| (*) -|/\@!| \@! \@! nothing, requires NO match |/zero-width| (*) -|/\@<=| \@<= \@<= nothing, requires a match behind |/zero-width| (*) -|/\@| \@> \@> 1, like matching a whole pattern +|/\@=| \@= \@= nothing, requires a match |/zero-width| +|/\@!| \@! \@! nothing, requires NO match |/zero-width| +|/\@<=| \@<= \@<= nothing, requires a match behind |/zero-width| +|/\@ |/\n| \n \n end-of-line |/~| ~ \~ last given substitute string -|/\1| \1 \1 same string as matched by first \(\) {not in Vi} +|/\1| \1 \1 same string as matched by first \(\) |/\2| \2 \2 Like "\1", but uses second \(\) ... |/\9| \9 \9 Like "\1", but uses ninth \(\) @@ -624,20 +613,19 @@ overview. character at a time. */\+* -\+ Matches 1 or more of the preceding atom, as many as possible. {not in - Vi} +\+ Matches 1 or more of the preceding atom, as many as possible. Example matches ~ ^.\+$ any non-empty line \s\+ white space of at least one character */\=* -\= Matches 0 or 1 of the preceding atom, as many as possible. {not in Vi} +\= Matches 0 or 1 of the preceding atom, as many as possible. Example matches ~ foo\= "fo" and "foo" */\?* \? Just like \=. Cannot be used when searching backwards with the "?" - command. {not in Vi} + command. */\{* *E60* *E554* *E870* \{n,m} Matches n to m of the preceding atom, as many as possible @@ -651,7 +639,6 @@ overview. \{-n,} matches at least n of the preceding atom, as few as possible \{-,m} matches 0 to m of the preceding atom, as few as possible \{-} matches 0 or more of the preceding atom, as few as possible - {Vi does not have any of these} n and m are positive decimal numbers or zero *non-greedy* @@ -674,7 +661,7 @@ overview. The } may optionally be preceded with a backslash: \{n,m\}. */\@=* -\@= Matches the preceding atom with zero width. {not in Vi} +\@= Matches the preceding atom with zero width. Like "(?=pattern)" in Perl. Example matches ~ foo\(bar\)\@= "foo" in "foobar" @@ -694,7 +681,7 @@ overview. */\@!* \@! Matches with zero width if the preceding atom does NOT match at the - current position. |/zero-width| {not in Vi} + current position. |/zero-width| Like "(?!pattern)" in Perl. Example matches ~ foo\(bar\)\@! any "foo" not followed by "bar" @@ -724,7 +711,7 @@ overview. */\@<=* \@<= Matches with zero width if the preceding atom matches just before what - follows. |/zero-width| {not in Vi} + follows. |/zero-width| Like "(?<=pattern)" in Perl, but Vim allows non-fixed-width patterns. Example matches ~ \(an\_s\+\)\@<=file "file" after "an" and white space or an @@ -768,7 +755,7 @@ overview. \@* -\@> Matches the preceding atom like matching a whole pattern. {not in Vi} +\@> Matches the preceding atom like matching a whole pattern. Like "(?>pattern)" in Perl. Example matches ~ \(a*\)\@>a nothing (the "a*" takes all the "a"'s, there can't be @@ -863,7 +850,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): /\(.\{-}\zsFab\)\{3} < Finds the third occurrence of "Fab". This cannot be followed by a multi. *E888* - {not in Vi} {not available when compiled without the |+syntax| feature} + {not available when compiled without the |+syntax| feature} */\ze* \ze Matches at any position, and sets the end of the match there: The previous char is the last char of the whole match. |/zero-width| @@ -872,17 +859,17 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): Example: "end\ze\(if\|for\)" matches the "end" in "endif" and "endfor". This cannot be followed by a multi. |E888| - {not in Vi} {not available when compiled without the |+syntax| feature} + {not available when compiled without the |+syntax| feature} */\%^* *start-of-file* \%^ Matches start of the file. When matching with a string, matches the - start of the string. {not in Vi} + start of the string. For example, to find the first "VIM" in a file: > /\%^\_.\{-}\zsVIM < */\%$* *end-of-file* \%$ Matches end of the file. When matching with a string, matches the - end of the string. {not in Vi} + end of the string. Note that this does NOT find the last "VIM" in a file: > /VIM\_.\{-}\%$ < It will find the next VIM, because the part after it will always @@ -906,7 +893,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): */\%#* *cursor-position* \%# Matches with the cursor position. Only works when matching in a - buffer displayed in a window. {not in Vi} + buffer displayed in a window. WARNING: When the cursor is moved after the pattern was used, the result becomes invalid. Vim doesn't automatically update the matches. This is especially relevant for syntax highlighting and 'hlsearch'. @@ -927,7 +914,6 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): < Note that two dots are required to include mark 'e in the match. That is because "\%<'e" matches at the character before the 'e mark, and since it's a |/zero-width| match it doesn't include that character. - {not in Vi} WARNING: When the mark is moved after the pattern was used, the result becomes invalid. Vim doesn't automatically update the matches. Similar to moving the cursor for "\%#" |/\%#|. @@ -937,7 +923,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): \%<23l Matches above a specific line (lower line number). \%>23l Matches below a specific line (higher line number). These three can be used to match specific lines in a buffer. The "23" - can be any line number. The first line is 1. {not in Vi} + can be any line number. The first line is 1. WARNING: When inserting or deleting lines Vim does not automatically update the matches. This means Syntax highlighting quickly becomes wrong. @@ -953,7 +939,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): These three can be used to match specific columns in a buffer or string. The "23" can be any column number. The first column is 1. Actually, the column is the byte number (thus it's not exactly right - for multi-byte characters). {not in Vi} + for multi-byte characters). WARNING: When inserting or deleting text Vim does not automatically update the matches. This means Syntax highlighting quickly becomes wrong. @@ -975,7 +961,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): The "23" can be any column number. The first column is 1. Note that some virtual column positions will never match, because they are halfway through a tab or other character that occupies more than - one screen character. {not in Vi} + one screen character. WARNING: When inserting or deleting text Vim does not automatically update highlighted matches. This means Syntax highlighting quickly becomes wrong. @@ -998,7 +984,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): where ".*" matches zero characters. < -Character classes: {not in Vi} +Character classes: \i identifier character (see 'isident' option) */\i* \I like "\i", but excluding digits */\I* \k keyword character (see 'iskeyword' option) */\k* @@ -1058,7 +1044,7 @@ match ASCII characters, as indicated by the range. *E51* *E54* *E55* *E872* *E873* \1 Matches the same string that was matched by */\1* *E65* - the first sub-expression in \( and \). {not in Vi} + the first sub-expression in \( and \). Example: "\([a-z]\).\1" matches "ata", "ehe", "tot", etc. \2 Like "\1", but uses second sub-expression, */\2* ... */\3* @@ -1070,7 +1056,6 @@ match ASCII characters, as indicated by the range. \%(\) A pattern enclosed by escaped parentheses. */\%(\)* */\%(* *E53* Just like \(\), but without counting it as a sub-expression. This allows using more groups and it's a little bit faster. - {not in Vi} x A single character, with no special meaning, matches itself @@ -1171,7 +1156,7 @@ x A single character, with no special meaning, matches itself backslash before it: "[xyz\]]", "[\^xyz]", "[xy\-z]" and "[xyz\\]". (Note: POSIX does not support the use of a backslash this way). For ']' you can also make it the first character (following a possible - "^"): "[]xyz]" or "[^]xyz]" {not in Vi}. + "^"): "[]xyz]" or "[^]xyz]". For '-' you can also make it the first or last character: "[-xyz]", "[^-xyz]" or "[xyz-]". For '\' you can also let it be followed by any character that's not in "^]-\bdertnoUux". "[\xyz]" matches '\', @@ -1180,7 +1165,7 @@ x A single character, with no special meaning, matches itself - Omitting the trailing ] is not considered an error. "[]" works like "[]]", it matches the ']' character. - The following translations are accepted when the 'l' flag is not - included in 'cpoptions' {not in Vi}: + included in 'cpoptions': \e \t \r (NOT end-of-line!) @@ -1261,7 +1246,7 @@ files. To match a with a search pattern you can just enter CTRL-@ or "CTRL-V 000". This is probably just what you expect. Internally the character is replaced with a in the search pattern. What is unusual is that typing CTRL-V CTRL-J also inserts a , thus also searches for a -in the file. {Vi cannot handle characters in the file at all} +in the file. *CR-used-for-NL* When 'fileformat' is "mac", characters in the file are stored as diff --git a/runtime/doc/pi_gzip.txt b/runtime/doc/pi_gzip.txt index 6017efa899..1631e2e8d8 100644 --- a/runtime/doc/pi_gzip.txt +++ b/runtime/doc/pi_gzip.txt @@ -1,4 +1,4 @@ -*pi_gzip.txt* For Vim version 8.1. Last change: 2016 Nov 06 +*pi_gzip.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -13,8 +13,6 @@ This plugin is only available if 'compatible' is not set. You can avoid loading this plugin by setting the "loaded_gzip" variable: > :let loaded_gzip = 1 -{Vi does not have any of this} - ============================================================================== 1. Autocommands *gzip-autocmd* diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 2b7e56575b..709b8477ca 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 8.1. Last change: 2017 Nov 03 +*pi_netrw.txt* For Vim version 8.1. Last change: 2019 May 05 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -114,8 +114,6 @@ Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright* 13. Todo..................................................|netrw-todo| 14. Credits...............................................|netrw-credits| -{Vi does not have any of this} - ============================================================================== 2. Starting With Netrw *netrw-start* {{{1 diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index 277ffb83b8..c58afdb7a3 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -1,4 +1,4 @@ -*print.txt* For Vim version 8.1. Last change: 2010 Jul 20 +*print.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -15,7 +15,6 @@ Printing *printing* 7. PostScript Utilities |postscript-print-util| 8. Formfeed Characters |printing-formfeed| -{Vi has None of this} {only available when compiled with the |+printer| feature} ============================================================================== diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index ef084fac57..6d9b342509 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 8.1. Last change: 2019 Jan 13 +*quickfix.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -16,8 +16,6 @@ This subject is introduced in section |30.1| of the user manual. 8. The directory stack |quickfix-directory-stack| 9. Specific error file formats |errorformats| -{Vi does not have any of these commands} - The quickfix commands are not available when the |+quickfix| feature was disabled at compile time. @@ -502,7 +500,6 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each buffer. - {not in Vi} Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, |:ldo|, |:cfdo| and |:lfdo|. @@ -515,7 +512,6 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: :{cmd} etc. < Otherwise it works the same as `:cdo`. - {not in Vi} *:ldo* :ld[o][!] {cmd} Execute {cmd} in each valid entry in the location list @@ -528,7 +524,6 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: etc. < Only valid entries in the location list are used. Otherwise it works the same as `:cdo`. - {not in Vi} *:lfdo* :lfdo[!] {cmd} Execute {cmd} in each file in the location list for @@ -540,7 +535,6 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: :{cmd} etc. < Otherwise it works the same as `:ldo`. - {not in Vi} ============================================================================= 2. The error window *quickfix-window* diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index eb88bfd853..2718f5c30c 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 8.1. Last change: 2019 Feb 16 +*quickref.txt* For Vim version 8.1. Last change: 2019 Apr 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -600,6 +600,7 @@ In Insert or Command-line mode: Short explanation of each option: *option-list* 'aleph' 'al' ASCII code of the letter Aleph (Hebrew) 'allowrevins' 'ari' allow CTRL-_ in Insert and Command-line mode +'altkeymap' 'akm' obsolete option for Farsi 'ambiwidth' 'ambw' what to do with Unicode chars of ambiguous width 'antialias' 'anti' Mac OS X: use smooth, antialiased fonts 'autochdir' 'acd' change directory to the file in the current window @@ -699,6 +700,7 @@ Short explanation of each option: *option-list* 'filetype' 'ft' type of file, used for autocommands 'fillchars' 'fcs' characters to use for displaying special items 'fixendofline' 'fixeol' make sure last line in file has +'fkmap' 'fk' obsolete option for Farsi 'foldclose' 'fcl' close a fold when the cursor leaves it 'foldcolumn' 'fdc' width of the column used to indicate folds 'foldenable' 'fen' set to display all folds open @@ -767,6 +769,7 @@ Short explanation of each option: *option-list* 'keywordprg' 'kp' program to use for the "K" command 'langmap' 'lmap' alphabetic characters for other language mode 'langmenu' 'lm' language to be used for the menus +'langnoremap' 'lnr' do not apply 'langmap' to mapped characters 'langremap' 'lrm' do apply 'langmap' to mapped characters 'laststatus' 'ls' tells when last window has status lines 'lazyredraw' 'lz' don't redraw while executing macros @@ -779,8 +782,6 @@ Short explanation of each option: *option-list* 'listchars' 'lcs' characters for displaying in list mode 'loadplugins' 'lpl' load plugin scripts when starting up 'luadll' name of the Lua dynamic library -'mzschemedll' name of the MzScheme dynamic library -'mzschemegcdll' name of the MzScheme dynamic library for GC 'macatsui' Mac GUI: use ATSUI text drawing 'magic' changes special characters in search patterns 'makeef' 'mef' name of the errorfile for ":make" @@ -808,6 +809,8 @@ Short explanation of each option: *option-list* 'mouseshape' 'mouses' shape of the mouse pointer in different modes 'mousetime' 'mouset' max time between mouse double-click 'mzquantum' 'mzq' the interval between polls for MzScheme threads +'mzschemedll' name of the MzScheme dynamic library +'mzschemegcdll' name of the MzScheme dynamic library for GC 'nrformats' 'nf' number formats recognized for CTRL-A command 'number' 'nu' print the line number in front of each line 'numberwidth' 'nuw' number of columns used for the line number @@ -916,6 +919,7 @@ Short explanation of each option: *option-list* 'tabstop' 'ts' number of spaces that in file uses 'tagbsearch' 'tbs' use binary searching in tags files 'tagcase' 'tc' how to handle case when searching in tags files +'tagfunc' 'tfu' function to get list of tag matches 'taglength' 'tl' number of significant characters for a tag 'tagrelative' 'tr' file names in tag file are relative 'tags' 'tag' list of file names used by the tag command diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt index 03e0d97592..2fe0297c58 100644 --- a/runtime/doc/remote.txt +++ b/runtime/doc/remote.txt @@ -1,4 +1,4 @@ -*remote.txt* For Vim version 8.1. Last change: 2017 Nov 12 +*remote.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -10,8 +10,6 @@ Vim client-server communication *client-server* 2. X11 specific items |x11-clientserver| 3. MS-Windows specific items |w32-clientserver| -{Vi does not have any of these commands} - ============================================================================== 1. Common functionality *clientserver* diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 27afb94ad5..ed48cf9c4f 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 8.1. Last change: 2019 Apr 05 +*repeat.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -163,12 +163,11 @@ q Stops recording. (Implementation note: The 'q' that *:@:* :[addr]@: Repeat last command-line. First set cursor at line - [addr] (default is current line). {not in Vi} + [addr] (default is current line). :[addr]@ *:@@* :[addr]@@ Repeat the previous :@{0-9a-z"}. First set cursor at - line [addr] (default is current line). {Vi: only in - some versions} + line [addr] (default is current line). ============================================================================== 4. Using Vim scripts *using-scripts* @@ -187,7 +186,6 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. |:bufdo|, in a loop or when another command follows the display won't be updated while executing the commands. - {not in Vi} *:ru* *:runtime* :ru[ntime][!] [where] {file} .. @@ -230,7 +228,6 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. when no file could be found. When 'verbose' is two or higher, there is a message about each searched file. - {not in Vi} *:pa* *:packadd* *E919* :pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath' @@ -323,7 +320,6 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. set encoding=utf-8 scriptencoding utf-8 < - {not in Vi} :scriptv[ersion] {version} *:scriptv* *:scriptversion* *E999* *E984* @@ -341,8 +337,8 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. :scr[iptnames] List all sourced script names, in the order they were first sourced. The number is used for the script ID ||. - {not in Vi} {not available when compiled without the - |+eval| feature} + {not available when compiled without the |+eval| + feature} :scr[iptnames][!] {scriptId} *:script* Edit script {scriptId}. Although ":scriptnames name" @@ -358,7 +354,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. following the ":finally" up to the matching |:endtry| are executed first. This process applies to all nested ":try"s in the script. The outermost ":endtry" - then stops sourcing the script. {not in Vi} + then stops sourcing the script. All commands and command sequences can be repeated by putting them in a named register and then executing it. There are two ways to get the commands in the @@ -698,7 +694,6 @@ sourced file or user function and set breakpoints. NOTE: The debugging mode is far from perfect. Debugging will have side effects on how Vim works. You cannot use it to debug everything. For example, the display is messed up by the debugging messages. -{Vi does not have a debug mode} An alternative to debug mode is setting the 'verbose' option. With a bigger number it will give more verbose messages about what Vim is doing. @@ -932,7 +927,6 @@ OBSCURE Profiling means that Vim measures the time that is spent on executing functions and/or scripts. The |+profile| feature is required for this. It is only included when Vim was compiled with "huge" features. -{Vi does not have profiling} You can also use the |reltime()| function to measure time. This only requires the |+reltime| feature, which is present more often. diff --git a/runtime/doc/rileft.txt b/runtime/doc/rileft.txt index f5ec8e8762..2060283419 100644 --- a/runtime/doc/rileft.txt +++ b/runtime/doc/rileft.txt @@ -1,4 +1,4 @@ -*rileft.txt* For Vim version 8.1. Last change: 2006 Apr 24 +*rileft.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Avner Lottem @@ -12,8 +12,6 @@ These functions were originally created by Avner Lottem: E-mail: alottem@iil.intel.com Phone: +972-4-8307322 -{Vi does not have any of these commands} - *E26* {only available when compiled with the |+rightleft| feature} diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt index 1415e2f91e..86c471b4a0 100644 --- a/runtime/doc/scroll.txt +++ b/runtime/doc/scroll.txt @@ -1,4 +1,4 @@ -*scroll.txt* For Vim version 8.1. Last change: 2018 Apr 26 +*scroll.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -45,9 +45,6 @@ CTRL-D Scroll window Downwards in the buffer. The number of difference). When the cursor is on the last line of the buffer nothing happens and a beep is produced. See also 'startofline' option. - {difference from vi: Vim scrolls 'scroll' screen - lines, instead of file lines; makes a difference when - lines wrap} or ** ** or ** *CTRL-F* @@ -120,7 +117,7 @@ z Redraw, line [count] at top of window (default *zt* zt Like "z", but leave the cursor in the same - column. {not in Vi} + column. *zN* z{height} Redraw, make window {height} lines tall. This is @@ -136,7 +133,7 @@ z. Redraw, line [count] at center of window (default *zz* zz Like "z.", but leave the cursor in the same column. Careful: If caps-lock is on, this command becomes - "ZZ": write buffer and exit! {not in Vi} + "ZZ": write buffer and exit! *z-* z- Redraw, line [count] at bottom of window (default @@ -145,7 +142,6 @@ z- Redraw, line [count] at bottom of window (default *zb* zb Like "z-", but leave the cursor in the same column. - {not in Vi} ============================================================================== 4. Scrolling horizontally *scroll-horizontal* @@ -158,26 +154,22 @@ not used. z or *zl* *z* zl Move the view on the text [count] characters to the right, thus scroll the text [count] characters to the - left. This only works when 'wrap' is off. {not in - Vi} + left. This only works when 'wrap' is off. z or *zh* *z* zh Move the view on the text [count] characters to the left, thus scroll the text [count] characters to the - right. This only works when 'wrap' is off. {not in - Vi} + right. This only works when 'wrap' is off. *zL* zL Move the view on the text half a screenwidth to the right, thus scroll the text half a screenwidth to the - left. This only works when 'wrap' is off. {not in - Vi} + left. This only works when 'wrap' is off. *zH* zH Move the view on the text half a screenwidth to the left, thus scroll the text half a screenwidth to the - right. This only works when 'wrap' is off. {not in - Vi} + right. This only works when 'wrap' is off. For the following two commands the cursor is not moved in the text, only the text scrolls on the screen. @@ -185,12 +177,12 @@ text scrolls on the screen. *zs* zs Scroll the text horizontally to position the cursor at the start (left side) of the screen. This only - works when 'wrap' is off. {not in Vi} + works when 'wrap' is off. *ze* ze Scroll the text horizontally to position the cursor at the end (right side) of the screen. This only - works when 'wrap' is off. {not in Vi} + works when 'wrap' is off. ============================================================================== 5. Scrolling synchronously *scroll-binding* diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 4886f74073..4f59c8f851 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -1,4 +1,4 @@ -*sign.txt* For Vim version 8.1. Last change: 2019 Jan 17 +*sign.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Gordon Prieur @@ -10,7 +10,6 @@ Sign Support Features *sign-support* 1. Introduction |sign-intro| 2. Commands |sign-commands| -{Vi does not have any of these features} {only available when compiled with the |+signs| feature} ============================================================================== diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index c7c83aa88a..4a28cdc0c9 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 8.1. Last change: 2019 Jan 19 +*spell.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -11,10 +11,7 @@ Spell checking *spell* 3. Generating a spell file |spell-mkspell| 4. Spell file format |spell-file-format| -{Vi does not have any of these commands} - -Spell checking is not available when the |+syntax| feature has been disabled -at compile time. +{not available when the |+syntax| feature has been disabled at compile time} Note: There also is a vimspell plugin. If you have it you can do ":help vimspell" to find about it. But you will probably want to get rid of the diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 595f595df0..c76557913e 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 8.1. Last change: 2019 Feb 16 +*starting.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -84,7 +84,6 @@ filename One or more file names. The first one will be the current and the first error is displayed. See |quickfix|. If [errorfile] is not given, the 'errorfile' option is used for the file name. See 'errorfile' for the default value. - {not in Vi} (nothing) Without one of the four items above, Vim will start editing a new buffer. It's empty and doesn't have a file name. @@ -129,17 +128,17 @@ a slash. Thus "-R" means recovery and "-/R" readonly. --help *-h* *--help* *-?* -? --h Give usage (help) message and exit. {not in Vi} +-h Give usage (help) message and exit. See |info-message| about capturing the text. *--version* --version Print version information and exit. Same output as for - |:version| command. {not in Vi} + |:version| command. See |info-message| about capturing the text. *--noplugin* --noplugin Skip loading plugins. Resets the 'loadplugins' option. - {not in Vi} + Note that the |-u| argument may also disable loading plugins: argument load: vimrc files plugins defaults.vim ~ (nothing) yes yes yes @@ -190,13 +189,11 @@ a slash. Thus "-R" means recovery and "-/R" readonly. Note: You can use up to 10 "+" or "-c" arguments in a Vim command. They are executed in the order given. A "-S" argument counts as a "-c" argument as well. - {Vi only allows one command} --cmd {command} *--cmd* {command} will be executed before processing any vimrc file. Otherwise it acts like -c {command}. You can use up to 10 of these commands, independently from "-c" commands. - {not in Vi} *-S* -S {file} The {file} will be sourced after the first file has been read. @@ -205,7 +202,9 @@ a slash. Thus "-R" means recovery and "-/R" readonly. < It can be mixed with "-c" arguments and repeated like "-c". The limit of 10 "-c" arguments applies here as well. {file} cannot start with a "-". - {not in Vi} + + Do not use this for running a script to do some work and exit + Vim, you won't see error messages. Use |-u| instead. -S Works like "-S Session.vim". Only when used as the last argument or when another "-" option follows. @@ -217,8 +216,7 @@ a slash. Thus "-R" means recovery and "-/R" readonly. |crash-recovery|. *-L* --L Same as -r. {only in some versions of Vi: "List recoverable - edit sessions"} +-L Same as -r. *-R* -R Readonly mode. The 'readonly' option will be set for all the @@ -238,7 +236,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. -m Modifications not allowed to be written. The 'write' option will be reset, so that writing files is disabled. However, the 'write' option can be set to enable writing again. - {not in Vi} *-M* -M Modifications not allowed. The 'modifiable' option will be @@ -246,7 +243,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. will be reset, so that writing files is disabled. However, the 'modifiable' and 'write' options can be set to enable changes and writing. - {not in Vi} *-Z* *restricted-mode* *E145* *E981* -Z Restricted mode. All commands that make use of an external @@ -260,11 +256,9 @@ a slash. Thus "-R" means recovery and "-/R" readonly. the Safe module. Note that the user may still find a loophole to execute a shell command, it has only been made difficult. - {not in Vi} *-g* -g Start Vim in GUI mode. See |gui|. For the opposite see |-v|. - {not in Vi} *-v* -v Start Ex in Vi mode. Only makes a difference when the @@ -278,7 +272,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. *-E* -E Start Vim in improved Ex mode |gQ|. Only makes a difference when the executable is not called "exim". - {not in Vi} *-s-ex* -s Silent or batch mode. Only when Vim was started as "ex" or @@ -302,6 +295,9 @@ a slash. Thus "-R" means recovery and "-/R" readonly. "-u" argument). Example: > vim -e -s < thefilter thefile +< For the opposite, to see errors from the script, execute the + file with the |-u| flag: > + vim -u thefilter thefile < *-b* -b Binary mode. File I/O will only recognize to separate @@ -309,7 +305,7 @@ a slash. Thus "-R" means recovery and "-/R" readonly. option is set to 0. 'modeline' is reset. The 'binary' option is set. This is done after reading the vimrc/exrc files but before reading any file in the arglist. See also - |edit-binary|. {not in Vi} + |edit-binary|. *-l* -l Lisp mode. Sets the 'lisp' and 'showmatch' options on. @@ -318,7 +314,7 @@ a slash. Thus "-R" means recovery and "-/R" readonly. -A Arabic mode. Sets the 'arabic' option on. (Only when compiled with the |+arabic| features (which include |+rightleft|), otherwise Vim gives an error message - and exits.) {not in Vi} + and exits.) *-F* -F This was used for Farsi mode, which has been removed. @@ -327,13 +323,13 @@ a slash. Thus "-R" means recovery and "-/R" readonly. *-H* -H Hebrew mode. Sets the 'hkmap' and 'rightleft' options on. (Only when compiled with the |+rightleft| feature, otherwise - Vim gives an error message and exits.) {not in Vi} + Vim gives an error message and exits.) *-V* *verbose* -V[N] Verbose. Sets the 'verbose' option to [N] (default: 10). Messages will be given for each file that is ":source"d and for reading or writing a viminfo file. Can be used to find - out what is happening upon startup and exit. {not in Vi} + out what is happening upon startup and exit. Example: > vim -V8 foobar @@ -348,7 +344,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. -D Debugging. Go to debugging mode when executing the first command from a script. |debug-mode| {not available when compiled without the |+eval| feature} - {not in Vi} *-C* -C Compatible mode. Sets the 'compatible' option. You can use @@ -360,13 +355,13 @@ a slash. Thus "-R" means recovery and "-/R" readonly. < Several plugins won't work with 'compatible' set. You may want to set it after startup this way: > vim "+set cp" filename -< Also see |compatible-default|. {not in Vi} +< Also see |compatible-default|. *-N* -N Not compatible mode. Resets the 'compatible' option. You can use this to get 'nocompatible', when there is no .vimrc file or when using "-u NONE". - Also see |compatible-default|. {not in Vi} + Also see |compatible-default|. *-y* *easy* -y Easy mode. Implied for |evim| and |eview|. Starts with @@ -374,7 +369,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. This sources the script $VIMRUNTIME/evim.vim. Mappings are set up to work like most click-and-type editors, see |evim-keys|. The GUI is started when available. - {not in Vi} *-n* -n No swap file will be used. Recovery after a crash will be @@ -394,7 +388,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. 'updatecount' to very big numbers, and type ":preserve" when you want to save your work. This way you keep the possibility for crash recovery. - {not in Vi} *-o* -o[N] Open N windows, split horizontally. If [N] is not given, @@ -402,13 +395,11 @@ a slash. Thus "-R" means recovery and "-/R" readonly. there is not enough room, only the first few files get a window. If there are more windows than arguments, the last few windows will be editing an empty file. - {not in Vi} *-O* -O[N] Open N windows, split vertically. Otherwise it's like -o. If both the -o and the -O option are given, the last one on the command line determines how the windows will be split. - {not in Vi} *-p* -p[N] Open N tab pages. If [N] is not given, one tab page is opened @@ -416,20 +407,19 @@ a slash. Thus "-R" means recovery and "-/R" readonly. 'tabpagemax' pages (default 10). If there are more tab pages than arguments, the last few tab pages will be editing an empty file. Also see |tabpage|. - {not in Vi} *-T* -T {terminal} Set the terminal type to "terminal". This influences the codes that Vim will send to your terminal. This is normally not needed, because Vim will be able to find out what type - of terminal you are using. (See |terminal-info|.) {not in Vi} + of terminal you are using. (See |terminal-info|.) *--not-a-term* --not-a-term Tells Vim that the user knows that the input and/or output is not connected to a terminal. This will avoid the warning and the two second delay that would happen. Also avoids the "Reading from stdin..." message. - {not in Vi} + Also avoids the "N files to edit" message. *--ttyfail* --ttyfail When the stdin or stdout is not a terminal (tty) then exit @@ -437,8 +427,7 @@ a slash. Thus "-R" means recovery and "-/R" readonly. *-d* -d Start in diff mode, like |vimdiff|. - {not in Vi} {not available when compiled without the |+diff| - feature} + {not available when compiled without the |+diff| feature} -d {device} Only on the Amiga and when not compiled with the |+diff| feature. Works like "-dev". @@ -448,7 +437,7 @@ a slash. Thus "-R" means recovery and "-/R" readonly. Normally you would use this to set the window position and size: "-d con:x/y/width/height", e.g., "-d con:30/10/600/150". But you can also use it to start - editing on another device, e.g., AUX:. {not in Vi} + editing on another device, e.g., AUX:. *-f* -f GUI: Do not disconnect from the program that started Vim. 'f' stands for "foreground". If omitted, the GUI forks a new @@ -467,7 +456,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. MS-Windows: This option is not supported. However, when running Vim with an installed vim.bat or gvim.bat file it works. - {not in Vi} *--nofork* @@ -499,7 +487,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. has the side effect that the 'compatible' option will be on by default. This can have unexpected effects. See |'compatible'|. - {not in Vi} *-U* *E230* -U {gvimrc} The file {gvimrc} is read for initializations when the GUI @@ -507,14 +494,12 @@ a slash. Thus "-R" means recovery and "-/R" readonly. is equal to "NONE", no file is read for GUI initializations at all. |gui-init| Exception: Reading the system-wide menu file is always done. - {not in Vi} *-i* -i {viminfo} The file "viminfo" is used instead of the default viminfo file. If the name "NONE" is used (all uppercase), no viminfo file is read or written, even if 'viminfo' is set or when ":rv" or ":wv" are used. See also |viminfo-file|. - {not in Vi} *--clean* --clean Similar to "-u DEFAULTS -U NONE -i NONE": @@ -551,7 +536,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. When the connection is desired later anyway (e.g., for client-server messages), call the |serverlist()| function. This does not enable the XSMP handler though. - {not in Vi} *-s* -s {scriptin} The script file "scriptin" is read. The characters in the @@ -560,7 +544,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. of the file is reached before the editor exits, further characters are read from the keyboard. Only works when not started in Ex mode, see |-s-ex|. See also |complex-repeat|. - {not in Vi} *-w_nr* -w {number} @@ -573,62 +556,59 @@ a slash. Thus "-R" means recovery and "-/R" readonly. ":source!". When the "scriptout" file already exists, new characters are appended. See also |complex-repeat|. {scriptout} cannot start with a digit. - {not in Vi} *-W* -W {scriptout} Like -w, but do not append, overwrite an existing file. - {not in Vi} --remote [+{cmd}] {file} ... Open the {file} in another Vim that functions as a server. Any non-file arguments must come before this. - See |--remote|. {not in Vi} + See |--remote|. --remote-silent [+{cmd}] {file} ... Like --remote, but don't complain if there is no server. - See |--remote-silent|. {not in Vi} + See |--remote-silent|. --remote-wait [+{cmd}] {file} ... Like --remote, but wait for the server to finish editing the file(s). - See |--remote-wait|. {not in Vi} + See |--remote-wait|. --remote-wait-silent [+{cmd}] {file} ... Like --remote-wait, but don't complain if there is no server. - See |--remote-wait-silent|. {not in Vi} + See |--remote-wait-silent|. --servername {name} Specify the name of the Vim server to send to or to become. - See |--servername|. {not in Vi} + See |--servername|. --remote-send {keys} Send {keys} to a Vim server and exit. - See |--remote-send|. {not in Vi} + See |--remote-send|. --remote-expr {expr} Evaluate {expr} in another Vim that functions as a server. The result is printed on stdout. - See |--remote-expr|. {not in Vi} + See |--remote-expr|. --serverlist Output a list of Vim server names and exit. See - |--serverlist|. {not in Vi} + |--serverlist|. --socketid {id} *--socketid* GTK+ GUI Vim only. Make gvim try to use GtkPlug mechanism, so that it runs inside another window. See |gui-gtk-socketid| - for details. {not in Vi} + for details. --windowid {id} *--windowid* Win32 GUI Vim only. Make gvim try to use the window {id} as a parent, so that it runs inside that window. See - |gui-w32-windowid| for details. {not in Vi} + |gui-w32-windowid| for details. --echo-wid *--echo-wid* GTK+ GUI Vim only. Make gvim echo the Window ID on stdout, which can be used to run gvim in a kpart widget. The format of the output is: > WID: 12345\n -< {not in Vi} --role {role} *--role* GTK+ 2 GUI only. Set the role of the main window to {role}. @@ -636,7 +616,6 @@ a slash. Thus "-R" means recovery and "-/R" readonly. identify a window, in order to restore window placement and such. The --role argument is passed automatically when restoring the session on login. See |gui-gnome-session| - {not in Vi} -P {parent-title} *-P* *MDI* *E671* *E672* Win32 only: Specify the title of the parent application. When @@ -1267,16 +1246,16 @@ vimrc file. *:mk* *:mkexrc* :mk[exrc] [file] Write current key mappings and changed options to [file] (default ".exrc" in the current directory), - unless it already exists. {not in Vi} + unless it already exists. :mk[exrc]! [file] Always write current key mappings and changed options to [file] (default ".exrc" in the current - directory). {not in Vi} + directory). *:mkv* *:mkvimrc* :mkv[imrc][!] [file] Like ":mkexrc", but the default is ".vimrc" in the current directory. The ":version" command is also - written to the file. {not in Vi} + written to the file. These commands will write ":map" and ":set" commands to a file, in such a way that when these commands are executed, the current key mappings and options @@ -1342,8 +1321,7 @@ You can quickly start editing with a previously saved View or Session with the |-S| argument: > vim -S Session.vim < -All this is {not in Vi} and {not available when compiled without the -|+mksession| feature}. +All this is {not available when compiled without the |+mksession| feature}. *:mks* *:mksession* :mks[ession][!] [file] Write a Vim script that restores the current editing @@ -1658,7 +1636,7 @@ most of the information will be restored). :rv[iminfo][!] [file] Read from viminfo file [file] (default: see above). If [!] is given, then any information that is already set (registers, marks, |v:oldfiles|, etc.) - will be overwritten {not in Vi} + will be overwritten *:wv* *:wviminfo* *E137* *E138* *E574* *E886* *E929* :wv[iminfo][!] [file] Write to viminfo file [file] (default: see above). @@ -1671,7 +1649,6 @@ most of the information will be restored). check that no old temp files were left behind (e.g. ~/.viminf*) and that you can write in the directory of the .viminfo file. - {not in Vi} *:ol* *:oldfiles* :ol[dfiles] List the files that have marks stored in the viminfo @@ -1681,8 +1658,7 @@ most of the information will be restored). The output can be filtered with |:filter|, e.g.: > filter /\.vim/ oldfiles < The filtering happens on the file name. - {not in Vi, only when compiled with the |+eval| - feature} + {only when compiled with the |+eval| feature} :bro[wse] ol[dfiles][!] List file names as with |:oldfiles|, and then prompt diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 57224f62d3..1a2b8de9fb 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -1,4 +1,4 @@ -*tabpage.txt* For Vim version 8.1. Last change: 2018 Mar 29 +*tabpage.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -16,7 +16,6 @@ when used in combination with more than one tab page. 4. Setting 'tabline' |setting-tabline| 5. Setting 'guitablabel' |setting-guitablabel| -{Vi does not have any of these commands} {not able to use multiple tab pages when the |+windows| feature was disabled at compile time} @@ -289,7 +288,6 @@ LOOPING OVER TAB PAGES: current tab page. {cmd} can contain '|' to concatenate several commands. {cmd} must not open or close tab pages or reorder them. - {not in Vi} Also see |:windo|, |:argdo|, |:bufdo|, |:cdo|, |:ldo|, |:cfdo| and |:lfdo| diff --git a/runtime/doc/tags b/runtime/doc/tags index 0c9aa1499e..b3332dfbcd 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -1075,6 +1075,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* 'tag' options.txt /*'tag'* 'tagbsearch' options.txt /*'tagbsearch'* 'tagcase' options.txt /*'tagcase'* +'tagfunc' options.txt /*'tagfunc'* 'taglength' options.txt /*'taglength'* 'tagrelative' options.txt /*'tagrelative'* 'tags' options.txt /*'tags'* @@ -1101,6 +1102,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* 'textmode' options.txt /*'textmode'* 'textwidth' options.txt /*'textwidth'* 'tf' options.txt /*'tf'* +'tfu' options.txt /*'tfu'* 'tgc' options.txt /*'tgc'* 'tgst' options.txt /*'tgst'* 'thesaurus' options.txt /*'thesaurus'* @@ -2133,17 +2135,25 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :cabbrev map.txt /*:cabbrev* :cabc map.txt /*:cabc* :cabclear map.txt /*:cabclear* +:cabo quickfix.txt /*:cabo* +:cabove quickfix.txt /*:cabove* :cad quickfix.txt /*:cad* :caddbuffer quickfix.txt /*:caddbuffer* :cadde quickfix.txt /*:cadde* :caddexpr quickfix.txt /*:caddexpr* :caddf quickfix.txt /*:caddf* :caddfile quickfix.txt /*:caddfile* +:caf quickfix.txt /*:caf* +:cafter quickfix.txt /*:cafter* :cal eval.txt /*:cal* :call eval.txt /*:call* :cat eval.txt /*:cat* :catch eval.txt /*:catch* :cb quickfix.txt /*:cb* +:cbe quickfix.txt /*:cbe* +:cbe quickfix.txt /*:cbe* +:cbefore quickfix.txt /*:cbefore* +:cbelow quickfix.txt /*:cbelow* :cbo quickfix.txt /*:cbo* :cbottom quickfix.txt /*:cbottom* :cbuffer quickfix.txt /*:cbuffer* @@ -2491,12 +2501,16 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :lNf quickfix.txt /*:lNf* :lNfile quickfix.txt /*:lNfile* :la editing.txt /*:la* +:lab quickfix.txt /*:lab* +:labove quickfix.txt /*:labove* :lad quickfix.txt /*:lad* :laddb quickfix.txt /*:laddb* :laddbuffer quickfix.txt /*:laddbuffer* :laddexpr quickfix.txt /*:laddexpr* :laddf quickfix.txt /*:laddf* :laddfile quickfix.txt /*:laddfile* +:laf quickfix.txt /*:laf* +:lafter quickfix.txt /*:lafter* :lan mlang.txt /*:lan* :lang mlang.txt /*:lang* :language mlang.txt /*:language* @@ -2504,6 +2518,10 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :lat undo.txt /*:lat* :later undo.txt /*:later* :lb quickfix.txt /*:lb* +:lbef quickfix.txt /*:lbef* +:lbefore quickfix.txt /*:lbefore* +:lbel quickfix.txt /*:lbel* +:lbelow quickfix.txt /*:lbelow* :lbo quickfix.txt /*:lbo* :lbottom quickfix.txt /*:lbottom* :lbuffer quickfix.txt /*:lbuffer* @@ -3185,6 +3203,9 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :tag tagsrch.txt /*:tag* :tags tagsrch.txt /*:tags* :tc if_tcl.txt /*:tc* +:tcd editing.txt /*:tcd* +:tch editing.txt /*:tch* +:tchdir editing.txt /*:tchdir* :tcl if_tcl.txt /*:tcl* :tcld if_tcl.txt /*:tcld* :tcldo if_tcl.txt /*:tcldo* @@ -3918,7 +3939,7 @@ E232 message.txt /*E232* E233 gui.txt /*E233* E234 options.txt /*E234* E235 options.txt /*E235* -E236 options.txt /*E236* +E236 gui.txt /*E236* E237 print.txt /*E237* E238 print.txt /*E238* E239 sign.txt /*E239* @@ -3926,8 +3947,8 @@ E24 message.txt /*E24* E240 remote.txt /*E240* E241 eval.txt /*E241* E243 if_ole.txt /*E243* -E244 options.txt /*E244* -E245 options.txt /*E245* +E244 gui.txt /*E244* +E245 gui.txt /*E245* E246 autocmd.txt /*E246* E247 remote.txt /*E247* E248 remote.txt /*E248* @@ -4699,6 +4720,9 @@ E982 terminal.txt /*E982* E983 message.txt /*E983* E984 repeat.txt /*E984* E985 eval.txt /*E985* +E986 tagsrch.txt /*E986* +E987 tagsrch.txt /*E987* +E988 gui_w32.txt /*E988* E99 diff.txt /*E99* E999 repeat.txt /*E999* EX intro.txt /*EX* @@ -6824,6 +6848,8 @@ gui-IME gui.txt /*gui-IME* gui-clipboard gui_w32.txt /*gui-clipboard* gui-colors syntax.txt /*gui-colors* gui-extras gui.txt /*gui-extras* +gui-font gui.txt /*gui-font* +gui-fontwide gui.txt /*gui-fontwide* gui-footer debugger.txt /*gui-footer* gui-fork gui_x11.txt /*gui-fork* gui-functions usr_41.txt /*gui-functions* @@ -6875,8 +6901,8 @@ gui-x11-various gui_x11.txt /*gui-x11-various* gui.txt gui.txt /*gui.txt* gui_w32.txt gui_w32.txt /*gui_w32.txt* gui_x11.txt gui_x11.txt /*gui_x11.txt* -guifontwide_gtk options.txt /*guifontwide_gtk* -guifontwide_win_mbyte options.txt /*guifontwide_win_mbyte* +guifontwide_gtk gui.txt /*guifontwide_gtk* +guifontwide_win_mbyte gui.txt /*guifontwide_win_mbyte* guu change.txt /*guu* gv visual.txt /*gv* gview starting.txt /*gview* @@ -9049,6 +9075,7 @@ tag-binary-search tagsrch.txt /*tag-binary-search* tag-blocks motion.txt /*tag-blocks* tag-commands tagsrch.txt /*tag-commands* tag-details tagsrch.txt /*tag-details* +tag-function tagsrch.txt /*tag-function* tag-functions usr_41.txt /*tag-functions* tag-highlight syntax.txt /*tag-highlight* tag-matchlist tagsrch.txt /*tag-matchlist* @@ -9226,6 +9253,7 @@ test_option_not_set() eval.txt /*test_option_not_set()* test_override() eval.txt /*test_override()* test_refcount() eval.txt /*test_refcount()* test_scrollbar() eval.txt /*test_scrollbar()* +test_setmouse() eval.txt /*test_setmouse()* test_settime() eval.txt /*test_settime()* testing eval.txt /*testing* testing-variable eval.txt /*testing-variable* @@ -9624,6 +9652,7 @@ version8.1 version8.txt /*version8.1* version8.txt version8.txt /*version8.txt* vi intro.txt /*vi* vi-differences vi_diff.txt /*vi-differences* +vi-features vi_diff.txt /*vi-features* vi: options.txt /*vi:* vi_diff.txt vi_diff.txt /*vi_diff.txt* vib motion.txt /*vib* diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index bc384521d7..2f493e2d8c 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -1,4 +1,4 @@ -*tagsrch.txt* For Vim version 8.1. Last change: 2019 Apr 28 +*tagsrch.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -60,7 +60,7 @@ CTRL-] Jump to the definition of the keyword under the *v_CTRL-]* {Visual}CTRL-] Same as ":tag {name}", where {name} is the text that - is highlighted. {not in Vi} + is highlighted. *telnet-CTRL-]* CTRL-] is the default telnet escape key. When you type CTRL-] to jump to a @@ -112,18 +112,18 @@ Tags are only pushed onto the stack when the 'tagstack' option is set. g *g* ** *CTRL-T* CTRL-T Jump to [count] older entry in the tag stack - (default 1). {not in Vi} + (default 1). *:po* *:pop* *E555* *E556* :[count]po[p][!] Jump to [count] older entry in tag stack (default 1). - See |tag-!| for [!]. {not in Vi} + See |tag-!| for [!]. :[count]ta[g][!] Jump to [count] newer entry in tag stack (default 1). - See |tag-!| for [!]. {not in Vi} + See |tag-!| for [!]. *:tags* :tags Show the contents of the tag stack. The active - entry is marked with a '>'. {not in Vi} + entry is marked with a '>'. The output of ":tags" looks like this: @@ -204,7 +204,7 @@ the same entry. the current position in the list (if there is one). [name] can be a regexp pattern, see |tag-regexp|. See |tag-priority| for the priorities used in the - listing. {not in Vi} + listing. Example output: > @@ -231,54 +231,50 @@ the same entry. *:sts* *:stselect* :sts[elect][!] [name] Does ":tselect[!] [name]" and splits the window for - the selected tag. {not in Vi} + the selected tag. *g]* g] Like CTRL-], but use ":tselect" instead of ":tag". - {not in Vi} *v_g]* {Visual}g] Same as "g]", but use the highlighted text as the - identifier. {not in Vi} + identifier. *:tj* *:tjump* :tj[ump][!] [name] Like ":tselect", but jump to the tag directly when - there is only one match. {not in Vi} + there is only one match. *:stj* *:stjump* :stj[ump][!] [name] Does ":tjump[!] [name]" and splits the window for the - selected tag. {not in Vi} + selected tag. *g_CTRL-]* g CTRL-] Like CTRL-], but use ":tjump" instead of ":tag". - {not in Vi} *v_g_CTRL-]* {Visual}g CTRL-] Same as "g CTRL-]", but use the highlighted text as - the identifier. {not in Vi} + the identifier. *:tn* *:tnext* :[count]tn[ext][!] Jump to [count] next matching tag (default 1). See - |tag-!| for [!]. {not in Vi} + |tag-!| for [!]. *:tp* *:tprevious* :[count]tp[revious][!] Jump to [count] previous matching tag (default 1). - See |tag-!| for [!]. {not in Vi} + See |tag-!| for [!]. *:tN* *:tNext* -:[count]tN[ext][!] Same as ":tprevious". {not in Vi} +:[count]tN[ext][!] Same as ":tprevious". *:tr* *:trewind* :[count]tr[ewind][!] Jump to first matching tag. If [count] is given, jump - to [count]th matching tag. See |tag-!| for [!]. {not - in Vi} + to [count]th matching tag. See |tag-!| for [!]. *:tf* *:tfirst* -:[count]tf[irst][!] Same as ":trewind". {not in Vi} +:[count]tf[irst][!] Same as ":trewind". *:tl* *:tlast* -:tl[ast][!] Jump to last matching tag. See |tag-!| for [!]. {not - in Vi} +:tl[ast][!] Jump to last matching tag. See |tag-!| for [!]. *:lt* *:ltag* :lt[ag][!] [name] Jump to tag [name] and add the matching tags to a new @@ -290,7 +286,6 @@ g CTRL-] Like CTRL-], but use ":tjump" instead of ":tag". characters (very nomagic). The location list showing the matching tags is independent of the tag stack. See |tag-!| for [!]. - {not in Vi} When there is no other message, Vim shows which matching tag has been jumped to, and the number of matching tags: > @@ -317,34 +312,28 @@ the same as above, with a "p" prepended. *:pts* *:ptselect* :pts[elect][!] [name] Does ":tselect[!] [name]" and shows the new tag in a "Preview" window. See |:ptag| for more info. - {not in Vi} *:ptj* *:ptjump* :ptj[ump][!] [name] Does ":tjump[!] [name]" and shows the new tag in a "Preview" window. See |:ptag| for more info. - {not in Vi} *:ptn* *:ptnext* :[count]ptn[ext][!] ":tnext" in the preview window. See |:ptag|. - {not in Vi} *:ptp* *:ptprevious* :[count]ptp[revious][!] ":tprevious" in the preview window. See |:ptag|. - {not in Vi} *:ptN* *:ptNext* -:[count]ptN[ext][!] Same as ":ptprevious". {not in Vi} +:[count]ptN[ext][!] Same as ":ptprevious". *:ptr* *:ptrewind* :[count]ptr[ewind][!] ":trewind" in the preview window. See |:ptag|. - {not in Vi} *:ptf* *:ptfirst* -:[count]ptf[irst][!] Same as ":ptrewind". {not in Vi} +:[count]ptf[irst][!] Same as ":ptrewind". *:ptl* *:ptlast* :ptl[ast][!] ":tlast" in the preview window. See |:ptag|. - {not in Vi} ============================================================================== 4. Tags details *tag-details* @@ -630,10 +619,7 @@ If the command is a normal search command (it starts and ends with "/" or "?"), some special handling is done: - Searching starts on line 1 of the file. The direction of the search is forward for "/", backward for "?". - Note that 'wrapscan' does not matter, the whole file is always searched. (Vi - does use 'wrapscan', which caused tags sometimes not be found.) {Vi starts - searching in line 2 of another file. It does not find a tag in line 1 of - another file when 'wrapscan' is not set} + Note that 'wrapscan' does not matter, the whole file is always searched. - If the search fails, another try is done ignoring case. If that fails too, a search is done for: "^tagname[ \t]*(" @@ -644,7 +630,7 @@ If the command is a normal search command (it starts and ends with "/" or "^[#a-zA-Z_].*\ of the file. Lines that look like a comment are ignored (see 'comments' option). If a count is given, the count'th matching line is displayed, and comment - lines are not ignored. {not in Vi} + lines are not ignored. *]i* ]i like "[i", but start at the current cursor position. - {not in Vi} *:is* *:isearch* :[range]is[earch][!] [count] [/]pattern[/] Like "[i" and "]i", but search in [range] lines (default: whole file). - See |:search-args| for [/] and [!]. {not in Vi} + See |:search-args| for [/] and [!]. *[I* [I Display all lines that contain the keyword under the cursor. Filenames and line numbers are displayed for the found lines. The search starts at the - beginning of the file. {not in Vi} + beginning of the file. *]I* ]I like "[I", but start at the current cursor position. - {not in Vi} *:il* *:ilist* :[range]il[ist][!] [/]pattern[/] Like "[I" and "]I", but search in [range] lines (default: whole file). - See |:search-args| for [/] and [!]. {not in Vi} + See |:search-args| for [/] and [!]. *[_CTRL-I* [ CTRL-I Jump to the first line that contains the keyword @@ -754,17 +738,17 @@ mapping to do that for you. Here is an example: > of the file. Lines that look like a comment are ignored (see 'comments' option). If a count is given, the count'th matching line is jumped to, and comment - lines are not ignored. {not in Vi} + lines are not ignored. *]_CTRL-I* ] CTRL-I like "[ CTRL-I", but start at the current cursor - position. {not in Vi} + position. *:ij* *:ijump* :[range]ij[ump][!] [count] [/]pattern[/] Like "[ CTRL-I" and "] CTRL-I", but search in [range] lines (default: whole file). - See |:search-args| for [/] and [!]. {not in Vi} + See |:search-args| for [/] and [!]. CTRL-W CTRL-I *CTRL-W_CTRL-I* *CTRL-W_i* CTRL-W i Open a new window, with the cursor on the first line @@ -773,45 +757,43 @@ CTRL-W i Open a new window, with the cursor on the first line that look like a comment line are ignored (see 'comments' option). If a count is given, the count'th matching line is jumped to, and comment lines are not - ignored. {not in Vi} + ignored. *:isp* *:isplit* :[range]isp[lit][!] [count] [/]pattern[/] Like "CTRL-W i" and "CTRL-W i", but search in [range] lines (default: whole file). - See |:search-args| for [/] and [!]. {not in Vi} + See |:search-args| for [/] and [!]. *[d* [d Display the first macro definition that contains the macro under the cursor. The search starts from the beginning of the file. If a count is given, the - count'th matching line is displayed. {not in Vi} + count'th matching line is displayed. *]d* ]d like "[d", but start at the current cursor position. - {not in Vi} *:ds* *:dsearch* :[range]ds[earch][!] [count] [/]string[/] Like "[d" and "]d", but search in [range] lines (default: whole file). - See |:search-args| for [/] and [!]. {not in Vi} + See |:search-args| for [/] and [!]. *[D* [D Display all macro definitions that contain the macro under the cursor. Filenames and line numbers are displayed for the found lines. The search starts - from the beginning of the file. {not in Vi} + from the beginning of the file. *]D* ]D like "[D", but start at the current cursor position. - {not in Vi} *:dli* *:dlist* :[range]dli[st][!] [/]string[/] Like `[D` and `]D`, but search in [range] lines (default: whole file). - See |:search-args| for [/] and [!]. {not in Vi} + See |:search-args| for [/] and [!]. Note that `:dl` works like `:delete` with the "l" flag, not `:dlist`. @@ -819,36 +801,35 @@ CTRL-W i Open a new window, with the cursor on the first line [ CTRL-D Jump to the first macro definition that contains the keyword under the cursor. The search starts from the beginning of the file. If a count is given, the - count'th matching line is jumped to. {not in Vi} + count'th matching line is jumped to. *]_CTRL-D* ] CTRL-D like "[ CTRL-D", but start at the current cursor - position. {not in Vi} + position. *:dj* *:djump* :[range]dj[ump][!] [count] [/]string[/] Like "[ CTRL-D" and "] CTRL-D", but search in [range] lines (default: whole file). - See |:search-args| for [/] and [!]. {not in Vi} + See |:search-args| for [/] and [!]. CTRL-W CTRL-D *CTRL-W_CTRL-D* *CTRL-W_d* CTRL-W d Open a new window, with the cursor on the first macro definition line that contains the keyword under the cursor. The search starts from the beginning of the file. If a count is given, the - count'th matching line is jumped to. {not in Vi} + count'th matching line is jumped to. *:dsp* *:dsplit* :[range]dsp[lit][!] [count] [/]string[/] Like "CTRL-W d", but search in [range] lines (default: whole file). - See |:search-args| for [/] and [!]. {not in Vi} + See |:search-args| for [/] and [!]. *:che* *:checkpath* :che[ckpath] List all the included files that could not be found. - {not in Vi} -:che[ckpath]! List all the included files. {not in Vi} +:che[ckpath]! List all the included files. *:search-args* Common arguments for the commands above: diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt index 006422dfb6..d01959bacc 100644 --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -1,4 +1,4 @@ -*terminal.txt* For Vim version 8.1. Last change: 2019 Feb 25 +*terminal.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -42,7 +42,6 @@ If the result is "1" you have it. Communication |termdebug-communication| Customizing |termdebug-customizing| -{Vi does not have any of these commands} {only available when compiled with the |+terminal| feature} The terminal feature requires the |+job| and |+channel| features. diff --git a/runtime/doc/textprop.txt b/runtime/doc/textprop.txt index 263c40eb1c..b6831875d7 100644 --- a/runtime/doc/textprop.txt +++ b/runtime/doc/textprop.txt @@ -20,7 +20,6 @@ What is not working yet: 3. When text changes |text-prop-changes| -{Vi does not have text properties} {not able to use text properties when the |+textprop| feature was disabled at compile time} diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 7a6f736a87..9019d4001b 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.1. Last change: 2019 Apr 20 +*todo.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -145,6 +145,9 @@ Williams, 2018 Oct 30) Problem with :tlmenu: Detach item added with all modes? Issue #3563. +The quoting of the [command] argument of :terminal is not clearly documented. +Give a few examples. (#4288) + Bug: script written with "-W scriptout" contains Key codes, while the script read with "-s scriptin" expects escape codes. Probably "scriptout" needs to be adjusted. (Daniel Steinberg, 2019 Feb 24, #4041) @@ -165,9 +168,27 @@ Support setting the character displayed below the last line? Neovim uses Check: __attribute__((format(printf, on semsg() and siemsg(). Where was this added? +Add test for urxvt mouse codes. Also test that mouse coordinates can be +negative. (see #4326) + +'cmdheight' has a tab-local value, but it cannot be obtained with +`:echo gettabwinvar(2, 1, '&cmdheight')` returns the value for the _current_ +tab page. (Ingo Karkat, #4324) +:call settabwinvar(1, 1, '&cmdheight', 2) also doesn't work well. + +Add a chdir() function, which will set the window-local, tab-local or global +directory, first one that is currently used. Returns the current directory, +so that this works: + let save_dir = chdir('somewhere') + ... + call chdir(save_dir) + This modeline throws unexpected errors: (#4165) vim: syn=nosyntax +":doau SomeEvent" gives "No matching autocommands". This message doesn't give +a hint about how to fix it. (#4300) + Make balloon_show() work outside of 'balloonexpr'? Users expect it to work: #2948. (related to #1512?) On Win32 it stops showing, because showState is already ShS_SHOWING. @@ -184,6 +205,9 @@ https://lgtm.com/projects/g/vim/vim/alerts/?mode=list Still a E315 error when using terminal. (Masato Nishihata, #3959) +Use dict_iterate_start() / dict_iterate_next() instead of relying on the +internals of the dict structure. + Running test_gui and test_gui_init with Motif sometimes kills the window manager. Problem with Motif? Now test_gui crashes in submenu_change(). Athena is OK. @@ -191,23 +215,6 @@ Motif: Build on Ubuntu can't enter any text in dialog text fields. nvo-mode mapping works on Windows, not on Linux. (#3678) -Patch to make Command-V use CTRL-R_CTRL-O* on Mac, like on Windows. -(Ken Takata, #4266) - -No test for NULL after allocating memory: #4174 (martinkunevtoptal does this?) - src/crypt.c line 256; - src/crypt_zip.c line 93; - src/gui_gtk_f.c line 132; - src/gui_gtk_x11 line 1578; - src/libvterm/src/state.c line 332; - src/libvterm/src/state.c line 255; - src/libvterm/src/state.c line 1618; - src/libvterm/src/state.c line 1643 - src/libvterm/src/termscreen.c line 83; - src/ops.c line 6185; - src/option.c line 12980; - src/popupmnu.c line 1090; - Missing tests for: - add_termcap_entry() @@ -240,6 +247,9 @@ punctuation is repeated. (Smylers, 2018 Nov 17, #3621) ml_get error: (Israel Chauca Fuentes, 2018 Oct 17, #3550). +Using single wide base character with double wide composing character gives +drawing errors. Fill up the base character? (Dominique, #4328) + Problem with two buffers with the same name a/b, if it didn't exist before and is created outside of Vim. (dskloetg, 2018 Jul 16, #3219) @@ -258,63 +268,41 @@ When splitting a window with few text lines, the relative cursor position is kept, which means part of the text isn't displayed. Better show all the text when possible. (Dylan Lloyd, #3973) -Patch to not recognize "version" as "v:version", "count" as "v:count". -Ken Takata, #4274. - -Patch to implement 'diffref' option. (#3535) - Easier to use a 'diffmaster' option, is the extra complexity needed? - -Patch to fix that bracketed paste remains after Vim exits. (2018 Oct 30, #3579) - Make ":interactive !cmd" stop termcap mode, also when used in an autocommand. (#3692) -cursorline highlighting not removed after yanking in Visual mode. -(Matéo Zanibelli, 2018 Oct 30, #3578) -Patch by Christian, Oct 30. - -Patch to clean up CI configs. (Ozaki Kiichi, 2019 Feb 1, #3890) - -Patch to filter marks. (Marcin Szamotulski, 2019 Feb 7, #3895) - Patch to add environ(), gets a dict with all environment vars, and getenv(), useful for environment vars that are not made of keyword chars. (Yasuhiro Matsumoto, #2875) Add buffer argument to undotree(). (#4001) -Patch to add optional arguments with default values. -(Andy Massimino, #3952) under development +Patch to restore X11 connection. (#844) -Patch to add tab-local directories. (Yegappan, #4212) -Good now? +Patch to add optional arguments with default values. +(Andy Massimino, #3952) Needs to be reviewed. Patch to add more info to OptionSet. Should mention what triggered the change ":set", ":setlocal", ":setglobal", "modeline"; and the old global value. -#4118. Proposed implementation: 2019 Mar 27. Tests fail, help update -missing. Updated 2019 Apr 9 +#4118. Proposed implementation: 2019 Mar 27. +Updated 2019 Apr 9: ASAN fails. Problem with Visual yank when 'linebreak' and 'showbreak' are set. Patch with tests, but it's not clear how it is supposed to work. (tommm, 2018 Nov 17) Asked about this, Dec 22. Christian will have a look. -Patch to add ruby cflags. (#4050, fixes #1081) -Needs modification. - Patch for larger icons in installer. (#978) Still not good. -Patch to add tagfunc(). Cleaned up by Christian Brabandt, 2013 Jun 22. -New update 2017 Apr 10, #1628 -https://github.com/chrisbra/vim-mq-patches/blob/master/tagfunc -Updated by Andy Massimino, 2018 Feb 7: -https://github.com/andymass/vim/commit/4e3aa0a5dab96d2799567622f3f537e357aa479e -Or should we make it asynchronous? -Patch by Andy Massimino: #4010 - needs a bit more work: produce errors when -something is wrong. +Patch to add commands to jump to quickfix entry above/below the cursor. +(Yegappan Lakshmanan, #4316) Also do :cbefore and :cafter. Patch to fix that using "5gj" starting inside a closed fold does not work on screen lines but on text lines. (Julius Hulsmann, #4095) Lacks a test. +Patch to implement 'diffref' option. (#3535) + Easier to use a 'diffmaster' option, is the extra complexity needed? + Not ready to include. + Memory leaks in test_channel? (or is it because of fork()) Using uninitialized value in test_crypt. Memory leak in test_terminal: @@ -331,9 +319,6 @@ Memory leak in test_alot with pyeval() (allocating partial) gethostbyname() is old, use getaddrinfo() if available. (#3227) -Patch to add match count and current index "3/44" when using "n" command. -(Christian Brabandt, on issue #453). Only when search string was typed? - matchaddpos() gets slow with many matches. Proposal by Rick Howe, 2018 Jul 19. @@ -455,6 +440,11 @@ Update Sep 7. Update by Christian Brabandt, 2015 Sep 8, 2016 Feb 1. Patch to be able to disable default digraphs (incomplete) (Eric Pruitt, 2018 Nov 22). +Patch to list user digraphs. (Christian Brabandt, 2012 Apr 14) + +Patch to add digraph() function. (Christian Brabandt, 2013 Aug 22, update Aug +24) + Try out background make plugin: https://github.com/AndrewVos/vim-make-background or asyncmake: @@ -712,10 +702,6 @@ The ++ options for the :edit command are also useful on the Vim command line. When recovering a file, put the swap file name in b:recovered_swapfile. Then a command can delete it. -When a swap file exists, is not for a running process, is from the same -machine and recovering results in the same text, we could silently delete it. -#1237 - Overlong utf-8 sequence is displayed wrong. (Harm te Hennepe, 2017 Sep 14, #2089) Patch with possible solution by Björn Linse. @@ -1019,6 +1005,8 @@ Regexp problems: time is spent in addstate_here() copying the threads. Instead of copying, let each thread point to the next one (by offset, the list is reallocated). (Dominique Pelle, 2019 Feb 18) +- Old engine: using 'incsearch' /\Zabc does not highlight the "c" if it has a + composing character. New engine is OK. (Tony Mechelynck, 2019 May 5) - When search pattern has the base character both with and without combining character, search fails. E.g. "รรีบ" in "การรีบรักใคร". (agguser, #2312) - [:space:] only matches ASCII spaces. Add [:white:] for all space-like @@ -1748,11 +1736,6 @@ When running Vim in silent ex mode, an existing swapfile causes Vim to wait for a user action without a prompt. (Maarten Billemont, 2012 Feb 3) Do give the prompt? Quit with an error? -Patch to list user digraphs. (Christian Brabandt, 2012 Apr 14) - -Patch to add digraph() function. (Christian Brabandt, 2013 Aug 22, update Aug -24) - Patch for input method status. (Hirohito Higashi, 2012 Apr 18) Update Vim app icon (for Gnome). (Jakub Steiner, 2013 Dec 6) @@ -4010,7 +3993,8 @@ Folding: secondary: zB zS zT zZ, z=) 8 Vertical folds: looks like vertically split windows, but the cursor moves through the vertical separator, separator moves when scrolling. -8 Add "z/" and "z?" for searching in not folded text only. +8 Add "z/" and "z?" for searching in not folded text only. Or use a regexp + item, so that it can be used in any pattern. 8 When a closed fold is displayed open because of 'foldminlines', the behavior of commands is still like the fold is closed. How to make the user aware of this? @@ -6001,7 +5985,7 @@ Various improvements: used, remove the at the end of lines in [range]. A CTRL-Z at the end of the file is removed. If [range] is omitted, or it is the whole file, and all - lines end in 'textmode' is set. {not in Vi} + lines end in 'textmode' is set. - Should integrate addstar() and file_pat_to_reg_pat(). - When working over a serial line with 7 bit characters, remove meta characters from 'isprint'. diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index b6c9809c2c..316e32f13a 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -1,4 +1,4 @@ -*undo.txt* For Vim version 8.1. Last change: 2019 Jan 04 +*undo.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -25,7 +25,7 @@ u Undo [count] changes. {Vi: only one level} :u[ndo] Undo one change. {Vi: only one level} *E830* :u[ndo] {N} Jump to after change number {N}. See |undo-branches| - for the meaning of {N}. {not in Vi} + for the meaning of {N}. *CTRL-R* CTRL-R Redo [count] changes which were undone. {Vi: redraw @@ -95,7 +95,6 @@ change but joins in with the previous change use this command: Warning: Use with care, it may prevent the user from properly undoing changes. Don't use this after undo or redo. - {not in Vi} This is most useful when you need to prompt the user halfway through a change. For example in a function that calls |getchar()|. Do make sure that there was @@ -151,7 +150,7 @@ This is explained in the user manual: |usr_32.txt|. *g-* g- Go to older text state. With a count repeat that many - times. {not in Vi} + times. *:ea* *:earlier* :earlier {count} Go to older text state {count} times. :earlier {N}s Go to older text state about {N} seconds before. @@ -170,7 +169,7 @@ g- Go to older text state. With a count repeat that many *g+* g+ Go to newer text state. With a count repeat that many - times. {not in Vi} + times. *:lat* *:later* :later {count} Go to newer text state {count} times. :later {N}s Go to newer text state about {N} seconds later. @@ -280,10 +279,8 @@ respectively: the existing file and then creating a new file with the same name. So it is not possible to overwrite an existing undofile in a write-protected directory. - {not in Vi} :rundo {file} Read undo history from {file}. - {not in Vi} You can use these in autocommands to explicitly specify the name of the history file. E.g.: > @@ -374,10 +371,10 @@ information you can use these commands: > :unlet old_undolevels Marks for the buffer ('a to 'z) are also saved and restored, together with the -text. {Vi does this a little bit different} +text. When all changes have been undone, the buffer is not considered to be changed. -It is then possible to exit Vim with ":q" instead of ":q!" {not in Vi}. Note +It is then possible to exit Vim with ":q" instead of ":q!". Note that this is relative to the last write of the file. Typing "u" after ":w" actually changes the buffer, compared to what was written, so the buffer is considered changed then. diff --git a/runtime/doc/usr_21.txt b/runtime/doc/usr_21.txt index 513dad06bc..86aadc2caa 100644 --- a/runtime/doc/usr_21.txt +++ b/runtime/doc/usr_21.txt @@ -1,4 +1,4 @@ -*usr_21.txt* For Vim version 8.1. Last change: 2012 Nov 02 +*usr_21.txt* For Vim version 8.1. Last change: 2019 Apr 25 VIM USER MANUAL - by Bram Moolenaar @@ -263,7 +263,8 @@ well stand for "source"). The windows that were open are restored, with the same position and size as before. Mappings and option values are like before. What exactly is restored depends on the 'sessionoptions' option. The -default value is "blank,buffers,curdir,folds,help,options,winsize". +default value is: +"blank,buffers,curdir,folds,help,options,tabpages,winsize,terminal". blank keep empty windows buffers all buffers, not only the ones in a window @@ -271,7 +272,9 @@ default value is "blank,buffers,curdir,folds,help,options,winsize". folds folds, also manually created ones help the help window options all options and mappings + tabpages all tab pages winsize window sizes + terminal include terminal windows Change this to your liking. To also restore the size of the Vim window, for example, use: > diff --git a/runtime/doc/usr_22.txt b/runtime/doc/usr_22.txt index e50237a9aa..b3da19cc64 100644 --- a/runtime/doc/usr_22.txt +++ b/runtime/doc/usr_22.txt @@ -1,4 +1,4 @@ -*usr_22.txt* For Vim version 8.1. Last change: 2016 Dec 13 +*usr_22.txt* For Vim version 8.1. Last change: 2019 Apr 27 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 8b4f988ee9..79889276a5 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 8.1. Last change: 2019 Mar 23 +*various.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -73,8 +73,6 @@ ga Print the ascii value of the character under the <ö> 246, Hex 00f6, Oct 366, Digr o: ~ This shows you can type CTRL-K o : to insert ö. - {not in Vi} - *g8* g8 Print the hex values of the bytes used in the character under the cursor, assuming it is in |UTF-8| @@ -82,7 +80,6 @@ g8 Print the hex values of the bytes used in the value of 'maxcombine' doesn't matter. Example of a character with two composing characters: e0 b8 81 + e0 b8 b9 + e0 b9 89 ~ - {not in Vi} *8g8* 8g8 Find an illegal UTF-8 byte sequence at or after the @@ -97,7 +94,6 @@ g8 Print the hex values of the bytes used in the Note that when the cursor is on an illegal byte or the cursor is halfway a multi-byte character the command won't move the cursor. - {not in Vi} *:p* *:pr* *:print* *E749* :[range]p[rint] [flags] @@ -174,7 +170,6 @@ g8 Print the hex values of the bytes used in the :{range}z#[+-^.=]{count} *:z#* Like ":z", but number the lines. - {not in all versions of Vi, not with these arguments} *:=* := [flags] Print the last line number. @@ -224,7 +219,6 @@ g8 Print the hex values of the bytes used in the Example: > :exe "normal \\" -< {not in Vi, of course} :{range}norm[al][!] {commands} *:normal-range* Execute Normal mode commands {commands} for each line @@ -232,7 +226,6 @@ g8 Print the hex values of the bytes used in the cursor is positioned in the first column of the range, for each line. Otherwise it's the same as the ":normal" command without a range. - {not in Vi} *:sh* *:shell* *E371* :sh[ell] This command starts a shell. When the shell exits @@ -490,7 +483,7 @@ N *+X11* Unix only: can restore window title |X11| :ve[rsion] {nr} Is now ignored. This was previously used to check the version number of a .vimrc file. It was removed, because you can now use the ":if" command for - version-dependent behavior. {not in Vi} + version-dependent behavior. *:redi* *:redir* :redi[r][!] > {file} Redirect messages to file {file}. The messages which @@ -510,31 +503,28 @@ N *+X11* Unix only: can restore window title |X11| with ":silent call Function()". An alternative is to use the 'verbosefile' option, this can be used in combination with ":redir". - {not in Vi} :redi[r] >> {file} Redirect messages to file {file}. Append if {file} - already exists. {not in Vi} + already exists. :redi[r] @{a-zA-Z} :redi[r] @{a-zA-Z}> Redirect messages to register {a-z}. Append to the contents of the register if its name is given uppercase {A-Z}. The ">" after the register name is - optional. {not in Vi} -:redi[r] @{a-z}>> Append messages to register {a-z}. {not in Vi} + optional. +:redi[r] @{a-z}>> Append messages to register {a-z}. :redi[r] @*> :redi[r] @+> Redirect messages to the selection or clipboard. For backward compatibility, the ">" after the register name can be omitted. See |quotestar| and |quoteplus|. - {not in Vi} :redi[r] @*>> :redi[r] @+>> Append messages to the selection or clipboard. - {not in Vi} :redi[r] @"> Redirect messages to the unnamed register. For backward compatibility, the ">" after the register - name can be omitted. {not in Vi} -:redi[r] @">> Append messages to the unnamed register. {not in Vi} + name can be omitted. +:redi[r] @">> Append messages to the unnamed register. :redi[r] => {var} Redirect messages to a variable. If the variable doesn't exist, then it is created. If the variable @@ -543,14 +533,14 @@ N *+X11* Unix only: can restore window title |X11| Only string variables can be used. After the redirection starts, if the variable is removed or locked or the variable type is changed, then further - command output messages will cause errors. {not in Vi} + command output messages will cause errors. To get the output of one command the |execute()| function can be used. :redi[r] =>> {var} Append messages to an existing variable. Only string - variables can be used. {not in Vi} + variables can be used. -:redi[r] END End redirecting messages. {not in Vi} +:redi[r] END End redirecting messages. *:filt* *:filter* :filt[er][!] {pat} {command} @@ -692,12 +682,11 @@ K Run a program to lookup the keyword under the < - When 'keywordprg' is equal to "man -s", a count before "K" is inserted after the "-s". If there is no count, the "-s" is removed. - {not in Vi} *v_K* {Visual}K Like "K", but use the visually highlighted text for the keyword. Only works when the highlighted text is - not more than one line. {not in Vi} + not more than one line. [N]gs *gs* *:sl* *:sleep* :[N]sl[eep] [N] [m] Do nothing for [N] seconds. When [m] is included, @@ -710,7 +699,7 @@ K Run a program to lookup the keyword under the < Can be interrupted with CTRL-C (CTRL-Break on MS-DOS). "gs" stands for "goto sleep". While sleeping the cursor is positioned in the text, - if at a visible position. {not in Vi} + if at a visible position. Also process the received netbeans messages. {only available when compiled with the |+netbeans_intg| feature} diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index b71fdbce47..a1f4ab4d50 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -1,4 +1,4 @@ -*vi_diff.txt* For Vim version 8.1. Last change: 2019 Apr 28 +*vi_diff.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -6,9 +6,8 @@ Differences between Vim and Vi *vi-differences* -Throughout the help files differences between Vim and Vi/Ex are given in -curly braces, like "{not in Vi}". This file only lists what has not been -mentioned in other files and gives an overview. +This file lists the differences between Vim and Vi/Ex and gives an overview of +what is in Vim that is not in Vi. Vim is mostly POSIX 1003.2-1 compliant. The only command known to be missing is ":open". There are probably a lot of small differences (either because Vim @@ -180,6 +179,10 @@ Multiple windows and buffers. |windows.txt| line with tab labels can be used to quickly switch between these pages. |tab-page| +Terminal window. |:terminal| + Vim can create a window in which a terminal emulator runs. This can + be used to execute an arbitrary command, a shell or a debugger. + Syntax highlighting. |:syntax| Vim can highlight keywords, patterns and other things. This is defined by a number of |:syntax| commands, and can be made to @@ -194,6 +197,11 @@ Syntax highlighting. |:syntax| |'hlsearch'|, matching parens |matchparen| and the cursor line and column |'cursorline'| |'cursorcolumn'|. +Text properties |textprop.txt| + Vim supports highlighting text by a plugin. Property types can be + specificed with |prop_type_add()| and properties can be placed with + |prop_add()|. + Spell checking. |spell| When the 'spell' option is set Vim will highlight spelling mistakes. About 50 languages are currently supported, selected with the @@ -262,6 +270,8 @@ Visual mode. |Visual-mode| ~ swap case u make lowercase U make uppercase + {Vi has no Visual mode, the name "visual" is used for Normal mode, to + distinguish it from Ex mode} Block operators. |visual-block| With Visual mode a rectangular block of text can be selected. Start @@ -522,6 +532,10 @@ With the CTRL-] command, the cursor may be in the middle of the identifier. The used tags are remembered. Commands that can be used with the tag stack are CTRL-T, ":pop" and ":tag". ":tags" lists the tag stack. +Vi uses 'wrapscan' when searching for a tag. When jumping to a tag Vi starts +searching in line 2 of another file. It does not find a tag in line 1 of +another file when 'wrapscan' is not set. + The 'tags' option can be set to a list of tag file names. Thus multiple tag files can be used. For file names that start with "./", the "./" is replaced with the path of the current file. This makes it possible to use a @@ -795,23 +809,231 @@ the 'compatible' option is set and 'cpoptions' contains all flags. What the effect is of resetting 'compatible' and removing flags from 'cpoptions' can be found at the help for the specific command. -Below is listed what features are present in Vi. Anything else has been added -by Vim. +The help files used to mark features that are in Vim but not in Vi with {not +in Vi}. However, since these remarks cluttered the help files we now do it +the other way around: Below is listed what Vi already supported. Anything +else has been added by Vim. + The following Ex commands are supported by Vi: ~ -TODO - -`:set` but not `:set inv{option}`, `:set option&`, `:set all&`, - `:set option+=value`, - `:set option^=value` - `:set option-=value` - `:set option<` +`:abbreviate` enter abbreviation +`:append` append text +`:args` print the argument list +`:cd` change directory; Vi: no "cd -" +`:change` replace a line or series of lines +`:chdir` change directory +`:copy` copy lines +`:delete` delete lines +`:edit` edit a file +`:exit` same as ":xit" +`:file` show or set the current file name; Vi: without the column number +`:global` execute commands for matching lines +`:insert` insert text +`:join` join lines; Vi: not :join! +`:k` set a mark +`:list` print lines +`:map` show or enter a mapping +`:mark` set a mark +`:move` move lines +`:Next` go to previous file in the argument list; no count or ++opt +`:next` go to next file in the argument list; no count or ++opt +`:number` print lines with line number +`:open` start open mode (not implemented in Vim) +`:pop` jump to older entry in tag stack (only in some versions) +`:preserve` write all text to swap file +`:print` print lines +`:put` insert contents of register in the text +`:quit` quit Vi +`:read` read file into the text +`:recover` recover a file from a swap file +`:rewind` go to the first file in the argument list; no ++opt +`:set` set option; but not `:set inv{option}`, `:set option&`, + `:set all&`, `:set option+=value`, `:set option^=value` + `:set option-=value` `:set option<` +`:shell` escape to a shell +`:source` read Vim or Ex commands from a file +`:stop` suspend the editor or escape to a shell +`:substitute` find and replace text; Vi: no '&', 'i', 's', 'r' or 'I' flag, + confirm prompt only supports 'y' and 'n', no highlighting +`:suspend` same as ":stop" +`:t` same as ":copy" +`:tag` jump to tag +`:unabbreviate` remove abbreviation +`:undo` undo last change {Vi: only one level} +`:unmap` remove mapping +`:vglobal` execute commands for not matching lines +`:version` print version number and other info +`:visual` same as ":edit", but turns off "Ex" mode +`:wq` write to a file and quit Vi +`:write` write to a file +`:xit` write if buffer changed and quit Vi +`:yank` yank lines into a register +`:z` print some lines {not in all versions of Vi} +`:!` filter lines or execute an external command +`:"` comment +`:#` same as ":number" +`:*` execute contents of a register +`:&` repeat last ":substitute" +`:<` shift lines one 'shiftwidth' left +`:=` print the cursor line number +`:>` shift lines one 'shiftwidth' right +`:@` execute contents of a register; but not `:@`; `:@@` only in + some versions The following Normal mode commands are supported by Vi: ~ -TODO +|CTRL-B| scroll N screens Backwards +|CTRL-C| interrupt current (search) command +|CTRL-D| scroll Down N lines (default: half a screen); Vim scrolls + 'scroll' screen lines, Vi scrolls file lines; makes a + difference when lines wrap +|CTRL-E| scroll N lines upwards (N lines Extra) +|CTRL-F| scroll N screens Forward +|CTRL-G| display current file name and position +|| same as "h" +|CTRL-H| same as "h" +|| same as "j" +|CTRL-J| same as "j" +|CTRL-L| redraw screen +|| cursor to the first CHAR N lines lower +|CTRL-M| same as +|CTRL-N| same as "j" +|CTRL-P| same as "k" +|CTRL-R| in some Vi versions: same as CTRL-L +|CTRL-T| jump to N older Tag in tag list +|CTRL-U| N lines Upwards (default: half a screen) +|CTRL-Y| scroll N lines downwards +|CTRL-Z| suspend program (or start new shell) +|CTRL-]| :ta to ident under cursor +|CTRL-^| edit alternate file; Vi: no count +|| same as "l" +|!| filter Nmove text through the {filter} command +|!!| filter N lines through the {filter} command +" use register {a-zA-Z0-9.%#:-"} for next delete, yank or put + (uppercase to append) ({.%#:} only work with put) +|$| cursor to the end of Nth next line +|%| find the next (curly/square) bracket on this line and go to + its match, or go to matching comment bracket, or go to + matching preprocessor directive (Vi: no count supported) +|&| repeat last :s +|'| jump to mark (Vi: only lowercase marks) +|(| cursor N sentences backward +|)| cursor N sentences forward +|+| same as +|,| repeat latest f, t, F or T in opposite direction N times +|-| cursor to the first CHAR N lines higher +|.| repeat last change with count replaced with N +|/| search forward for the Nth occurrence of {pattern} +|0| cursor to the first char of the line +|:| start entering an Ex command +|;| repeat latest f, t, F or T N times +|<| shift Nmove lines one 'shiftwidth' leftwards +|<<| shift N lines one 'shiftwidth' leftwards +|=| filter Nmove lines through "indent" +|==| filter N lines through "indent" +|>| shift Nmove lines one 'shiftwidth' rightwards +|>>| shift N lines one 'shiftwidth' rightwards +|?| search backward for the Nth previous occurrence of {pattern} +|@| execute the contents of register {a-z} N times +|@@| repeat the previous @{a-z} N times +|A| append text after the end of the line N times +|B| cursor N WORDS backward +|C| change from the cursor position to the end of the line +|D| delete the characters under the cursor until the end of the + line and N-1 more lines [into register x]; synonym for "d$" +|E| cursor forward to the end of WORD N +|F| cursor to the Nth occurrence of {char} to the left +|G| cursor to line N, default last line +|H| cursor to line N from top of screen +|I| insert text before the first CHAR on the line N times +|J| Join N lines; default is 2 +|L| cursor to line N from bottom of screen +|M| cursor to middle line of screen +|N| repeat the latest '/' or '?' N times in opposite direction +|O| begin a new line above the cursor and insert text, repeat N + times +|P| put the text [from register x] before the cursor N times +|Q| switch to "Ex" mode +|R| enter replace mode: overtype existing characters, repeat the + entered text N-1 times +|S| delete N lines [into register x] and start insert; synonym for + "cc". +|T| cursor till after Nth occurrence of {char} to the left +|U| undo all latest changes on one line +|W| cursor N WORDS forward +|X| delete N characters before the cursor [into register x] +|Y| yank N lines [into register x]; synonym for "yy" +|ZZ| store current file if modified, and exit +|[[| cursor N sections backward +|]]| cursor N sections forward +|^| cursor to the first CHAR of the line +|_| cursor to the first CHAR N - 1 lines lower +|`| cursor to the mark {a-zA-Z0-9} +|a| append text after the cursor N times +|b| cursor N words backward +|c| delete Nmove text [into register x] and start insert +|cc| delete N lines [into register x] and start insert +|d| delete Nmove text [into register x] +|dd| delete N lines [into register x] +|e| cursor forward to the end of word N +|f| cursor to Nth occurrence of {char} to the right +|h| cursor N chars to the left +|i| insert text before the cursor N times +|j| cursor N lines downward +|k| cursor N lines upward +|l| cursor N chars to the right +|m| set mark {A-Za-z} at cursor position +|n| repeat the latest '/' or '?' N times +|o| begin a new line below the cursor and insert text +|p| put the text [from register x] after the cursor N times +|r| replace N chars with {char} +|s| (substitute) delete N characters [into register x] and start + insert +|t| cursor till before Nth occurrence of {char} to the right +|u| undo changes {Vi: only one level} +|w| cursor N words forward +|x| delete N characters under and after the cursor [into register + x] +|y| yank Nmove text [into register x] +|yy| yank N lines [into register x] +|z| current line to the top +|z-| current line to the bottom +|z+| cursor on line N +|z^| cursor on line N +|{| cursor N paragraphs backward +| cursor to column N +|}| cursor N paragraphs forward +|~| switch case of N characters under the cursor; Vim: depends on + 'tildeop' +|| same as "x" + + +The following commands are supported in Insert mode by Vi: ~ + +CTRL-@ insert previously inserted text and stop insert +CTRL-C quit insert mode, without checking for abbreviation, unless + 'insertmode' set. +CTRL-D delete one shiftwidth of indent in the current line + delete character before the cursor +CTRL-H same as + insert a character +CTRL-I same as + same as +CTRL-J same as + begin new line +CTRL-M same as +CTRL-T insert one shiftwidth of indent in current line +CTRL-V {char} insert next non-digit literally +CTRL-W delete word before the cursor +CTRL-Z when 'insertmode' set: suspend Vim + end insert mode (unless 'insertmode' set) +CTRL-[ same as +0 CTRL-D delete all indent in the current line +^ CTRL-D delete all indent in the current line, restore it in the next + line + delete character under the cursor The following options are supported by Vi: ~ @@ -849,11 +1071,14 @@ The following options are supported by Vi: ~ 'term' name of the terminal 'terse' shorten some messages 'timeout' 'to' time out on mappings and key codes +'timeoutlen' 'tm' time for 'timeout' {only in some Vi versions} 'ttytype' 'tty' alias for 'term' 'verbose' 'vbs' give informative messages {only in some Vi versions as a boolean option} 'warn' warn for shell command when buffer was changed 'window' 'wi' nr of lines to scroll for CTRL-F and CTRL-B + {Vi also uses the option to specify the number of + displayed lines} 'wrapmargin' 'wm' chars from the right where wrapping starts 'wrapscan' 'ws' searches wrap around the end of the file 'writeany' 'wa' write to file with no need for "!" override @@ -968,7 +1193,8 @@ Only Vim is able to accept options in between and after the file names. -i Elvis: Start each window in Insert mode. -i {viminfo} Vim: Use {viminfo} for viminfo file. --L Vim: Same as "-r" (also in some versions of Vi). +-L Vim: Same as "-r" {only in some versions of Vi: "List + recoverable edit sessions"}. -l Nvi, Vi, Vim: Set 'lisp' and 'showmatch' options. diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index f63a08d04f..b953dcbf15 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -1,4 +1,4 @@ -*visual.txt* For Vim version 8.1. Last change: 2019 Feb 25 +*visual.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -20,8 +20,6 @@ This is introduced in section |04.4| of the user manual. 7. Examples |visual-examples| 8. Select mode |Select-mode| -{Vi has no Visual mode, the name "visual" is used for Normal mode, to -distinguish it from Ex mode} {Since Vim 7.4.200 the |+visual| feature is always included} ============================================================================== diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 0b96115041..9a682e59e5 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 8.1. Last change: 2019 Mar 17 +*windows.txt* For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -26,7 +26,6 @@ The basics are explained in chapter 7 and 8 of the user manual |usr_07.txt| 11. Using hidden buffers |buffer-hidden| 12. Special kinds of buffers |special-buffers| -{Vi does not have any of these commands} {not able to use multiple windows when the |+windows| feature was disabled at compile time} {not able to use vertically split windows when the |+vertsplit| feature was @@ -737,7 +736,7 @@ can also get to them with the buffer list commands, like ":bnext". the current window. {cmd} can contain '|' to concatenate several commands. {cmd} must not open or close windows or reorder them. - {not in Vi} + Also see |:tabdo|, |:argdo|, |:bufdo|, |:cdo|, |:ldo|, |:cfdo| and |:lfdo| @@ -765,7 +764,7 @@ can also get to them with the buffer list commands, like ":bnext". autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each buffer. - {not in Vi} + Also see |:tabdo|, |:argdo|, |:windo|, |:cdo|, |:ldo|, |:cfdo| and |:lfdo| @@ -891,7 +890,7 @@ CTRL-W CTRL-Z *CTRL-W_CTRL-Z* *:pc* *:pclose* *:pp* *:ppop* :[count]pp[op][!] Does ":[count]pop[!]" in the preview window. See |:pop| and - |:ptag|. {not in Vi} + |:ptag|. CTRL-W } *CTRL-W_}* Use identifier under cursor as a tag and perform a :ptag on diff --git a/src/version.c b/src/version.c index 8ab83c363b..0ba9dd13c5 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1280, /**/ 1279, /**/ From 8ffc7c8b5f004971cb6f2bdcfbe4f7123cce717c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 21:00:26 +0200 Subject: [PATCH 11/97] patch 8.1.1281: cannot specify a count with :chistory Problem: Cannot specify a count with :chistory. Solution: Add a count to :chistory and :lhistory. (Yegappan Lakshmanan, closes #4344) --- runtime/doc/quickfix.txt | 56 +++++++++++++++++++++-------------- src/ex_cmds.h | 8 ++--- src/quickfix.c | 21 +++++++++++++ src/testdir/test_quickfix.vim | 14 +++++++++ src/version.c | 2 ++ 5 files changed, 75 insertions(+), 26 deletions(-) diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 6d9b342509..bae2ee9323 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -139,8 +139,8 @@ processing a quickfix or location list command, it will be aborted. :[count]lab[ove] Same as ":cabove", except the location list for the current window is used instead of the quickfix list. - *:cbe* *:cbelow* -:[count]cbe[low] Go to the [count] error below the current line in the + *:cbel* *:cbelow* +:[count]cbel[ow] Go to the [count] error below the current line in the current buffer. If [count] is omitted, then 1 is used. If there are no errors, then an error message is displayed. Assumes that the entries in a quickfix @@ -164,8 +164,8 @@ processing a quickfix or location list command, it will be aborted. number of entries before the current position, then the first error in the file is selected. - *:lbef* *:lbefore* -:[count]lbef[ore] Same as ":cbefore", except the location list for the + *:lbe* *:lbefore* +:[count]lbe[fore] Same as ":cbefore", except the location list for the current window is used instead of the quickfix list. *:caf* *:cafter* @@ -536,6 +536,29 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: etc. < Otherwise it works the same as `:ldo`. +FILTERING A QUICKFIX OR LOCATION LIST: + *cfilter-plugin* *:Cfilter* *:Lfilter* +If you have too many entries in a quickfix list, you can use the cfilter +plugin to reduce the number of entries. Load the plugin with: > + + packadd cfilter + +Then you can use the following commands to filter a quickfix/location list: > + + :Cfilter[!] /{pat}/ + :Lfilter[!] /{pat}/ + +The |:Cfilter| command creates a new quickfix list from the entries matching +{pat} in the current quickfix list. {pat} is a Vim |regular-expression| +pattern. Both the file name and the text of the entries are matched against +{pat}. If the optional ! is supplied, then the entries not matching {pat} are +used. The pattern can be optionally enclosed using one of the following +characters: ', ", /. If the pattern is empty, then the last used search +pattern is used. + +The |:Lfilter| command does the same as |:Cfilter| but operates on the current +location list. + ============================================================================= 2. The error window *quickfix-window* @@ -822,14 +845,19 @@ lists. They set one of the existing error lists as the current one. the current window instead of the quickfix list. *:chistory* *:chi* -:chi[story] Show the list of error lists. The current list is +:[count]chi[story] Show the list of error lists. The current list is marked with ">". The output looks like: error list 1 of 3; 43 errors ~ > error list 2 of 3; 0 errors ~ error list 3 of 3; 15 errors ~ + When [count] is given, then the count'th quickfix + list is made the current list. Example: > + " Make the 4th quickfix list current + :4chistory +< *:lhistory* *:lhi* -:lhi[story] Show the list of location lists, otherwise like +:[count]lhi[story] Show the list of location lists, otherwise like `:chistory`. When adding a new error list, it becomes the current list. @@ -1641,22 +1669,6 @@ The backslashes before the pipe character are required to avoid it to be recognized as a command separator. The backslash before each space is required for the set command. - *cfilter-plugin* *:Cfilter* *:Lfilter* -If you have too many matching messages, you can use the cfilter plugin to -reduce the number of entries. Load the plugin with: > - packadd cfilter - -Then you can use these command: > - :Cfilter[!] /{pat}/ - :Lfilter[!] /{pat}/ - -:Cfilter creates a new quickfix list from entries matching {pat} in the -current quickfix list. Both the file name and the text of the entries are -matched against {pat}. If ! is supplied, then entries not matching {pat} are -used. - -:Lfilter does the same as :Cfilter but operates on the current location list. - ============================================================================= 8. The directory stack *quickfix-directory-stack* diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 9e420b3fd1..37577f7b30 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -336,8 +336,8 @@ EX(CMD_checktime, "checktime", ex_checktime, RANGE|BUFNAME|COUNT|EXTRA|TRLBAR, ADDR_OTHER), EX(CMD_chistory, "chistory", qf_history, - TRLBAR, - ADDR_NONE), + RANGE|COUNT|TRLBAR, + ADDR_UNSIGNED), EX(CMD_clist, "clist", qf_list, BANG|EXTRA|TRLBAR|CMDWIN, ADDR_NONE), @@ -828,8 +828,8 @@ EX(CMD_lhelpgrep, "lhelpgrep", ex_helpgrep, EXTRA|NOTRLCOM|NEEDARG, ADDR_NONE), EX(CMD_lhistory, "lhistory", qf_history, - TRLBAR, - ADDR_NONE), + RANGE|COUNT|TRLBAR, + ADDR_UNSIGNED), EX(CMD_ll, "ll", ex_cc, RANGE|COUNT|TRLBAR|BANG, ADDR_QUICKFIX), diff --git a/src/quickfix.c b/src/quickfix.c index b4497ae754..61576505a9 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3742,6 +3742,27 @@ qf_history(exarg_T *eap) qf_info_T *qi = qf_cmd_get_stack(eap, FALSE); int i; + if (eap->addr_count > 0) + { + if (qi == NULL) + { + emsg(_(e_loclist)); + return; + } + + // Jump to the specified quickfix list + if (eap->line2 > 0 && eap->line2 <= qi->qf_listcount) + { + qi->qf_curlist = eap->line2 - 1; + qf_msg(qi, qi->qf_curlist, ""); + qf_update_buffer(qi, NULL); + } + else + emsg(_(e_invrange)); + + return; + } + if (qf_stack_empty(qi)) msg(_("No entries")); else diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index ae3aec5222..54c10ad6a2 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -1831,9 +1831,23 @@ func HistoryTest(cchar) call assert_equal(' error list 2 of 3; 2 ' . common, res[1]) call assert_equal('> error list 3 of 3; 3 ' . common, res[2]) + " Test for changing the quickfix lists + call assert_equal(3, g:Xgetlist({'nr' : 0}).nr) + exe '1' . a:cchar . 'hist' + call assert_equal(1, g:Xgetlist({'nr' : 0}).nr) + exe '3' . a:cchar . 'hist' + call assert_equal(3, g:Xgetlist({'nr' : 0}).nr) + call assert_fails('-2' . a:cchar . 'hist', 'E16:') + call assert_fails('4' . a:cchar . 'hist', 'E16:') + call g:Xsetlist([], 'f') let l = split(execute(a:cchar . 'hist'), "\n") call assert_equal('No entries', l[0]) + if a:cchar == 'c' + call assert_fails('4chist', 'E16:') + else + call assert_fails('4lhist', 'E776:') + endif " An empty list should still show the stack history call g:Xsetlist([]) diff --git a/src/version.c b/src/version.c index 0ba9dd13c5..f137b8356c 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1281, /**/ 1280, /**/ From 91882cf712119794b5d658bcb10d15dd2fad73ba Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 5 May 2019 21:01:51 +0200 Subject: [PATCH 12/97] patch 8.1.1282: running make in src/po leaves LINGUAS file behind Problem: Running make in src/po leaves LINGUAS file behind. (Ken Takata) Solution: Delete LINGUAS after running msgfmt. --- src/po/Makefile | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/po/Makefile b/src/po/Makefile index cc56b83d2e..6049b497ea 100644 --- a/src/po/Makefile +++ b/src/po/Makefile @@ -168,10 +168,12 @@ $(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_p vim.desktop: vim.desktop.in $(POFILES) @echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS $(MSGFMT) --desktop -d . --template vim.desktop.in -o vim.desktop + rm -f LINGUAS gvim.desktop: gvim.desktop.in $(POFILES) @echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS $(MSGFMT) --desktop -d . --template gvim.desktop.in -o gvim.desktop + rm -f LINGUAS update-po: $(LANGUAGES) diff --git a/src/version.c b/src/version.c index f137b8356c..90b6904f2e 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1282, /**/ 1281, /**/ From c7a10b35de70471519d104a74d402c63557f0512 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 6 May 2019 21:37:18 +0200 Subject: [PATCH 13/97] patch 8.1.1283: delaying half a second after the top-bot message Problem: Delaying half a second after the top-bot message. Solution: Instead of the delay add "W" to the search count. --- src/search.c | 22 +++++++++++++++++----- src/testdir/test_search_stat.vim | 5 ++++- src/version.c | 2 ++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/search.c b/src/search.c index 1fa52b443c..dd5519e792 100644 --- a/src/search.c +++ b/src/search.c @@ -26,7 +26,7 @@ static void show_pat_in_path(char_u *, int, #ifdef FEAT_VIMINFO static void wvsp_one(FILE *fp, int idx, char *s, int sc); #endif -static void search_stat(int dirc, pos_T *pos, char_u *msgbuf); +static void search_stat(int dirc, pos_T *pos, int show_top_bot_msg, char_u *msgbuf); /* * This file contains various searching-related routines. These fall into @@ -1294,6 +1294,8 @@ do_search( */ for (;;) { + int show_top_bot_msg = FALSE; + searchstr = pat; dircp = NULL; /* use previous pattern */ @@ -1524,7 +1526,7 @@ do_search( if (!shortmess(SHM_SEARCH) && ((dirc == '/' && LT_POS(pos, curwin->w_cursor)) || (dirc == '?' && LT_POS(curwin->w_cursor, pos)))) - ui_delay(500L, FALSE); // leave some time for top_bot_msg + show_top_bot_msg = TRUE; if (c == FAIL) { @@ -1581,7 +1583,7 @@ do_search( && c != FAIL && !shortmess(SHM_SEARCHCOUNT) && msgbuf != NULL) - search_stat(dirc, &pos, msgbuf); + search_stat(dirc, &pos, show_top_bot_msg, msgbuf); /* * The search command can be followed by a ';' to do another search. @@ -4911,6 +4913,7 @@ linewhite(linenr_T lnum) search_stat( int dirc, pos_T *pos, + int show_top_bot_msg, char_u *msgbuf) { int save_ws = p_ws; @@ -4979,8 +4982,9 @@ search_stat( } if (cur > 0) { -#define STAT_BUF_LEN 10 +#define STAT_BUF_LEN 12 char t[STAT_BUF_LEN] = ""; + int len; #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl && *curwin->w_p_rlc == 's') @@ -5006,7 +5010,15 @@ search_stat( else vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cur, cnt); } - mch_memmove(msgbuf + STRLEN(msgbuf) - STRLEN(t), t, STRLEN(t)); + + len = STRLEN(t); + if (show_top_bot_msg && len + 3 < STAT_BUF_LEN) + { + STRCPY(t + len, " W"); + len += 2; + } + + mch_memmove(msgbuf + STRLEN(msgbuf) - len, t, len); if (dirc == '?' && cur == 100) cur = -1; diff --git a/src/testdir/test_search_stat.vim b/src/testdir/test_search_stat.vim index 37e2fdaef5..57dad81b81 100644 --- a/src/testdir/test_search_stat.vim +++ b/src/testdir/test_search_stat.vim @@ -3,6 +3,8 @@ " This test is fragile, it might not work interactively, but it works when run " as test! +source shared.vim + func! Test_search_stat() new set shortmess-=S @@ -79,7 +81,7 @@ func! Test_search_stat() set norl endif - " 9) normal, back at top + " 9) normal, back at bottom call cursor(1,1) let @/ = 'foobar' let pat = '?foobar\s\+' @@ -87,6 +89,7 @@ func! Test_search_stat() let stat = '\[20/20\]' call assert_match(pat .. stat, g:a) call assert_match('search hit TOP, continuing at BOTTOM', g:a) + call assert_match('\[20/20\] W', Screenline(&lines)) " 10) normal, no match call cursor(1,1) diff --git a/src/version.c b/src/version.c index 90b6904f2e..892d1a5075 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1283, /**/ 1282, /**/ From d1362211291c85d29609baab65abc764b1aec169 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 6 May 2019 21:46:10 +0200 Subject: [PATCH 14/97] patch 8.1.1284: detecting *.tmpl as htmlcheetah is outdated Problem: Detecting *.tmpl as htmlcheetah is outdated. Solution: Use the generic name "template". (closes #4348) --- 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 d1f3884bdf..9ac773a5c5 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -713,8 +713,8 @@ au BufNewFile,BufRead *.erb,*.rhtml setf eruby " HTML with M4 au BufNewFile,BufRead *.html.m4 setf htmlm4 -" HTML Cheetah template -au BufNewFile,BufRead *.tmpl setf htmlcheetah +" Some template. Used to be HTML Cheetah. +au BufNewFile,BufRead *.tmpl setf template " Host config au BufNewFile,BufRead */etc/host.conf setf hostconf diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 0783d3ef66..cb55e28b63 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -200,7 +200,7 @@ let s:filename_checks = { \ 'hog': ['file.hog', 'snort.conf', 'vision.conf'], \ 'hostconf': ['/etc/host.conf'], \ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny'], - \ 'htmlcheetah': ['file.tmpl'], + \ 'template': ['file.tmpl'], \ 'htmlm4': ['file.html.m4'], \ 'httest': ['file.htt', 'file.htb'], \ 'ibasic': ['file.iba', 'file.ibi'], diff --git a/src/version.c b/src/version.c index 892d1a5075..bb310e2d06 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1284, /**/ 1283, /**/ From f0ab01f6d868164ed0bb247b6f7b152e6929ef18 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 6 May 2019 22:00:00 +0200 Subject: [PATCH 15/97] patch 8.1.1285: test17 is old style Problem: Test17 is old style. Solution: Turn into new style test. (Yegappan Lakshmanan, closes #4347) --- src/Makefile | 2 +- src/testdir/Make_all.mak | 3 +- src/testdir/Make_vms.mms | 3 +- src/testdir/test17.in | 135 --------------------------------- src/testdir/test17.ok | 33 -------- src/testdir/test17a.in | 3 - src/testdir/test_checkpath.vim | 104 +++++++++++++++++++++++++ src/testdir/test_gf.vim | 35 +++++++++ src/version.c | 2 + 9 files changed, 145 insertions(+), 175 deletions(-) delete mode 100644 src/testdir/test17.in delete mode 100644 src/testdir/test17.ok delete mode 100644 src/testdir/test17a.in create mode 100644 src/testdir/test_checkpath.vim diff --git a/src/Makefile b/src/Makefile index 65e7981449..10ba8755b7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2175,7 +2175,7 @@ test_libvterm: # These do not depend on the executable, compile it when needed. test1 \ test_eval \ - test3 test17 \ + test3 \ test29 test30 test37 test39 \ test42 test44 test48 test49 \ test52 test59 \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 25c8feec72..2bda742768 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -44,7 +44,6 @@ SCRIPTS_MORE2 = \ # Tests that run on most systems, but not on VMS SCRIPTS_MORE4 = \ - test17.out \ test30.out \ test59.out \ test72.out \ @@ -82,6 +81,7 @@ NEW_TESTS = \ test_channel \ test_charsearch \ test_charsearch_utf8 \ + test_checkpath \ test_cindent \ test_clientserver \ test_close_count \ @@ -302,6 +302,7 @@ NEW_TESTS_RES = \ test_changelist.res \ test_channel.res \ test_charsearch.res \ + test_checkpath.res \ test_cindent.res \ test_clientserver.res \ test_close_count.res \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 8a92b4af28..d72b9dac42 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -83,7 +83,6 @@ SCRIPT = test1.out test3.out \ test_eval.out # Known problems: -# test17: ? # # test30: bug, most probably - a problem around mac format # @@ -102,7 +101,7 @@ GUI_OPTION = -g .ENDIF .IFDEF WANT_UNIX -SCRIPT_UNIX = test10.out test17.out test27.out test49.out +SCRIPT_UNIX = test10.out test27.out test49.out .ENDIF .IFDEF WANT_WIN diff --git a/src/testdir/test17.in b/src/testdir/test17.in deleted file mode 100644 index 59b57c2444..0000000000 --- a/src/testdir/test17.in +++ /dev/null @@ -1,135 +0,0 @@ -Tests for: -- "gf" on ${VAR}, -- ":checkpath!" with various 'include' settings. - -STARTTEST -:so small.vim -:if has("ebcdic") -: set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,} -:else -: set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} -:endif -:" -:if has("unix") -:let $CDIR = "." -/CDIR -:else -:if has("amiga") -:let $TDIR = "/testdir" -:else -:let $TDIR = "." -:endif -/TDIR -:endif -:" Dummy writing for making that sure gf doesn't fail even if the current -:" file is modified. It can be occurred when executing the following command -:" directly on Windows without fixing the 'fileformat': -:" > nmake -f Make_dos.mak test17.out -:w! test.out -gf -:set ff=unix -:w! test.out -:brewind -ENDTEST - - ${CDIR}/test17a.in - $TDIR/test17a.in - -STARTTEST -:" check for 'include' without \zs or \ze -:lang C -:call delete("./Xbase.a") -:call delete("Xdir1", "rf") -:!mkdir Xdir1 -:!mkdir "Xdir1/dir2" -:e! Xdir1/dir2/foo.a -i#include "bar.a": -:w -:e Xdir1/dir2/bar.a -i#include "baz.a": -:w -:e Xdir1/dir2/baz.a -i#include "foo.a": -:w -:e Xbase.a -:set path=Xdir1/dir2 -i#include : -:w -:redir! >>test.out -:checkpath! -:redir END -:brewind -ENDTEST - -STARTTEST -:" check for 'include' with \zs and \ze -:call delete("./Xbase.b") -:call delete("Xdir1", "rf") -:!mkdir Xdir1 -:!mkdir "Xdir1/dir2" -:let &include='^\s*%inc\s*/\zs[^/]\+\ze' -:function! DotsToSlashes() -: return substitute(v:fname, '\.', '/', 'g') . '.b' -:endfunction -:let &includeexpr='DotsToSlashes()' -:e! Xdir1/dir2/foo.b -i%inc /bar/: -:w -:e Xdir1/dir2/bar.b -i%inc /baz/: -:w -:e Xdir1/dir2/baz.b -i%inc /foo/: -:w -:e Xbase.b -:set path=Xdir1/dir2 -i%inc /foo/: -:w -:redir! >>test.out -:checkpath! -:redir END -:brewind -ENDTEST - -STARTTEST -:" check for 'include' with \zs and no \ze -:call delete("./Xbase.c") -:call delete("Xdir1", "rf") -:!mkdir Xdir1 -:!mkdir "Xdir1/dir2" -:let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze' -:function! StripNewlineChar() -: if v:fname =~ '\n$' -: return v:fname[:-2] -: endif -: return v:fname -:endfunction -:let &includeexpr='StripNewlineChar()' -:e! Xdir1/dir2/foo.c -i%inc bar.c: -:w -:e Xdir1/dir2/bar.c -i%inc baz.c: -:w -:e Xdir1/dir2/baz.c -i%inc foo.c: -:w -:e Xdir1/dir2/FALSE.c -i%inc foo.c: -:w -:e Xbase.c -:set path=Xdir1/dir2 -i%inc FALSE.c foo.c: -:w -:redir! >>test.out -:checkpath! -:redir END -:brewind -:" change "\" to "/" for Windows and fix 'fileformat' -:e test.out -:%s#\\#/#g -:set ff& -:w -:q -ENDTEST - diff --git a/src/testdir/test17.ok b/src/testdir/test17.ok deleted file mode 100644 index b2a66d5f85..0000000000 --- a/src/testdir/test17.ok +++ /dev/null @@ -1,33 +0,0 @@ -This file is just to test "gf" in test 17. -The contents is not important. -Just testing! - - ---- Included files in path --- -Xdir1/dir2/foo.a -Xdir1/dir2/foo.a --> - Xdir1/dir2/bar.a - Xdir1/dir2/bar.a --> - Xdir1/dir2/baz.a - Xdir1/dir2/baz.a --> - "foo.a" (Already listed) - - ---- Included files in path --- -Xdir1/dir2/foo.b -Xdir1/dir2/foo.b --> - Xdir1/dir2/bar.b - Xdir1/dir2/bar.b --> - Xdir1/dir2/baz.b - Xdir1/dir2/baz.b --> - foo (Already listed) - - ---- Included files in path --- -Xdir1/dir2/foo.c -Xdir1/dir2/foo.c --> - Xdir1/dir2/bar.c - Xdir1/dir2/bar.c --> - Xdir1/dir2/baz.c - Xdir1/dir2/baz.c --> - foo.c (Already listed) diff --git a/src/testdir/test17a.in b/src/testdir/test17a.in deleted file mode 100644 index 7e89364797..0000000000 --- a/src/testdir/test17a.in +++ /dev/null @@ -1,3 +0,0 @@ -This file is just to test "gf" in test 17. -The contents is not important. -Just testing! diff --git a/src/testdir/test_checkpath.vim b/src/testdir/test_checkpath.vim new file mode 100644 index 0000000000..eff30cf205 --- /dev/null +++ b/src/testdir/test_checkpath.vim @@ -0,0 +1,104 @@ +" Tests for the :checkpath command + +" Test for 'include' without \zs or \ze +func Test_checkpath1() + call mkdir("Xdir1/dir2", "p") + call writefile(['#include "bar.a"'], 'Xdir1/dir2/foo.a') + call writefile(['#include "baz.a"'], 'Xdir1/dir2/bar.a') + call writefile(['#include "foo.a"'], 'Xdir1/dir2/baz.a') + call writefile(['#include '], 'Xbase.a') + + edit Xbase.a + set path=Xdir1/dir2 + let res = split(execute("checkpath!"), "\n") + call assert_equal([ + \ '--- Included files in path ---', + \ 'Xdir1/dir2/foo.a', + \ 'Xdir1/dir2/foo.a -->', + \ ' Xdir1/dir2/bar.a', + \ ' Xdir1/dir2/bar.a -->', + \ ' Xdir1/dir2/baz.a', + \ ' Xdir1/dir2/baz.a -->', + \ ' "foo.a" (Already listed)'], res) + + enew + call delete("./Xbase.a") + call delete("Xdir1", "rf") + set path& +endfunc + +func DotsToSlashes() + return substitute(v:fname, '\.', '/', 'g') . '.b' +endfunc + +" Test for 'include' with \zs and \ze +func Test_checkpath2() + call mkdir("Xdir1/dir2", "p") + call writefile(['%inc /bar/'], 'Xdir1/dir2/foo.b') + call writefile(['%inc /baz/'], 'Xdir1/dir2/bar.b') + call writefile(['%inc /foo/'], 'Xdir1/dir2/baz.b') + call writefile(['%inc /foo/'], 'Xbase.b') + + let &include='^\s*%inc\s*/\zs[^/]\+\ze' + let &includeexpr='DotsToSlashes()' + + edit Xbase.b + set path=Xdir1/dir2 + let res = split(execute("checkpath!"), "\n") + call assert_equal([ + \ '--- Included files in path ---', + \ 'Xdir1/dir2/foo.b', + \ 'Xdir1/dir2/foo.b -->', + \ ' Xdir1/dir2/bar.b', + \ ' Xdir1/dir2/bar.b -->', + \ ' Xdir1/dir2/baz.b', + \ ' Xdir1/dir2/baz.b -->', + \ ' foo (Already listed)'], res) + + enew + call delete("./Xbase.b") + call delete("Xdir1", "rf") + set path& + set include& + set includeexpr& +endfunc + +func StripNewlineChar() + if v:fname =~ '\n$' + return v:fname[:-2] + endif + return v:fname +endfunc + +" Test for 'include' with \zs and no \ze +func Test_checkpath3() + call mkdir("Xdir1/dir2", "p") + call writefile(['%inc bar.c'], 'Xdir1/dir2/foo.c') + call writefile(['%inc baz.c'], 'Xdir1/dir2/bar.c') + call writefile(['%inc foo.c'], 'Xdir1/dir2/baz.c') + call writefile(['%inc foo.c'], 'Xdir1/dir2/FALSE.c') + call writefile(['%inc FALSE.c foo.c'], 'Xbase.c') + + let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze' + let &includeexpr='StripNewlineChar()' + + edit Xbase.c + set path=Xdir1/dir2 + let res = split(execute("checkpath!"), "\n") + call assert_equal([ + \ '--- Included files in path ---', + \ 'Xdir1/dir2/foo.c', + \ 'Xdir1/dir2/foo.c -->', + \ ' Xdir1/dir2/bar.c', + \ ' Xdir1/dir2/bar.c -->', + \ ' Xdir1/dir2/baz.c', + \ ' Xdir1/dir2/baz.c -->', + \ ' foo.c (Already listed)'], res) + + enew + call delete("./Xbase.c") + call delete("Xdir1", "rf") + set path& + set include& + set includeexpr& +endfunc diff --git a/src/testdir/test_gf.vim b/src/testdir/test_gf.vim index d233046d2b..accd21e9a3 100644 --- a/src/testdir/test_gf.vim +++ b/src/testdir/test_gf.vim @@ -64,3 +64,38 @@ func Test_gF() bwipe Xfile bwipe Xfile2 endfunc + +" Test for invoking 'gf' on a ${VAR} variable +func Test_gf() + if has("ebcdic") + set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,} + else + set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} + endif + + call writefile(["Test for gf command"], "Xtest1") + if has("unix") + call writefile([" ${CDIR}/Xtest1"], "Xtestgf") + else + call writefile([" $TDIR/Xtest1"], "Xtestgf") + endif + new Xtestgf + if has("unix") + let $CDIR = "." + /CDIR + else + if has("amiga") + let $TDIR = "/testdir" + else + let $TDIR = "." + endif + /TDIR + endif + + normal gf + call assert_equal('Xtest1', fnamemodify(bufname(''), ":t")) + close! + + call delete('Xtest1') + call delete('Xtestgf') +endfunc diff --git a/src/version.c b/src/version.c index bb310e2d06..f4344aa387 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1285, /**/ 1284, /**/ From 4fa06870e5d347c30fe55290dab87e494c8aa06a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 6 May 2019 22:03:39 +0200 Subject: [PATCH 16/97] patch 8.1.1286: running tests leaves XTest_tabpage_cmdheight file behind Problem: Running tests leaves XTest_tabpage_cmdheight file behind. Solution: Delete the right file. (closes #4350) --- src/testdir/test_tabpage.vim | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim index 6b7ef92478..60a5f3d968 100644 --- a/src/testdir/test_tabpage.vim +++ b/src/testdir/test_tabpage.vim @@ -573,7 +573,7 @@ func Test_tabpage_cmdheight() call VerifyScreenDump(buf, 'Test_tabpage_cmdheight', {}) call StopVimInTerminal(buf) - call delete('XTest_conceal') + call delete('XTest_tabpage_cmdheight') endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index f4344aa387..098c723a6e 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1286, /**/ 1285, /**/ From 7e1a5af5409120835f6c51c8d26ad7891a966aa8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 May 2019 16:28:13 +0200 Subject: [PATCH 17/97] patch 8.1.1287: cannot build with +eval but without +mouse Problem: Cannot build with +eval but without +mouse. Solution: Add #ifdefs around f_test_setmouse(). (John Marriott) --- src/evalfunc.c | 6 ++++++ src/version.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/evalfunc.c b/src/evalfunc.c index a2be7b903b..ba3db95c9f 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -456,7 +456,9 @@ static void f_test_null_string(typval_T *argvars, typval_T *rettv); #ifdef FEAT_GUI static void f_test_scrollbar(typval_T *argvars, typval_T *rettv); #endif +#ifdef FEAT_MOUSE static void f_test_setmouse(typval_T *argvars, typval_T *rettv); +#endif static void f_test_settime(typval_T *argvars, typval_T *rettv); #ifdef FEAT_FLOAT static void f_tan(typval_T *argvars, typval_T *rettv); @@ -994,7 +996,9 @@ static struct fst #ifdef FEAT_GUI {"test_scrollbar", 3, 3, f_test_scrollbar}, #endif +#ifdef FEAT_MOUSE {"test_setmouse", 2, 2, f_test_setmouse}, +#endif {"test_settime", 1, 1, f_test_settime}, #ifdef FEAT_TIMERS {"timer_info", 0, 1, f_timer_info}, @@ -14499,12 +14503,14 @@ f_test_scrollbar(typval_T *argvars, typval_T *rettv UNUSED) } #endif +#ifdef FEAT_MOUSE static void f_test_setmouse(typval_T *argvars, typval_T *rettv UNUSED) { mouse_row = (time_t)tv_get_number(&argvars[0]) - 1; mouse_col = (time_t)tv_get_number(&argvars[1]) - 1; } +#endif static void f_test_settime(typval_T *argvars, typval_T *rettv UNUSED) diff --git a/src/version.c b/src/version.c index 098c723a6e..e2ca5b04a1 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1287, /**/ 1286, /**/ From 9ce3fa828d238ff28d57b0092bb37575e20010ec Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 May 2019 21:29:11 +0200 Subject: [PATCH 18/97] patch 8.1.1288: search stats don't show for mapped command Problem: Search stats don't show for mapped command. Solution: Remove SEARCH_PEEK from searchit flags. Add a test. (Christian Brabandt) --- src/search.c | 4 ++-- src/testdir/test_search_stat.vim | 25 +++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/search.c b/src/search.c index dd5519e792..2d829b56c2 100644 --- a/src/search.c +++ b/src/search.c @@ -4958,8 +4958,8 @@ search_stat( profile_setlimit(20L, &start); #endif while (!got_int && searchit(curwin, curbuf, &lastpos, NULL, - FORWARD, NULL, 1, SEARCH_PEEK + SEARCH_KEEP, - RE_LAST, (linenr_T)0, NULL, NULL) != FAIL) + FORWARD, NULL, 1, SEARCH_KEEP, RE_LAST, + (linenr_T)0, NULL, NULL) != FAIL) { #ifdef FEAT_RELTIME // Stop after passing the time limit. diff --git a/src/testdir/test_search_stat.vim b/src/testdir/test_search_stat.vim index 57dad81b81..107cd54a0e 100644 --- a/src/testdir/test_search_stat.vim +++ b/src/testdir/test_search_stat.vim @@ -8,6 +8,7 @@ source shared.vim func! Test_search_stat() new set shortmess-=S + " Append 50 lines with text to search for, "foobar" appears 20 times call append(0, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 10)) " 1) match at second line @@ -105,6 +106,30 @@ func! Test_search_stat() call assert_false(1) endtry + " 11) normal, n comes from a mapping + " Need to move over more than 64 lines to trigger char_avail(. + nnoremap n nzv + call cursor(1,1) + call append(50, repeat(['foobar', 'foo', 'fooooobar', 'foba', 'foobar'], 10)) + call setline(2, 'find this') + call setline(70, 'find this') + let @/ = 'find this' + let pat = '/find this\s\+' + let g:a = execute(':unsilent :norm n') + " g:a will contain several lines + let g:b = split(g:a, "\n")[-1] + let stat = '\[1/2\]' + call assert_match(pat .. stat, g:b) + unmap n + + " 11) normal, but silent + call cursor(1,1) + let @/ = 'find this' + let pat = '/find this\s\+' + let g:a = execute(':norm! n') + let stat = '\[1/2\]' + call assert_notmatch(pat .. stat, g:a) + " close the window set shortmess+=S bwipe! diff --git a/src/version.c b/src/version.c index e2ca5b04a1..fb1235c4a0 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1288, /**/ 1287, /**/ From b6cb26ffe1795ae62d8235960dccf517c2b2ed45 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 May 2019 21:34:37 +0200 Subject: [PATCH 19/97] patch 8.1.1289: may not have enough space to add "W" to search stats Problem: May not have enough space to add "W" to search stats. Solution: Reserve a bit more space. (Christian Brabandt) --- src/search.c | 26 +++++++++++++------------- src/version.c | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/search.c b/src/search.c index 2d829b56c2..d9b6a7ca85 100644 --- a/src/search.c +++ b/src/search.c @@ -1219,6 +1219,7 @@ do_search( char_u *ps; char_u *msgbuf = NULL; size_t len; +#define SEARCH_STAT_BUF_LEN 12 /* * A line offset is not remembered, this is vi compatible. @@ -1399,8 +1400,8 @@ do_search( else // Use up to 'showcmd' column. len = (int)(Rows - msg_row - 1) * Columns + sc_col - 1; - if (len < STRLEN(p) + 40 + 11) - len = STRLEN(p) + 40 + 11; + if (len < STRLEN(p) + 40 + SEARCH_STAT_BUF_LEN + 1) + len = STRLEN(p) + 40 + SEARCH_STAT_BUF_LEN + 1; } else // Reserve enough space for the search pattern + offset. @@ -4982,37 +4983,36 @@ search_stat( } if (cur > 0) { -#define STAT_BUF_LEN 12 - char t[STAT_BUF_LEN] = ""; + char t[SEARCH_STAT_BUF_LEN] = ""; int len; #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl && *curwin->w_p_rlc == 's') { if (cur == OUT_OF_TIME) - vim_snprintf(t, STAT_BUF_LEN, "[?/??]"); + vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[?/??]"); else if (cnt > 99 && cur > 99) - vim_snprintf(t, STAT_BUF_LEN, "[>99/>99]"); + vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>99/>99]"); else if (cnt > 99) - vim_snprintf(t, STAT_BUF_LEN, "[>99/%d]", cur); + vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>99/%d]", cur); else - vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cnt, cur); + vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/%d]", cnt, cur); } else #endif { if (cur == OUT_OF_TIME) - vim_snprintf(t, STAT_BUF_LEN, "[?/??]"); + vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[?/??]"); else if (cnt > 99 && cur > 99) - vim_snprintf(t, STAT_BUF_LEN, "[>99/>99]"); + vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>99/>99]"); else if (cnt > 99) - vim_snprintf(t, STAT_BUF_LEN, "[%d/>99]", cur); + vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/>99]", cur); else - vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cur, cnt); + vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/%d]", cur, cnt); } len = STRLEN(t); - if (show_top_bot_msg && len + 3 < STAT_BUF_LEN) + if (show_top_bot_msg && len + 3 < SEARCH_STAT_BUF_LEN) { STRCPY(t + len, " W"); len += 2; diff --git a/src/version.c b/src/version.c index fb1235c4a0..99bfb98210 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1289, /**/ 1288, /**/ From fd31e45e4bccd7070d02e4d20bcab1f45b271600 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 May 2019 21:48:51 +0200 Subject: [PATCH 20/97] patch 8.1.1290: .hgignore and .gitignore are either distributed or in git Problem: .hgignore and .gitignore are either distributed or in git, not both. Solution: Add .gitignore to the distribution and .hgignore to git. Update the entries. (Christian Brabandt, Ken Takata) --- .gitignore | 20 ++++++++-- .hgignore | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++ Filelist | 1 + src/version.c | 2 + 4 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 .hgignore diff --git a/.gitignore b/.gitignore index 85e482d1f7..5767bae79c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,16 +6,15 @@ src/auto/if_perl.c src/auto/gui_gtk_gresources.c src/auto/gui_gtk_gresources.h src/objects/.dirstamp +src/objects src/tags # We do need src/auto/configure. -src/auto/config.aap src/auto/config.cache src/auto/config.h src/auto/config.log src/auto/config.mk src/auto/config.status -src/auto/configure.aap src/auto/osdef.h src/auto/link.log src/auto/link.sed @@ -26,6 +25,7 @@ src/auto/pathdef.c *.idb *.manifest *.exp +*.map *.obj *.pdb *.ilk @@ -35,13 +35,13 @@ src/auto/pathdef.c *.RES vim*.dll vim*.lib -src/if_perl.c src/pathdef.c src/Obj*/pathdef.c gvimext.dll gvimext.lib gvim.lib runtime/doc/uganda.nsis.txt +nsis/icons/* # Borland C++ bcc.cfg @@ -49,7 +49,6 @@ bcc.cfg *.ild *.ilf *.ils -*.map *.tds # NetBeans @@ -88,3 +87,16 @@ src/memfile_test src/json_test src/message_test src/kword_test + +# Generated by "make install" +runtime/doc/tags + +# Generated by "make shadow". The directory names could be anything but we +# restrict them to shadow (the default) or shadow-* +src/shadow +src/shadow-* +src/runtime +src/pixmaps + +# other possible files build by tools +src/cscope.out diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000000..8b5c5eda2f --- /dev/null +++ b/.hgignore @@ -0,0 +1,104 @@ +syntax: glob + +# Unixen: object and executable files. +*.o +src/vim +src/xxd/xxd +src/auto/if_perl.c +src/auto/gui_gtk_gresources.c +src/auto/gui_gtk_gresources.h +src/objects/.dirstamp +src/objects +src/tags + +# We do need src/auto/configure. +src/auto/config.cache +src/auto/config.h +src/auto/config.log +src/auto/config.mk +src/auto/config.status +src/auto/osdef.h +src/auto/link.log +src/auto/link.sed +src/auto/pathdef.c + +# Windows +*.exe +*.idb +*.manifest +*.exp +*.map +*.obj +*.pdb +*.ilk +*.sln +*.suo +*.res +*.RES +vim*.dll +vim*.lib +src/pathdef.c +src/Obj*/pathdef.c +gvimext.dll +gvimext.lib +gvim.lib +runtime/doc/uganda.nsis.txt +nsis/icons/* + +# Borland C++ +bcc.cfg +*.ilc +*.ild +*.ilf +*.ils +*.tds + +# NetBeans +nbproject/* + +# Mac OSX +src/xxd/xxd.dSYM + +# All platforms +*.rej +*.orig +*.mo +*.swp +*~ +*.pyc +*.log +src/po/vim.pot + +# Generated by "make test" +src/po/*.ck +src/po/*.desktop +src/testdir/mbyte.vim +src/testdir/mzscheme.vim +src/testdir/lua.vim +src/testdir/small.vim +src/testdir/tiny.vim +src/testdir/test*.out +src/testdir/test*.failed +src/testdir/test.log +src/testdir/dostmp/* +src/testdir/messages +src/testdir/viminfo +src/testdir/opt_test.vim +runtime/indent/testdir/*.out +src/memfile_test +src/json_test +src/message_test +src/kword_test + +# Generated by "make install" +runtime/doc/tags + +# Generated by "make shadow". The directory names could be anything but we +# restrict them to shadow (the default) or shadow-* +src/shadow +src/shadow-* +src/runtime +src/pixmaps + +# other possible files build by tools +src/cscope.out diff --git a/Filelist b/Filelist index 71892782f8..23dfa3f22c 100644 --- a/Filelist +++ b/Filelist @@ -3,6 +3,7 @@ # source files for all source archives SRC_ALL = \ + .gitignore \ .hgignore \ .lgtm.yml \ .travis.yml \ diff --git a/src/version.c b/src/version.c index 99bfb98210..676c383062 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1290, /**/ 1289, /**/ From 1063f3d2008f22d02ccfa9dab83a23db52febbdc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 May 2019 22:06:52 +0200 Subject: [PATCH 21/97] patch 8.1.1291: not easy to change directory and restore Problem: Not easy to change directory and restore. Solution: Add the chdir() function. (Yegappan Lakshmanan, closes #4358) --- runtime/doc/eval.txt | 22 +++++ runtime/doc/usr_41.txt | 1 + src/evalfunc.c | 41 +++++++++ src/ex_docmd.c | 188 ++++++++++++++++++++++------------------ src/if_py_both.h | 2 +- src/proto/ex_docmd.pro | 3 +- src/structs.h | 7 ++ src/testdir/test_cd.vim | 43 ++++++++- src/version.c | 2 + 9 files changed, 224 insertions(+), 85 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index a39f72b551..84001b7a02 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2273,6 +2273,7 @@ ch_status({handle} [, {options}]) String status of channel {handle} changenr() Number current change number char2nr({expr} [, {utf8}]) Number ASCII/UTF8 value of first char in {expr} +chdir({dir}) String change current working directory cindent({lnum}) Number C indent for line {lnum} clearmatches([{win}]) none clear all matches col({expr}) Number column nr of cursor or mark @@ -3469,6 +3470,27 @@ char2nr({expr} [, {utf8}]) *char2nr()* let list = map(split(str, '\zs'), {_, val -> char2nr(val)}) < Result: [65, 66, 67] +chdir({dir}) *chdir()* + Change the current working directory to {dir}. The scope of + the directory change depends on the directory of the current + window: + - If the current window has a window-local directory + (|:lcd|), then changes the window local directory. + - Otherwise, if the current tabpage has a local + directory (|:tcd|) then changes the tabpage local + directory. + - Otherwise, changes the global directory. + If successful, returns the previous working directory. Pass + this to another chdir() to restore the directory. + On failure, returns an empty string. + + Example: > + let save_dir = chdir(newdir) + if save_dir + " ... do some work + call chdir(save_dir) + endif +< cindent({lnum}) *cindent()* Get the amount of indent for line {lnum} according the C indenting rules, as with 'cindent'. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index cef6fd793a..f874b073b9 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -769,6 +769,7 @@ System functions and manipulation of files: haslocaldir() check if current window used |:lcd| or |:tcd| tempname() get the name of a temporary file mkdir() create a new directory + chdir() change current working directory delete() delete a file rename() rename a file system() get the result of a shell command as a string diff --git a/src/evalfunc.c b/src/evalfunc.c index ba3db95c9f..ca412f7549 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -107,6 +107,7 @@ static void f_ch_status(typval_T *argvars, typval_T *rettv); #endif static void f_changenr(typval_T *argvars, typval_T *rettv); static void f_char2nr(typval_T *argvars, typval_T *rettv); +static void f_chdir(typval_T *argvars, typval_T *rettv); static void f_cindent(typval_T *argvars, typval_T *rettv); static void f_clearmatches(typval_T *argvars, typval_T *rettv); static void f_col(typval_T *argvars, typval_T *rettv); @@ -597,6 +598,7 @@ static struct fst #endif {"changenr", 0, 0, f_changenr}, {"char2nr", 1, 2, f_char2nr}, + {"chdir", 1, 1, f_chdir}, {"cindent", 1, 1, f_cindent}, {"clearmatches", 0, 1, f_clearmatches}, {"col", 1, 1, f_col}, @@ -2490,6 +2492,45 @@ f_char2nr(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = tv_get_string(&argvars[0])[0]; } +/* + * "chdir(dir)" function + */ + static void +f_chdir(typval_T *argvars, typval_T *rettv) +{ + char_u *cwd; + cdscope_T scope = CDSCOPE_GLOBAL; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + + if (argvars[0].v_type != VAR_STRING) + return; + + // Return the current directory + cwd = alloc(MAXPATHL); + if (cwd != NULL) + { + if (mch_dirname(cwd, MAXPATHL) != FAIL) + { +#ifdef BACKSLASH_IN_FILENAME + slash_adjust(cwd); +#endif + rettv->vval.v_string = vim_strsave(cwd); + } + vim_free(cwd); + } + + if (curwin->w_localdir != NULL) + scope = CDSCOPE_WINDOW; + else if (curtab->tp_localdir != NULL) + scope = CDSCOPE_TABPAGE; + + if (!changedir_func(argvars[0].vval.v_string, TRUE, scope)) + // Directory change failed + VIM_CLEAR(rettv->vval.v_string); +} + /* * "cindent(lnum)" function */ diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 1393d0e2f7..a2b302d922 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7513,17 +7513,17 @@ free_cd_dir(void) /* * Deal with the side effects of changing the current directory. - * When "tablocal" is TRUE then this was after an ":tcd" command. - * When "winlocal" is TRUE then this was after an ":lcd" command. + * When 'scope' is CDSCOPE_TABPAGE then this was after an ":tcd" command. + * When 'scope' is CDSCOPE_WINDOW then this was after an ":lcd" command. */ void -post_chdir(int tablocal, int winlocal) +post_chdir(cdscope_T scope) { - if (!winlocal) + if (scope != CDSCOPE_WINDOW) // Clear tab local directory for both :cd and :tcd VIM_CLEAR(curtab->tp_localdir); VIM_CLEAR(curwin->w_localdir); - if (winlocal || tablocal) + if (scope != CDSCOPE_GLOBAL) { /* If still in global directory, need to remember current * directory as global directory. */ @@ -7532,7 +7532,7 @@ post_chdir(int tablocal, int winlocal) /* Remember this local directory for the window. */ if (mch_dirname(NameBuff, MAXPATHL) == OK) { - if (tablocal) + if (scope == CDSCOPE_TABPAGE) curtab->tp_localdir = vim_strsave(NameBuff); else curwin->w_localdir = vim_strsave(NameBuff); @@ -7548,6 +7548,96 @@ post_chdir(int tablocal, int winlocal) shorten_fnames(TRUE); } +/* + * Change directory function used by :cd/:tcd/:lcd Ex commands and the + * chdir() function. If 'winlocaldir' is TRUE, then changes the window-local + * directory. If 'tablocaldir' is TRUE, then changes the tab-local directory. + * Otherwise changes the global directory. + * Returns TRUE if the directory is successfully changed. + */ + int +changedir_func( + char_u *new_dir, + int forceit, + cdscope_T scope) +{ + char_u *tofree; + int dir_differs; + int retval = FALSE; + + if (allbuf_locked()) + return FALSE; + + if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !forceit) + { + emsg(_("E747: Cannot change directory, buffer is modified (add ! to override)")); + return FALSE; + } + + // ":cd -": Change to previous directory + if (STRCMP(new_dir, "-") == 0) + { + if (prev_dir == NULL) + { + emsg(_("E186: No previous directory")); + return FALSE; + } + new_dir = prev_dir; + } + + // Save current directory for next ":cd -" + tofree = prev_dir; + if (mch_dirname(NameBuff, MAXPATHL) == OK) + prev_dir = vim_strsave(NameBuff); + else + prev_dir = NULL; + +#if defined(UNIX) || defined(VMS) + // for UNIX ":cd" means: go to home directory + if (*new_dir == NUL) + { + // use NameBuff for home directory name +# ifdef VMS + char_u *p; + + p = mch_getenv((char_u *)"SYS$LOGIN"); + if (p == NULL || *p == NUL) // empty is the same as not set + NameBuff[0] = NUL; + else + vim_strncpy(NameBuff, p, MAXPATHL - 1); +# else + expand_env((char_u *)"$HOME", NameBuff, MAXPATHL); +# endif + new_dir = NameBuff; + } +#endif + dir_differs = new_dir == NULL || prev_dir == NULL + || pathcmp((char *)prev_dir, (char *)new_dir, -1) != 0; + if (new_dir == NULL || (dir_differs && vim_chdir(new_dir))) + emsg(_(e_failed)); + else + { + char_u *acmd_fname; + + post_chdir(scope); + + if (dir_differs) + { + if (scope == CDSCOPE_WINDOW) + acmd_fname = (char_u *)"window"; + else if (scope == CDSCOPE_TABPAGE) + acmd_fname = (char_u *)"tabpage"; + else + acmd_fname = (char_u *)"global"; + apply_autocmds(EVENT_DIRCHANGED, acmd_fname, new_dir, FALSE, + curbuf); + } + retval = TRUE; + } + vim_free(tofree); + + return retval; +} /* * ":cd", ":tcd", ":lcd", ":chdir" ":tchdir" and ":lchdir". @@ -7556,94 +7646,28 @@ post_chdir(int tablocal, int winlocal) ex_cd(exarg_T *eap) { char_u *new_dir; - char_u *tofree; - int dir_differs; new_dir = eap->arg; #if !defined(UNIX) && !defined(VMS) - /* for non-UNIX ":cd" means: print current directory */ + // for non-UNIX ":cd" means: print current directory if (*new_dir == NUL) ex_pwd(NULL); else #endif { - if (allbuf_locked()) - return; - if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() - && !eap->forceit) + cdscope_T scope = CDSCOPE_GLOBAL; + + if (eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir) + scope = CDSCOPE_WINDOW; + else if (eap->cmdidx == CMD_tcd || eap->cmdidx == CMD_tchdir) + scope = CDSCOPE_TABPAGE; + + if (changedir_func(new_dir, eap->forceit, scope)) { - emsg(_("E747: Cannot change directory, buffer is modified (add ! to override)")); - return; - } - - /* ":cd -": Change to previous directory */ - if (STRCMP(new_dir, "-") == 0) - { - if (prev_dir == NULL) - { - emsg(_("E186: No previous directory")); - return; - } - new_dir = prev_dir; - } - - /* Save current directory for next ":cd -" */ - tofree = prev_dir; - if (mch_dirname(NameBuff, MAXPATHL) == OK) - prev_dir = vim_strsave(NameBuff); - else - prev_dir = NULL; - -#if defined(UNIX) || defined(VMS) - /* for UNIX ":cd" means: go to home directory */ - if (*new_dir == NUL) - { - /* use NameBuff for home directory name */ -# ifdef VMS - char_u *p; - - p = mch_getenv((char_u *)"SYS$LOGIN"); - if (p == NULL || *p == NUL) /* empty is the same as not set */ - NameBuff[0] = NUL; - else - vim_strncpy(NameBuff, p, MAXPATHL - 1); -# else - expand_env((char_u *)"$HOME", NameBuff, MAXPATHL); -# endif - new_dir = NameBuff; - } -#endif - dir_differs = new_dir == NULL || prev_dir == NULL - || pathcmp((char *)prev_dir, (char *)new_dir, -1) != 0; - if (new_dir == NULL || (dir_differs && vim_chdir(new_dir))) - emsg(_(e_failed)); - else - { - char_u *acmd_fname; - int is_winlocal_chdir = eap->cmdidx == CMD_lcd - || eap->cmdidx == CMD_lchdir; - int is_tablocal_chdir = eap->cmdidx == CMD_tcd - || eap->cmdidx == CMD_tchdir; - - post_chdir(is_tablocal_chdir, is_winlocal_chdir); - - /* Echo the new current directory if the command was typed. */ + // Echo the new current directory if the command was typed. if (KeyTyped || p_verbose >= 5) ex_pwd(eap); - - if (dir_differs) - { - if (is_winlocal_chdir) - acmd_fname = (char_u *)"window"; - else if (is_tablocal_chdir) - acmd_fname = (char_u *)"tabpage"; - else - acmd_fname = (char_u *)"global"; - apply_autocmds(EVENT_DIRCHANGED, acmd_fname, - new_dir, FALSE, curbuf); - } } - vim_free(tofree); } } diff --git a/src/if_py_both.h b/src/if_py_both.h index ede2f5cde4..498972d548 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -1032,7 +1032,7 @@ _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) Py_DECREF(newwd); Py_XDECREF(todecref); - post_chdir(FALSE, FALSE); + post_chdir(CDSCOPE_GLOBAL); if (VimTryEnd()) { diff --git a/src/proto/ex_docmd.pro b/src/proto/ex_docmd.pro index 9934d60fcb..6714b38c4e 100644 --- a/src/proto/ex_docmd.pro +++ b/src/proto/ex_docmd.pro @@ -37,7 +37,8 @@ void ex_splitview(exarg_T *eap); void tabpage_new(void); void do_exedit(exarg_T *eap, win_T *old_curwin); void free_cd_dir(void); -void post_chdir(int tablocal, int winlocal); +void post_chdir(cdscope_T cdscope); +int changedir_func(char_u *new_dir, int forceit, cdscope_T cdscope); void ex_cd(exarg_T *eap); void do_sleep(long msec); void ex_may_print(exarg_T *eap); diff --git a/src/structs.h b/src/structs.h index fa8a7655fa..ca678f83b1 100644 --- a/src/structs.h +++ b/src/structs.h @@ -3555,3 +3555,10 @@ typedef struct { varnumber_T vv_count; varnumber_T vv_count1; } vimvars_save_T; + +// Scope for changing directory +typedef enum { + CDSCOPE_GLOBAL, // :cd + CDSCOPE_TABPAGE, // :tcd + CDSCOPE_WINDOW // :lcd +} cdscope_T; diff --git a/src/testdir/test_cd.vim b/src/testdir/test_cd.vim index c63f0060f8..31859542e5 100644 --- a/src/testdir/test_cd.vim +++ b/src/testdir/test_cd.vim @@ -1,4 +1,4 @@ -" Test for :cd +" Test for :cd and chdir() func Test_cd_large_path() " This used to crash with a heap write overflow. @@ -65,3 +65,44 @@ func Test_cd_with_cpo_chdir() set cpo& bw! endfunc + +" Test for chdir() +func Test_chdir_func() + let topdir = getcwd() + call mkdir('Xdir/y/z', 'p') + + " Create a few tabpages and windows with different directories + new + cd Xdir + tabnew + tcd y + below new + below new + lcd z + + tabfirst + call chdir('..') + call assert_equal('y', fnamemodify(getcwd(1, 2), ':t')) + call assert_equal('z', fnamemodify(getcwd(3, 2), ':t')) + tabnext | wincmd t + call chdir('..') + call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t')) + call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) + call assert_equal('z', fnamemodify(getcwd(3, 2), ':t')) + call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) + 3wincmd w + call chdir('..') + call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t')) + call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) + call assert_equal('y', fnamemodify(getcwd(3, 2), ':t')) + call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) + + " Error case + call assert_fails("call chdir('dir-abcd')", 'E472:') + silent! let d = chdir("dir_abcd") + call assert_equal("", d) + + only | tabonly + exe 'cd ' . topdir + call delete('Xdir', 'rf') +endfunc diff --git a/src/version.c b/src/version.c index 676c383062..09bb1be853 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1291, /**/ 1290, /**/ From ba9ea91beb8f687b0f61b28319c1dbdced2f46ca Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 May 2019 22:10:50 +0200 Subject: [PATCH 22/97] patch 8.1.1292: invalid command line arguments not tested Problem: Invalid command line arguments not tested. Solution: Add a test. (Dominique Pelle, closes #4346) --- src/testdir/test_startup.vim | 90 ++++++++++++++++++++++++++++++++++++ src/version.c | 2 + 2 files changed, 92 insertions(+) diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim index 6509c0cc16..dec485b138 100644 --- a/src/testdir/test_startup.vim +++ b/src/testdir/test_startup.vim @@ -385,6 +385,96 @@ func Test_A_F_H_arg() call delete('Xtestout') endfunc +func Test_invalid_args() + if !has('unix') || has('gui_running') + " can't get output of Vim. + return + endif + + for opt in ['-Y', '--does-not-exist'] + let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") + call assert_equal(1, v:shell_error) + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Unknown option argument: "' .. opt .. '"', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + endfor + + for opt in ['-c', '-i', '-s', '-t', '-T', '-u', '-U', '-w', '-W', '--cmd', '--startuptime'] + let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") + call assert_equal(1, v:shell_error) + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Argument missing after: "' .. opt .. '"', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + endfor + + if has('clientserver') + " FIXME: need to add --servername to this list + " but it causes vim-8.1.1282 to crash! + for opt in ['--remote', '--remote-send', '--remote-silent', '--remote-expr', + \ '--remote-tab', '--remote-tab-wait', + \ '--remote-tab-wait-silent', '--remote-tab-silent', + \ '--remote-wait', '--remote-wait-silent', + \ ] + let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") + call assert_equal(1, v:shell_error) + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Argument missing after: "' .. opt .. '"', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + endfor + endif + + " FIXME: commented out as this causes vim-8.1.1282 to crash! + "if has('clipboard') + " let out = split(system(GetVimCommand() .. ' --display'), "\n") + " call assert_equal(1, v:shell_error) + " call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + " call assert_equal('Argument missing after: "--display"', out[1]) + " call assert_equal('More info with: "vim -h"', out[2]) + "endif + + let out = split(system(GetVimCommand() .. ' -ix'), "\n") + call assert_equal(1, v:shell_error) + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Garbage after option argument: "-ix"', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + + let out = split(system(GetVimCommand() .. ' - xxx'), "\n") + call assert_equal(1, v:shell_error) + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Too many edit arguments: "xxx"', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + + " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'. + for opt in ['-t', '-q'] + let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n") + call assert_equal(1, v:shell_error) + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Too many edit arguments: "' .. opt .. '"', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + endfor + + for opt in [' -cq', ' --cmd q', ' +', ' -S foo'] + let out = split(system(GetVimCommand() .. repeat(opt, 11)), "\n") + call assert_equal(1, v:shell_error) + " FIXME: The error message given by Vim is not ideal in case of repeated + " -S foo since it does not mention -S. + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Too many "+command", "-c command" or "--cmd command" arguments', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + endfor + + " FIXME: commented out as this causes vim-8.1.1282 to crash! + "if has('gui_gtk') + " for opt in ['--socketid x', '--socketid 0xg'] + " let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") + " call assert_equal(1, v:shell_error) + " call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + " call assert_equal('Invalid argument for: "--socketid"', out[1]) + " call assert_equal('More info with: "vim -h"', out[2]) + " endfor + "endif +endfunc + func Test_file_args() let after = [ \ 'call writefile(argv(), "Xtestout")', diff --git a/src/version.c b/src/version.c index 09bb1be853..5eeec1ce10 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1292, /**/ 1291, /**/ From fda9784dc9596e1e36f840bbf1935a4c4b502bd9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 May 2019 22:25:27 +0200 Subject: [PATCH 23/97] patch 8.1.1293: MSVC files are no longer useful Problem: MSVC files are no longer useful for debugging. Newer Visual Studio versions cannot read them. Solution: Delete the files. (Ken Takata, closes #4357) --- Filelist | 2 - runtime/doc/debug.txt | 4 - src/INSTALLpc.txt | 12 +- src/Make_dvc.mak | 105 ------ src/Make_ivc.mak | 778 ------------------------------------------ src/Make_mvc.mak | 31 -- src/version.c | 2 + 7 files changed, 3 insertions(+), 931 deletions(-) delete mode 100644 src/Make_dvc.mak delete mode 100644 src/Make_ivc.mak diff --git a/Filelist b/Filelist index 23dfa3f22c..046a9a7be1 100644 --- a/Filelist +++ b/Filelist @@ -424,8 +424,6 @@ SRC_DOS = \ src/Make_bc5.mak \ src/Make_cyg.mak \ src/Make_cyg_ming.mak \ - src/Make_ivc.mak \ - src/Make_dvc.mak \ src/Make_ming.mak \ src/Make_mvc.mak \ tools/rename.bat \ diff --git a/runtime/doc/debug.txt b/runtime/doc/debug.txt index b03bf1517f..37a5772f42 100644 --- a/runtime/doc/debug.txt +++ b/runtime/doc/debug.txt @@ -78,10 +78,6 @@ matches the EXE (same date). If you built the executable yourself with the Microsoft Visual C++ compiler, then the PDB was built with the EXE. -Alternatively, if you have the source files, you can import Make_ivc.mak into -Visual Studio as a workspace. Then select a debug configuration, build and -you can do all kinds of debugging (set breakpoints, watch variables, etc.). - If you have Visual Studio, use that instead of the VC Toolkit and WinDbg. For other compilers, you should always use the corresponding debugger: TD for diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt index 4b2bd3df7c..0c276fa830 100644 --- a/src/INSTALLpc.txt +++ b/src/INSTALLpc.txt @@ -81,21 +81,11 @@ nmake -f Make_mvc.mak PERL=C:\Perl PYTHON=C:\Python etc. Perl, Python, etc. Make_mvc.mak allows a Vim to be built with various different features and -debug support. Debugging with MS Devstudio is provided by Make_dvc.mak. -For a description of the use of Make_dvc.mak, look in Make_mvc.mak. +debug support. For compiling Gvim with IME support on far-east Windows, add IME=yes to the parameters you pass to Make_mvc.mak. -To build Vim from within the Visual Studio IDE, open the Make_ivc.mak project. -(Note: Make_ivc.mak is not as rich as Make_mvc.mak, which allows for -far more configuration.) Make_ivc.mak can also be built with nmake. - -nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim" - GUI Microsoft Visual C++ 4.x or later -nmake -f Make_ivc.mak CFG="Vim - Win32 Release gvim OLE" - OLE Microsoft Visual C++ 4.x or later - See the specific files for comments and options. These files have been supplied by George V. Reilly, Ben Singer, Ken Scott and diff --git a/src/Make_dvc.mak b/src/Make_dvc.mak deleted file mode 100644 index 46377f07d1..0000000000 --- a/src/Make_dvc.mak +++ /dev/null @@ -1,105 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -!IF "$(CFG)" == "" -CFG=Vim - Win32 IDE for Make_mvc.mak -!MESSAGE No configuration specified. Defaulting to Vim - Win32 IDE for\ - Make_mvc.mak. -!ENDIF - -!IF "$(CFG)" != "Vim - Win32 IDE for Make_mvc.mak" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE on this makefile -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Make_dvc.mak" CFG="Vim - Win32 IDE for Make_mvc.mak" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Vim - Win32 IDE for Make_mvc.mak" (based on\ - "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF -################################################################################ -# Begin Project -# PROP Target_Last_Scanned "Vim - Win32 IDE for Make_mvc.mak" -CPP=cl.exe -RSC=rc.exe -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "" -# PROP Target_Dir "" -OUTDIR=. -INTDIR=. - -ALL : "$(OUTDIR)\vimrun.exe" - -CLEAN : - -@erase ".\vimrun.exe" - -@erase ".\vimrun.obj" - -# ADD CPP /nologo /c -# ADD BASE RSC /l 0x809 -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/Make_dvc.bsc" -BSC32_SBRS= -LINK32=link.exe -# ADD BASE LINK32 /machine:IX86 -# ADD LINK32 /nologo /pdb:none /machine:IX86 /out:"vimrun.exe" -LINK32_FLAGS=/nologo /pdb:none /machine:IX86 /out:"$(OUTDIR)/vimrun.exe" -LINK32_OBJS= \ - "$(INTDIR)/vimrun.obj" - -"$(OUTDIR)\vimrun.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -CPP_PROJ=/nologo /ML /c - -.c.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx.obj: - $(CPP) $(CPP_PROJ) $< - -.c.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx.sbr: - $(CPP) $(CPP_PROJ) $< - -################################################################################ -# Begin Target - -# Name "Vim - Win32 IDE for Make_mvc.mak" -################################################################################ -# Begin Source File - -SOURCE=.\vimrun.c - -"$(INTDIR)\vimrun.obj" : $(SOURCE) "$(INTDIR)" - - -# End Source File -# End Target -# End Project -################################################################################ diff --git a/src/Make_ivc.mak b/src/Make_ivc.mak deleted file mode 100644 index a8b9dffd7b..0000000000 --- a/src/Make_ivc.mak +++ /dev/null @@ -1,778 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00 -# ** DO NOT EDIT ** -# -# Make_ivc.mak Makefile to build vim in both IDE and nmake. -# This file can be imported as a workspace into Visual Studio. It must be in -# DOS fileformat then! -# -# It is worth making the file read-only as the VC4 IDE will try to overwrite -# it with a HUGELY expanded clone of itself. -# -# The following points are worth noting: -# 1) Comments here are ignored by VC[456].0 IDEs -# 2) # ADD LINK32 /pdb:.\Dbg/vimd.pdb is written so rather than -# # ADD LINK32 /pdb:".\Dbg/vimd.pdb" to avoid VC4 -> VC5 conversion failure -# 3) It is good to delete .pdb file before linking to cope with switch among -# VC[456] as IDE clean action does not remove that file and link clashes -# with it. The following works in VC5 but not in VC4 which does not support -# pre-link actions. The nmake action does such deletions. -# Begin Special Build Tool -PreLink_Cmds=@if exist .\oleDbg\gvimd.pdb del .\oleDbg\gvimd.pdb -# End Special Build Tool -# 4) I was unable to make !IFDEF OLE, etc. work in the VC4 IDE. -# I was aiming for 4 configurations with sub-configurations selected by -# environment variables. -# 5) Optimisation is not supported by disabled versions of VC. This results in -# messages for Release builds like: -# Command line warning D4025 : overriding '/O2' with '/Od' -# 6) nmake 1.62 and later support batch compilation. I was unable to use this -# in a manner acceptable to earlier IDEs. -# -# History -# -# When Who What -# 2001-07-06 W.Briscoe Original derived from Make_[go]vc.mak with less noise -# 2001-07-08 W.Briscoe Further noise reduction; consistent .map and .pdb logic -# Added install.exe rule, etc.; Removed unused libraries. -# 2001-08-09 W.Briscoe Restored VC4.0-required trailing space in !MESSAGE afore -# Enhanced if_ole.idl rule to use /out argument. -# Default rules now relative to . to reduce IDE/nmake difs - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -!IF "$(CFG)" == "" -CFG=Vim - Win32 Release gvim OLE -!MESSAGE No configuration specified. Defaulting to Vim - Win32 Release gvim OLE. -!ENDIF - -!IF "$(CFG)" != "Vim - Win32 Release gvim OLE"\ - && "$(CFG)" != "Vim - Win32 Debug gvim OLE"\ - && "$(CFG)" != "Vim - Win32 Release gvim"\ - && "$(CFG)" != "Vim - Win32 Debug gvim"\ - && "$(CFG)" != "Vim - Win32 Release vim"\ - && "$(CFG)" != "Vim - Win32 Debug vim" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE on this makefile -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Make_ivc.mak" CFG="Vim - Win32 Debug vim" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Vim - Win32 Release gvim OLE" (based on "Win32 (x86) Console Application") -!MESSAGE "Vim - Win32 Debug gvim OLE" (based on "Win32 (x86) Console Application") -!MESSAGE "Vim - Win32 Release gvim" (based on "Win32 (x86) Console Application") -!MESSAGE "Vim - Win32 Debug gvim" (based on "Win32 (x86) Console Application") -!MESSAGE "Vim - Win32 Release vim" (based on "Win32 (x86) Console Application") -!MESSAGE "Vim - Win32 Debug vim" (based on "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -DEL_TREE = rmdir /s /q -!ELSE -NULL=nul -DEL_TREE = deltree /y -!ENDIF - -# Begin Project -# PROP Target_Last_Scanned "Vim - Win32 Debug vim" -# PROP Use_MFC 0 - -RSC=rc.exe -CPP=cl.exe -LINK32=link.exe - -CPP_PROJ= /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c -# ADD CPP /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c - -LINK32_FLAGS= oldnames.lib kernel32.lib user32.lib gdi32.lib version.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib netapi32.lib uuid.lib /nologo /machine:I386 /nodefaultlib -# ADD LINK32 oldnames.lib kernel32.lib user32.lib gdi32.lib version.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib uuid.lib /nologo /machine:I386 /nodefaultlib -# SUBTRACT LINK32 /incremental:yes - -RSC_PROJ= /l 0x409 /d "FEAT_GUI_MSWIN" -# ADD RSC /l 0x409 /d "FEAT_GUI_MSWIN" - -!IF "$(CFG)" == "Vim - Win32 Release gvim OLE" - -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir .\oleRel -# PROP Intermediate_Dir .\oleRel - -INTDIR=.\oleRel -VIM=gvim -EXTRAS="$(INTDIR)/if_ole.obj" "$(INTDIR)/vim.res" "$(INTDIR)/gui.obj" "$(INTDIR)/gui_w32.obj" "$(INTDIR)/gui_beval.obj" "$(INTDIR)/os_w32exe.obj" - -CPP_PROJ=$(CPP_PROJ) /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_MSWIN" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleRel/ /Fo.\oleRel/ -# ADD CPP /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_MSWIN" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleRel/ /Fo.\oleRel/ - -RSC_PROJ=$(RSC_PROJ) /I ".\oleRel" /d "NDEBUG" /d "FEAT_OLE" /fo.\oleRel\vim.res -# ADD RSC /I ".\oleRel" /d "NDEBUG" /d "FEAT_OLE" /fo.\oleRel\vim.res - -LINK32_FLAGS=$(LINK32_FLAGS) /pdb:.\oleRel/gvim.pdb -debug:full -debugtype:cv,fixup /map:.\oleDbg\gvim.map libc.lib oleaut32.lib /subsystem:windows /out:.\gvim.exe -# ADD LINK32 /pdb:.\oleRel/gvim.pdb -debug:full -debugtype:cv,fixup /map:.\oleDbg\gvim.map libc.lib oleaut32.lib /subsystem:windows /out:.\gvim.exe - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug gvim OLE" - -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir .\oleDbg -# PROP Intermediate_Dir .\oleDbg - -INTDIR=.\oleDbg -VIM=gvimd -EXTRAS="$(INTDIR)/if_ole.obj" "$(INTDIR)/vim.res" "$(INTDIR)/gui.obj" "$(INTDIR)/gui_w32.obj" "$(INTDIR)/gui_beval.obj" "$(INTDIR)/os_w32exe.obj" - -CPP_PROJ=$(CPP_PROJ) /Zi /Od /D "_DEBUG" /D "FEAT_GUI_MSWIN" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleDbg/ /Fo.\oleDbg/ -# ADD CPP /Zi /Od /D "_DEBUG" /D "FEAT_GUI_MSWIN" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleDbg/ /Fo.\oleDbg/ - -RSC_PROJ=$(RSC_PROJ) /I .\oleDbg /d "_DEBUG" /d "FEAT_OLE" /fo.\oleDbg\vim.res -# ADD RSC /I .\oleDbg /d "_DEBUG" /d "FEAT_OLE" /fo.\oleDbg\vim.res - -LINK32_FLAGS=$(LINK32_FLAGS) libcd.lib oleaut32.lib /subsystem:windows /debug /profile /pdb:.\oleDbg/gvimd.pdb -debug:full -debugtype:cv,fixup /map:.\oleDbg\gvimd.map /out:.\gvimd.exe -# ADD LINK32 libcd.lib oleaut32.lib /subsystem:windows /debug /profile /pdb:.\oleDbg/gvimd.pdb -debug:full -debugtype:cv,fixup /map:.\oleDbg\gvimd.map /out:.\gvimd.exe - - -!ELSEIF "$(CFG)" == "Vim - Win32 Release gvim" - -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir .\gRel -# PROP Intermediate_Dir .\gRel - -INTDIR=.\gRel -VIM=gvim -EXTRAS="$(INTDIR)/vim.res" "$(INTDIR)/gui.obj" "$(INTDIR)/gui_w32.obj" "$(INTDIR)/gui_beval.obj" "$(INTDIR)/os_w32exe.obj" - -CPP_PROJ=$(CPP_PROJ) /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_MSWIN" /Fd.\gRel/ /Fo.\gRel/ -# ADD CPP /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_MSWIN" /Fd.\gRel/ /Fo.\gRel/ - -RSC_PROJ=$(RSC_PROJ) /d "NDEBUG" /fo.\gRel\vim.res -# ADD RSC /d "NDEBUG" /fo.\gRel\vim.res - -LINK32_FLAGS=$(LINK32_FLAGS) /pdb:.\gRel/gvim.pdb -debug:full -debugtype:cv,fixup /map:.\oleDbg\gvim.map libc.lib /subsystem:windows /out:.\gvim.exe -# ADD LINK32 /pdb:.\gRel/gvim.pdb -debug:full -debugtype:cv,fixup /map:.\oleDbg\gvim.map libc.lib /subsystem:windows /out:.\gvim.exe - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug gvim" - -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir .\gDbg -# PROP Intermediate_Dir .\gDbg - -INTDIR=.\gDbg -VIM=gvimd -EXTRAS="$(INTDIR)/vim.res" "$(INTDIR)/gui.obj" "$(INTDIR)/gui_w32.obj" "$(INTDIR)/gui_beval.obj" "$(INTDIR)/os_w32exe.obj" - -CPP_PROJ=$(CPP_PROJ) /Zi /Od /D "_DEBUG" /D "FEAT_GUI_MSWIN" /Fd.\gDbg/ /Fo.\gDbg/ -# ADD CPP /Zi /Od /D "_DEBUG" /D "FEAT_GUI_MSWIN" /Fd.\gDbg/ /Fo.\gDbg/ - -RSC_PROJ=$(RSC_PROJ) /d "_DEBUG" /fo.\gDbg\vim.res -# ADD RSC /d "_DEBUG" /fo.\gDbg\vim.res - -LINK32_FLAGS=$(LINK32_FLAGS) libcd.lib /subsystem:windows /debug /profile /pdb:.\gDbg/gvimd.pdb -debug:full -debugtype:cv,fixup /map:.\gDbg\gvimd.map /out:.\gvimd.exe -# ADD LINK32 libcd.lib /subsystem:windows /debug /profile /pdb:.\gDbg/gvimd.pdb -debug:full -debugtype:cv,fixup /map:.\gDbg\gvimd.map /out:.\gvimd.exe - -!ELSEIF "$(CFG)" == "Vim - Win32 Release vim" - -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir .\Rel -# PROP Intermediate_Dir .\Rel - -INTDIR=.\Rel -VIM=vim -EXTRAS= - -CPP_PROJ=$(CPP_PROJ) /Zi /O2 /D "NDEBUG" /Fd.\Rel/ /Fo.\Rel/ -# ADD CPP /Zi /O2 /D "NDEBUG" /Fd.\Rel/ /Fo.\Rel/ - -LINK32_FLAGS=$(LINK32_FLAGS) /pdb:.\Rel/vim.pdb -debug:full -debugtype:cv,fixup /map:.\oleDbg\vim.map libc.lib /subsystem:console /out:.\vim.exe -# ADD LINK32 /pdb:.\Rel/vim.pdb -debug:full -debugtype:cv,fixup /map:.\oleDbg\vim.map libc.lib /subsystem:console /out:.\vim.exe - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug vim" - -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir .\Dbg -# PROP Intermediate_Dir .\Dbg - -INTDIR=.\Dbg -VIM=vimd -EXTRAS= - -CPP_PROJ=$(CPP_PROJ) /Zi /Od /D "_DEBUG" /Fd.\Dbg/ /Fo.\Dbg/ -# ADD CPP /Zi /Od /D "_DEBUG" /Fd.\Dbg/ /Fo.\Dbg/ - -LINK32_FLAGS=$(LINK32_FLAGS) libcd.lib /subsystem:console /debug /profile /pdb:.\Dbg/vimd.pdb -debug:full -debugtype:cv,fixup /map:.\Dbg/vimd.map /out:.\vimd.exe -# ADD LINK32 libcd.lib /subsystem:console /debug /profile /pdb:.\Dbg/vimd.pdb -debug:full -debugtype:cv,fixup /map:.\Dbg/vimd.map /out:.\vimd.exe - -!ENDIF - -ALL : .\$(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe GvimExt/gvimext.dll - -LINK32_OBJS= \ - $(EXTRAS) \ - "$(INTDIR)/arabic.obj" \ - "$(INTDIR)/autocmd.obj" \ - "$(INTDIR)/blowfish.obj" \ - "$(INTDIR)/buffer.obj" \ - "$(INTDIR)/charset.obj" \ - "$(INTDIR)/crypt.obj" \ - "$(INTDIR)/crypt_zip.obj" \ - "$(INTDIR)/debugger.obj" \ - "$(INTDIR)/dict.obj" \ - "$(INTDIR)/diff.obj" \ - "$(INTDIR)/digraph.obj" \ - "$(INTDIR)/edit.obj" \ - "$(INTDIR)/eval.obj" \ - "$(INTDIR)/evalfunc.obj" \ - "$(INTDIR)/ex_cmds.obj" \ - "$(INTDIR)/ex_cmds2.obj" \ - "$(INTDIR)/ex_docmd.obj" \ - "$(INTDIR)/ex_eval.obj" \ - "$(INTDIR)/ex_getln.obj" \ - "$(INTDIR)/fileio.obj" \ - "$(INTDIR)/findfile.obj" \ - "$(INTDIR)/fold.obj" \ - "$(INTDIR)/getchar.obj" \ - "$(INTDIR)/hardcopy.obj" \ - "$(INTDIR)/hashtab.obj" \ - "$(INTDIR)/indent.obj" \ - "$(INTDIR)/insexpand.obj" \ - "$(INTDIR)/json.obj" \ - "$(INTDIR)/list.obj" \ - "$(INTDIR)/main.obj" \ - "$(INTDIR)/mark.obj" \ - "$(INTDIR)/mbyte.obj" \ - "$(INTDIR)/memfile.obj" \ - "$(INTDIR)/memline.obj" \ - "$(INTDIR)/menu.obj" \ - "$(INTDIR)/message.obj" \ - "$(INTDIR)/misc1.obj" \ - "$(INTDIR)/misc2.obj" \ - "$(INTDIR)/move.obj" \ - "$(INTDIR)/normal.obj" \ - "$(INTDIR)/ops.obj" \ - "$(INTDIR)/option.obj" \ - "$(INTDIR)/os_mswin.obj" \ - "$(INTDIR)/winclip.obj" \ - "$(INTDIR)/os_win32.obj" \ - "$(INTDIR)/popupmnu.obj" \ - "$(INTDIR)/quickfix.obj" \ - "$(INTDIR)/regexp.obj" \ - "$(INTDIR)/screen.obj" \ - "$(INTDIR)/search.obj" \ - "$(INTDIR)/sha256.obj" \ - "$(INTDIR)/sign.obj" \ - "$(INTDIR)/spell.obj" \ - "$(INTDIR)/spellfile.obj" \ - "$(INTDIR)/syntax.obj" \ - "$(INTDIR)/tag.obj" \ - "$(INTDIR)/term.obj" \ - "$(INTDIR)/ui.obj" \ - "$(INTDIR)/undo.obj" \ - "$(INTDIR)/usercmd.obj" \ - "$(INTDIR)/userfunc.obj" \ - "$(INTDIR)/version.obj" \ - "$(INTDIR)/window.obj" - -".\$(VIM).exe" : "$(INTDIR)" $(EXTRAS) $(LINK32_OBJS) - @if exist $(INTDIR)\$(VIM).pdb del $(INTDIR)\$(VIM).pdb - $(LINK32) $(LINK32_FLAGS) $(LINK32_OBJS) - -"$(INTDIR)" : - if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" - -CLEAN : - -@if exist "$(INTDIR)/$(NULL)" $(DEL_TREE) "$(INTDIR)" - -@if exist $(VIM).exe erase $(VIM).exe - -@if exist $(VIM).ilk erase $(VIM).ilk - -@if exist $(VIM).map erase $(VIM).map - -@if exist $(VIM).pdb erase $(VIM).pdb - -@if exist DLLDATA.C erase DLLDATA.C - -@if exist Make_ivc.bak attrib -r Make_ivc.bak - -@if exist Make_ivc.bak erase Make_ivc.bak - -@if exist Make_ivc.dsp erase Make_ivc.dsp - -@if exist Make_ivc.dsw erase Make_ivc.dsw - -@if exist Make_ivc.mdp erase Make_ivc.mdp - -@if exist Make_ivc.ncb erase Make_ivc.ncb - -@if exist Make_ivc.opt erase Make_ivc.opt - -@if exist Make_ivc.plg erase Make_ivc.plg - -@if exist dosinst.obj erase dosinst.obj - -@if exist install.exe erase install.exe - -@if exist uninstal.exe erase uninstal.exe - -@if exist uninstal.obj erase uninstal.obj - -@if exist vimrun.exe erase vimrun.exe - -@if exist vimrun.obj erase vimrun.obj - - -install.exe: dosinst.c - $(CPP) /Fe$@ /nologo /W3 -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib user32.lib ole32.lib advapi32.lib uuid.lib - -uninstal.exe: uninstal.c - $(CPP) /nologo /W3 -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib - -vimrun.exe: vimrun.c - $(CPP) /nologo /W3 -DNDEBUG vimrun.c - -xxd/xxd.exe: xxd/xxd.c - cd xxd - $(MAKE) /NOLOGO -f Make_mvc.mak - cd .. - -GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h - cd GvimExt - $(MAKE) /NOLOGO -f Makefile - cd .. - -{.}.c{$(INTDIR)/}.obj: - $(CPP) $(CPP_PROJ) $< - -{.}.cpp{$(INTDIR)/}.obj: - $(CPP) $(CPP_PROJ) /I $(INTDIR) $< - -{.}.rc{$(INTDIR)/}.res: - $(RSC) $(RSC_PROJ) $< - -# Begin Target - -# Name "Vim - Win32 Release gvim OLE" -# Name "Vim - Win32 Debug gvim OLE" -# Name "Vim - Win32 Release gvim" -# Name "Vim - Win32 Debug gvim" -# Name "Vim - Win32 Release vim" -# Name "Vim - Win32 Debug vim" - -# Begin Source File - -SOURCE=.\arabic.c -# End Source File -# Begin Source File -# -SOURCE=.\autocmd.c -# End Source File -# Begin Source File - -SOURCE=.\blowfish.c -# End Source File -# Begin Source File - -SOURCE=.\buffer.c -# End Source File -# Begin Source File - -SOURCE=.\charset.c -# End Source File -# Begin Source File - -SOURCE=.\crypt.c -# End Source File -# Begin Source File - -SOURCE=.\crypt_zip.c -# End Source File -# Begin Source File - -SOURCE=.\debugger.c -# End Source File -# Begin Source File - -SOURCE=.\dict.c -# End Source File -# Begin Source File - -SOURCE=.\diff.c -# End Source File -# Begin Source File - -SOURCE=.\digraph.c -# End Source File -# Begin Source File - -SOURCE=.\edit.c -# End Source File -# Begin Source File - -SOURCE=.\eval.c -# End Source File -# Begin Source File - -SOURCE=.\evalfunc.c -# End Source File -# Begin Source File - -SOURCE=.\ex_cmds.c -# End Source File -# Begin Source File - -SOURCE=.\ex_cmds2.c -# End Source File -# Begin Source File - -SOURCE=.\ex_docmd.c -# End Source File -# Begin Source File - -SOURCE=.\ex_eval.c -# End Source File -# Begin Source File - -SOURCE=.\ex_getln.c -# End Source File -# Begin Source File - -SOURCE=.\fileio.c -# End Source File -# Begin Source File -# -SOURCE=.\findfile.c -# End Source File -# Begin Source File - -SOURCE=.\fold.c -# End Source File -# Begin Source File - -SOURCE=.\getchar.c -# End Source File -# Begin Source File - -SOURCE=.\hardcopy.c -# End Source File -# Begin Source File - -SOURCE=.\hashtab.c -# End Source File -# Begin Source File -# -SOURCE=.\indent.c -# End Source File -# Begin Source File -# -SOURCE=.\insexpand.c -# End Source File -# Begin Source File - -SOURCE=.\gui.c - -!IF "$(CFG)" == "Vim - Win32 Release vim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug vim" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\gui_w32.c - -!IF "$(CFG)" == "Vim - Win32 Release vim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug vim" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\gui_beval.c - -!IF "$(CFG)" == "Vim - Win32 Release vim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug vim" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\os_w32exe.c - -!IF "$(CFG)" == "Vim - Win32 Release vim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug vim" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\if_ole.cpp - -!IF "$(CFG)" == "Vim - Win32 Release gvim OLE" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - -"$(INTDIR)\if_ole.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\if_ole.h" - cl.exe /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_MSWIN" /D "FEAT_OLE" /Fd.\oleRel/ /Fo.\oleRel/ /I ".\oleRel" .\if_ole.cpp - @rem This is the default rule with /I "$(IntDir)" added - -# End Custom Build - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug gvim OLE" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - -"$(INTDIR)\if_ole.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\if_ole.h" - cl.exe /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c /Zi /Od /D "_DEBUG" /D "FEAT_GUI_MSWIN" /D "FEAT_OLE" /Fd.\oleDbg/ /Fo.\oleDbg/ /I ".\oleDbg" .\if_ole.cpp - @rem This is the default rule with /I "$(IntDir)" added - -# End Custom Build - -!ELSEIF "$(CFG)" == "Vim - Win32 Release gvim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug gvim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Release vim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug vim" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\if_ole.idl - -!IF "$(CFG)" == "Vim - Win32 Release gvim OLE" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - -"$(INTDIR)\if_ole.h" : $(SOURCE) "$(INTDIR)" - if exist .\if_ole.h del .\if_ole.h - midl /out .\oleRel /iid iid_ole.c /tlb vim.tlb /proxy nul /header if_ole.h .\if_ole.idl - -# End Custom Build - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug gvim OLE" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - -"$(INTDIR)\if_ole.h" : $(SOURCE) "$(INTDIR)" - if exist .\if_ole.h del .\if_ole.h - midl /out .\oleDbg /iid iid_ole.c /tlb vim.tlb /proxy nul /header if_ole.h .\if_ole.idl - -# End Custom Build - -!ELSEIF "$(CFG)" == "Vim - Win32 Release gvim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug gvim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Release vim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug vim" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\json.c -# End Source File -# Begin Source File - -SOURCE=.\list.c -# End Source File -# Begin Source File - -SOURCE=.\main.c -# End Source File -# Begin Source File - -SOURCE=.\mark.c -# End Source File -# Begin Source File - -SOURCE=.\mbyte.c -# End Source File -# Begin Source File - -SOURCE=.\memfile.c -# End Source File -# Begin Source File - -SOURCE=.\memline.c -# End Source File -# Begin Source File - -SOURCE=.\menu.c -# End Source File -# Begin Source File - -SOURCE=.\message.c -# End Source File -# Begin Source File - -SOURCE=.\misc1.c -# End Source File -# Begin Source File - -SOURCE=.\misc2.c -# End Source File -# Begin Source File - -SOURCE=.\move.c -# End Source File -# Begin Source File - -SOURCE=.\normal.c -# End Source File -# Begin Source File - -SOURCE=.\ops.c -# End Source File -# Begin Source File - -SOURCE=.\option.c -# End Source File -# Begin Source File - -SOURCE=.\os_mswin.c -# End Source File -# Begin Source File - -SOURCE=.\winclip.c -# End Source File -# Begin Source File - -SOURCE=.\os_win32.c -# End Source File -# Begin Source File - -SOURCE=.\popupmnu.c -# End Source File -# Begin Source File - -SOURCE=.\quickfix.c -# End Source File -# Begin Source File - -SOURCE=.\regexp.c -# End Source File -# Begin Source File - -SOURCE=.\screen.c -# End Source File -# Begin Source File - -SOURCE=.\search.c -# End Source File -# Begin Source File - -SOURCE=.\sha256.c -# End Source File -# Begin Source File - -SOURCE=.\sign.c -# End Source File -# Begin Source File - -SOURCE=.\spell.c -# End Source File -# Begin Source File - -SOURCE=.\spellfile.c -# End Source File -# Begin Source File - -SOURCE=.\syntax.c -# End Source File -# Begin Source File - -SOURCE=.\tag.c -# End Source File -# Begin Source File - -SOURCE=.\term.c -# End Source File -# Begin Source File - -SOURCE=.\ui.c -# End Source File -# Begin Source File - -SOURCE=.\undo.c -# End Source File -# Begin Source File - -SOURCE=.\usercmd.c -# End Source File -# Begin Source File - -SOURCE=.\userfunc.c -# End Source File -# Begin Source File - -SOURCE=.\version.c -# End Source File -# Begin Source File - -SOURCE=.\vim.rc - -!IF "$(CFG)" == "Vim - Win32 Release gvim OLE" - -"$(INTDIR)\vim.res" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\if_ole.h" - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug gvim OLE" - -"$(INTDIR)\vim.res" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\if_ole.h" - -!ELSEIF "$(CFG)" == "Vim - Win32 Release gvim" - -"$(INTDIR)\vim.res" : $(SOURCE) "$(INTDIR)" - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug gvim" - -"$(INTDIR)\vim.res" : $(SOURCE) "$(INTDIR)" - -!ELSEIF "$(CFG)" == "Vim - Win32 Release vim" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "Vim - Win32 Debug vim" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\window.c -# End Source File -# End Target -# End Project diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 2bbbb47829..44be242e3c 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -143,37 +143,6 @@ # # Example: To build the non-debug, GUI version with Perl interface: # nmake -f Make_mvc.mak GUI=yes PERL=C:\Perl -# -# DEBUG with Make_mvc.mak and Make_dvc.mak: -# This makefile gives a fineness of control which is not supported in -# Visual C++ configuration files. Therefore, debugging requires a bit of -# extra work. -# Make_dvc.mak is a Visual C++ project to access that support. It may be -# badly out of date for the Visual C++ you are using... -# To use Make_dvc.mak: -# 1) Build Vim with Make_mvc.mak. -# Use a "DEBUG=yes" argument to build Vim with debug support. -# E.g. the following builds gvimd.exe: -# nmake -f Make_mvc.mak debug=yes gui=yes -# 2) Use MS Devstudio and set it up to allow that file to be debugged: -# i) Pass Make_dvc.mak to the IDE. -# Use the "open workspace" menu entry to load Make_dvc.mak. -# Alternatively, from the command line: -# msdev /nologo Make_dvc.mak -# Note: Make_dvc.mak is in VC4.0 format. Later VC versions see -# this and offer to convert it to their own format. Accept that. -# It creates a file called Make_dvc.dsw which can then be used -# for further operations. E.g. -# msdev /nologo Make_dvc.dsw -# ii) Set the built executable for debugging: -# a) Alt+F7/Debug takes you to the Debug dialog. -# b) Fill "Executable for debug session". e.g. gvimd.exe -# c) Fill "Program arguments". e.g. -R dosinst.c -# d) Complete the dialog -# 3) You can now debug the executable you built with Make_mvc.mak -# -# Note: Make_dvc.mak builds vimrun.exe, because it must build something -# to be a valid makefile.. ### See feature.h for a list of optionals. # If you want to build some optional features without modifying the source, diff --git a/src/version.c b/src/version.c index 5eeec1ce10..21292fe26b 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1293, /**/ 1292, /**/ From 93d77b2cbec08518ee426d0c44c50cf505732443 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 May 2019 22:52:50 +0200 Subject: [PATCH 24/97] patch 8.1.1294: MS-Windows: Some fonts return wrong average char width Problem: MS-Windows: Some fonts return wrong average char width. Solution: Compute the average ourselves. (Ken Takata, closes #4356) --- src/gui_w32.c | 8 +++++++- src/version.c | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui_w32.c b/src/gui_w32.c index 3914733d78..7bea58e97c 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -1455,10 +1455,16 @@ GetFontSize(GuiFont font) HWND hwnd = GetDesktopWindow(); HDC hdc = GetWindowDC(hwnd); HFONT hfntOld = SelectFont(hdc, (HFONT)font); + SIZE size; TEXTMETRIC tm; GetTextMetrics(hdc, &tm); - gui.char_width = tm.tmAveCharWidth + tm.tmOverhang; + // GetTextMetrics() may not return the right value in tmAveCharWidth + // for some fonts. Do our own average computation. + GetTextExtentPoint(hdc, + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", + 52, &size); + gui.char_width = (size.cx / 26 + 1) / 2 + tm.tmOverhang; gui.char_height = tm.tmHeight + p_linespace; diff --git a/src/version.c b/src/version.c index 21292fe26b..06a7a5f687 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1294, /**/ 1293, /**/ From 98ffe4c6d8bded840436cfec0f26dd9c9bce4939 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 May 2019 23:01:39 +0200 Subject: [PATCH 25/97] patch 8.1.1295: when vimrun.exe does not exist external command may fail Problem: When vimrun.exe does not exist external command may fail. Solution: Use "cmd /c" twice to get the same behavior. (Ken Takata, closes #4355) --- src/os_win32.c | 19 ++++++++++++++++--- src/version.c | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/os_win32.c b/src/os_win32.c index 537af4675f..cbb09af5ff 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -4827,11 +4827,14 @@ mch_call_shell( } else { - cmdlen = ( + cmdlen = #ifdef FEAT_GUI_MSWIN - (gui.in_use ? (!p_stmp ? 0 : STRLEN(vimrun_path)) : 0) + + (gui.in_use ? + (!s_dont_use_vimrun && p_stmp ? + STRLEN(vimrun_path) : STRLEN(p_sh) + STRLEN(p_shcf)) + : 0) + #endif - STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10); + STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10; newcmd = lalloc(cmdlen, TRUE); if (newcmd != NULL) @@ -4869,9 +4872,19 @@ mch_call_shell( ? "-s " : "", p_sh, p_shcf, cmd); else +# ifdef VIMDLL + if (gui.in_use) +# endif + vim_snprintf((char *)newcmd, cmdlen, "%s %s %s %s %s", + p_sh, p_shcf, p_sh, p_shcf, cmd); +# ifdef VIMDLL + else +# endif #endif +#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) vim_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd); +#endif x = mch_system((char *)newcmd, options); vim_free(newcmd); } diff --git a/src/version.c b/src/version.c index 06a7a5f687..32066b4f61 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1295, /**/ 1294, /**/ From 27821260c0afaac85cb1c10627f1d7fbe48860ae Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 8 May 2019 16:41:09 +0200 Subject: [PATCH 26/97] patch 8.1.1296: crash when using invalid command line argument Problem: Crash when using invalid command line argument. Solution: Check for options not being initialized. --- src/term.c | 8 ++++---- src/testdir/test_startup.vim | 37 +++++++++++++++++------------------- src/version.c | 2 ++ 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/term.c b/src/term.c index bcc3dd3872..462fe6f981 100644 --- a/src/term.c +++ b/src/term.c @@ -3014,13 +3014,13 @@ term_settitle(char_u *title) void term_push_title(int which) { - if ((which & SAVE_RESTORE_TITLE) && *T_CST != NUL) + if ((which & SAVE_RESTORE_TITLE) && T_CST != NULL && *T_CST != NUL) { OUT_STR(T_CST); out_flush(); } - if ((which & SAVE_RESTORE_ICON) && *T_SSI != NUL) + if ((which & SAVE_RESTORE_ICON) && T_SSI != NULL && *T_SSI != NUL) { OUT_STR(T_SSI); out_flush(); @@ -3033,13 +3033,13 @@ term_push_title(int which) void term_pop_title(int which) { - if ((which & SAVE_RESTORE_TITLE) && *T_CRT != NUL) + if ((which & SAVE_RESTORE_TITLE) && T_CRT != NULL && *T_CRT != NUL) { OUT_STR(T_CRT); out_flush(); } - if ((which & SAVE_RESTORE_ICON) && *T_SRI != NUL) + if ((which & SAVE_RESTORE_ICON) && T_SRI != NULL && *T_SRI != NUL) { OUT_STR(T_SRI); out_flush(); diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim index dec485b138..a45130f7a7 100644 --- a/src/testdir/test_startup.vim +++ b/src/testdir/test_startup.vim @@ -408,12 +408,11 @@ func Test_invalid_args() endfor if has('clientserver') - " FIXME: need to add --servername to this list - " but it causes vim-8.1.1282 to crash! for opt in ['--remote', '--remote-send', '--remote-silent', '--remote-expr', \ '--remote-tab', '--remote-tab-wait', \ '--remote-tab-wait-silent', '--remote-tab-silent', \ '--remote-wait', '--remote-wait-silent', + \ '--servername', \ ] let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") call assert_equal(1, v:shell_error) @@ -423,14 +422,13 @@ func Test_invalid_args() endfor endif - " FIXME: commented out as this causes vim-8.1.1282 to crash! - "if has('clipboard') - " let out = split(system(GetVimCommand() .. ' --display'), "\n") - " call assert_equal(1, v:shell_error) - " call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) - " call assert_equal('Argument missing after: "--display"', out[1]) - " call assert_equal('More info with: "vim -h"', out[2]) - "endif + if has('clipboard') + let out = split(system(GetVimCommand() .. ' --display'), "\n") + call assert_equal(1, v:shell_error) + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Argument missing after: "--display"', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + endif let out = split(system(GetVimCommand() .. ' -ix'), "\n") call assert_equal(1, v:shell_error) @@ -463,16 +461,15 @@ func Test_invalid_args() call assert_equal('More info with: "vim -h"', out[2]) endfor - " FIXME: commented out as this causes vim-8.1.1282 to crash! - "if has('gui_gtk') - " for opt in ['--socketid x', '--socketid 0xg'] - " let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") - " call assert_equal(1, v:shell_error) - " call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) - " call assert_equal('Invalid argument for: "--socketid"', out[1]) - " call assert_equal('More info with: "vim -h"', out[2]) - " endfor - "endif + if has('gui_gtk') + for opt in ['--socketid x', '--socketid 0xg'] + let out = split(system(GetVimCommand() .. ' ' .. opt), "\n") + call assert_equal(1, v:shell_error) + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Invalid argument for: "--socketid"', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + endfor + endif endfunc func Test_file_args() diff --git a/src/version.c b/src/version.c index 32066b4f61..8e6b404f8b 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1296, /**/ 1295, /**/ From 240f7abab01b5e3fd5336dd780e42501ec3f2fcb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 8 May 2019 17:58:15 +0200 Subject: [PATCH 27/97] patch 8.1.1297: invalid argument test fails without GTK Problem: Invalid argument test fails without GTK. Solution: Test -display and --display separately. --- src/testdir/test_startup.vim | 10 +++++++++- src/version.c | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim index a45130f7a7..61c508275c 100644 --- a/src/testdir/test_startup.vim +++ b/src/testdir/test_startup.vim @@ -422,7 +422,7 @@ func Test_invalid_args() endfor endif - if has('clipboard') + if has('gui_gtk') let out = split(system(GetVimCommand() .. ' --display'), "\n") call assert_equal(1, v:shell_error) call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) @@ -430,6 +430,14 @@ func Test_invalid_args() call assert_equal('More info with: "vim -h"', out[2]) endif + if has('clipboard') + let out = split(system(GetVimCommand() .. ' -display'), "\n") + call assert_equal(1, v:shell_error) + call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) + call assert_equal('Argument missing after: "-display"', out[1]) + call assert_equal('More info with: "vim -h"', out[2]) + endif + let out = split(system(GetVimCommand() .. ' -ix'), "\n") call assert_equal(1, v:shell_error) call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) diff --git a/src/version.c b/src/version.c index 8e6b404f8b..da0d1dfabb 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1297, /**/ 1296, /**/ From 5416b75031138182387399f8fe5e17a884414e1a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 8 May 2019 18:36:43 +0200 Subject: [PATCH 28/97] patch 8.1.1298: invalid argument test fails without X clipboard Problem: Invalid argument test fails without X clipboard. Solution: Test -display only with the +xterm_clipboard feature. --- src/testdir/test_startup.vim | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim index 61c508275c..8f494a8507 100644 --- a/src/testdir/test_startup.vim +++ b/src/testdir/test_startup.vim @@ -430,7 +430,7 @@ func Test_invalid_args() call assert_equal('More info with: "vim -h"', out[2]) endif - if has('clipboard') + if has('xterm_clipboard') let out = split(system(GetVimCommand() .. ' -display'), "\n") call assert_equal(1, v:shell_error) call assert_match('^VIM - Vi IMproved .* (.*)$', out[0]) diff --git a/src/version.c b/src/version.c index da0d1dfabb..90f9e87bf9 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1298, /**/ 1297, /**/ From a5c6a0b6c71ae11078cbf6f5e18ce49a0468a117 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 8 May 2019 20:20:46 +0200 Subject: [PATCH 29/97] patch 8.1.1299: "extends" from 'listchars' is used when 'list' is off Problem: "extends" from 'listchars' is used when 'list' is off. (Hiroyuki Yoshinaga) Solution: Only use the "extends" character when 'list' is on. (Hirohito Higashi, closes #4360) --- src/screen.c | 6 ++++-- src/testdir/test_listchars.vim | 19 +++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/screen.c b/src/screen.c index eb81bee84a..e56d2bc018 100644 --- a/src/screen.c +++ b/src/screen.c @@ -5594,8 +5594,10 @@ win_line( break; } - /* line continues beyond line end */ - if (lcs_ext + // Show "extends" character from 'listchars' if beyond the line end and + // 'list' is set. + if (lcs_ext != NUL + && wp->w_p_list && !wp->w_p_wrap #ifdef FEAT_DIFF && filler_todo <= 0 diff --git a/src/testdir/test_listchars.vim b/src/testdir/test_listchars.vim index 3eef75d289..5df5010396 100644 --- a/src/testdir/test_listchars.vim +++ b/src/testdir/test_listchars.vim @@ -110,6 +110,25 @@ func Test_listchars() call cursor(1, 1) call assert_equal([expected], ScreenLines(1, virtcol('$'))) + " test extends + normal ggdG + set listchars=extends:Z + set nowrap + set nolist + call append(0, [ repeat('A', &columns + 1) ]) + + let expected = repeat('A', &columns) + + redraw! + call cursor(1, 1) + call assert_equal([expected], ScreenLines(1, &columns)) + + set list + let expected = expected[:-2] . 'Z' + redraw! + call cursor(1, 1) + call assert_equal([expected], ScreenLines(1, &columns)) + enew! set listchars& ff& endfunc diff --git a/src/version.c b/src/version.c index 90f9e87bf9..1ea47db720 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1299, /**/ 1298, /**/ From 2f10658b06bbdd8f25c4ff152266c808234cee0a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 8 May 2019 21:59:25 +0200 Subject: [PATCH 30/97] patch 8.1.1300: in a terminal 'ballooneval' does not work right away Problem: In a terminal 'ballooneval' does not work right away. Solution: Flush output after drawing the balloon. Add the key code. Add a test. --- src/ex_cmds2.c | 7 ++++ src/misc2.c | 1 + src/testdir/Make_all.mak | 2 ++ .../dumps/Test_balloon_eval_term_01.dump | 10 ++++++ src/testdir/test_balloon.vim | 32 +++++++++++++++++++ src/version.c | 2 ++ 6 files changed, 54 insertions(+) create mode 100644 src/testdir/dumps/Test_balloon_eval_term_01.dump create mode 100644 src/testdir/test_balloon.vim diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 07e664867a..1e9d18e833 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -229,6 +229,9 @@ profile_zero(proftime_T *tm) static timer_T *first_timer = NULL; static long last_timer_id = 0; +/* + * Return time left until "due". Negative if past "due". + */ long proftime_time_left(proftime_T *due, proftime_T *now) { @@ -445,7 +448,11 @@ check_due_timer(void) balloonEvalForTerm = TRUE; } if (balloonEval != NULL) + { general_beval_cb(balloonEval, 0); + setcursor(); + out_flush(); + } } else if (next_due == -1 || next_due > this_due) next_due = this_due; diff --git a/src/misc2.c b/src/misc2.c index e615f96b50..3ef7c94222 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -2496,6 +2496,7 @@ static struct key_name_entry #endif {K_PLUG, (char_u *)"Plug"}, {K_CURSORHOLD, (char_u *)"CursorHold"}, + {K_IGNORE, (char_u *)"Ignore"}, {0, NULL} /* NOTE: When adding a long name update MAX_KEY_NAME_LEN. */ }; diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 2bda742768..6b966e6fe8 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -68,6 +68,7 @@ NEW_TESTS = \ test_autoload \ test_backspace_opt \ test_backup \ + test_balloon \ test_behave \ test_blob \ test_blockedit \ @@ -294,6 +295,7 @@ NEW_TESTS_RES = \ test_autocmd.res \ test_autoload.res \ test_backspace_opt.res \ + test_balloon.res \ test_blob.res \ test_blockedit.res \ test_breakindent.res \ diff --git a/src/testdir/dumps/Test_balloon_eval_term_01.dump b/src/testdir/dumps/Test_balloon_eval_term_01.dump new file mode 100644 index 0000000000..20a7197a7b --- /dev/null +++ b/src/testdir/dumps/Test_balloon_eval_term_01.dump @@ -0,0 +1,10 @@ +>o+0&#ffffff0|n|e| |o|n|e| |o|n|e| @38 +@2|o| |t|X|o| |t|w|o| @38 +|t|h|r|e| +0#0000001#ffd7ff255@16| +0#0000000#ffffff0@28 +|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6| | +0#4040ff13#ffffff0@28 +|~| @2| +0#0000001#ffd7ff255@16| +0#4040ff13#ffffff0@28 +|~| @48 +|~| @48 +|~| @48 +|~| @48 +| +0#0000000&@31|1|,|1| @10|A|l@1| diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim new file mode 100644 index 0000000000..e5187557a2 --- /dev/null +++ b/src/testdir/test_balloon.vim @@ -0,0 +1,32 @@ +" Tests for 'balloonevalterm'. + +if !has('balloon_eval_term') || has('gui_running') + finish +endif + +source screendump.vim +if !CanRunVimInTerminal() + finish +endif + +func Test_balloon_eval_term() + call writefile([ + \ 'call setline(1, ["one one one", "two tXo two", "three three three"])', + \ 'set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100', + \ 'func MyBalloonExpr()', + \ ' return "line " . v:beval_lnum . " column " . v:beval_col', + \ 'endfun', + \ 'redraw', + \ 'call test_setmouse(2, 6)', + \ 'call feedkeys("\\", "xt")', + \ ], 'XTest_beval') + + " Check that the balloon shows up + let buf = RunVimInTerminal('-S XTest_beval', {'rows': 10, 'cols': 50}) + call term_wait(buf, 100) + call VerifyScreenDump(buf, 'Test_balloon_eval_term_01', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('XTest_beval') +endfunc diff --git a/src/version.c b/src/version.c index 1ea47db720..7905cdac19 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1300, /**/ 1299, /**/ From 0b75f7c97cd7f2529884c48dca8edb02abda4bc5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 8 May 2019 22:28:46 +0200 Subject: [PATCH 31/97] patch 8.1.1301: when compiled with VIMDLL some messages are not shown Problem: When compiled with VIMDLL some messages are not shown. Solution: Set/reset gui.in_use and gui.starting as needed. (Ken Takata, closes #4361) --- src/gui_w32.c | 4 ++++ src/main.c | 10 ++++++++++ src/message.c | 4 ++-- src/version.c | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gui_w32.c b/src/gui_w32.c index 7bea58e97c..69212ebb75 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -4827,6 +4827,10 @@ ole_error(char *arg) { char buf[IOSIZE]; +# ifdef VIMDLL + gui.in_use = mch_is_gui_executable(); +# endif + /* Can't use emsg() here, we have not finished initialisation yet. */ vim_snprintf(buf, IOSIZE, _("E243: Argument not supported: \"-%s\"; Use the OLE version."), diff --git a/src/main.c b/src/main.c index a57b196cf7..6d30143a3c 100644 --- a/src/main.c +++ b/src/main.c @@ -178,6 +178,8 @@ main #ifdef VIMDLL // Check if the current executable file is for the GUI subsystem. gui.starting = mch_is_gui_executable(); +#elif defined(FEAT_GUI_MSWIN) + gui.starting = TRUE; #endif #ifdef FEAT_CLIENTSERVER @@ -3242,6 +3244,14 @@ mainerr( reset_signals(); /* kill us with CTRL-C here, if you like */ #endif + // If this is a Windows GUI executable, show an error dialog box. +#ifdef VIMDLL + gui.in_use = mch_is_gui_executable(); +#endif +#ifdef FEAT_GUI_MSWIN + gui.starting = FALSE; // Needed to show as error. +#endif + init_longVersion(); mch_errmsg(longVersion); mch_errmsg("\n"); diff --git a/src/message.c b/src/message.c index 038ccd640f..7c256585dc 100644 --- a/src/message.c +++ b/src/message.c @@ -2977,7 +2977,7 @@ mch_errmsg(char *str) int len; #endif -#if (defined(UNIX) || defined(FEAT_GUI)) && (!defined(ALWAYS_USE_GUI) || !defined(VIMDLL)) +#if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) /* On Unix use stderr if it's a tty. * When not going to start the GUI also use stderr. * On Mac, when started from Finder, stderr is the console. */ @@ -3080,7 +3080,7 @@ mch_msg_c(char *str) void mch_msg(char *str) { -#if (defined(UNIX) || defined(FEAT_GUI)) && (!defined(ALWAYS_USE_GUI) || !defined(VIMDLL)) +#if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) /* On Unix use stdout if we have a tty. This allows "vim -h | more" and * uses mch_errmsg() when started from the desktop. * When not going to start the GUI also use stdout. diff --git a/src/version.c b/src/version.c index 7905cdac19..6f6456b214 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1301, /**/ 1300, /**/ From 06bd824869b1cb7a85e64ec94135a35698be5b7f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 8 May 2019 22:55:16 +0200 Subject: [PATCH 32/97] patch 8.1.1302: v:beval_text is not tested in Visual mode Problem: v:beval_text is not tested in Visual mode. Solution: Add a screenshot of the balloon in Visual mode. --- src/normal.c | 4 +-- .../dumps/Test_balloon_eval_term_01.dump | 6 ++-- .../dumps/Test_balloon_eval_term_02.dump | 10 ++++++ src/testdir/test_balloon.vim | 31 ++++++++++++++++--- src/version.c | 2 ++ 5 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 src/testdir/dumps/Test_balloon_eval_term_02.dump diff --git a/src/normal.c b/src/normal.c index 06595e98c5..8d4cf09379 100644 --- a/src/normal.c +++ b/src/normal.c @@ -2326,10 +2326,10 @@ do_mouse( if (c == K_MOUSEMOVE) { - /* Mouse moved without a button pressed. */ + // Mouse moved without a button pressed. #ifdef FEAT_BEVAL_TERM ui_may_remove_balloon(); - if (p_bevalterm && !VIsual_active) + if (p_bevalterm) { profile_setlimit(p_bdlay, &bevalexpr_due); bevalexpr_due_set = TRUE; diff --git a/src/testdir/dumps/Test_balloon_eval_term_01.dump b/src/testdir/dumps/Test_balloon_eval_term_01.dump index 20a7197a7b..4ffeb8f118 100644 --- a/src/testdir/dumps/Test_balloon_eval_term_01.dump +++ b/src/testdir/dumps/Test_balloon_eval_term_01.dump @@ -1,8 +1,8 @@ >o+0&#ffffff0|n|e| |o|n|e| |o|n|e| @38 @2|o| |t|X|o| |t|w|o| @38 -|t|h|r|e| +0#0000001#ffd7ff255@16| +0#0000000#ffffff0@28 -|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6| | +0#4040ff13#ffffff0@28 -|~| @2| +0#0000001#ffd7ff255@16| +0#4040ff13#ffffff0@28 +|t|h|r|e| +0#0000001#ffd7ff255@21| +0#0000000#ffffff0@23 +|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6|:| |t|X|o| | +0#4040ff13#ffffff0@23 +|~| @2| +0#0000001#ffd7ff255@21| +0#4040ff13#ffffff0@23 |~| @48 |~| @48 |~| @48 diff --git a/src/testdir/dumps/Test_balloon_eval_term_02.dump b/src/testdir/dumps/Test_balloon_eval_term_02.dump new file mode 100644 index 0000000000..4f4b788444 --- /dev/null +++ b/src/testdir/dumps/Test_balloon_eval_term_02.dump @@ -0,0 +1,10 @@ +|o+0&#ffffff0|n|e| |o|n|e| |o|n|e| @38 +@2|o| |t|X|o| |t|w|o| @38 +|t|h|r|e|e+0&#e0e0e08| |t|h>r+0&#ffffff0|e@1| |t|h|r|e@1| @32 +|~+0#4040ff13&| @2| +0#0000001#ffd7ff255@23| +0#4040ff13#ffffff0@21 +|~| @2| +0#0000001#ffd7ff255|l|i|n|e| |3| |c|o|l|u|m|n| |5|:| |e| |t|h|r| | +0#4040ff13#ffffff0@21 +|~| @2| +0#0000001#ffd7ff255@23| +0#4040ff13#ffffff0@21 +|~| @48 +|~| @48 +|~| @48 +|-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@9|5| @8|3|,|9| @10|A|l@1| diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim index e5187557a2..966587c312 100644 --- a/src/testdir/test_balloon.vim +++ b/src/testdir/test_balloon.vim @@ -9,19 +9,24 @@ if !CanRunVimInTerminal() finish endif -func Test_balloon_eval_term() - call writefile([ +let s:common_script = [ \ 'call setline(1, ["one one one", "two tXo two", "three three three"])', \ 'set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100', \ 'func MyBalloonExpr()', - \ ' return "line " . v:beval_lnum . " column " . v:beval_col', + \ ' return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text', \ 'endfun', \ 'redraw', + \ ] + +func Test_balloon_eval_term() + " Use after to return from vgetc() without removing + " the balloon. + call writefile(s:common_script + [ \ 'call test_setmouse(2, 6)', \ 'call feedkeys("\\", "xt")', \ ], 'XTest_beval') - " Check that the balloon shows up + " Check that the balloon shows up after a mouse move let buf = RunVimInTerminal('-S XTest_beval', {'rows': 10, 'cols': 50}) call term_wait(buf, 100) call VerifyScreenDump(buf, 'Test_balloon_eval_term_01', {}) @@ -30,3 +35,21 @@ func Test_balloon_eval_term() call StopVimInTerminal(buf) call delete('XTest_beval') endfunc + +func Test_balloon_eval_term_visual() + " Use after to return from vgetc() without removing + " the balloon. + call writefile(s:common_script + [ + \ 'call test_setmouse(3, 6)', + \ 'call feedkeys("3Gevfr\\", "xt")', + \ ], 'XTest_beval_visual') + + " Check that the balloon shows up after a mouse move + let buf = RunVimInTerminal('-S XTest_beval_visual', {'rows': 10, 'cols': 50}) + call term_wait(buf, 100) + call VerifyScreenDump(buf, 'Test_balloon_eval_term_02', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('XTest_beval_visual') +endfunc diff --git a/src/version.c b/src/version.c index 6f6456b214..96c72faa27 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1302, /**/ 1301, /**/ From be0a2597ae0d9eb0b8a8a2fc9ae1784faa929844 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 13:50:16 +0200 Subject: [PATCH 33/97] patch 8.1.1303: not possible to hide a balloon Problem: Not possible to hide a balloon. Solution: Hide the balloon when balloon_show() is called with an empty string or list. Add balloon_gettext(). --- runtime/doc/eval.txt | 10 +++++++++- src/beval.h | 2 +- src/evalfunc.c | 31 +++++++++++++++++++++++++++++-- src/gui_beval.c | 10 +++++++--- src/gui_w32.c | 9 +++++++++ src/popupmnu.c | 3 +++ src/testdir/test_balloon.vim | 26 +++++++++++++++++++++++--- src/version.c | 2 ++ 8 files changed, 83 insertions(+), 10 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 84001b7a02..15732d6504 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2226,6 +2226,7 @@ assert_true({actual} [, {msg}]) Number assert {actual} is true asin({expr}) Float arc sine of {expr} atan({expr}) Float arc tangent of {expr} atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2} +balloon_gettext() String current text in the balloon balloon_show({expr}) none show {expr} inside the balloon balloon_split({msg}) List split {msg} as used for a balloon browse({save}, {title}, {initdir}, {default}) @@ -3007,15 +3008,20 @@ atan2({expr1}, {expr2}) *atan2()* < 2.356194 {only available when compiled with the |+float| feature} +balloon_gettext() *balloon_gettext()* + Return the current text in the balloon. Only for the string, + not used for the List. + balloon_show({expr}) *balloon_show()* Show {expr} inside the balloon. For the GUI {expr} is used as a string. For a terminal {expr} can be a list, which contains the lines of the balloon. If {expr} is not a list it will be split with |balloon_split()|. + If {expr} is an empty string any existing balloon is removed. Example: > func GetBalloonContent() - " initiate getting the content + " ... initiate getting the content return '' endfunc set balloonexpr=GetBalloonContent() @@ -4229,6 +4235,8 @@ feedkeys({string} [, {mode}]) *feedkeys()* and "\..." notation |expr-quote|. For example, feedkeys("\") simulates pressing of the key. But feedkeys('\') pushes 5 characters. + A special code that might be useful is , it exits the + wait for a character without doing anything. ** {mode} is a String, which can contain these character flags: 'm' Remap keys. This is default. If {mode} is absent, diff --git a/src/beval.h b/src/beval.h index 090c5fb55c..60cf1ab9dc 100644 --- a/src/beval.h +++ b/src/beval.h @@ -75,7 +75,7 @@ typedef struct BalloonEvalStruct #ifdef FEAT_VARTABS int *vts; // vartabstop setting for this buffer #endif - char_u *msg; + char_u *msg; // allocated: current text #ifdef FEAT_GUI_MSWIN void *tofree; #endif diff --git a/src/evalfunc.c b/src/evalfunc.c index ca412f7549..eaefccf620 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -63,6 +63,7 @@ static void f_atan(typval_T *argvars, typval_T *rettv); static void f_atan2(typval_T *argvars, typval_T *rettv); #endif #ifdef FEAT_BEVAL +static void f_balloon_gettext(typval_T *argvars, typval_T *rettv); static void f_balloon_show(typval_T *argvars, typval_T *rettv); # if defined(FEAT_BEVAL_TERM) static void f_balloon_split(typval_T *argvars, typval_T *rettv); @@ -552,6 +553,7 @@ static struct fst {"atan2", 2, 2, f_atan2}, #endif #ifdef FEAT_BEVAL + {"balloon_gettext", 0, 0, f_balloon_gettext}, {"balloon_show", 1, 1, f_balloon_show}, # if defined(FEAT_BEVAL_TERM) {"balloon_split", 1, 1, f_balloon_split}, @@ -1763,6 +1765,19 @@ f_atan2(typval_T *argvars, typval_T *rettv) * "balloon_show()" function */ #ifdef FEAT_BEVAL + static void +f_balloon_gettext(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + if (balloonEval != NULL) + { + if (balloonEval->msg == NULL) + rettv->vval.v_string = NULL; + else + rettv->vval.v_string = vim_strsave(balloonEval->msg); + } +} + static void f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED) { @@ -1773,9 +1788,21 @@ f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED) && !gui.in_use # endif ) - post_balloon(balloonEval, NULL, argvars[0].vval.v_list); + { + list_T *l = argvars[0].vval.v_list; + + // empty list removes the balloon + post_balloon(balloonEval, NULL, + l == NULL || l->lv_len == 0 ? NULL : l); + } else - post_balloon(balloonEval, tv_get_string_chk(&argvars[0]), NULL); + { + char_u *mesg = tv_get_string_chk(&argvars[0]); + + if (mesg != NULL) + // empty string removes the balloon + post_balloon(balloonEval, *mesg == NUL ? NULL : mesg, NULL); + } } } diff --git a/src/gui_beval.c b/src/gui_beval.c index e1e093f375..f4309b8c33 100644 --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -117,7 +117,8 @@ gui_mch_create_beval_area( beval->appContext = XtWidgetToApplicationContext((Widget)target); #endif beval->showState = ShS_NEUTRAL; - beval->msg = mesg; + vim_free(beval->msg); + beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); beval->msgCB = mesgCB; beval->clientData = clientData; @@ -208,8 +209,9 @@ gui_mch_currently_showing_beval(void) void gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) { - beval->msg = mesg; - if (mesg != NULL) + vim_free(beval->msg); + beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); + if (beval->msg != NULL) drawBalloon(beval); else undrawBalloon(beval); @@ -225,6 +227,7 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) void gui_mch_unpost_balloon(BalloonEval *beval) { + VIM_CLEAR(beval->msg); undrawBalloon(beval); } #endif @@ -975,6 +978,7 @@ drawBalloon(BalloonEval *beval) gtk_widget_show(beval->balloonShell); beval->showState = ShS_SHOWING; + gui_mch_update(); } } diff --git a/src/gui_w32.c b/src/gui_w32.c index 69212ebb75..8d28148808 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -8506,6 +8506,15 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) { POINT pt; + vim_free(beval->msg); + beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); + if (beval->msg == NULL) + { + delete_tooltip(beval); + beval->showState = ShS_NEUTRAL; + return; + } + // TRACE0("gui_mch_post_balloon {{{"); if (beval->showState == ShS_SHOWING) return; diff --git a/src/popupmnu.c b/src/popupmnu.c index 2639d97d56..0b002f53e3 100644 --- a/src/popupmnu.c +++ b/src/popupmnu.c @@ -1154,7 +1154,10 @@ ui_post_balloon(char_u *mesg, list_T *list) ui_remove_balloon(); if (mesg == NULL && list == NULL) + { + pum_undisplay(); return; + } if (list != NULL) { listitem_T *li; diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim index 966587c312..57d8dcce30 100644 --- a/src/testdir/test_balloon.vim +++ b/src/testdir/test_balloon.vim @@ -1,8 +1,7 @@ " Tests for 'balloonevalterm'. -if !has('balloon_eval_term') || has('gui_running') - finish -endif +" Tests that only work in the terminal. +if has('balloon_eval_term') && !has('gui_running') source screendump.vim if !CanRunVimInTerminal() @@ -53,3 +52,24 @@ func Test_balloon_eval_term_visual() call StopVimInTerminal(buf) call delete('XTest_beval_visual') endfunc + +endif + +" Tests that only work in the GUI +if has('gui_running') + +func Test_balloon_show_gui() + let msg = 'this this this this' + call balloon_show(msg) + call assert_equal(msg, balloon_gettext()) + sleep 10m + call balloon_show('') + + let msg = 'that that' + call balloon_show(msg) + call assert_equal(msg, balloon_gettext()) + sleep 10m + call balloon_show('') +endfunc + +endif diff --git a/src/version.c b/src/version.c index 96c72faa27..8aef9ddaf8 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1303, /**/ 1302, /**/ From 68cbb14bae1013702270b25e886b5ee09e07575a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 14:14:42 +0200 Subject: [PATCH 34/97] patch 8.1.1304: MS-Windows: compiler warning for unused value Problem: MS-Windows: compiler warning for unused value. Solution: Adjust #ifdefs. (Ken Takata, closes #4363) --- src/gui.c | 7 +++++-- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui.c b/src/gui.c index 471202bf47..da7284f937 100644 --- a/src/gui.c +++ b/src/gui.c @@ -69,7 +69,7 @@ gui_start(char_u *arg UNUSED) { char_u *old_term; static int recursive = 0; -#ifdef GUI_MAY_SPAWN +#if defined(GUI_MAY_SPAWN) && defined(EXPERIMENTAL_GUI_CMD) char *msg = NULL; #endif @@ -113,7 +113,10 @@ gui_start(char_u *arg UNUSED) # endif ) { - msg = gui_mch_do_spawn(arg); +# ifdef EXPERIMENTAL_GUI_CMD + msg = +# endif + gui_mch_do_spawn(arg); } else #endif diff --git a/src/version.c b/src/version.c index 8aef9ddaf8..7715410bd8 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1304, /**/ 1303, /**/ From 691ddeefb545d8488e5a495af61caba2e57b3de9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 14:52:41 +0200 Subject: [PATCH 35/97] patch 8.1.1305: there is no easy way to manipulate environment variables Problem: There is no easy way to manipulate environment variables. Solution: Add environ(), getenv() and setenv(). (Yasuhiro Matsumoto, closes #2875) --- runtime/doc/eval.txt | 43 +++++++++++++--- runtime/doc/usr_41.txt | 4 ++ src/evalfunc.c | 97 ++++++++++++++++++++++++++++++++++++ src/testdir/Make_all.mak | 2 + src/testdir/test_environ.vim | 44 ++++++++++++++++ src/version.c | 2 + 6 files changed, 185 insertions(+), 7 deletions(-) create mode 100644 src/testdir/test_environ.vim diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 15732d6504..1ccb9adda6 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1369,6 +1369,13 @@ $VAR environment variable The String value of any environment variable. When it is not defined, the result is an empty string. + +The functions `getenv()` and `setenv()` can also be used and work for +environment variables with non-alphanumeric names. +The function `environ()` can be used to get a Dict with all environment +variables. + + *expr-env-expand* Note that there is a difference between using $VAR directly and using expand("$VAR"). Using it directly will only expand environment variables that @@ -2303,6 +2310,7 @@ did_filetype() Number |TRUE| if FileType autocmd event used diff_filler({lnum}) Number diff filler lines about {lnum} diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col} empty({expr}) Number |TRUE| if {expr} is empty +environ() Dict return environment variables escape({string}, {chars}) String escape {chars} in {string} with '\' eval({string}) any evaluate {string} into its value eventhandler() Number |TRUE| if inside an event handler @@ -2360,6 +2368,7 @@ getcompletion({pat}, {type} [, {filtered}]) List list of cmdline completion matches getcurpos() List position of the cursor getcwd([{winnr} [, {tabnr}]]) String get the current working directory +getenv({name}) String return environment variable getfontname([{name}]) String name of font being used getfperm({fname}) String file permissions of file {fname} getfsize({fname}) Number size in bytes of file {fname} @@ -2568,6 +2577,7 @@ setbufvar({expr}, {varname}, {val}) none set {varname} in buffer {expr} to {val} setcharsearch({dict}) Dict set character search from {dict} setcmdpos({pos}) Number set cursor position in command-line +setenv({name}, {val}) none set environment variable setfperm({fname}, {mode}) Number set {fname} file permissions to {mode} setline({lnum}, {line}) Number set line {lnum} to {line} setloclist({nr}, {list} [, {action} [, {what}]]) @@ -3905,6 +3915,14 @@ diff_hlID({lnum}, {col}) *diff_hlID()* The highlight ID can be used with |synIDattr()| to obtain syntax information about the highlighting. +environ() *environ()* + Return all of environment variables as dictionary. You can + check if an environment variable exists like this: > + :echo has_key(environ(), 'HOME') +< Note that the variable name may be CamelCase; to ignore case + use this: > + :echo index(keys(environ()), 'HOME', 0, 1) != -1 + empty({expr}) *empty()* Return the Number 1 if {expr} is empty, zero otherwise. - A |List| or |Dictionary| is empty when it does not have any @@ -4970,13 +4988,11 @@ getcwd([{winnr} [, {tabnr}]]) " Get the working directory of current tabpage :echo getcwd(-1, 0) < -getfsize({fname}) *getfsize()* - The result is a Number, which is the size in bytes of the - given file {fname}. - If {fname} is a directory, 0 is returned. - If the file {fname} can't be found, -1 is returned. - If the size of {fname} is too big to fit in a Number then -2 - is returned. +getenv({name}) *getenv()* + Return the value of environment variable {name}. + When the variable does not exist |v:null| is returned. That + is different from a variable set to an empty string. + See also |expr-env|. getfontname([{name}]) *getfontname()* Without an argument returns the name of the normal font being @@ -5009,6 +5025,14 @@ getfperm({fname}) *getfperm()* For setting permissions use |setfperm()|. +getfsize({fname}) *getfsize()* + The result is a Number, which is the size in bytes of the + given file {fname}. + If {fname} is a directory, 0 is returned. + If the file {fname} can't be found, -1 is returned. + If the size of {fname} is too big to fit in a Number then -2 + is returned. + getftime({fname}) *getftime()* The result is a Number, which is the last modification time of the given file {fname}. The value is measured as seconds @@ -8012,6 +8036,11 @@ setcmdpos({pos}) *setcmdpos()* Returns 0 when successful, 1 when not editing the command line. +setenv({name}, {val}) *setenv()* + Set environment variable {name} to {val}. + When {val} is |v:null| the environment variable is deleted. + See also |expr-env|. + setfperm({fname}, {mode}) *setfperm()* *chmod* Set the file permissions for {fname} to {mode}. {mode} must be a string with 9 characters. It is of the form diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index f874b073b9..f43edf81ed 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -774,6 +774,9 @@ System functions and manipulation of files: rename() rename a file system() get the result of a shell command as a string systemlist() get the result of a shell command as a list + environ() get all environment variables + getenv() get one environment variable + setenv() set an environment variable hostname() name of the system readfile() read a file into a List of lines readdir() get a List of file names in a directory @@ -903,6 +906,7 @@ GUI: *gui-functions* getwinposy() Y position of the Vim window balloon_show() set the balloon content balloon_split() split a message for a balloon + balloon_gettext() get the text in the balloon Vim server: *server-functions* serverlist() return the list of server names diff --git a/src/evalfunc.c b/src/evalfunc.c index eaefccf620..267683268f 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -137,6 +137,7 @@ static void f_did_filetype(typval_T *argvars, typval_T *rettv); static void f_diff_filler(typval_T *argvars, typval_T *rettv); static void f_diff_hlID(typval_T *argvars, typval_T *rettv); static void f_empty(typval_T *argvars, typval_T *rettv); +static void f_environ(typval_T *argvars, typval_T *rettv); static void f_escape(typval_T *argvars, typval_T *rettv); static void f_eval(typval_T *argvars, typval_T *rettv); static void f_eventhandler(typval_T *argvars, typval_T *rettv); @@ -187,6 +188,7 @@ static void f_getcmdpos(typval_T *argvars, typval_T *rettv); static void f_getcmdtype(typval_T *argvars, typval_T *rettv); static void f_getcmdwintype(typval_T *argvars, typval_T *rettv); static void f_getcwd(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_getfperm(typval_T *argvars, typval_T *rettv); static void f_getfsize(typval_T *argvars, typval_T *rettv); @@ -365,6 +367,7 @@ static void f_setbufline(typval_T *argvars, typval_T *rettv); static void f_setbufvar(typval_T *argvars, typval_T *rettv); static void f_setcharsearch(typval_T *argvars, typval_T *rettv); static void f_setcmdpos(typval_T *argvars, typval_T *rettv); +static void f_setenv(typval_T *argvars, typval_T *rettv); static void f_setfperm(typval_T *argvars, typval_T *rettv); static void f_setline(typval_T *argvars, typval_T *rettv); static void f_setloclist(typval_T *argvars, typval_T *rettv); @@ -629,6 +632,7 @@ static struct fst {"diff_filler", 1, 1, f_diff_filler}, {"diff_hlID", 2, 2, f_diff_hlID}, {"empty", 1, 1, f_empty}, + {"environ", 0, 0, f_environ}, {"escape", 2, 2, f_escape}, {"eval", 1, 1, f_eval}, {"eventhandler", 0, 0, f_eventhandler}, @@ -681,6 +685,7 @@ static struct fst #endif {"getcurpos", 0, 0, f_getcurpos}, {"getcwd", 0, 2, f_getcwd}, + {"getenv", 1, 1, f_getenv}, {"getfontname", 0, 1, f_getfontname}, {"getfperm", 1, 1, f_getfperm}, {"getfsize", 1, 1, f_getfsize}, @@ -873,6 +878,7 @@ static struct fst {"setbufvar", 3, 3, f_setbufvar}, {"setcharsearch", 1, 1, f_setcharsearch}, {"setcmdpos", 1, 1, f_setcmdpos}, + {"setenv", 2, 2, f_setenv}, {"setfperm", 2, 2, f_setfperm}, {"setline", 2, 2, f_setline}, {"setloclist", 2, 4, f_setloclist}, @@ -3339,6 +3345,59 @@ f_empty(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = n; } +/* + * "environ()" function + */ + static void +f_environ(typval_T *argvars UNUSED, typval_T *rettv) +{ +#if !defined(AMIGA) + int i = 0; + char_u *entry, *value; +# ifdef MSWIN + extern wchar_t **_wenviron; +# else + extern char **environ; +# endif + + if (rettv_dict_alloc(rettv) != OK) + return; + +# ifdef MSWIN + if (*_wenviron == NULL) + return; +# else + if (*environ == NULL) + return; +# endif + + for (i = 0; ; ++i) + { +# ifdef MSWIN + short_u *p; + + if ((p = (short_u *)_wenviron[i]) == NULL) + return; + entry = utf16_to_enc(p, NULL); +# else + if ((entry = (char_u *)environ[i]) == NULL) + return; + entry = vim_strsave(entry); +# endif + if (entry == NULL) // out of memory + return; + if ((value = vim_strchr(entry, '=')) == NULL) + { + vim_free(entry); + continue; + } + *value++ = NUL; + dict_add_string(rettv->vval.v_dict, (char *)entry, value); + vim_free(entry); + } +#endif +} + /* * "escape({string}, {chars})" function */ @@ -5260,6 +5319,27 @@ f_getcwd(typval_T *argvars, typval_T *rettv) #endif } +/* + * "getenv()" function + */ + static void +f_getenv(typval_T *argvars, typval_T *rettv) +{ + int mustfree = FALSE; + char_u *p = vim_getenv(tv_get_string(&argvars[0]), &mustfree); + + if (p == NULL) + { + rettv->v_type = VAR_SPECIAL; + rettv->vval.v_number = VVAL_NULL; + return; + } + if (!mustfree) + p = vim_strsave(p); + rettv->vval.v_string = p; + rettv->v_type = VAR_STRING; +} + /* * "getfontname()" function */ @@ -11424,6 +11504,23 @@ f_setcmdpos(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = set_cmdline_pos(pos); } +/* + * "setenv()" function + */ + static void +f_setenv(typval_T *argvars, typval_T *rettv UNUSED) +{ + char_u namebuf[NUMBUFLEN]; + char_u valbuf[NUMBUFLEN]; + char_u *name = tv_get_string_buf(&argvars[0], namebuf); + + if (argvars[1].v_type == VAR_SPECIAL + && argvars[1].vval.v_number == VVAL_NULL) + vim_unsetenv(name); + else + vim_setenv(name, tv_get_string_buf(&argvars[1], valbuf)); +} + /* * "setfperm({fname}, {mode})" function */ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 6b966e6fe8..1f50bd8cf8 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -104,6 +104,7 @@ NEW_TESTS = \ test_erasebackword \ test_escaped_glob \ test_eval_stuff \ + test_environ \ test_ex_equal \ test_ex_undo \ test_ex_z \ @@ -320,6 +321,7 @@ NEW_TESTS_RES = \ test_digraph.res \ test_display.res \ test_edit.res \ + test_environ.res \ test_erasebackword.res \ test_escaped_glob.res \ test_eval_stuff.res \ diff --git a/src/testdir/test_environ.vim b/src/testdir/test_environ.vim new file mode 100644 index 0000000000..094c4ce36f --- /dev/null +++ b/src/testdir/test_environ.vim @@ -0,0 +1,44 @@ +scriptencoding utf-8 + +func Test_environ() + unlet! $TESTENV + call assert_equal(0, has_key(environ(), 'TESTENV')) + let $TESTENV = 'foo' + call assert_equal(1, has_key(environ(), 'TESTENV')) + let $TESTENV = 'こんにちわ' + call assert_equal('こんにちわ', environ()['TESTENV']) +endfunc + +func Test_getenv() + unlet! $TESTENV + call assert_equal(v:null, getenv('TESTENV')) + let $TESTENV = 'foo' + call assert_equal('foo', getenv('TESTENV')) +endfunc + +func Test_setenv() + unlet! $TESTENV + call setenv('TEST ENV', 'foo') + call assert_equal('foo', getenv('TEST ENV')) + call setenv('TEST ENV', v:null) + call assert_equal(v:null, getenv('TEST ENV')) +endfunc + +func Test_external_env() + call setenv('FOO', 'HelloWorld') + if has('win32') + let result = system('echo %FOO%') + else + let result = system('echo $FOO') + endif + let result = substitute(result, '[ \r\n]', '', 'g') + call assert_equal('HelloWorld', result) + + call setenv('FOO', v:null) + if has('win32') + let result = system('set | grep ^FOO=') + else + let result = system('env | grep ^FOO=') + endif + call assert_equal('', result) +endfunc diff --git a/src/version.c b/src/version.c index 7715410bd8..182a43a53d 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1305, /**/ 1304, /**/ From eae1b91fea74842000fc055afc74fe2e7934c6ee Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 15:12:55 +0200 Subject: [PATCH 36/97] patch 8.1.1306: Borland support is outdated and doesn't work Problem: Borland support is outdated and doesn't work. Solution: Remove Borland support, there are other (free) compilers available. (Thomas Dziedzic, Ken Takata, closes #4364) --- .gitignore | 8 - .hgignore | 8 - Filelist | 2 - runtime/doc/debug.txt | 5 +- runtime/doc/develop.txt | 1 - runtime/doc/usr_90.txt | 5 +- src/GvimExt/Make_bc5.mak | 43 -- src/GvimExt/gvimext.cpp | 9 - src/GvimExt/gvimext.rc | 4 +- src/INSTALLpc.txt | 60 ++- src/Make_bc5.mak | 983 --------------------------------------- src/dosinst.c | 2 +- src/dosinst.h | 18 +- src/evalfunc.c | 18 +- src/ex_cmds.c | 18 +- src/ex_getln.c | 12 +- src/gui_w32.c | 17 +- src/if_ole.cpp | 10 - src/if_py_both.h | 5 - src/main.c | 3 - src/mark.c | 3 - src/message.c | 11 +- src/misc1.c | 9 +- src/misc2.c | 9 +- src/normal.c | 9 +- src/option.c | 10 - src/os_mswin.c | 53 +-- src/os_w32exe.c | 10 +- src/os_win32.c | 20 - src/os_win32.h | 16 +- src/proto.h | 57 +-- src/screen.c | 3 - src/spell.c | 9 +- src/spellfile.c | 9 +- src/syntax.c | 6 - src/userfunc.c | 18 +- src/version.c | 2 + src/vim.h | 30 -- src/vim.rc | 6 +- src/vimrun.c | 5 - src/xxd/Make_bc5.mak | 18 - src/xxd/xxd.c | 10 +- 42 files changed, 79 insertions(+), 1475 deletions(-) delete mode 100644 src/GvimExt/Make_bc5.mak delete mode 100644 src/Make_bc5.mak delete mode 100644 src/xxd/Make_bc5.mak diff --git a/.gitignore b/.gitignore index 5767bae79c..188636c175 100644 --- a/.gitignore +++ b/.gitignore @@ -43,14 +43,6 @@ gvim.lib runtime/doc/uganda.nsis.txt nsis/icons/* -# Borland C++ -bcc.cfg -*.ilc -*.ild -*.ilf -*.ils -*.tds - # NetBeans nbproject/* diff --git a/.hgignore b/.hgignore index 8b5c5eda2f..a48b3b9409 100644 --- a/.hgignore +++ b/.hgignore @@ -45,14 +45,6 @@ gvim.lib runtime/doc/uganda.nsis.txt nsis/icons/* -# Borland C++ -bcc.cfg -*.ilc -*.ild -*.ilf -*.ils -*.tds - # NetBeans nbproject/* diff --git a/Filelist b/Filelist index 046a9a7be1..4f73cc7ef1 100644 --- a/Filelist +++ b/Filelist @@ -421,7 +421,6 @@ SRC_DOS = \ src/GvimExt/uninst.bat \ README_srcdos.txt \ src/INSTALLpc.txt \ - src/Make_bc5.mak \ src/Make_cyg.mak \ src/Make_cyg_ming.mak \ src/Make_ming.mak \ @@ -474,7 +473,6 @@ SRC_DOS = \ src/xpm_w32.c \ src/xpm_w32.h \ src/tee/Make_mvc.mak \ - src/xxd/Make_bc5.mak \ src/xxd/Make_ming.mak \ src/xxd/Make_mvc.mak \ nsis/gvim.nsi \ diff --git a/runtime/doc/debug.txt b/runtime/doc/debug.txt index 37a5772f42..4564565516 100644 --- a/runtime/doc/debug.txt +++ b/runtime/doc/debug.txt @@ -80,9 +80,8 @@ then the PDB was built with the EXE. If you have Visual Studio, use that instead of the VC Toolkit and WinDbg. -For other compilers, you should always use the corresponding debugger: TD for -a Vim executable compiled with the Borland compiler; gdb (see above -|debug-gcc|) for the Cygwin and MinGW compilers. +For other compilers, you should always use the corresponding debugger: gdb +(see above |debug-gcc|) for the Cygwin and MinGW compilers. *debug-vs2005* diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 2d0cc2278d..9c7867c65f 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -278,7 +278,6 @@ wait don't use as argument to a function, conflicts with types.h index shadows global declaration time shadows global declaration new C++ reserved keyword -try Borland C++ doesn't like it to be used as a variable. clear Mac curses.h echo Mac curses.h diff --git a/runtime/doc/usr_90.txt b/runtime/doc/usr_90.txt index a5b429280c..087de8f2da 100644 --- a/runtime/doc/usr_90.txt +++ b/runtime/doc/usr_90.txt @@ -281,9 +281,8 @@ unpacked them. In case you are not satisfied with the features included in the supplied binaries, you could try compiling Vim yourself. Get the source archive from the same location as where the binaries are. You need a compiler for which a -makefile exists. Microsoft Visual C works, but is expensive. The Free -Borland command-line compiler 5.5 can be used, as well as the free MingW and -Cygwin compilers. Check the file src/INSTALLpc.txt for hints. +makefile exists. Microsoft Visual C works, but is expensive. The free MinGW +and Cygwin compilers can be used. Check the file src/INSTALLpc.txt for hints. ============================================================================== *90.3* Upgrading diff --git a/src/GvimExt/Make_bc5.mak b/src/GvimExt/Make_bc5.mak deleted file mode 100644 index 363c6d608f..0000000000 --- a/src/GvimExt/Make_bc5.mak +++ /dev/null @@ -1,43 +0,0 @@ -### USEDLL no for statically linked version of run-time, yes for DLL runtime -### BOR path to root of Borland C install (c:\bc5) - -### (requires cc3250.dll be available in %PATH%) -!if ("$(USEDLL)"=="") -USEDLL = no -!endif - -### BOR: root of the BC installation -!if ("$(BOR)"=="") -BOR = c:\bc5 -!endif - -CC = $(BOR)\bin\Bcc32 -BRC = $(BOR)\bin\brc32 -LINK = $(BOR)\BIN\ILink32 -INCLUDE = $(BOR)\include;. -LIB = $(BOR)\lib - -!if ("$(USEDLL)"=="yes") -RT_DEF = -D_RTLDLL -RT_LIB = cw32i.lib -!else -RT_DEF = -RT_LIB = cw32.lib -!endif - - -all : gvimext.dll - -gvimext.obj : gvimext.cpp gvimext.h - $(CC) -tWD -I$(INCLUDE) -c -DFEAT_GETTEXT $(RT_DEF) -w- gvimext.cpp - -gvimext.res : gvimext.rc - $(BRC) -r gvimext.rc - -gvimext.dll : gvimext.obj gvimext.res - $(LINK) -L$(LIB) -aa gvimext.obj, gvimext.dll, , c0d32.obj $(RT_LIB) import32.lib, gvimext.def, gvimext.res - -clean : - -@del gvimext.obj - -@del gvimext.res - -@del gvimext.dll diff --git a/src/GvimExt/gvimext.cpp b/src/GvimExt/gvimext.cpp index b9d9d91f01..53d96df8bf 100644 --- a/src/GvimExt/gvimext.cpp +++ b/src/GvimExt/gvimext.cpp @@ -16,14 +16,7 @@ #include "gvimext.h" -#ifdef __BORLANDC__ -# include -# ifndef _strnicmp -# define _strnicmp(a, b, c) strnicmp((a), (b), (c)) -# endif -#else static char *searchpath(char *name); -#endif // Always get an error while putting the following stuff to the // gvimext.h file as class protected variables, give up and @@ -917,7 +910,6 @@ BOOL CShellExt::LoadMenuIcon() return TRUE; } -#ifndef __BORLANDC__ static char * searchpath(char *name) { @@ -937,7 +929,6 @@ searchpath(char *name) } return (char *)""; } -#endif STDMETHODIMP CShellExt::InvokeGvim(HWND hParent, LPCSTR /* pszWorkingDir */, diff --git a/src/GvimExt/gvimext.rc b/src/GvimExt/gvimext.rc index 22102db75f..10476da4fa 100644 --- a/src/GvimExt/gvimext.rc +++ b/src/GvimExt/gvimext.rc @@ -7,9 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#ifndef __BORLANDC__ -# include "winresrc.h" -#endif +#include "winresrc.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt index 0c276fa830..c72875a8be 100644 --- a/src/INSTALLpc.txt +++ b/src/INSTALLpc.txt @@ -25,21 +25,20 @@ Contents: 2. Using MSYS2 with MinGW 3. Using MinGW 4. Cygwin -5. Borland -6. Cross compiling for Win32 from a Linux machine -7. Building with Python support -8. Building with Python3 support -9. Building with Racket or MzScheme support -10. Building with Lua support -11. Building with Perl support -12. Building with Ruby support -13. Building with Tcl support -14. Building with Terminal support -15. Building with DirectX (DirectWrite) support -16. Windows 3.1 -17. MS-DOS +5. Cross compiling for Win32 from a Linux machine +6. Building with Python support +7. Building with Python3 support +8. Building with Racket or MzScheme support +9. Building with Lua support +10. Building with Perl support +11. Building with Ruby support +12. Building with Tcl support +13. Building with Terminal support +14. Building with DirectX (DirectWrite) support +15. Windows 3.1 +16. MS-DOS -18. Installing after building from sources +17. Installing after building from sources The currently recommended way (that means it has been verified to work) is @@ -451,14 +450,7 @@ running on Unix), while with Make_cyg.mak you get a Windows application (like with the other makefiles). -5. Borland -=========== - -Use Make_bc5.mak with Borland C++ 5.x. See - http://users.skynet.be/antoine.mechelynck/vim/compile.htm - - -6. Cross compiling for Win32 from a Linux machine +5. Cross compiling for Win32 from a Linux machine ================================================= [Update of 1) needs to be verified] @@ -478,7 +470,7 @@ your Linux (or other unix) box. To do this, you need to follow a few steps: Now you have created the Windows binary from your Linux box! Have fun... -7. Building with Python support +6. Building with Python support =============================== For building with MSVC 2008 the "Windows Installer" from www.python.org @@ -539,7 +531,7 @@ Now just do: You will end up with a Python-enabled, Win32 version. Enjoy! -8. Building with Python3 support +7. Building with Python3 support ================================ For building with MSVC 2008 the "Windows Installer" from www.python.org @@ -576,7 +568,7 @@ When using msys2 and link with Python3 bundled with msys2 (as one line): libstdc++-6.dll.) -9. Building with Racket or MzScheme support +8. Building with Racket or MzScheme support ======================================== 1) Building with Racket support (newest) @@ -666,7 +658,7 @@ After a successful build, these dlls can be freely removed, leaving them in -10. Building with Lua support +9. Building with Lua support ============================ Vim with Lua support can be built with either MSVC or MinGW (or maybe Cygwin). @@ -721,7 +713,7 @@ Or when using Cygwin (as one line) (untested): LUA=/cygdrive/c/projects/lua53 DYNAMIC_LUA=yes LUA_VER=53 -11. Building with Perl support +10. Building with Perl support ============================== Vim with Perl support can be built with either MSVC or MinGW (or Cygwin). @@ -747,7 +739,7 @@ Or when using MinGW (as one line): PERL=C:/Perl DYNAMIC_PERL=yes PERL_VER=522 -12. Building with Ruby support +11. Building with Ruby support ============================== Vim with Ruby support can be built with either MSVC or MinGW (or Cygwin). @@ -855,7 +847,7 @@ Ruby 2.1 or later. (Default is 0x600.) -13. Building with Tcl support +12. Building with Tcl support ============================= Vim with Tcl support can be built with either MSVC or MinGW (or Cygwin). @@ -894,7 +886,7 @@ Or when using MinGW (as one line): TCL=C:/Tcl86 DYNAMIC_TCL=yes TCL_VER=86 TCL_VER_LONG=8.6 -14. Building with Terminal support +13. Building with Terminal support ================================== Vim with Terminal support can be built with either MSVC, MinGW or Cygwin. @@ -910,7 +902,7 @@ Or when using MinGW: mingw32-make -f Make_ming.mak TERMINAL=yes -15. Building with DirectX (DirectWrite) support +14. Building with DirectX (DirectWrite) support =============================================== Vim with DirectX (DirectWrite) support can be built with either MSVC or MinGW. @@ -944,20 +936,20 @@ Just set DIRECTX to yes: mingw32-make -f Make_ming.mak DIRECTX=yes -16. Windows 3.1x +15. Windows 3.1x ================ The Windows 3.1x support was removed in patch 7.4.1364. -17. MS-DOS +16. MS-DOS ========== The MS-DOS support was removed in patch 7.4.1399. Only very old Vim versions work on MS-DOS because of the limited amount of memory available. -18. Installing after building from sources +17. Installing after building from sources ========================================== [provided by Michael Soyka, updated by Ken Takata] diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak deleted file mode 100644 index a6b4bc96e9..0000000000 --- a/src/Make_bc5.mak +++ /dev/null @@ -1,983 +0,0 @@ -# -# Makefile for Vim. -# Compiler: Borland C++ 5.0 and later 32-bit compiler -# Targets: Win32 (Windows NT and Windows 95) (with/without GUI) -# -# NOTE: THIS IS OLD AND PROBABLY NO LONGER WORKS. -# -# Contributed by Ben Singer. -# Updated 4/1997 by Ron Aaron -# 2016: removed support for 16 bit DOS -# 6/1997 - added support for 16 bit DOS -# Note: this has been tested, and works, for BC5. Your mileage may vary. -# Has been reported NOT to work with BC 4.52. Maybe it can be fixed? -# 10/1997 - ron - fixed bugs w/ BC 5.02 -# 8/1998 - ron - updated with new targets, fixed some stuff -# 3/2000 - Bram: Made it work with BC 5.5 free command line compiler, -# cleaned up variables. -# 6/2001 - Dan - Added support for compiling Python and TCL -# 7/2001 - Dan - Added support for compiling Ruby -# -# It builds on Windows 95 and NT-Intel, producing the same binary in either -# case. To build using Microsoft Visual C++, use Make_mvc.mak. -# -# This should work with the free Borland command line compiler, version 5.5. -# You need at least sp1 (service pack 1). With sp2 it compiles faster. -# Use a command like this: -# \bin\make /f Make_bc5.mak BOR= -# - -# let the make utility do the hard work: -.AUTODEPEND -.CACHEAUTODEPEND - -# VARIABLES: -# name value (default) -# -# BOR path to root of Borland C install (c:\bc5) -# LINK name of the linker ($(BOR)\bin\ilink32) -# GUI no or yes: set to yes if you want the GUI version (yes) -# LUA define to path to Lua dir to get Lua support (not defined) -# LUA_VER define to version of Lua being used (51) -# DYNAMIC_LUA no or yes: set to yes to load the Lua DLL dynamically (no) -# PERL define to path to Perl dir to get Perl support (not defined) -# PERL_VER define to version of Perl being used (56) -# DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (no) -# PYTHON define to path to Python dir to get PYTHON support (not defined) -# PYTHON_VER define to version of Python being used (22) -# DYNAMIC_PYTHON no or yes: use yes to load the Python DLL dynamically (no) -# PYTHON3 define to path to Python3 dir to get PYTHON3 support (not defined) -# PYTHON3_VER define to version of Python3 being used (31) -# DYNAMIC_PYTHON3 no or yes: use yes to load the Python3 DLL dynamically (no) -# TCL define to path to TCL dir to get TCL support (not defined) -# TCL_VER define to version of TCL being used (83) -# DYNAMIC_TCL no or yes: use yes to load the TCL DLL dynamically (no) -# RUBY define to path to Ruby dir to get Ruby support (not defined) -# NOTE: You may have to remove the defines for uid_t and gid_t -# from the Ruby config.h header file. -# RUBY_VER define to version of Ruby being used (16) -# NOTE: compilation on WinNT/2K/XP requires -# at least version 1.6.5 of Ruby. Earlier versions -# of Ruby will cause a compile error on these systems. -# RUBY_VER_LONG same, but in format with dot. (1.6) -# DYNAMIC_RUBY no or yes: use yes to load the Ruby DLL dynamically (no) -# IME no or yes: set to yes for multi-byte IME support (yes) -# DYNAMIC_IME no or yes: set to yes to load imm32.dll dynamically (yes) -# GETTEXT no or yes: set to yes for multi-language support (yes) -# ICONV no or yes: set to yes for dynamic iconv support (yes) -# OLE no or yes: set to yes to make OLE gvim (no) -# DEBUG no or yes: set to yes if you wish a DEBUGging build (no) -# CODEGUARD no or yes: set to yes if you want to use CODEGUARD (no) -# CPUNR 1 through 6: select -CPU argument to compile with (3) -# 3 for 386, 4 for 486, 5 for pentium, 6 for pentium pro. -# USEDLL no or yes: set to yes to use the Runtime library DLL (no) -# For USEDLL=yes the cc3250.dll is required to run Vim. -# ALIGN 1, 2 or 4: Alignment to use (4 for Win32) -# FASTCALL no or yes: set to yes to use register-based function protocol (yes) -# OPTIMIZE SPACE, SPEED, or MAXSPEED: type of optimization (MAXSPEED) -# POSTSCRIPT no or yes: set to yes for PostScript printing -# FEATURES TINY, SMALL, NORMAL, BIG or HUGE (BIG for WIN32) -# WINVER 0x0400 or 0x0500: minimum Win32 version to support (0x0400) -# CSCOPE no or yes: include support for Cscope interface (yes) -# NETBEANS no or yes: include support for Netbeans interface; also -# requires CHANNEL (yes if GUI -# is yes) -# NBDEBUG no or yes: include support for debugging Netbeans interface (no) -# CHANNEL no or yes: include support for inter process communication (yes -# if GUI is yes) -# XPM define to path to XPM dir to get support for loading XPM images. - -### BOR: root of the BC installation -!if ("$(BOR)"=="") -BOR = c:\bc5 -!endif - -### LINK: Name of the linker: ilink32 (this is below) - -### GUI: yes for GUI version, no for console version -!if ("$(GUI)"=="") -GUI = yes -!endif - -### IME: yes for multibyte support, no to disable it. -!if ("$(IME)"=="") -IME = yes -!endif -!if ("$(DYNAMIC_IME)"=="") -DYNAMIC_IME = yes -!endif - -### GETTEXT: yes for multilanguage support, no to disable it. -!if ("$(GETTEXT)"=="") -GETTEXT = yes -!endif - -### ICONV: yes to enable dynamic-iconv support, no to disable it -!if ("$(ICONV)"=="") -ICONV = yes -!endif - -### CSCOPE: yes to enable Cscope support, no to disable it -!if ("$(CSCOPE)"=="") -CSCOPE = yes -!endif - -### NETBEANS: yes to enable NetBeans interface support, no to disable it -!if ("$(NETBEANS)"=="") && ("$(GUI)"=="yes") -NETBEANS = yes -!endif - -### CHANNEL: yes to enable inter process communication, no to disable it -!if ("$(CHANNEL)"=="") && ("$(GUI)"=="yes") -CHANNEL = yes -!endif - -### LUA: uncomment this line if you want lua support in vim -# LUA=c:\lua - -### PERL: uncomment this line if you want perl support in vim -# PERL=c:\perl - -### PYTHON: uncomment this line if you want python support in vim -# PYTHON=c:\python22 - -### PYTHON3: uncomment this line if you want python3 support in vim -# PYTHON3=c:\python31 - -### RUBY: uncomment this line if you want ruby support in vim -# RUBY=c:\ruby - -### TCL: uncomment this line if you want tcl support in vim -# TCL=c:\tcl - -### OLE: no for normal gvim, yes for OLE-capable gvim (only works with GUI) -#OLE = yes - -### DEBUG: Uncomment to make an executable for debugging -# DEBUG = yes -!if ("$(DEBUG)"=="yes") -DEBUG_FLAG = -v -!endif - -### CODEGUARD: Uncomment to use the CODEGUARD stuff (BC 5.0 or later): -# CODEGUARD = yes -!if ("$(CODEGUARD)"=="yes") -CODEGUARD_FLAG = -vG -!endif - -### CPUNR: set your target processor (3 to 6) -!if ("$(CPUNR)" == "i386") || ("$(CPUNR)" == "3") -CPUNR = 3 -!elif ("$(CPUNR)" == "i486") || ("$(CPUNR)" == "4") -CPUNR = 4 -!elif ("$(CPUNR)" == "i586") || ("$(CPUNR)" == "5") -CPUNR = 5 -!elif ("$(CPUNR)" == "i686") || ("$(CPUNR)" == "6") -CPUNR = 6 -!else -CPUNR = 3 -!endif - -### Comment out to use precompiled headers (faster, but uses lots of disk!) -HEADERS = -H -H=vim.csm -Hc - -### USEDLL: no for statically linked version of run-time, yes for DLL runtime -!if ("$(USEDLL)"=="") -USEDLL = no -!endif - -### ALIGN: alignment you desire: (1,2 or 4: s/b 4 for Win32) -!if ("$(ALIGN)"=="") -ALIGN = 4 -!endif - -### FASTCALL: yes to use FASTCALL calling convention (RECOMMENDED!), no otherwise -# Incompatible when calling external functions (like MSVC-compiled DLLs), so -# don't use FASTCALL when linking with external libs. -!if ("$(FASTCALL)"=="") && \ - ("$(LUA)"=="") && \ - ("$(PYTHON)"=="") && \ - ("$(PYTHON3)"=="") && \ - ("$(PERL)"=="") && \ - ("$(TCL)"=="") && \ - ("$(RUBY)"=="") && \ - ("$(ICONV)"!="yes") && \ - ("$(IME)"!="yes") && \ - ("$(XPM)"=="") -FASTCALL = yes -!endif - -### OPTIMIZE: SPEED to optimize for speed, SPACE otherwise (SPEED RECOMMENDED) -!if ("$(OPTIMIZE)"=="") -OPTIMIZE = MAXSPEED -!endif - -### FEATURES: TINY, SMALL, NORMAL, BIG or HUGE (BIG for WIN32) -!if ("$(FEATURES)"=="") -FEATURES = BIG -!endif - -### POSTSCRIPT: uncomment this line if you want PostScript printing -#POSTSCRIPT = yes - -### -# If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal -# default, use these lines. -#VIMRCLOC = somewhere -#VIMRUNTIMEDIR = somewhere - -### Set the default $(WINVER) to make it work with Bcc 5.5. -!ifndef WINVER -WINVER = 0x0400 -!endif - -# -# Sanity checks for the above options: -# - -OSTYPE = WIN32 - -# -# Optimizations: change as desired (RECOMMENDATION: Don't change!): -# -!if ("$(DEBUG)"=="yes") -OPT = -Od -N -!else -!if ("$(OPTIMIZE)"=="SPACE") -OPT = -O1 -f- -d -!elif ("$(OPTIMIZE)"=="MAXSPEED") -OPT = -O2 -f- -d -Ocavi -O -!else -OPT = -O2 -f- -d -Oc -O -!endif -!if ("$(FASTCALL)"=="yes") -OPT = $(OPT) -pr -!endif -!if ("$(CODEGUARD)"!="yes") -OPT = $(OPT) -vi- -!endif -!endif -# shouldn't have to change: -LIB = $(BOR)\lib -INCLUDE = $(BOR)\include;.;proto -DEFINES = -DFEAT_$(FEATURES) -DWIN32 -DHAVE_PATHDEF \ - -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) - -!ifdef LUA -INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_LUA -INCLUDE = $(LUA)\include;$(INCLUDE) -! ifndef LUA_VER -LUA_VER = 51 -! endif -! if ("$(DYNAMIC_LUA)" == "yes") -INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\" -LUA_LIB_FLAG = /nodefaultlib: -! endif -!endif - -!ifdef PERL -INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_PERL -INCLUDE = $(PERL)\lib\core;$(INCLUDE) -! ifndef PERL_VER -PERL_VER = 56 -! endif -! if ("$(DYNAMIC_PERL)" == "yes") -! if ($(PERL_VER) > 55) -INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\" -PERL_LIB_FLAG = /nodefaultlib: -! else -! message "Cannot dynamically load Perl versions less than 5.6. Loading statically..." -! endif -! endif -!endif - -!ifdef PYTHON -!ifdef PYTHON3 -DYNAMIC_PYTHON=yes -DYNAMIC_PYTHON3=yes -!endif -!endif - -!ifdef PYTHON -INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_PYTHON -!ifndef PYTHON_VER -PYTHON_VER = 22 -!endif -!if "$(DYNAMIC_PYTHON)" == "yes" -INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" -PYTHON_LIB_FLAG = /nodefaultlib: -!endif -!endif - -!ifdef PYTHON3 -INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_PYTHON3 -!ifndef PYTHON3_VER -PYTHON3_VER = 31 -!endif -!if "$(DYNAMIC_PYTHON3)" == "yes" -INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\" -PYTHON3_LIB_FLAG = /nodefaultlib: -!endif -!endif - - -!ifdef RUBY -!ifndef RUBY_VER -RUBY_VER = 16 -!endif -!ifndef RUBY_VER_LONG -RUBY_VER_LONG = 1.6 -!endif - -!if "$(RUBY_VER)" == "16" -!ifndef RUBY_PLATFORM -RUBY_PLATFORM = i586-mswin32 -!endif -!ifndef RUBY_INSTALL_NAME -RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER) -!endif -!else -!ifndef RUBY_PLATFORM -RUBY_PLATFORM = i386-mswin32 -!endif -!ifndef RUBY_INSTALL_NAME -RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER) -!endif -!endif - -INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_RUBY -INCLUDE = $(RUBY)\lib\ruby\$(RUBY_VER_LONG)\$(RUBY_PLATFORM);$(INCLUDE) - -!if "$(DYNAMIC_RUBY)" == "yes" -INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_RUBY_VER=$(RUBY_VER) -RUBY_LIB_FLAG = /nodefaultlib: -!endif -!endif - -!ifdef TCL -INTERP_DEFINES = $(INTERP_DEFINES) -DFEAT_TCL -INCLUDE = $(TCL)\include;$(INCLUDE) -!ifndef TCL_VER -TCL_VER = 83 -!endif -TCL_LIB = $(TCL)\lib\tcl$(TCL_VER).lib -TCL_LIB_FLAG = -!if "$(DYNAMIC_TCL)" == "yes" -INTERP_DEFINES = $(INTERP_DEFINES) -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\" -TCL_LIB = tclstub$(TCL_VER)-bor.lib -TCL_LIB_FLAG = -!endif -!endif -# -# DO NOT change below: -# -CPUARG = -$(CPUNR) -ALIGNARG = -a$(ALIGN) -# -!if ("$(DEBUG)"=="yes") -DEFINES=$(DEFINES) -DDEBUG -D_DEBUG -!endif -# -!if ("$(OLE)"=="yes") -DEFINES = $(DEFINES) -DFEAT_OLE -!endif -# -!if ("$(IME)"=="yes") -MBDEFINES = $(MBDEFINES) -DFEAT_MBYTE_IME -!if ("$(DYNAMIC_IME)" == "yes") -MBDEFINES = $(MBDEFINES) -DDYNAMIC_IME -!endif -!endif -!if ("$(ICONV)"=="yes") -MBDEFINES = $(MBDEFINES) -DDYNAMIC_ICONV -!endif -!if ("$(GETTEXT)"=="yes") -MBDEFINES = $(MBDEFINES) -DDYNAMIC_GETTEXT -!endif - -!if ("$(CSCOPE)"=="yes") -DEFINES = $(DEFINES) -DFEAT_CSCOPE -!endif - -!if ("$(GUI)"=="yes") -DEFINES = $(DEFINES) -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD -!if ("$(DEBUG)"=="yes") -TARGET = gvimd.exe -!else -TARGET = gvim.exe -!endif -EXETYPE=-W -STARTUPOBJ = c0w32.obj -LINK2 = -aa -RESFILE = vim.res -!else -!undef NETBEANS -!undef CHANNEL -!undef XPM -!if ("$(DEBUG)"=="yes") -TARGET = vimd.exe -!else -# for now, anyway: VIMDLL is only for the GUI version -TARGET = vim.exe -!endif -EXETYPE=-WC -STARTUPOBJ = c0x32.obj -LINK2 = -ap -OS -o -P -RESFILE = vim.res -!endif - -!if ("$(NETBEANS)"=="yes") -!if ("$(CHANNEL)"!="yes") -# cannot use Netbeans without CHANNEL -NETBEANS = no -!else -DEFINES = $(DEFINES) -DFEAT_NETBEANS_INTG -!if ("$(NBDEBUG)"=="yes") -DEFINES = $(DEFINES) -DNBDEBUG -NBDEBUG_DEP = nbdebug.h nbdebug.c -!endif -!endif -!endif - -!if ("$(CHANNEL)"=="yes") -DEFINES = $(DEFINES) -DFEAT_JOB_CHANNEL -!endif - -!ifdef XPM -!if ("$(GUI)"=="yes") -DEFINES = $(DEFINES) -DFEAT_XPM_W32 -INCLUDE = $(XPM)\include;$(INCLUDE) -!endif -!endif - -!if ("$(USEDLL)"=="yes") -DEFINES = $(DEFINES) -D_RTLDLL -!endif - -!if ("$(DEBUG)"=="yes") -OBJDIR = $(OSTYPE)\objdbg -!else -!if ("$(GUI)"=="yes") -!if ("$(OLE)"=="yes") -OBJDIR = $(OSTYPE)\oleobj -!else -OBJDIR = $(OSTYPE)\gobj -!endif -!else -OBJDIR = $(OSTYPE)\obj -!endif -!endif - -!if ("$(POSTSCRIPT)"=="yes") -DEFINES = $(DEFINES) -DMSWINPS -!endif - -##### BASE COMPILER/TOOLS RULES ##### -MAKE = $(BOR)\bin\make -CFLAGS = -w-aus -w-par -w-pch -w-ngu -w-csu -I$(INCLUDE) -BRC = $(BOR)\BIN\brc32 -!if ("$(LINK)"=="") -LINK = $(BOR)\BIN\ILink32 -!endif -CC = $(BOR)\BIN\Bcc32 -LFLAGS = -OS -Tpe -c -m -L$(LIB) $(DEBUG_FLAG) $(LINK2) -LFLAGSDLL = -Tpd -c -m -L$(LIB) $(DEBUG_FLAG) $(LINK2) -CFLAGS = $(CFLAGS) -d -RT- -k- -Oi $(HEADERS) -f- - -CC1 = -c -CC2 = -o -CCARG = +$(OBJDIR)\bcc.cfg - -# implicit rules: - -# Without the following, the implicit rule in BUILTINS.MAK is picked up -# for a rule for .c.obj rather than the local implicit rule -.SUFFIXES -.SUFFIXES .c .obj -.path.c = . - -{.}.c{$(OBJDIR)}.obj: - $(CC) $(CCARG) $(CC1) -n$(OBJDIR)\ {$< } - -.cpp.obj: - $(CC) $(CCARG) $(CC1) $(CC2)$@ $*.cpp - -vimmain = \ - $(OBJDIR)\os_w32exe.obj -vimwinmain = \ - $(OBJDIR)\os_w32exe.obj - -vimobj = \ - $(OBJDIR)\arabic.obj \ - $(OBJDIR)\autocmd.obj \ - $(OBJDIR)\blowfish.obj \ - $(OBJDIR)\buffer.obj \ - $(OBJDIR)\charset.obj \ - $(OBJDIR)\crypt.obj \ - $(OBJDIR)\crypt_zip.obj \ - $(OBJDIR)\debugger.obj \ - $(OBJDIR)\dict.obj \ - $(OBJDIR)\diff.obj \ - $(OBJDIR)\digraph.obj \ - $(OBJDIR)\edit.obj \ - $(OBJDIR)\eval.obj \ - $(OBJDIR)\evalfunc.obj \ - $(OBJDIR)\ex_cmds.obj \ - $(OBJDIR)\ex_cmds2.obj \ - $(OBJDIR)\ex_docmd.obj \ - $(OBJDIR)\ex_eval.obj \ - $(OBJDIR)\ex_getln.obj \ - $(OBJDIR)\fileio.obj \ - $(OBJDIR)\findfile.obj \ - $(OBJDIR)\fold.obj \ - $(OBJDIR)\getchar.obj \ - $(OBJDIR)\hardcopy.obj \ - $(OBJDIR)\hashtab.obj \ - $(OBJDIR)\indent.obj \ - $(OBJDIR)\insexpand.obj \ - $(OBJDIR)\json.obj \ - $(OBJDIR)\list.obj \ - $(OBJDIR)\main.obj \ - $(OBJDIR)\mark.obj \ - $(OBJDIR)\memfile.obj \ - $(OBJDIR)\memline.obj \ - $(OBJDIR)\menu.obj \ - $(OBJDIR)\message.obj \ - $(OBJDIR)\misc1.obj \ - $(OBJDIR)\misc2.obj \ - $(OBJDIR)\move.obj \ - $(OBJDIR)\mbyte.obj \ - $(OBJDIR)\normal.obj \ - $(OBJDIR)\ops.obj \ - $(OBJDIR)\option.obj \ - $(OBJDIR)\popupmnu.obj \ - $(OBJDIR)\quickfix.obj \ - $(OBJDIR)\regexp.obj \ - $(OBJDIR)\screen.obj \ - $(OBJDIR)\search.obj \ - $(OBJDIR)\sha256.obj \ - $(OBJDIR)\sign.obj \ - $(OBJDIR)\spell.obj \ - $(OBJDIR)\spellfile.obj \ - $(OBJDIR)\syntax.obj \ - $(OBJDIR)\tag.obj \ - $(OBJDIR)\term.obj \ - $(OBJDIR)\ui.obj \ - $(OBJDIR)\undo.obj \ - $(OBJDIR)\usercmd.obj \ - $(OBJDIR)\userfunc.obj \ - $(OBJDIR)\version.obj \ - $(OBJDIR)\window.obj \ - $(OBJDIR)\pathdef.obj - -!if ("$(OLE)"=="yes") -vimobj = $(vimobj) \ - $(OBJDIR)\if_ole.obj -!endif - -!ifdef LUA -vimobj = $(vimobj) \ - $(OBJDIR)\if_lua.obj -!endif - -!ifdef PERL -vimobj = $(vimobj) \ - $(OBJDIR)\if_perl.obj -!endif - -!ifdef PYTHON -vimobj = $(vimobj) \ - $(OBJDIR)\if_python.obj -!endif - -!ifdef PYTHON3 -vimobj = $(vimobj) \ - $(OBJDIR)\if_python3.obj -!endif - -!ifdef RUBY -vimobj = $(vimobj) \ - $(OBJDIR)\if_ruby.obj -!endif - -!ifdef TCL -vimobj = $(vimobj) \ - $(OBJDIR)\if_tcl.obj -!endif - -!if ("$(CSCOPE)"=="yes") -vimobj = $(vimobj) \ - $(OBJDIR)\if_cscope.obj -!endif - -!if ("$(NETBEANS)"=="yes") -vimobj = $(vimobj) \ - $(OBJDIR)\netbeans.obj -!endif - -!if ("$(CHANNEL)"=="yes") -vimobj = $(vimobj) \ - $(OBJDIR)\channel.obj -!endif - -!ifdef XPM -vimobj = $(vimobj) \ - $(OBJDIR)\xpm_w32.obj -!endif - -!if ("$(GUI)"=="yes") -vimobj = $(vimobj) \ - $(vimwinmain) \ - $(OBJDIR)\gui.obj \ - $(OBJDIR)\gui_beval.obj \ - $(OBJDIR)\gui_w32.obj -!endif - -vimobj = $(vimobj) \ - $(OBJDIR)\os_win32.obj $(OBJDIR)\os_mswin.obj $(OBJDIR)\winclip.obj -# Blab what we are going to do: -MSG = Compiling $(OSTYPE) $(TARGET) $(OLETARGET), with: -!if ("$(GUI)"=="yes") -MSG = $(MSG) GUI -!endif -!if ("$(OLE)"=="yes") -MSG = $(MSG) OLE -!endif -!if ("$(USEDLL)"=="yes") -MSG = $(MSG) USEDLL -!endif -!if ("$(FASTCALL)"=="yes") -MSG = $(MSG) FASTCALL -!endif -!if ("$(IME)"=="yes") -MSG = $(MSG) IME -! if "$(DYNAMIC_IME)" == "yes" -MSG = $(MSG)(dynamic) -! endif -!endif -!if ("$(GETTEXT)"=="yes") -MSG = $(MSG) GETTEXT -!endif -!if ("$(ICONV)"=="yes") -MSG = $(MSG) ICONV -!endif -!if ("$(DEBUG)"=="yes") -MSG = $(MSG) DEBUG -!endif -!if ("$(CODEGUARD)"=="yes") -MSG = $(MSG) CODEGUARD -!endif -!if ("$(CSCOPE)"=="yes") -MSG = $(MSG) CSCOPE -!endif -!if ("$(NETBEANS)"=="yes") -MSG = $(MSG) NETBEANS -!endif -!if ("$(CHANNEL)"=="yes") -MSG = $(MSG) CHANNEL -!endif -!ifdef XPM -MSG = $(MSG) XPM -!endif -!ifdef LUA -MSG = $(MSG) LUA -! if "$(DYNAMIC_LUA)" == "yes" -MSG = $(MSG)(dynamic) -! endif -!endif -!ifdef PERL -MSG = $(MSG) PERL -! if "$(DYNAMIC_PERL)" == "yes" -MSG = $(MSG)(dynamic) -! endif -!endif -!ifdef PYTHON -MSG = $(MSG) PYTHON -! if "$(DYNAMIC_PYTHON)" == "yes" -MSG = $(MSG)(dynamic) -! endif -!endif -!ifdef PYTHON3 -MSG = $(MSG) PYTHON3 -! if "$(DYNAMIC_PYTHON3)" == "yes" -MSG = $(MSG)(dynamic) -! endif -!endif -!ifdef RUBY -MSG = $(MSG) RUBY -! if "$(DYNAMIC_RUBY)" == "yes" -MSG = $(MSG)(dynamic) -! endif -!endif -!ifdef TCL -MSG = $(MSG) TCL -! if "$(DYNAMIC_TCL)" == "yes" -MSG = $(MSG)(dynamic) -! endif -!endif -MSG = $(MSG) cpu=$(CPUARG) -MSG = $(MSG) Align=$(ALIGNARG) - -!message $(MSG) - -TARGETS = $(TARGETS) $(TARGET) - -# Targets: -all: vim vimrun.exe install.exe xxd uninstal.exe GvimExt/gvimext.dll - -vim: $(OSTYPE) $(OBJDIR) $(OBJDIR)\bcc.cfg $(TARGETS) - @if exist $(OBJDIR)\version.obj del $(OBJDIR)\version.obj - @if exist auto\pathdef.c del auto\pathdef.c - -$(OSTYPE): - -@md $(OSTYPE) - -$(OBJDIR): - -@md $(OBJDIR) - -xxd: - @cd xxd - $(MAKE) /f Make_bc5.mak BOR="$(BOR)" BCC="$(CC)" - @cd .. - -GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h - cd GvimExt - $(MAKE) /f Make_bc5.mak USEDLL=$(USEDLL) BOR=$(BOR) - cd .. - -install.exe: dosinst.c $(OBJDIR)\bcc.cfg - $(CC) $(CCARG) -WC -DWIN32 -einstall dosinst.c - -uninstal.exe: uninstal.c $(OBJDIR)\bcc.cfg - $(CC) $(CCARG) -WC -DWIN32 -O2 -euninstal uninstal.c - -clean: -!if "$(OS)" == "Windows_NT" - # For Windows NT/2000, doesn't work on Windows 95/98... - # $(COMSPEC) needed to ensure rmdir.exe is not run - -@$(COMSPEC) /C rmdir /Q /S $(OBJDIR) -!else - # For Windows 95/98, doesn't work on Windows NT/2000... - -@deltree /y $(OBJDIR) -!endif - -@del *.res - -@del vim32*.dll - -@del vim32*.lib - -@del *vim*.exe - -@del *install*.exe - -@del *.csm - -@del *.map - -@del *.ilc - -@del *.ild - -@del *.ilf - -@del *.ils - -@del *.tds -!ifdef LUA - -@del lua.lib -!endif -!ifdef PERL - -@del perl.lib - -@del if_perl.c - -@del auto\if_perl.c -!endif -!ifdef PYTHON - -@del python.lib -!endif -!ifdef PYTHON3 - -@del python3.lib -!endif -!ifdef RUBY - -@del ruby.lib -!endif -!ifdef TCL - -@del tcl.lib -!endif -!ifdef XPM - -@del xpm.lib -!endif - cd xxd - $(MAKE) /f Make_bc5.mak BOR="$(BOR)" clean - cd .. - cd GvimExt - $(MAKE) /f Make_bc5.mak BOR="$(BOR)" clean - cd .. - - -$(TARGET): $(OBJDIR) $(vimobj) $(OBJDIR)\$(RESFILE) - $(LINK) @&&| - $(LFLAGS) + - $(STARTUPOBJ) + - $(vimobj) - $<,$* -!if ("$(CODEGUARD)"=="yes") - cg32.lib+ -!endif -# $(OSTYPE)==WIN32 causes os_mswin.c compilation. FEAT_SHORTCUT in it needs OLE - ole2w32.lib + - import32.lib+ -!ifdef LUA - $(LUA_LIB_FLAG)lua.lib+ -!endif -!ifdef PERL - $(PERL_LIB_FLAG)perl.lib+ -!endif -!ifdef PYTHON - $(PYTHON_LIB_FLAG)python.lib+ -!endif -!ifdef PYTHON3 - $(PYTHON3_LIB_FLAG)python3.lib+ -!endif -!ifdef RUBY - $(RUBY_LIB_FLAG)ruby.lib+ -!endif -!ifdef TCL - $(TCL_LIB_FLAG)tcl.lib+ -!endif -!ifdef XPM - xpm.lib+ -!endif -!if ("$(USEDLL)"=="yes") - cw32i.lib -!else - cw32.lib -!endif - - $(OBJDIR)\$(RESFILE) -| - -test: - cd testdir - $(MAKE) /NOLOGO -f Make_dos.mak win32 - cd .. - -$(OBJDIR)\ex_docmd.obj: ex_docmd.c ex_cmds.h - -$(OBJDIR)\ex_eval.obj: ex_eval.c ex_cmds.h - -$(OBJDIR)\if_ole.obj: if_ole.cpp - -$(OBJDIR)\if_lua.obj: if_lua.c lua.lib - $(CC) $(CCARG) $(CC1) $(CC2)$@ -pc if_lua.c - -$(OBJDIR)\if_perl.obj: auto/if_perl.c perl.lib - $(CC) $(CCARG) $(CC1) $(CC2)$@ -pc auto/if_perl.c - -auto/if_perl.c: if_perl.xs typemap - $(PERL)\bin\perl.exe $(PERL)\lib\ExtUtils\xsubpp -prototypes -typemap \ - $(PERL)\lib\ExtUtils\typemap if_perl.xs -output $@ - -$(OBJDIR)\if_python.obj: if_python.c if_py_both.h python.lib - $(CC) -I$(PYTHON)\include $(CCARG) $(CC1) $(CC2)$@ -pc if_python.c - -$(OBJDIR)\if_python3.obj: if_python3.c if_py_both.h python3.lib - $(CC) -I$(PYTHON3)\include $(CCARG) $(CC1) $(CC2)$@ -pc if_python3.c - -$(OBJDIR)\if_ruby.obj: if_ruby.c ruby.lib - $(CC) $(CCARG) $(CC1) $(CC2)$@ -pc if_ruby.c - -$(OBJDIR)\if_tcl.obj: if_tcl.c tcl.lib - $(CC) $(CCARG) $(CC1) $(CC2)$@ -pc if_tcl.c - -$(OBJDIR)\xpm_w32.obj: xpm_w32.c xpm.lib - $(CC) $(CCARG) $(CC1) $(CC2)$@ -pc xpm_w32.c - -$(OBJDIR)\netbeans.obj: netbeans.c $(NBDEBUG_DEP) - $(CC) $(CCARG) $(CC1) $(CC2)$@ netbeans.c - -$(OBJDIR)\channel.obj: channel.c - $(CC) $(CCARG) $(CC1) $(CC2)$@ channel.c - -$(OBJDIR)\vim.res: vim.rc version.h tools.bmp tearoff.bmp \ - vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico - $(BRC) -fo$(OBJDIR)\vim.res -i $(BOR)\include -w32 -r vim.rc @&&| - $(DEFINES) -| - -$(OBJDIR)\pathdef.obj: auto\pathdef.c - $(CC) $(CCARG) $(CC1) $(CC2)$@ auto\pathdef.c - - -# Need to escape both quotes and backslashes in $INTERP_DEFINES -INTERP_DEFINES_ESC_BKS=$(INTERP_DEFINES:\=\\) -INTERP_DEFINES_ESC=$(INTERP_DEFINES_ESC_BKS:"=\") - -# Note: the silly /*"*/ below are there to trick make into accepting -# the # character as something other than a comment without messing up -# the preprocessor directive. -auto\pathdef.c:: - -@md auto - @echo creating auto/pathdef.c - @copy /y &&| -/* pathdef.c */ -/*"*/#include "vim.h"/*"*/ - -char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)"; -char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR:\=\\)"; -char_u *all_cflags = (char_u *)"$(CC:\=\\) $(CFLAGS:\=\\) $(DEFINES) $(MBDEFINES) $(INTERP_DEFINES_ESC) $(OPT) $(EXETYPE) $(CPUARG) $(ALIGNARG) $(DEBUG_FLAG) $(CODEGUARD_FLAG)"; -char_u *all_lflags = (char_u *)"$(LINK:\=\\) $(LFLAGS:\=\\)"; -char_u *compiled_user = (char_u *)"$(USERNAME)"; -char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; -| auto\pathdef.c - -lua.lib: $(LUA)\lib\lua$(LUA_VER).lib - coff2omf $(LUA)\lib\lua$(LUA_VER).lib $@ - -perl.lib: $(PERL)\lib\CORE\perl$(PERL_VER).lib - coff2omf $(PERL)\lib\CORE\perl$(PERL_VER).lib $@ - -python.lib: $(PYTHON)\libs\python$(PYTHON_VER).lib - coff2omf $(PYTHON)\libs\python$(PYTHON_VER).lib $@ - -python3.lib: $(PYTHON3)\libs\python$(PYTHON3_VER).lib - coff2omf $(PYTHON3)\libs\python$(PYTHON3_VER).lib $@ - -ruby.lib: $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib - coff2omf $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib $@ - -# For some reason, the coff2omf method doesn't work on libXpm.lib, so -# we have to manually generate an import library straight from the DLL. -xpm.lib: $(XPM)\lib\libXpm.lib - implib -a $@ $(XPM)\bin\libXpm.dll - -tcl.lib: $(TCL_LIB) -!if ("$(DYNAMIC_TCL)" == "yes") - copy $(TCL_LIB) $@ -!else - coff2omf $(TCL_LIB) $@ -!endif - -!if ("$(DYNAMIC_TCL)" == "yes") -tclstub$(TCL_VER)-bor.lib: - -@IF NOT EXIST $@ ECHO You must download tclstub$(TCL_VER)-bor.lib separately and\ - place it in the src directory in order to compile a dynamic TCL-enabled\ - (g)vim with the Borland compiler. You can get the tclstub$(TCL_VER)-bor.lib file\ - at http://mywebpage.netscape.com/sharppeople/vim/tclstub$(TCL_VER)-bor.lib -!endif - -# vimrun.exe: -vimrun.exe: vimrun.c -!if ("$(USEDLL)"=="yes") - $(CC) -WC -O1 -I$(INCLUDE) -L$(LIB) -D_RTLDLL vimrun.c cw32mti.lib -!else - $(CC) -WC -O1 -I$(INCLUDE) -L$(LIB) vimrun.c -!endif - -# The dependency on $(OBJDIR) is to have bcc.cfg generated each time. -$(OBJDIR)\bcc.cfg: Make_bc5.mak $(OBJDIR) - copy /y &&| - $(CFLAGS) - -L$(LIB) - $(DEFINES) - $(MBDEFINES) - $(INTERP_DEFINES) - $(EXETYPE) - $(DEBUG_FLAG) - $(OPT) - $(CODEGUARD_FLAG) - $(CPUARG) - $(ALIGNARG) -| $@ - -# vi:set sts=4 sw=4: - diff --git a/src/dosinst.c b/src/dosinst.c index ca74758e0f..b975ff8bbc 100644 --- a/src/dosinst.c +++ b/src/dosinst.c @@ -10,7 +10,7 @@ /* * dosinst.c: Install program for Vim on MS-DOS and MS-Windows * - * Compile with Make_mvc.mak, Make_bc3.mak, Make_bc5.mak or Make_djg.mak. + * Compile with Make_mvc.mak, Make_cyg.mak or Make_ming.mak. */ /* diff --git a/src/dosinst.h b/src/dosinst.h index 7f30e90f4b..7cb4139a09 100644 --- a/src/dosinst.h +++ b/src/dosinst.h @@ -47,11 +47,7 @@ char *searchpath(char *name); #if defined(UNIX_LINT) # define vim_mkdir(x, y) mkdir((char *)(x), y) #else -# ifndef __BORLANDC__ -# define vim_mkdir(x, y) _mkdir((char *)(x)) -# else -# define vim_mkdir(x, y) mkdir((char *)(x)) -# endif +# define vim_mkdir(x, y) _mkdir((char *)(x)) #endif #define sleep(n) Sleep((n) * 1000) @@ -150,10 +146,6 @@ is_64bit_os(void) #endif } -#ifdef __BORLANDC__ -/* Borland defines its own searchpath() in dir.h */ -# include -#else static char * searchpath(char *name) { @@ -173,7 +165,6 @@ searchpath(char *name) } return NULL; } -#endif /* * Call searchpath() and save the result in allocated memory, or return NULL. @@ -463,12 +454,6 @@ mch_chdir(char *path) /* * Expand the executable name into a full path name. */ -#if defined(__BORLANDC__) - -/* Only Borland C++ has this. */ -# define my_fullpath(b, n, l) _fullpath(b, n, l) - -#else static char * my_fullpath(char *buf, char *fname, int len) { @@ -478,7 +463,6 @@ my_fullpath(char *buf, char *fname, int len) return (len_read > 0 && len_read < (DWORD)len) ? buf : NULL; } -#endif /* * Remove the tail from a file or directory name. diff --git a/src/evalfunc.c b/src/evalfunc.c index 267683268f..f3b1fafb98 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -12500,16 +12500,8 @@ f_sinh(typval_T *argvars, typval_T *rettv) } #endif -static int -#ifdef __BORLANDC__ - _RTLENTRYF -#endif - item_compare(const void *s1, const void *s2); -static int -#ifdef __BORLANDC__ - _RTLENTRYF -#endif - item_compare2(const void *s1, const void *s2); +static int item_compare(const void *s1, const void *s2); +static int item_compare2(const void *s1, const void *s2); /* struct used in the array that's given to qsort() */ typedef struct @@ -12540,9 +12532,6 @@ static sortinfo_T *sortinfo = NULL; * Compare functions for f_sort() and f_uniq() below. */ static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif item_compare(const void *s1, const void *s2) { sortItem_T *si1, *si2; @@ -12627,9 +12616,6 @@ item_compare(const void *s1, const void *s2) } static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif item_compare2(const void *s1, const void *s2) { sortItem_T *si1, *si2; diff --git a/src/ex_cmds.c b/src/ex_cmds.c index ebfcf54537..8da5dfd7ca 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -29,11 +29,7 @@ static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing); static int check_readonly(int *forceit, buf_T *buf); static void delbuf_msg(char_u *name); -static int -#ifdef __BORLANDC__ - _RTLENTRYF -#endif - help_compare(const void *s1, const void *s2); +static int help_compare(const void *s1, const void *s2); static void prepare_help_buffer(void); /* @@ -314,16 +310,9 @@ typedef struct } st_u; } sorti_T; -static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -sort_compare(const void *s1, const void *s2); +static int sort_compare(const void *s1, const void *s2); static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif sort_compare(const void *s1, const void *s2) { sorti_T l1 = *(sorti_T *)s1; @@ -6580,9 +6569,6 @@ help_heuristic( * that has been put after the tagname by find_tags(). */ static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif help_compare(const void *s1, const void *s2) { char *p1; diff --git a/src/ex_getln.c b/src/ex_getln.c index b2b6f534a2..f1c30a2d9d 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -125,11 +125,7 @@ static int open_cmdwin(void); #endif #if defined(FEAT_CMDL_COMPL) || defined(PROTO) -static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -sort_func_compare(const void *s1, const void *s2); +static int sort_func_compare(const void *s1, const void *s2); #endif @@ -3803,9 +3799,6 @@ ccheck_abbr(int c) #if defined(FEAT_CMDL_COMPL) || defined(PROTO) static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif sort_func_compare(const void *s1, const void *s2) { char_u *p1 = *(char_u **)s1; @@ -6855,9 +6848,6 @@ concat_history(int type) #if defined(FEAT_CMDL_COMPL) || defined(PROTO) static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif sort_hist(const void *s1, const void *s2) { histentry_T *p1 = *(histentry_T **)s1; diff --git a/src/gui_w32.c b/src/gui_w32.c index 8d28148808..5961830737 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -1303,9 +1303,6 @@ gui_mch_def_colors(void) int gui_mch_open(void) { -#ifndef SW_SHOWDEFAULT -# define SW_SHOWDEFAULT 10 /* Borland 5.0 doesn't have it */ -#endif /* Actually open the window, if not already visible * (may be done already in gui_mch_set_shellsize) */ if (!IsWindowVisible(s_hwnd)) @@ -3799,9 +3796,6 @@ _OnScroll( * Add a lot of missing defines. * They are not always missing, we need the #ifndef's. */ -# ifndef _cdecl -# define _cdecl -# endif # ifndef IsMinimized # define IsMinimized(hwnd) IsIconic(hwnd) # endif @@ -5521,7 +5515,7 @@ gui_mch_set_sp_color(guicolor_T color) * First static functions (no prototypes generated). */ # ifdef _MSC_VER -# include /* Apparently not needed for Cygwin, MingW or Borland. */ +# include /* Apparently not needed for Cygwin or MinGW. */ # endif # include @@ -6272,15 +6266,6 @@ gui_mch_draw_string( void gui_mch_flush(void) { -# if defined(__BORLANDC__) - /* - * The GdiFlush declaration (in Borland C 5.01 ) is not a - * prototype declaration. - * The compiler complains if __stdcall is not used in both declarations. - */ - BOOL __stdcall GdiFlush(void); -# endif - #if defined(FEAT_DIRECTX) if (IS_ENABLE_DIRECTX()) DWriteContext_Flush(s_dwc); diff --git a/src/if_ole.cpp b/src/if_ole.cpp index 8780847ad8..e52f5ec784 100644 --- a/src/if_ole.cpp +++ b/src/if_ole.cpp @@ -12,24 +12,14 @@ * * See os_mswin.c for the client side. */ - -/* - * We have some trouble with order of includes here. For Borland it needs to - * be different from MSVC... - */ -#ifndef __BORLANDC__ extern "C" { # include "vim.h" } -#endif #include #include extern "C" { -#ifdef __BORLANDC__ -# include "vim.h" -#endif extern HWND s_hwnd; extern HWND vim_parent_hwnd; } diff --git a/src/if_py_both.h b/src/if_py_both.h index 498972d548..4e1a42a3cf 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -13,11 +13,6 @@ * Common code for if_python.c and if_python3.c. */ -#ifdef __BORLANDC__ -/* Disable Warning W8060: Possibly incorrect assignment in function ... */ -# pragma warn -8060 -#endif - static char_u e_py_systemexit[] = "E880: Can't handle SystemExit of %s exception in vim"; #if PY_VERSION_HEX < 0x02050000 diff --git a/src/main.c b/src/main.c index 6d30143a3c..d01cf9b073 100644 --- a/src/main.c +++ b/src/main.c @@ -98,9 +98,6 @@ __declspec(dllexport) # endif int # ifdef MSWIN -# ifdef __BORLANDC__ -_cdecl -# endif VimMain # else main diff --git a/src/mark.c b/src/mark.c index 1b34c20895..eb365416d8 100644 --- a/src/mark.c +++ b/src/mark.c @@ -1950,9 +1950,6 @@ write_viminfo_marks(FILE *fp_out, garray_T *buflist) * Compare functions for qsort() below, that compares b_last_used. */ static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif buf_compare(const void *s1, const void *s2) { buf_T *buf1 = *(buf_T **)s1; diff --git a/src/message.c b/src/message.c index 7c256585dc..0ddff8b310 100644 --- a/src/message.c +++ b/src/message.c @@ -357,9 +357,6 @@ trunc_string( int vim_snprintf(char *str, size_t str_m, const char *fmt, ...); int -# ifdef __BORLANDC__ -_RTLENTRYF -# endif smsg(const char *s, ...) { va_list arglist; @@ -371,9 +368,6 @@ smsg(const char *s, ...) } int -# ifdef __BORLANDC__ -_RTLENTRYF -# endif smsg_attr(int attr, const char *s, ...) { va_list arglist; @@ -385,9 +379,6 @@ smsg_attr(int attr, const char *s, ...) } int -# ifdef __BORLANDC__ -_RTLENTRYF -# endif smsg_attr_keep(int attr, const char *s, ...) { va_list arglist; @@ -3091,7 +3082,7 @@ mch_msg(char *str) (isatty(2) && strcmp("/dev/console", ttyname(2)) != 0) # else isatty(2) -# endif +# endif # ifdef FEAT_GUI || # endif diff --git a/src/misc1.c b/src/misc1.c index 3797094755..a1c9a82711 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -5626,18 +5626,11 @@ static int expand_backtick(garray_T *gap, char_u *pat, int flags); * File name expansion code for MS-DOS, Win16 and Win32. It's here because * it's shared between these systems. */ -# if defined(PROTO) -# define _cdecl -# else -# ifdef __BORLANDC__ -# define _cdecl _RTLENTRYF -# endif -# endif /* * comparison function for qsort in dos_expandpath() */ - static int _cdecl + static int pstrcmp(const void *a, const void *b) { return (pathcmp(*(char **)a, *(char **)b, -1)); diff --git a/src/misc2.c b/src/misc2.c index 3ef7c94222..f9f6bf58e8 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -3912,16 +3912,9 @@ qsort( /* * Sort an array of strings. */ -static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -sort_compare(const void *s1, const void *s2); +static int sort_compare(const void *s1, const void *s2); static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif sort_compare(const void *s1, const void *s2) { return STRCMP(*(char **)s1, *(char **)s2); diff --git a/src/normal.c b/src/normal.c index 8d4cf09379..e297a2e77b 100644 --- a/src/normal.c +++ b/src/normal.c @@ -27,11 +27,7 @@ static int restart_VIsual_select = 0; #ifdef FEAT_EVAL static void set_vcount_ca(cmdarg_T *cap, int *set_prevcount); #endif -static int -#ifdef __BORLANDC__ - _RTLENTRYF -#endif - nv_compare(const void *s1, const void *s2); +static int nv_compare(const void *s1, const void *s2); static void op_colon(oparg_T *oap); static void op_function(oparg_T *oap); #if defined(FEAT_MOUSE) @@ -422,9 +418,6 @@ static int nv_max_linear; * through the index in nv_cmd_idx[]. */ static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif nv_compare(const void *s1, const void *s2) { int c1, c2; diff --git a/src/option.c b/src/option.c index 657c011b1f..a9b9780792 100644 --- a/src/option.c +++ b/src/option.c @@ -12561,11 +12561,6 @@ compatible_set(void) #ifdef FEAT_LINEBREAK -# if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) - /* Borland C++ screws up loop optimisation here (negri) */ - #pragma option -O-l -# endif - /* * fill_breakat_flags() -- called when 'breakat' changes value. */ @@ -12582,11 +12577,6 @@ fill_breakat_flags(void) for (p = p_breakat; *p; p++) breakat_flags[*p] = TRUE; } - -# if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) - #pragma option -O.l -# endif - #endif /* diff --git a/src/os_mswin.c b/src/os_mswin.c index 9179e9b2d9..fc6806d88b 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -172,26 +172,6 @@ int _chdrive(int drive) return !SetCurrentDirectory(temp); } # endif -#else -# ifdef __BORLANDC__ -/* being a more ANSI compliant compiler, BorlandC doesn't define _stricoll: - * but it does in BC 5.02! */ -# if __BORLANDC__ < 0x502 -int _stricoll(char *a, char *b) -{ -# if 1 - // this is fast but not correct: - return stricmp(a, b); -# else - // the ANSI-ish correct way is to use strxfrm(): - char a_buff[512], b_buff[512]; // file names, so this is enough on Win32 - strxfrm(a_buff, a, 512); - strxfrm(b_buff, b, 512); - return strcoll(a_buff, b_buff); -# endif -} -# endif -# endif #endif @@ -374,30 +354,22 @@ mch_FullName( int force UNUSED) { int nResult = FAIL; + WCHAR *wname; + WCHAR wbuf[MAX_PATH]; + char_u *cname = NULL; -#ifdef __BORLANDC__ - if (*fname == NUL) /* Borland behaves badly here - make it consistent */ - nResult = mch_dirname(buf, len); - else -#endif + wname = enc_to_utf16(fname, NULL); + if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH) != NULL) { - WCHAR *wname; - WCHAR wbuf[MAX_PATH]; - char_u *cname = NULL; - - wname = enc_to_utf16(fname, NULL); - if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH) != NULL) + cname = utf16_to_enc((short_u *)wbuf, NULL); + if (cname != NULL) { - cname = utf16_to_enc((short_u *)wbuf, NULL); - if (cname != NULL) - { - vim_strncpy(buf, cname, len - 1); - nResult = OK; - } + vim_strncpy(buf, cname, len - 1); + nResult = OK; } - vim_free(wname); - vim_free(cname); } + vim_free(wname); + vim_free(cname); #ifdef USE_FNAME_CASE fname_case(buf, len); @@ -2044,9 +2016,6 @@ serverSendEnc(HWND target) * Clean up on exit. This destroys the hidden message window. */ static void -#ifdef __BORLANDC__ - _RTLENTRYF -#endif CleanUpMessaging(void) { if (message_window != 0) diff --git a/src/os_w32exe.c b/src/os_w32exe.c index efdbc96f75..c4f02949db 100644 --- a/src/os_w32exe.c +++ b/src/os_w32exe.c @@ -15,19 +15,13 @@ */ #include "vim.h" -#ifdef __MINGW32__ -# ifndef _cdecl -# define _cdecl -# endif -#endif - // cproto doesn't create a prototype for VimMain() #ifdef VIMDLL __declspec(dllimport) #endif -int _cdecl VimMain(int argc, char **argv); +int VimMain(int argc, char **argv); #ifndef VIMDLL -void _cdecl SaveInst(HINSTANCE hInst); +void SaveInst(HINSTANCE hInst); #endif #ifndef PROTO diff --git a/src/os_win32.c b/src/os_win32.c index cbb09af5ff..54ca4de7d4 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -146,11 +146,6 @@ typedef int LPSECURITY_ATTRIBUTES; # define __stdcall /* empty */ #endif -#if defined(__BORLANDC__) -/* Strangely Borland uses a non-standard name. */ -# define wcsicmp(a, b) wcscmpi((a), (b)) -#endif - #if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) /* Win32 Console handles for input and output */ static HANDLE g_hConIn = INVALID_HANDLE_VALUE; @@ -941,9 +936,6 @@ static const struct /* The return code indicates key code size. */ static int -#ifdef __BORLANDC__ - __stdcall -#endif win32_kbd_patch_key( KEY_EVENT_RECORD *pker) { @@ -6695,8 +6687,6 @@ getout: int mch_open(const char *name, int flags, int mode) { - /* _wopen() does not work with Borland C 5.5: creates a read-only file. */ -#ifndef __BORLANDC__ WCHAR *wn; int f; @@ -6707,16 +6697,6 @@ mch_open(const char *name, int flags, int mode) f = _wopen(wn, flags, mode); vim_free(wn); return f; -#else - /* open() can open a file which name is longer than _MAX_PATH bytes - * and shorter than _MAX_PATH characters successfully, but sometimes it - * causes unexpected error in another part. We make it an error explicitly - * here. */ - if (strlen(name) >= _MAX_PATH) - return -1; - - return open(name, flags, mode); -#endif } /* diff --git a/src/os_win32.h b/src/os_win32.h index ea1018256d..2169bd3115 100644 --- a/src/os_win32.h +++ b/src/os_win32.h @@ -53,12 +53,10 @@ #define FEAT_SHORTCUT /* resolve shortcuts */ -#if (!defined(__BORLANDC__) || __BORLANDC__ >= 0x550) \ - && (!defined(_MSC_VER) || _MSC_VER > 1020) +#if (!defined(_MSC_VER) || _MSC_VER > 1020) /* * Access Control List (actually security info). - * Borland has the acl stuff only in version 5.5 and later. - * MSVC in 5.0, not in 4.2, don't know about 4.3. + * MSVC has acl stuff only in 5.0, not in 4.2, don't know about 4.3. */ # define HAVE_ACL #endif @@ -142,8 +140,8 @@ # define IO_REPARSE_TAG_SYMLINK 0xA000000C #endif -#if defined(_MSC_VER) || defined(__BORLANDC__) - /* Support for __try / __except. All versions of MSVC and Borland C are +#if defined(_MSC_VER) + /* Support for __try / __except. All versions of MSVC are * expected to have this. Any other compilers that support it? */ # define HAVE_TRY_EXCEPT 1 # include /* for _resetstkoflw() */ @@ -206,11 +204,7 @@ Trace(char *pszFormat, ...); # define HAVE_SETENV #endif #define mch_getenv(x) (char_u *)getenv((char *)(x)) -#ifdef __BORLANDC__ -# define vim_mkdir(x, y) mkdir(x) -#else -# define vim_mkdir(x, y) mch_mkdir(x) -#endif +#define vim_mkdir(x, y) mch_mkdir(x) /* Enable common dialogs input unicode from IME if possible. */ #define pDispatchMessage DispatchMessageW diff --git a/src/proto.h b/src/proto.h index e34af85007..80272327c3 100644 --- a/src/proto.h +++ b/src/proto.h @@ -42,8 +42,7 @@ # include "os_win32.pro" # include "os_mswin.pro" # include "winclip.pro" -# if (defined(__GNUC__) && !defined(__MINGW32__)) \ - || (defined(__BORLANDC__) && __BORLANDC__ < 0x502) +# if (defined(__GNUC__) && !defined(__MINGW32__)) extern int _stricoll(char *a, char *b); # endif # endif @@ -108,73 +107,45 @@ extern int _stricoll(char *a, char *b); # endif /* These prototypes cannot be produced automatically. */ -int -# ifdef __BORLANDC__ -_RTLENTRYF -# endif -smsg(const char *, ...) +int smsg(const char *, ...) #ifdef USE_PRINTF_FORMAT_ATTRIBUTE __attribute__((format(printf, 1, 0))) #endif ; -int -# ifdef __BORLANDC__ -_RTLENTRYF -# endif -smsg_attr(int, const char *, ...) +int smsg_attr(int, const char *, ...) #ifdef USE_PRINTF_FORMAT_ATTRIBUTE __attribute__((format(printf, 2, 3))) #endif ; -int -# ifdef __BORLANDC__ -_RTLENTRYF -# endif -smsg_attr_keep(int, const char *, ...) +int smsg_attr_keep(int, const char *, ...) #ifdef USE_PRINTF_FORMAT_ATTRIBUTE __attribute__((format(printf, 2, 3))) #endif ; /* These prototypes cannot be produced automatically. */ -int -# ifdef __BORLANDC__ -_RTLENTRYF -# endif -semsg(const char *, ...) +int semsg(const char *, ...) #ifdef USE_PRINTF_FORMAT_ATTRIBUTE __attribute__((format(printf, 1, 0))) #endif ; /* These prototypes cannot be produced automatically. */ -void -# ifdef __BORLANDC__ -_RTLENTRYF -# endif -siemsg(const char *, ...) +void siemsg(const char *, ...) #ifdef USE_PRINTF_FORMAT_ATTRIBUTE __attribute__((format(printf, 1, 0))) #endif ; -int -# ifdef __BORLANDC__ -_RTLENTRYF -# endif -vim_snprintf_add(char *, size_t, const char *, ...) +int vim_snprintf_add(char *, size_t, const char *, ...) #ifdef USE_PRINTF_FORMAT_ATTRIBUTE __attribute__((format(printf, 3, 4))) #endif ; -int -# ifdef __BORLANDC__ -_RTLENTRYF -# endif -vim_snprintf(char *, size_t, const char *, ...) +int vim_snprintf(char *, size_t, const char *, ...) #ifdef USE_PRINTF_FORMAT_ATTRIBUTE __attribute__((format(printf, 3, 4))) #endif @@ -209,7 +180,7 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void # endif # include "search.pro" # ifdef FEAT_SIGNS -# include "sign.pro" +# include "sign.pro" # endif # include "spell.pro" # include "spellfile.pro" @@ -337,13 +308,7 @@ extern char *vim_SelFile(Widget toplevel, char *prompt, char *init_path, int (*s */ #if defined(FEAT_PERL) && !defined(IN_PERL_FILE) # define CV void -# ifdef __BORLANDC__ - #pragma option -pc -# endif # include "if_perl.pro" -# ifdef __BORLANDC__ - #pragma option -p. -# endif # include "if_perlsfio.pro" #endif @@ -357,8 +322,4 @@ int clip_mch_own_selection(VimClipboard *cbd); void clip_mch_request_selection(VimClipboard *cbd); void clip_mch_set_selection(VimClipboard *cbd); #endif - -#ifdef __BORLANDC__ -# define _PROTO_H -#endif #endif /* !PROTO && !NOPROTO */ diff --git a/src/screen.c b/src/screen.c index e56d2bc018..3ebc244f58 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2945,9 +2945,6 @@ static textprop_T *current_text_props = NULL; static buf_T *current_buf = NULL; static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif text_prop_compare(const void *s1, const void *s2) { int idx1, idx2; diff --git a/src/spell.c b/src/spell.c index 947bee5187..8f32fd7c3a 100644 --- a/src/spell.c +++ b/src/spell.c @@ -6760,20 +6760,13 @@ rescore_one(suginfo_T *su, suggest_T *stp) } } -static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -sug_compare(const void *s1, const void *s2); +static int sug_compare(const void *s1, const void *s2); /* * Function given to qsort() to sort the suggestions on st_score. * First on "st_score", then "st_altscore" then alphabetically. */ static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif sug_compare(const void *s1, const void *s2) { suggest_T *p1 = (suggest_T *)s1; diff --git a/src/spellfile.c b/src/spellfile.c index 00f6b7cb81..2616afbbb1 100644 --- a/src/spellfile.c +++ b/src/spellfile.c @@ -4802,19 +4802,12 @@ node_equal(wordnode_T *n1, wordnode_T *n2) return p1 == NULL && p2 == NULL; } -static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif -rep_compare(const void *s1, const void *s2); +static int rep_compare(const void *s1, const void *s2); /* * Function given to qsort() to sort the REP items on "from" string. */ static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif rep_compare(const void *s1, const void *s2) { fromto_T *p1 = (fromto_T *)s1; diff --git a/src/syntax.c b/src/syntax.c index b4925050a1..537794a2d8 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -5348,9 +5348,6 @@ syn_cmd_region( * A simple syntax group ID comparison function suitable for use in qsort() */ static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif syn_compare_stub(const void *v1, const void *v2) { const short *s1 = v1; @@ -6703,9 +6700,6 @@ typedef struct } time_entry_T; static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif syn_compare_syntime(const void *v1, const void *v2) { const time_entry_T *s1 = v1; diff --git a/src/userfunc.c b/src/userfunc.c index bd7d2f7d81..28cf8b8a0f 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -55,16 +55,8 @@ static char *e_nofunc = N_("E130: Unknown function: %s"); static void func_do_profile(ufunc_T *fp); static void prof_sort_list(FILE *fd, ufunc_T **sorttab, int st_len, char *title, int prefer_self); static void prof_func_line(FILE *fd, int count, proftime_T *total, proftime_T *self, int prefer_self); -static int -# ifdef __BORLANDC__ - _RTLENTRYF -# endif - prof_total_cmp(const void *s1, const void *s2); -static int -# ifdef __BORLANDC__ - _RTLENTRYF -# endif - prof_self_cmp(const void *s1, const void *s2); +static int prof_total_cmp(const void *s1, const void *s2); +static int prof_self_cmp(const void *s1, const void *s2); #endif static void funccal_unref(funccall_T *fc, ufunc_T *fp, int force); @@ -2794,9 +2786,6 @@ prof_func_line( * Compare function for total time sorting. */ static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif prof_total_cmp(const void *s1, const void *s2) { ufunc_T *p1, *p2; @@ -2810,9 +2799,6 @@ prof_total_cmp(const void *s1, const void *s2) * Compare function for self time sorting. */ static int -#ifdef __BORLANDC__ -_RTLENTRYF -#endif prof_self_cmp(const void *s1, const void *s2) { ufunc_T *p1, *p2; diff --git a/src/version.c b/src/version.c index 182a43a53d..3b9ef3236d 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1306, /**/ 1305, /**/ diff --git a/src/vim.h b/src/vim.h index 2c9149b69a..05ad07ff6b 100644 --- a/src/vim.h +++ b/src/vim.h @@ -17,24 +17,6 @@ # define MSWIN #endif -// use fastcall for Borland, when compiling for MS-Windows -#if defined(__BORLANDC__) && defined(MSWIN) && !defined(DEBUG) -#if defined(FEAT_PERL) || \ - defined(FEAT_PYTHON) || \ - defined(FEAT_PYTHON3) || \ - defined(FEAT_RUBY) || \ - defined(FEAT_TCL) || \ - defined(FEAT_MZSCHEME) || \ - defined(DYNAMIC_GETTEXT) || \ - defined(DYNAMIC_ICONV) || \ - defined(DYNAMIC_IME) || \ - defined(XPM) - #pragma option -pc -# else - #pragma option -pr -# endif -#endif - #ifdef MSWIN # include "vimio.h" #endif @@ -2163,11 +2145,6 @@ typedef enum { # define BROWSE_DIR 2 /* flag for do_browse() */ #endif -/* stop using fastcall for Borland */ -#if defined(__BORLANDC__) && defined(MSWIN) && !defined(DEBUG) - #pragma option -p. -#endif - #ifdef _MSC_VER /* Avoid useless warning "conversion from X to Y of greater size". */ #pragma warning(disable : 4312) @@ -2344,9 +2321,6 @@ typedef enum { # undef FF # undef OP_DELETE # undef OP_JOIN -# ifdef __BORLANDC__ -# define NOPROTO 1 -# endif /* remove MAX and MIN, included by glib.h, redefined by sys/param.h */ # ifdef MAX # undef MAX @@ -2374,10 +2348,6 @@ typedef enum { # undef bool # endif -# ifdef __BORLANDC__ - /* Borland has the structure stati64 but not _stati64 */ -# define _stati64 stati64 -# endif #endif /* values for vim_handle_signal() that are not a signal */ diff --git a/src/vim.rc b/src/vim.rc index 195536c036..726cb96409 100644 --- a/src/vim.rc +++ b/src/vim.rc @@ -12,11 +12,7 @@ #include #include "version.h" #include "gui_w32_rc.h" -// #if defined(__BORLANDC__) || defined(__CYGWIN32__) || defined(__MINGW32__) -# include -// #else -// # include -// #endif +#include // // Icons diff --git a/src/vimrun.c b/src/vimrun.c index 13efd911e5..ece20f8392 100644 --- a/src/vimrun.c +++ b/src/vimrun.c @@ -23,11 +23,6 @@ #endif #include -#ifdef __BORLANDC__ -# define _kbhit kbhit -# define _getch getch -#endif - int main(void) { diff --git a/src/xxd/Make_bc5.mak b/src/xxd/Make_bc5.mak deleted file mode 100644 index 4f446223e7..0000000000 --- a/src/xxd/Make_bc5.mak +++ /dev/null @@ -1,18 +0,0 @@ -# The most simplistic Makefile for Win32 (NT and Windows 95). -# Used for Borland C++. - -!if ("$(BOR)"=="") -BOR = c:\bc5 -!endif -!if ("$(BCC)"=="") -BCC = bcc32 -!endif - -xxd: xxd.exe - -xxd.exe: xxd.c - $(BCC) -I$(BOR)\include -L$(BOR)\lib -DWIN32 xxd.c $(BOR)\lib\wildargs.obj - -clean: - - del xxd.obj - - del xxd.exe diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index b9f6041ba0..f2192cf0d9 100644 --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -81,7 +81,7 @@ #else # include #endif -#if defined(WIN32) || defined(__BORLANDC__) || defined(CYGWIN) +#if defined(WIN32) || defined(CYGWIN) # include /* for setmode() */ #else # ifdef UNIX @@ -96,12 +96,6 @@ # include /* for fdopen() on MAC */ #endif -#if defined(__BORLANDC__) && __BORLANDC__ <= 0x0410 && !defined(fileno) -/* Missing define and prototype grabbed from the BC 4.0 */ -# define fileno(f) ((f)->fd) -FILE _FAR *_Cdecl _FARFUNC fdopen(int __handle, char _FAR *__type); -#endif - /* This corrects the problem of missing prototypes for certain functions * in some GNU installations (e.g. SunOS 4.1.x). @@ -190,7 +184,7 @@ char osver[] = ""; #endif #ifndef __P -# if defined(__STDC__) || defined(WIN32) || defined(__BORLANDC__) +# if defined(__STDC__) || defined(WIN32) # define __P(a) a # else # define __P(a) () From d4aa83af1d691fdabbc8e6aab36db2c96ea4d4b6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 18:59:31 +0200 Subject: [PATCH 37/97] patch 8.1.1307: cannot reconnect to the X server after it restarted Problem: Cannot reconnect to the X server after it restarted. Solution: Add the :xrestore command. (Adrian Kocis, closes #844) --- runtime/doc/index.txt | 1 + runtime/doc/various.txt | 15 +++++++++++++++ src/ex_cmdidxs.h | 8 ++++---- src/ex_cmds.h | 3 +++ src/ex_docmd.c | 3 +++ src/globals.h | 11 ++++++++--- src/os_unix.c | 25 ++++++++++++++++++++++++- src/proto/os_unix.pro | 1 + src/testdir/test_paste.vim | 26 ++++++++++++++++++++++++++ src/version.c | 2 ++ 10 files changed, 87 insertions(+), 8 deletions(-) diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 792a71569e..8437f2410b 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1714,6 +1714,7 @@ tag command action ~ |:xmapclear| :xmapc[lear] remove all mappings for Visual mode |:xmap| :xm[ap] like ":map" but for Visual mode |:xmenu| :xme[nu] add menu for Visual mode +|:xrestore| :xr[estore] restores the X server connection |:xnoremap| :xn[oremap] like ":noremap" but for Visual mode |:xnoremenu| :xnoreme[nu] like ":noremenu" but for Visual mode |:xunmap| :xu[nmap] like ":unmap" but for Visual mode diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 79889276a5..9b61e8b2c3 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -704,6 +704,21 @@ K Run a program to lookup the keyword under the available when compiled with the |+netbeans_intg| feature} + *:xrestore* *:xr* +:xr[estore] [display] Reinitializes the connection to the X11 server. Useful + after the X server restarts, e.g. when running Vim for + long time inside screen/tmux and connecting from + different machines). + [display] should be in the format of the $DISPLAY + environment variable (e.g. "localhost:10.0") + If [display] is omitted, then it reinitializes the + connection to the X11 server using the same value as + was used for the previous execution of this command. + If the value was never specified, then it uses the + value of $DISPLAY environment variable as it was when + Vim was started. + {only available when compiled with the |+clipboard| + feature} *g_CTRL-A* g CTRL-A Only when Vim was compiled with MEM_PROFILING defined diff --git a/src/ex_cmdidxs.h b/src/ex_cmdidxs.h index 6b96c6cfa1..0103a1741a 100644 --- a/src/ex_cmdidxs.h +++ b/src/ex_cmdidxs.h @@ -29,8 +29,8 @@ static const unsigned short cmdidxs1[26] = /* v */ 503, /* w */ 521, /* x */ 535, - /* y */ 544, - /* z */ 545 + /* y */ 545, + /* z */ 546 }; /* @@ -64,9 +64,9 @@ static const unsigned char cmdidxs2[26][26] = /* u */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* v */ { 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 9, 12, 0, 0, 0, 0, 15, 0, 16, 0, 0, 0, 0, 0 }, /* w */ { 2, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 8, 0, 9, 10, 0, 0, 0, 12, 13, 0, 0, 0, 0 }, - /* x */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0 }, + /* x */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 0, 0, 0, 7, 0, 0, 8, 0, 0, 0, 0, 0 }, /* y */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -static const int command_count = 558; +static const int command_count = 559; diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 37577f7b30..5ec69be364 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -1739,6 +1739,9 @@ EX(CMD_xnoremap, "xnoremap", ex_map, EX(CMD_xnoremenu, "xnoremenu", ex_menu, RANGE|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, ADDR_OTHER), +EX(CMD_xrestore, "xrestore", ex_xrestore, + EXTRA|TRLBAR|CMDWIN, + ADDR_NONE), EX(CMD_xunmap, "xunmap", ex_unmap, EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, ADDR_NONE), diff --git a/src/ex_docmd.c b/src/ex_docmd.c index a2b302d922..16f505967d 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -394,6 +394,9 @@ static void ex_folddo(exarg_T *eap); #ifndef FEAT_TERMINAL # define ex_terminal ex_ni #endif +#if !defined(FEAT_X11) || !defined(FEAT_XCLIPBOARD) +# define ex_xrestore ex_ni +#endif /* * Declare cmdnames[]. diff --git a/src/globals.h b/src/globals.h index 1a055d6085..09ac6b5e80 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1279,9 +1279,14 @@ EXTERN linenr_T printer_page_num; #endif #ifdef FEAT_XCLIPBOARD -EXTERN char *xterm_display INIT(= NULL); /* xterm display name; points - into argv[] */ -EXTERN Display *xterm_dpy INIT(= NULL); /* xterm display pointer */ +// xterm display name +EXTERN char *xterm_display INIT(= NULL); + +// whether xterm_display was allocated, when FALSE it points into argv[] +EXTERN int xterm_display_allocated INIT(= FALSE); + +// xterm display pointer +EXTERN Display *xterm_dpy INIT(= NULL); #endif #if defined(FEAT_XCLIPBOARD) || defined(FEAT_GUI_X11) EXTERN XtAppContext app_context INIT(= (XtAppContext)NULL); diff --git a/src/os_unix.c b/src/os_unix.c index b5627b1628..a6d1a12d10 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1659,6 +1659,25 @@ may_restore_clipboard(void) get_x11_title(FALSE); } } + + void +ex_xrestore(exarg_T *eap) +{ + if (eap->arg != NULL && STRLEN(eap->arg) > 0) + { + if (xterm_display_allocated) + vim_free(xterm_display); + xterm_display = (char *)vim_strsave(eap->arg); + xterm_display_allocated = TRUE; + } + smsg(_("restoring display %s"), xterm_display == NULL + ? (char *)mch_getenv("DISPLAY") : xterm_display); + + clear_xterm_clip(); + x11_window = 0; + xterm_dpy_retry_count = 5; // Try reconnecting five times + may_restore_clipboard(); +} #endif /* @@ -1761,6 +1780,10 @@ get_x11_windis(void) x11_window = (Window)atol(winid); #ifdef FEAT_XCLIPBOARD + if (xterm_dpy == x11_display) + // x11_display may have been set to xterm_dpy elsewhere + x11_display_from = XD_XTERM; + if (xterm_dpy != NULL && x11_window != 0) { /* We may have checked it already, but Gnome terminal can move us to @@ -7661,7 +7684,7 @@ do_xterm_trace(void) return TRUE; } -# if defined(FEAT_GUI) || defined(PROTO) +# if defined(FEAT_GUI) || defined(FEAT_XCLIPBOARD) || defined(PROTO) /* * Destroy the display, window and app_context. Required for GTK. */ diff --git a/src/proto/os_unix.pro b/src/proto/os_unix.pro index 0117b1ea1e..0e7c609f39 100644 --- a/src/proto/os_unix.pro +++ b/src/proto/os_unix.pro @@ -13,6 +13,7 @@ void reset_signals(void); int vim_handle_signal(int sig); int mch_check_win(int argc, char **argv); int mch_input_isatty(void); +void ex_xrestore(exarg_T *eap); int mch_can_restore_title(void); int mch_can_restore_icon(void); void mch_settitle(char_u *title, char_u *icon); diff --git a/src/testdir/test_paste.vim b/src/testdir/test_paste.vim index f3664f6a62..29206b94bc 100644 --- a/src/testdir/test_paste.vim +++ b/src/testdir/test_paste.vim @@ -110,3 +110,29 @@ func Test_paste_visual_mode() bwipe! endfunc + +func CheckCopyPaste() + call setline(1, ['copy this', '']) + normal 1G0"*y$ + normal j"*p + call assert_equal('copy this', getline(2)) +endfunc + +func Test_xrestore() + if !has('xterm_clipboard') + return + endif +call ch_logfile('logfile', 'w') + let display = $DISPLAY + new + call CheckCopyPaste() + + xrestore + call CheckCopyPaste() + + exe "xrestore " .. display + call CheckCopyPaste() + +call ch_logfile('', '') + bwipe! +endfunc diff --git a/src/version.c b/src/version.c index 3b9ef3236d..ea04ff99c1 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1307, /**/ 1306, /**/ From a6c27c47ddf081859659d7de1caec675147e466b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 19:16:22 +0200 Subject: [PATCH 38/97] Update runtime files --- runtime/doc/change.txt | 14 +- runtime/doc/cmdline.txt | 3 +- runtime/doc/debug.txt | 2 +- runtime/doc/editing.txt | 26 +- runtime/doc/eval.txt | 4 +- runtime/doc/index.txt | 2 +- runtime/doc/insert.txt | 28 +- runtime/doc/intro.txt | 20 +- runtime/doc/message.txt | 3 +- runtime/doc/motion.txt | 18 +- runtime/doc/options.txt | 20 +- runtime/doc/recover.txt | 4 +- runtime/doc/repeat.txt | 12 +- runtime/doc/tags | 13 +- runtime/doc/tagsrch.txt | 4 +- runtime/doc/term.txt | 5 +- runtime/doc/textprop.txt | 8 +- runtime/doc/todo.txt | 19 +- runtime/doc/undo.txt | 12 +- runtime/doc/usr_41.txt | 2 +- runtime/doc/various.txt | 2 +- runtime/doc/vi_diff.txt | 80 ++- runtime/filetype.vim | 2 +- runtime/ftplugin/nroff.vim | 11 + runtime/ftplugin/ocaml.vim | 4 +- runtime/ftplugin/sql.vim | 6 +- runtime/gvim.desktop | 6 +- runtime/indent/awk.vim | 2 +- runtime/indent/mma.vim | 2 +- runtime/indent/rmd.vim | 2 +- runtime/indent/sh.vim | 6 +- runtime/pack/dist/opt/matchit/doc/matchit.txt | 4 +- runtime/syntax/c.vim | 18 +- runtime/syntax/debchangelog.vim | 4 +- runtime/syntax/debsources.vim | 7 +- runtime/syntax/rmd.vim | 10 +- runtime/syntax/spec.vim | 6 +- runtime/syntax/template.vim | 15 + runtime/syntax/vim.vim | 4 +- runtime/vim.desktop | 6 +- src/po/af.po | 2 +- src/po/cs.cp1250.po | 2 +- src/po/cs.po | 2 +- src/po/es.po | 2 +- src/po/gvim.desktop.in | 1 - src/po/ja.euc-jp.po | 531 ++++++++++-------- src/po/ja.po | 531 ++++++++++-------- src/po/ja.sjis.po | 531 ++++++++++-------- src/po/vi.po | 2 +- src/po/vim.desktop.in | 1 - src/po/zh_TW.UTF-8.po | 2 +- src/po/zh_TW.po | 2 +- 52 files changed, 1119 insertions(+), 906 deletions(-) create mode 100644 runtime/ftplugin/nroff.vim create mode 100644 runtime/syntax/template.vim diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index a904aec387..baecc923ca 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 8.1. Last change: 2019 May 05 +*change.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -268,8 +268,6 @@ r{char} Replace the character under the cursor with {char}. If {char} is a or , a line break replaces the character. To replace with a real , use CTRL-V . CTRL-V replaces with a . - {Vi: CTRL-V still replaces with a line break, - cannot replace something with a } If {char} is CTRL-E or CTRL-Y the character from the line below or above is used, just like with |i_CTRL-E| @@ -310,11 +308,9 @@ The following commands change the case of letters. The currently active *~* ~ 'notildeop' option: Switch case of the character under the cursor and move the cursor to the right. - If a [count] is given, do that many characters. {Vi: - no count} + If a [count] is given, do that many characters. -~{motion} 'tildeop' option: switch case of {motion} text. {Vi: - tilde cannot be used as an operator} +~{motion} 'tildeop' option: switch case of {motion} text. *g~* g~{motion} Switch case of {motion} text. @@ -1054,11 +1050,11 @@ inside of strings can change! Also see 'softtabstop' option. > *p* *put* *E353* ["x]p Put the text [from register x] after the cursor - [count] times. {Vi: no count} + [count] times. *P* ["x]P Put the text [from register x] before the cursor - [count] times. {Vi: no count} + [count] times. ** ["x] Put the text from a register before the cursor [count] diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index ed085ef62b..0a4917a359 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 8.1. Last change: 2019 May 05 +*cmdline.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -27,7 +27,6 @@ Basic command line editing is explained in chapter 20 of the user manual Normally characters are inserted in front of the cursor position. You can move around in the command-line with the left and right cursor keys. With the key, you can toggle between inserting and overstriking characters. -{Vi: can only alter the last character in the line} Note that if your keyboard does not have working cursor keys or any of the other special keys, you can use ":cnoremap" to define another key for them. diff --git a/runtime/doc/debug.txt b/runtime/doc/debug.txt index 4564565516..8a5715b660 100644 --- a/runtime/doc/debug.txt +++ b/runtime/doc/debug.txt @@ -1,4 +1,4 @@ -*debug.txt* For Vim version 8.1. Last change: 2017 Jul 15 +*debug.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 4d01e49a1b..5a303c02a5 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 8.1. Last change: 2019 May 05 +*editing.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -51,7 +51,7 @@ for editing (e.g., with ":e filename") or writing (e.g., with ":w filename"), the file name is added to the list. You can use the buffer list to remember which files you edited and to quickly switch from one file to another (e.g., to copy text) with the |CTRL-^| command. First type the number of the file -and then hit CTRL-^. {Vi: only one alternate file name is remembered} +and then hit CTRL-^. CTRL-G or *CTRL-G* *:f* *:fi* *:file* @@ -197,7 +197,6 @@ If you want to keep the changed buffer without saving it, switch on the buffer and 'autowriteall' isn't set or the file can't be written. Also see |++opt| and |+cmd|. - {Vi: no ++opt} *:edit!* *discard* :e[dit]! [++opt] [+cmd] @@ -205,7 +204,6 @@ If you want to keep the changed buffer without saving it, switch on the the current buffer. This is useful if you want to start all over again. Also see |++opt| and |+cmd|. - {Vi: no ++opt} *:edit_f* :e[dit] [++opt] [+cmd] {file} @@ -214,14 +212,12 @@ If you want to keep the changed buffer without saving it, switch on the buffer, unless 'hidden' is set or 'autowriteall' is set and the file can be written. Also see |++opt| and |+cmd|. - {Vi: no ++opt} *:edit!_f* :e[dit]! [++opt] [+cmd] {file} Edit {file} always. Discard any changes to the current buffer. Also see |++opt| and |+cmd|. - {Vi: no ++opt} :e[dit] [++opt] [+cmd] #[count] Edit the [count]th buffer (as shown by |:files|). @@ -229,7 +225,6 @@ If you want to keep the changed buffer without saving it, switch on the #" doesn't work if the alternate buffer doesn't have a file name, while CTRL-^ still works then. Also see |++opt| and |+cmd|. - {Vi: no ++opt} *:ene* *:enew* :ene[w] Edit a new, unnamed buffer. This fails when changes @@ -607,14 +602,12 @@ list of the current window. the first one. This fails when changes have been made and Vim does not want to |abandon| the current buffer. Also see |++opt| and |+cmd|. - {Vi: no ++opt} :ar[gs]! [++opt] [+cmd] {arglist} *:args_f!* Define {arglist} as the new argument list and edit the first one. Discard any changes to the current buffer. Also see |++opt| and |+cmd|. - {Vi: no ++opt} :[count]arge[dit][!] [++opt] [+cmd] {name} .. *:arge* *:argedit* Add {name}s to the argument list and edit it. @@ -693,13 +686,11 @@ list of the current window. :[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163* Edit [count] next file. This fails when changes have been made and Vim does not want to |abandon| the - current buffer. Also see |++opt| and |+cmd|. {Vi: no - count or ++opt}. + current buffer. Also see |++opt| and |+cmd|. :[count]n[ext]! [++opt] [+cmd] Edit [count] next file, discard any changes to the - buffer. Also see |++opt| and |+cmd|. {Vi: no count - or ++opt}. + buffer. Also see |++opt| and |+cmd|. :n[ext] [++opt] [+cmd] {arglist} *:next_f* Same as |:args_f|. @@ -716,18 +707,17 @@ list of the current window. :[count]N[ext]! [count] [++opt] [+cmd] Edit [count] previous file in argument list. Discard any changes to the buffer. Also see |++opt| and - |+cmd|. {Vi: no count or ++opt}. + |+cmd|. :[count]prev[ious] [count] [++opt] [+cmd] *:prev* *:previous* - Same as :Next. Also see |++opt| and |+cmd|. {Vi: - only in some versions} + Same as :Next. Also see |++opt| and |+cmd|. *:rew* *:rewind* :rew[ind] [++opt] [+cmd] Start editing the first file in the argument list. This fails when changes have been made and Vim does not want to |abandon| the current buffer. - Also see |++opt| and |+cmd|. {Vi: no ++opt} + Also see |++opt| and |+cmd|. :rew[ind]! [++opt] [+cmd] Start editing the first file in the argument list. @@ -1335,7 +1325,7 @@ present in 'cpoptions' and "!" is not used in the command. :lch[dir][!] Same as |:lcd|. *:pw* *:pwd* *E187* -:pw[d] Print the current directory name. {Vi: no pwd} +:pw[d] Print the current directory name. Also see |getcwd()|. So long as no |:lcd| or |:tcd| command has been used, all windows share the diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 1ccb9adda6..d5ba286abd 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.1. Last change: 2019 May 05 +*eval.txt* For Vim version 8.1. Last change: 2019 May 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -7271,7 +7271,7 @@ prop_type_add({name}, {props}) *prop_type_add()* *E969* *E970* will be used; negative values can be used, the default priority is zero combine when TRUE combine the highlight with any - syntax highlight; when omitted of FALSE syntax + syntax highlight; when omitted or FALSE syntax highlight will not be used start_incl when TRUE inserts at the start position will be included in the text property diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 8437f2410b..6ae5fccea0 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 8.1. Last change: 2019 Apr 24 +*index.txt* For Vim version 8.1. Last change: 2019 May 09 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index e962343a07..852ba68a26 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 8.1. Last change: 2019 May 05 +*insert.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -59,8 +59,8 @@ CTRL-C Quit insert mode, go back to Normal mode. Do not check for event. *i_CTRL-@* -CTRL-@ Insert previously inserted text and stop insert. {Vi: only - when typed as first char, only up to 128 chars} +CTRL-@ Insert previously inserted text and stop insert. + *i_CTRL-A* CTRL-A Insert previously inserted text. @@ -68,7 +68,7 @@ CTRL-A Insert previously inserted text. or CTRL-H Delete the character before the cursor (see |i_backspacing| about joining lines). See |:fixdel| if your key does not do what you want. - {Vi: does not delete autoindents} + *i_* *i_DEL* Delete the character under the cursor. If the cursor is at the end of the line, and the 'backspace' option includes @@ -174,19 +174,18 @@ CTRL-R CTRL-P {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-P* *i_CTRL-T* CTRL-T Insert one shiftwidth of indent at the start of the current line. The indent is always rounded to a 'shiftwidth' (this is - vi compatible). {Vi: only when in indent} + vi compatible). *i_CTRL-D* CTRL-D Delete one shiftwidth of indent at the start of the current line. The indent is always rounded to a 'shiftwidth' (this is - vi compatible). {Vi: CTRL-D works only when used after - autoindent} + vi compatible). *i_0_CTRL-D* -0 CTRL-D Delete all indent in the current line. {Vi: CTRL-D works - only when used after autoindent} +0 CTRL-D Delete all indent in the current line. + *i_^_CTRL-D* ^ CTRL-D Delete all indent in the current line. The indent is restored in the next line. This is useful when inserting a - label. {Vi: CTRL-D works only when used after autoindent} + label. *i_CTRL-V* CTRL-V Insert next non-digit literally. For special keys, the @@ -194,7 +193,7 @@ CTRL-V Insert next non-digit literally. For special keys, the decimal, octal or hexadecimal value of a character |i_CTRL-V_digit|. The characters typed right after CTRL-V are not considered for - mapping. {Vi: no decimal byte entry} + mapping. Note: When CTRL-V is mapped (e.g., to paste text) you can often use CTRL-Q instead |i_CTRL-Q|. @@ -273,7 +272,6 @@ For backwards compatibility the values "0", "1" and "2" are also allowed, see If the 'backspace' option does contain "eol" and the cursor is in column 1 when one of the three keys is used, the current line is joined with the previous line. This effectively deletes the in front of the cursor. -{Vi: does not cross lines, does not delete past start position of insert} *i_CTRL-V_digit* With CTRL-V the decimal, octal or hexadecimal value of a character can be @@ -1815,15 +1813,13 @@ gi Insert text in the same position as where Insert mode *o* o Begin a new line below the cursor and insert text, - repeat [count] times. {Vi: blank [count] screen - lines} + repeat [count] times. When the '#' flag is in 'cpoptions' the count is ignored. *O* O Begin a new line above the cursor and insert text, - repeat [count] times. {Vi: blank [count] screen - lines} + repeat [count] times. When the '#' flag is in 'cpoptions' the count is ignored. diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 198ff18600..6e410010b6 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -1,4 +1,4 @@ -*intro.txt* For Vim version 8.1. Last change: 2019 May 05 +*intro.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -646,11 +646,7 @@ Ex :vi -- -- -- -- -- the command. In the last case may be the character defined with the 'wildchar' option, in which case it will start command-line completion. You can - ignore that and type again. {Vi: when hitting the command-line - is executed. This is unexpected for most people; therefore it was changed - in Vim. But when the is part of a mapping, the command-line is - executed. If you want the Vi behaviour also when typing , use ":cmap - ^V ^V^M"} + ignore that and type again. *4 Go from Normal to Select mode by: - use the mouse to select text while 'selectmode' contains "mouse" - use a non-printable command to move the cursor while keeping the Shift @@ -713,7 +709,6 @@ exceptions: character. - When inserting text in one window, other windows on the same text are not updated until the insert is finished. -{Vi: The screen is not always updated on slow terminals} Lines longer than the window width will wrap, unless the 'wrap' option is off (see below). The 'linebreak' option can be set to wrap at a blank character. @@ -759,7 +754,6 @@ If there is a single line that is too long to fit in the window, this is a special situation. Vim will show only part of the line, around where the cursor is. There are no special characters shown, so that you can edit all parts of this line. -{Vi: gives an "internal error" on lines that do not fit in the window} The '@' occasion in the 'highlight' option can be used to set special highlighting for the '@' and '~' characters. This makes it possible to @@ -774,7 +768,7 @@ that is not shown, the screen is scrolled horizontally. The advantage of this method is that columns are shown as they are and lines that cannot fit on the screen can be edited. The disadvantage is that you cannot see all the characters of a line at once. The 'sidescroll' option can be set to the -minimal number of columns to scroll. {Vi: has no 'wrap' option} +minimal number of columns to scroll. All normal ASCII characters are displayed directly on the screen. The is replaced with the number of spaces that it represents. Other non-printing @@ -806,16 +800,14 @@ command characters 'showcmd' on off cursor position 'ruler' off off The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|. The -command characters are those that you typed but were not used yet. {Vi: does -not show the characters you typed or the cursor position} +command characters are those that you typed but were not used yet. If you have a slow terminal you can switch off the status messages to speed up editing: :set nosc noru nosm If there is an error, an error message will be shown for at least one second -(in reverse video). {Vi: error messages may be overwritten with other -messages before you have a chance to read them} +(in reverse video). Some commands show how many lines were affected. Above which threshold this happens can be controlled with the 'report' option (default 2). @@ -828,7 +820,7 @@ Make it at least 40 characters wide to be able to read most messages on the last line. On most Unix systems, resizing the window is recognized and handled correctly -by Vim. {Vi: not ok} +by Vim. ============================================================================== 8. Definitions *definitions* diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 7a4543fc48..5e47df1b08 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -1,4 +1,4 @@ -*message.txt* For Vim version 8.1. Last change: 2019 May 05 +*message.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -798,7 +798,6 @@ and the screen is about to be redrawn: like pressing . This makes it impossible to select text though. -> For the GUI clicking the left mouse button in the last line works like pressing . -{Vi: only ":" commands are interpreted} If you accidentally hit or and you want to see the displayed text then use |g<|. This only works when 'more' is set. diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index bc015a3ac4..64b1fbfc22 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -1,4 +1,4 @@ -*motion.txt* For Vim version 8.1. Last change: 2019 May 05 +*motion.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -409,9 +409,7 @@ WORD before the fold. Special case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is on a non-blank. This is because "cw" is interpreted as change-word, and a -word does not include the following white space. {Vi: "cw" when on a blank -followed by other blanks changes only the first blank; this is probably a -bug, because "dw" deletes all the blanks} +word does not include the following white space. Another special case: When using the "w" motion in combination with an operator and the last word moved over is at the end of a line, the end of @@ -831,12 +829,12 @@ deletes the lines from the cursor position to mark 't'. Hint: Use mark 't' for Top, 'b' for Bottom, etc.. Lowercase marks are restored when using undo and redo. -Uppercase marks 'A to 'Z include the file name. {Vi: no uppercase marks} You -can use them to jump from file to file. You can only use an uppercase mark -with an operator if the mark is in the current file. The line number of the -mark remains correct, even if you insert/delete lines or edit another file for -a moment. When the 'viminfo' option is not empty, uppercase marks are kept in -the .viminfo file. See |viminfo-file-marks|. +Uppercase marks 'A to 'Z include the file name. You can use them to jump from +file to file. You can only use an uppercase mark with an operator if the mark +is in the current file. The line number of the mark remains correct, even if +you insert/delete lines or edit another file for a moment. When the 'viminfo' +option is not empty, uppercase marks are kept in the .viminfo file. See +|viminfo-file-marks|. Numbered marks '0 to '9 are quite different. They can not be set directly. They are only present when using a viminfo file |viminfo-file|. Basically '0 diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index c17842f3cd..691a8b68ba 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.1. Last change: 2019 May 05 +*options.txt* For Vim version 8.1. Last change: 2019 May 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -795,9 +795,6 @@ A jump table for the options with a short description can be found at |Q_op|. a different way. The 'autoindent' option is reset when the 'paste' option is set and restored when 'paste' is reset. - {small difference from Vi: After the indent is deleted when typing - or , the cursor position when moving up or down is after the - deleted indent; Vi puts the cursor somewhere in the deleted indent}. *'autoread'* *'ar'* *'noautoread'* *'noar'* 'autoread' 'ar' boolean (default off) @@ -1121,7 +1118,8 @@ A jump table for the options with a short description can be found at |Q_op|. {only available when compiled with the |+balloon_eval| feature} Expression for text to show in evaluation balloon. It is only used - when 'ballooneval' is on. These variables can be used: + when 'ballooneval' or 'balloonevalterm' is on. These variables can be + used: v:beval_bufnr number of the buffer in which balloon is going to show v:beval_winnr number of the window @@ -1132,7 +1130,7 @@ A jump table for the options with a short description can be found at |Q_op|. The evaluation of the expression must not have side effects! Example: > - function! MyBalloonExpr() + function MyBalloonExpr() return 'Cursor is at line ' . v:beval_lnum . \', column ' . v:beval_col . \ ' of file ' . bufname(v:beval_bufnr) . @@ -2677,7 +2675,6 @@ A jump table for the options with a short description can be found at |Q_op|. uses another default. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. - {Vi: directory to put temp file in, defaults to "/tmp"} *'display'* *'dy'* 'display' 'dy' string (default "", set to "truncate" in @@ -4707,7 +4704,6 @@ A jump table for the options with a short description can be found at |Q_op|. "=" operator to use this same indentation algorithm rather than calling an external program if 'equalprg' is empty. This option is not used when 'paste' is set. - {Vi: Does it a little bit differently} *'lispwords'* *'lw'* 'lispwords' 'lw' string (default is very long) @@ -6585,7 +6581,8 @@ A jump table for the options with a short description can be found at |Q_op|. O message for reading a file overwrites any previous message. Also for quickfix message (e.g., ":cn"). s don't give "search hit BOTTOM, continuing at TOP" or "search - hit TOP, continuing at BOTTOM" messages + hit TOP, continuing at BOTTOM" messages; when using the search + count do not show "W" after the count message (see S below) t truncate file message at the start if it is too long to fit on the command-line, "<" will appear in the left most column. Ignored in Ex mode. @@ -7443,7 +7440,6 @@ A jump table for the options with a short description can be found at |Q_op|. must be included in the tags file. This option doesn't affect commands that find all matching tags (e.g., command-line completion and ":help"). - {Vi: always uses binary search in some versions} *'tagcase'* *'tc'* 'tagcase' 'tc' string (default "followic") @@ -7507,7 +7503,6 @@ A jump table for the options with a short description can be found at |Q_op|. The use of |:set+=| and |:set-=| is preferred when adding or removing file names from the list. This avoids problems when a future version uses another default. - {Vi: default is "tags /usr/lib/tags"} *'tagstack'* *'tgst'* *'notagstack'* *'notgst'* 'tagstack' 'tgst' boolean (default on) @@ -8783,8 +8778,7 @@ A jump table for the options with a short description can be found at |Q_op|. When 'textwidth' is non-zero, this option is not used. This option is set to 0 when 'paste' is set and restored when 'paste' is reset. - See also 'formatoptions' and |ins-textwidth|. {Vi: works differently - and less usefully} + See also 'formatoptions' and |ins-textwidth|. *'wrapscan'* *'ws'* *'nowrapscan'* *'nows'* 'wrapscan' 'ws' boolean (default on) *E384* *E385* diff --git a/runtime/doc/recover.txt b/runtime/doc/recover.txt index a1e1feb69d..476eab3b48 100644 --- a/runtime/doc/recover.txt +++ b/runtime/doc/recover.txt @@ -1,4 +1,4 @@ -*recover.txt* For Vim version 8.1. Last change: 2014 Mar 27 +*recover.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -131,7 +131,6 @@ command: flag is present in 'cpoptions' the swap file will not be deleted for this buffer when Vim exits and the buffer is still loaded |cpo-&|. - {Vi: might also exit} A Vim swap file can be recognized by the first six characters: "b0VIM ". After that comes the version number, e.g., "3.0". @@ -196,7 +195,6 @@ recovered file. Or use |:DiffOrig|. Once you are sure the recovery is ok delete the swap file. Otherwise, you will continue to get warning messages that the ".swp" file already exists. -{Vi: recovers in another way and sends mail if there is something to recover} ENCRYPTION AND THE SWAP FILE *:recover-crypt* diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index ed48cf9c4f..9c701ff135 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 8.1. Last change: 2019 May 05 +*repeat.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -124,11 +124,11 @@ q{0-9a-zA-Z"} Record typed characters into register {0-9a-zA-Z"} used for |y| and |p| the result is most likely not what is expected, because the put will paste the recorded macro and the yank will overwrite the - recorded macro. {Vi: no recording} + recorded macro. q Stops recording. (Implementation note: The 'q' that stops recording is not stored in the register, unless - it was the result of a mapping) {Vi: no recording} + it was the result of a mapping) *@* @{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} [count] @@ -140,7 +140,7 @@ q Stops recording. (Implementation note: The 'q' that applies. For "@=" you are prompted to enter an expression. The result of the expression is then executed. - See also |@:|. {Vi: only named registers} + See also |@:|. *@@* *E748* @@ Repeat the previous @{0-9a-z":*} [count] times. @@ -158,8 +158,8 @@ q Stops recording. (Implementation note: The 'q' that result of evaluating the expression is executed as an Ex command. Mappings are not recognized in these commands. - {Vi: only in some versions} Future: Will execute the - register for each line in the address range. + Future: Will execute the register for each line in the + address range. *:@:* :[addr]@: Repeat last command-line. First set cursor at line diff --git a/runtime/doc/tags b/runtime/doc/tags index b3332dfbcd..50ca425d77 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2151,8 +2151,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :catch eval.txt /*:catch* :cb quickfix.txt /*:cb* :cbe quickfix.txt /*:cbe* -:cbe quickfix.txt /*:cbe* :cbefore quickfix.txt /*:cbefore* +:cbel quickfix.txt /*:cbel* :cbelow quickfix.txt /*:cbelow* :cbo quickfix.txt /*:cbo* :cbottom quickfix.txt /*:cbottom* @@ -2518,7 +2518,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :lat undo.txt /*:lat* :later undo.txt /*:later* :lb quickfix.txt /*:lb* -:lbef quickfix.txt /*:lbef* +:lbe quickfix.txt /*:lbe* :lbefore quickfix.txt /*:lbefore* :lbel quickfix.txt /*:lbel* :lbelow quickfix.txt /*:lbelow* @@ -3367,6 +3367,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :xnoremap map.txt /*:xnoremap* :xnoreme gui.txt /*:xnoreme* :xnoremenu gui.txt /*:xnoremenu* +:xr various.txt /*:xr* +:xrestore various.txt /*:xrestore* :xu map.txt /*:xu* :xunmap map.txt /*:xunmap* :xunme gui.txt /*:xunme* @@ -3441,6 +3443,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* term.txt /** helphelp.txt /** motion.txt /** + eval.txt /** insert.txt /** map.txt /** motion.txt /** @@ -5316,6 +5319,7 @@ backup-changed version4.txt /*backup-changed* backup-extension version4.txt /*backup-extension* backup-table editing.txt /*backup-table* balloon-eval debugger.txt /*balloon-eval* +balloon_gettext() eval.txt /*balloon_gettext()* balloon_show() eval.txt /*balloon_show()* balloon_split() eval.txt /*balloon_split()* bar motion.txt /*bar* @@ -5590,6 +5594,7 @@ charconvert_to-variable eval.txt /*charconvert_to-variable* charity uganda.txt /*charity* charset mbyte.txt /*charset* charset-conversion mbyte.txt /*charset-conversion* +chdir() eval.txt /*chdir()* chill.vim syntax.txt /*chill.vim* chmod eval.txt /*chmod* cindent() eval.txt /*cindent()* @@ -6017,6 +6022,7 @@ encryption editing.txt /*encryption* end intro.txt /*end* end-of-file pattern.txt /*end-of-file* enlightened-terminal syntax.txt /*enlightened-terminal* +environ() eval.txt /*environ()* erlang.vim syntax.txt /*erlang.vim* err_buf channel.txt /*err_buf* err_cb channel.txt /*err_cb* @@ -6756,6 +6762,7 @@ getcmdwintype() eval.txt /*getcmdwintype()* getcompletion() eval.txt /*getcompletion()* getcurpos() eval.txt /*getcurpos()* getcwd() eval.txt /*getcwd()* +getenv() eval.txt /*getenv()* getfontname() eval.txt /*getfontname()* getfperm() eval.txt /*getfperm()* getfsize() eval.txt /*getfsize()* @@ -8544,6 +8551,7 @@ setbufline() eval.txt /*setbufline()* setbufvar() eval.txt /*setbufvar()* setcharsearch() eval.txt /*setcharsearch()* setcmdpos() eval.txt /*setcmdpos()* +setenv() eval.txt /*setenv()* setfperm() eval.txt /*setfperm()* setline() eval.txt /*setline()* setloclist() eval.txt /*setloclist()* @@ -9282,6 +9290,7 @@ text-prop-functions textprop.txt /*text-prop-functions* text-prop-intro textprop.txt /*text-prop-intro* text-properties textprop.txt /*text-properties* textlock eval.txt /*textlock* +textprop textprop.txt /*textprop* textprop.txt textprop.txt /*textprop.txt* tf.vim syntax.txt /*tf.vim* this_session-variable eval.txt /*this_session-variable* diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 2f493e2d8c..c8df0af428 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -1,4 +1,4 @@ -*tagsrch.txt* For Vim version 8.1. Last change: 2019 May 05 +*tagsrch.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -56,7 +56,6 @@ CTRL-] Jump to the definition of the keyword under the to the [count] one. When no [count] is given the first one is jumped to. See |tag-matchlist| for jumping to other matching tags. - {Vi: identifier after the cursor} *v_CTRL-]* {Visual}CTRL-] Same as ":tag {name}", where {name} is the text that @@ -421,7 +420,6 @@ In a future version changing the buffer will be impossible. All this for security reasons: Somebody might hide a nasty command in the tags file, which would otherwise go unnoticed. Example: > :$d|/tag-function-name/ -{this security prevention is not present in Vi} In Vi the ":tag" command sets the last search pattern when the tag is searched for. In Vim this is not done, the previous search pattern is still remembered, diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index dc92418a63..79debe3a1e 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 8.1. Last change: 2019 Apr 11 +*term.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -249,9 +249,6 @@ It is always possible to change individual strings by setting the appropriate option. For example: > :set t_ce=^V^[[K (CTRL-V, , [, K) -{Vi: no terminal options. You have to exit Vi, edit the termcap entry and -try again} - The options are listed below. The associated termcap code is always equal to the last two characters of the option name. Only one termcap code is required: Cursor motion, 't_cm'. diff --git a/runtime/doc/textprop.txt b/runtime/doc/textprop.txt index b6831875d7..c24e47a914 100644 --- a/runtime/doc/textprop.txt +++ b/runtime/doc/textprop.txt @@ -1,10 +1,10 @@ -*textprop.txt* For Vim version 8.1. Last change: 2019 May 05 +*textprop.txt* For Vim version 8.1. Last change: 2019 May 06 VIM REFERENCE MANUAL by Bram Moolenaar -Displaying text with properties attached. *text-properties* +Displaying text with properties attached. *textprop* *text-properties* THIS IS UNDER DEVELOPMENT - ANYTHING MAY STILL CHANGE *E967* @@ -132,10 +132,10 @@ When using replace mode, the text properties stay on the same character positions, even though the characters themselves change. -When text property columns are not updated ~ +Text property columns are not updated: ~ - When setting the line with |setline()| or through an interface, such as Lua, - Tcl or Python. + Tcl or Python. Vim does not know what text got inserted or deleted. vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 9019d4001b..c69a9490d9 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.1. Last change: 2019 May 05 +*todo.txt* For Vim version 8.1. Last change: 2019 May 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -155,6 +155,9 @@ be adjusted. (Daniel Steinberg, 2019 Feb 24, #4041) Bug: "vipgw" does not put cursor back where it belongs. (Jason Franklin, 2019 Mar 5) +Add a way to create an empty, hidden buffer. Like doing ":new|hide". +":let buf = bufcreate('name') + When using a timer callback vgetc_busy is reset, allowing for using input(). But in a channel callback this does not happen. We need to do something similar to check_due_timer(). Also see #3809. @@ -176,13 +179,6 @@ negative. (see #4326) tab page. (Ingo Karkat, #4324) :call settabwinvar(1, 1, '&cmdheight', 2) also doesn't work well. -Add a chdir() function, which will set the window-local, tab-local or global -directory, first one that is currently used. Returns the current directory, -so that this works: - let save_dir = chdir('somewhere') - ... - call chdir(save_dir) - This modeline throws unexpected errors: (#4165) vim: syn=nosyntax @@ -271,13 +267,10 @@ when possible. (Dylan Lloyd, #3973) Make ":interactive !cmd" stop termcap mode, also when used in an autocommand. (#3692) -Patch to add environ(), gets a dict with all environment vars, and getenv(), -useful for environment vars that are not made of keyword chars. -(Yasuhiro Matsumoto, #2875) - Add buffer argument to undotree(). (#4001) -Patch to restore X11 connection. (#844) +Patch to fix that Normal is not defined when not compiled with GUI. +(Christian Brabandt, 2019 May 7, on issue #4072) Patch to add optional arguments with default values. (Andy Massimino, #3952) Needs to be reviewed. diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index 316e32f13a..92553ab330 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -1,4 +1,4 @@ -*undo.txt* For Vim version 8.1. Last change: 2019 May 05 +*undo.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -19,26 +19,24 @@ The basics are explained in section |02.5| of the user manual. 1. Undo and redo commands *undo-commands* or *undo* ** *u* -u Undo [count] changes. {Vi: only one level} +u Undo [count] changes. *:u* *:un* *:undo* -:u[ndo] Undo one change. {Vi: only one level} +:u[ndo] Undo one change. *E830* :u[ndo] {N} Jump to after change number {N}. See |undo-branches| for the meaning of {N}. *CTRL-R* -CTRL-R Redo [count] changes which were undone. {Vi: redraw - screen} +CTRL-R Redo [count] changes which were undone. *:red* *:redo* *redo* -:red[o] Redo one change which was undone. {Vi: no redo} +:red[o] Redo one change which was undone. *U* U Undo all latest changes on one line, the line where the latest change was made. |U| itself also counts as a change, and thus |U| undoes a previous |U|. - {Vi: while not moved off of the last modified line} The last changes are remembered. You can use the undo and redo commands above to revert the text to how it was before each change. You can also apply the diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index f43edf81ed..c5317e231e 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 8.1. Last change: 2019 May 04 +*usr_41.txt* For Vim version 8.1. Last change: 2019 May 09 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 9b61e8b2c3..5e9f5cccc8 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 8.1. Last change: 2019 May 05 +*various.txt* For Vim version 8.1. Last change: 2019 May 09 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index a1f4ab4d50..715021e6b7 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -1,4 +1,4 @@ -*vi_diff.txt* For Vim version 8.1. Last change: 2019 May 05 +*vi_diff.txt* For Vim version 8.1. Last change: 2019 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -293,6 +293,12 @@ Command-line editing and history. |cmdline-editing| forward/backward one character. The shifted right/left cursor keys can be used to move forward/backward one word. CTRL-B/CTRL-E can be used to go to the begin/end of the command-line. + {Vi: can only alter the last character in the line} + {Vi: when hitting the command-line is executed. This is + unexpected for most people; therefore it was changed in Vim. But when + the is part of a mapping, the command-line is executed. If you + want the Vi behaviour also when typing , use ":cmap ^V + ^V^M"} |cmdline-history| The command-lines are remembered. The up/down cursor keys can be used to recall previous command-lines. The 'history' option can be set to @@ -540,6 +546,8 @@ The 'tags' option can be set to a list of tag file names. Thus multiple tag files can be used. For file names that start with "./", the "./" is replaced with the path of the current file. This makes it possible to use a tags file in the same directory as the file being edited. +{Vi: always uses binary search in some versions} +{Vi does not have the security prevention for commands in tag files} Previously used file names are remembered in the alternate file name list. CTRL-^ accepts a count, which is an index in this list. @@ -577,6 +585,8 @@ one space after a period (Vi inserts two spaces). "cw" can be used to change white space formed by several characters (Vi is confusing: "cw" only changes one space, while "dw" deletes all white space). +{Vi: "cw" when on a blank followed by other blanks changes only the first +blank; this is probably a bug, because "dw" deletes all the blanks} "o" and "O" accept a count for repeating the insert (Vi clears a part of display). @@ -645,7 +655,7 @@ of the window. Uppercase marks can be used to jump between files. The ":marks" command lists all currently set marks. The commands "']" and "`]" jump to the end of the previous operator or end of the text inserted with the put command. "'[" and -"`[" do jump to the start. +"`[" do jump to the start. {Vi: no uppercase marks} The 'shelltype' option can be set to reflect the type of shell used on the Amiga. @@ -790,14 +800,16 @@ filesystem under Unix. See |'shortname'|. Error messages are shown at least one second (Vi overwrites error messages). If Vim gives the |hit-enter| prompt, you can hit any key. Characters other -than , and are interpreted as the (start of) a command. (Vi -only accepts a command starting with ':'). +than , and are interpreted as the (start of) a command. +{Vi: only ":" commands are interpreted} The contents of the numbered and unnamed registers is remembered when changing files. The "No lines in buffer" message is a normal message instead of an error message, since that may cause a mapping to be aborted. +{Vi: error messages may be overwritten with other messages before you have a +chance to read them} The AUX: device of the Amiga is supported. @@ -826,28 +838,30 @@ The following Ex commands are supported by Vi: ~ `:copy` copy lines `:delete` delete lines `:edit` edit a file -`:exit` same as ":xit" +`:exit` same as `:xit` `:file` show or set the current file name; Vi: without the column number `:global` execute commands for matching lines `:insert` insert text `:join` join lines; Vi: not :join! `:k` set a mark `:list` print lines -`:map` show or enter a mapping +`:map` show or enter a mapping `:mark` set a mark `:move` move lines -`:Next` go to previous file in the argument list; no count or ++opt -`:next` go to next file in the argument list; no count or ++opt +`:Next` go to previous file in the argument list {Vi: no count} +`:next` go to next file in the argument list {Vi: no count} `:number` print lines with line number `:open` start open mode (not implemented in Vim) `:pop` jump to older entry in tag stack (only in some versions) -`:preserve` write all text to swap file +`:preserve` write all text to swap file {Vi: might also exit} +`:previous` same as `:Next` {Vi: only in some versions} `:print` print lines `:put` insert contents of register in the text `:quit` quit Vi `:read` read file into the text -`:recover` recover a file from a swap file -`:rewind` go to the first file in the argument list; no ++opt +`:recover` recover a file from a swap file {Vi: recovers in another way + and sends mail if there is something to recover} +`:rewind` go to the first file in the argument list; no ++opt `:set` set option; but not `:set inv{option}`, `:set option&`, `:set all&`, `:set option+=value`, `:set option^=value` `:set option-=value` `:set option<` @@ -870,7 +884,7 @@ The following Ex commands are supported by Vi: ~ `:xit` write if buffer changed and quit Vi `:yank` yank lines into a register `:z` print some lines {not in all versions of Vi} -`:!` filter lines or execute an external command +`:!` filter lines or execute an external command `:"` comment `:#` same as ":number" `:*` execute contents of a register @@ -881,6 +895,9 @@ The following Ex commands are supported by Vi: ~ `:@` execute contents of a register; but not `:@`; `:@@` only in some versions +Common for these commands is that Vi doesn't support the ++opt argument on +`:edit` and other commands that open a file. + The following Normal mode commands are supported by Vi: ~ @@ -906,8 +923,8 @@ The following Normal mode commands are supported by Vi: ~ |CTRL-U| N lines Upwards (default: half a screen) |CTRL-Y| scroll N lines downwards |CTRL-Z| suspend program (or start new shell) -|CTRL-]| :ta to ident under cursor -|CTRL-^| edit alternate file; Vi: no count +|CTRL-]| :ta to ident under cursor {Vi: identifier after the cursor} +|CTRL-^| edit alternate file {Vi: no count} || same as "l" |!| filter Nmove text through the {filter} command |!!| filter N lines through the {filter} command @@ -937,6 +954,7 @@ The following Normal mode commands are supported by Vi: ~ |>>| shift N lines one 'shiftwidth' rightwards |?| search backward for the Nth previous occurrence of {pattern} |@| execute the contents of register {a-z} N times + {Vi: only named registers} |@@| repeat the previous @{a-z} N times |A| append text after the end of the line N times |B| cursor N WORDS backward @@ -953,8 +971,9 @@ The following Normal mode commands are supported by Vi: ~ |M| cursor to middle line of screen |N| repeat the latest '/' or '?' N times in opposite direction |O| begin a new line above the cursor and insert text, repeat N - times + times {Vi: blank [count] screen lines} |P| put the text [from register x] before the cursor N times + {Vi: no count} |Q| switch to "Ex" mode |R| enter replace mode: overtype existing characters, repeat the entered text N-1 times @@ -962,6 +981,7 @@ The following Normal mode commands are supported by Vi: ~ "cc". |T| cursor till after Nth occurrence of {char} to the left |U| undo all latest changes on one line + {Vi: while not moved off of the last modified line} |W| cursor N WORDS forward |X| delete N characters before the cursor [into register x] |Y| yank N lines [into register x]; synonym for "yy" @@ -987,8 +1007,11 @@ The following Normal mode commands are supported by Vi: ~ |m| set mark {A-Za-z} at cursor position |n| repeat the latest '/' or '?' N times |o| begin a new line below the cursor and insert text + {Vi: blank [count] screen lines} |p| put the text [from register x] after the cursor N times -|r| replace N chars with {char} + {Vi: no count} +|r| replace N chars with {char} {Vi: CTRL-V still replaces + with a line break, cannot replace something with a } |s| (substitute) delete N characters [into register x] and start insert |t| cursor till before Nth occurrence of {char} to the right @@ -1006,17 +1029,21 @@ The following Normal mode commands are supported by Vi: ~ | cursor to column N |}| cursor N paragraphs forward |~| switch case of N characters under the cursor; Vim: depends on - 'tildeop' + 'tildeop' {Vi: no count, no 'tildeop'} || same as "x" The following commands are supported in Insert mode by Vi: ~ CTRL-@ insert previously inserted text and stop insert + {Vi: only when typed as first char, only up to 128 chars} CTRL-C quit insert mode, without checking for abbreviation, unless 'insertmode' set. CTRL-D delete one shiftwidth of indent in the current line - delete character before the cursor + {Vi: CTRL-D works only when used after autoindent} + delete character before the cursor {Vi: does not delete + autoindents, does not cross lines, does not delete past start + position of insert} CTRL-H same as insert a character CTRL-I same as @@ -1024,8 +1051,9 @@ CTRL-I same as CTRL-J same as begin new line CTRL-M same as -CTRL-T insert one shiftwidth of indent in current line -CTRL-V {char} insert next non-digit literally +CTRL-T insert one shiftwidth of indent in current line {Vi: only when + in indent} +CTRL-V {char} insert next non-digit literally {Vi: no decimal byte entry} CTRL-W delete word before the cursor CTRL-Z when 'insertmode' set: suspend Vim end insert mode (unless 'insertmode' set) @@ -1039,13 +1067,21 @@ CTRL-[ same as The following options are supported by Vi: ~ 'autoindent' 'ai' take indent for new line from previous line + {Vi does this slightly differently: After the + indent is deleted when typing or , the + cursor position when moving up or down is after + the deleted indent; Vi puts the cursor somewhere + in the deleted indent}. 'autowrite' 'aw' automatically write file if changed 'directory' 'dir' list of directory names for the swap file + {Vi: directory to put temp file in, defaults to + "/tmp"} 'edcompatible' 'ed' toggle flags of ":substitute" command 'errorbells' 'eb' ring the bell for error messages 'ignorecase' 'ic' ignore case in search patterns 'lines' number of lines in the display -'lisp' automatic indenting for Lisp +'lisp' automatic indenting for Lisp {Vi: Does it a little + bit differently} 'list' show and 'magic' changes special characters in search patterns 'modeline' 'ml' recognize 'modelines' at start or end of file @@ -1066,6 +1102,7 @@ The following options are supported by Vi: ~ 'tabstop' 'ts' number of spaces that in file uses 'taglength' 'tl' number of significant characters for a tag 'tags' 'tag' list of file names used by the tag command + {Vi: default is "tags /usr/lib/tags"} 'tagstack' 'tgst' push tags onto the tag stack {not in all versions of Vi} 'term' name of the terminal @@ -1080,6 +1117,7 @@ The following options are supported by Vi: ~ {Vi also uses the option to specify the number of displayed lines} 'wrapmargin' 'wm' chars from the right where wrapping starts + {Vi: works differently and less usefully} 'wrapscan' 'ws' searches wrap around the end of the file 'writeany' 'wa' write to file with no need for "!" override diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 9ac773a5c5..36a5163279 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2019 Apr 19 +" Last Change: 2019 May 06 " Listen very carefully, I will say this only once if exists("did_load_filetypes") diff --git a/runtime/ftplugin/nroff.vim b/runtime/ftplugin/nroff.vim new file mode 100644 index 0000000000..069c02e59a --- /dev/null +++ b/runtime/ftplugin/nroff.vim @@ -0,0 +1,11 @@ +" Vim filetype plugin +" Language: roff(7) +" Maintainer: Chris Spiegel +" Last Change: 2019 Apr 24 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=.\\\"%s diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim index 3ee7849063..ae41422497 100644 --- a/runtime/ftplugin/ocaml.vim +++ b/runtime/ftplugin/ocaml.vim @@ -372,8 +372,8 @@ endfunction endfun " This variable contain a dictionnary of list. Each element of the dictionnary - " represent an annotation system. An annotation system is a list with : - " - annotation file name as it's key + " represent an annotation system. An annotation system is a list with: + " - annotation file name as its key " - annotation file path as first element of the contained list " - build path as second element of the contained list " - annot_file_last_mod (contain the date of .annot file) as third element diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index 4d6fcd9564..1c02a98c7c 100644 --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -400,7 +400,7 @@ endif " Predefined SQL objects what are used by the below mappings using " the ]} style maps. -" This global variable allows the users to override it's value +" This global variable allows the users to override its value " from within their vimrc. " Note, you cannot use \?, since these patterns can be used to search " backwards, you must use \{,1} @@ -486,10 +486,10 @@ if exists('&omnifunc') " OMNI function prior to setting up the SQL OMNI function let b:sql_compl_savefunc = &omnifunc - " Source it to determine it's version + " Source it to determine its version runtime autoload/sqlcomplete.vim " This is used by the sqlcomplete.vim plugin - " Source it for it's global functions + " Source it for its global functions runtime autoload/syntaxcomplete.vim setlocal omnifunc=sqlcomplete#Complete diff --git a/runtime/gvim.desktop b/runtime/gvim.desktop index 7f8b25c478..88f325e8db 100644 --- a/runtime/gvim.desktop +++ b/runtime/gvim.desktop @@ -6,14 +6,15 @@ Name[de]=GVim Name=GVim # Translators: This is the Generic Application Name used in the Vim desktop file GenericName[de]=Texteditor +GenericName[ja]=テキストエディタ GenericName=Text Editor # Translators: This is the comment used in the Vim desktop file Comment[de]=Textdateien bearbeiten +Comment[ja]=テキストファイルを編集します Comment=Edit text files # The translations should come from the po file. Leave them here for now, they will # be overwritten by the po file when generating the desktop.file! GenericName[da]=Teksteditor -GenericName[de]=Texteditor GenericName[eo]=Tekstoredaktilo GenericName[fr]=Éditeur de texte GenericName[pl]=Edytor tekstu @@ -30,7 +31,6 @@ Comment[ca]=Edita fitxers de text Comment[cs]=Úprava textových souborů Comment[cy]=Golygu ffeiliau testun Comment[da]=Rediger tekstfiler -Comment[de]=Textdateien bearbeiten Comment[el]=Επεξεργασία αρχείων κειμένου Comment[en_CA]=Edit text files Comment[en_GB]=Edit text files @@ -50,7 +50,6 @@ Comment[hu]=Szövegfájlok szerkesztése Comment[id]=Edit file teks Comment[is]=Vinna með textaskrár Comment[it]=Modifica file di testo -Comment[ja]=テキストファイルを編集します Comment[kn]=ಪಠ್ಯ ಕಡತಗಳನ್ನು ಸಂಪಾದಿಸು Comment[ko]=텍스트 파일을 편집합니다 Comment[lt]=Redaguoti tekstines bylas @@ -93,6 +92,7 @@ Terminal=false Type=Application # Translators: Search terms to find this application. Do NOT change the semicolons! The list MUST also end with a semicolon! Keywords[de]=Text;Editor; +Keywords[ja]=テキスト;エディタ; Keywords=Text;editor; # Translators: This is the Icon file name. Do NOT translate Icon[de]=gvim diff --git a/runtime/indent/awk.vim b/runtime/indent/awk.vim index aad73ee71f..e65331977c 100644 --- a/runtime/indent/awk.vim +++ b/runtime/indent/awk.vim @@ -47,7 +47,7 @@ endif function! GetAwkIndent() - " Find previous line and get it's indentation + " Find previous line and get its indentation let prev_lineno = s:Get_prev_line( v:lnum ) if prev_lineno == 0 return 0 diff --git a/runtime/indent/mma.vim b/runtime/indent/mma.vim index 8298ad98cd..a76fa8ede0 100644 --- a/runtime/indent/mma.vim +++ b/runtime/indent/mma.vim @@ -57,7 +57,7 @@ function GetMmaIndent() if getline(v:lnum) =~ '[^[]*]\s*$' " move to the closing bracket call search(']','bW') - " and find it's partner's indent + " and find its partner's indent let ind = indent(searchpair('\[','',']','bWn')) " same for ( blocks elseif getline(v:lnum) =~ '[^(]*)$' diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim index 182b07cbaa..83fe4e4fed 100644 --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -39,7 +39,7 @@ endfunction function s:GetYamlIndent() let pline = getline(v:lnum - 1) if pline =~ ':\s*$' - return indent(v:lnum) + &sw + return indent(v:lnum) + shiftwidth() elseif pline =~ '^\s*- ' return indent(v:lnum) + 2 endif diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index 520d3eece1..148a86ed67 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -3,10 +3,12 @@ " Maintainer: Christian Brabandt " Original Author: Nikolai Weibull " Previous Maintainer: Peter Aronoff -" Latest Revision: 2019-03-25 +" Latest Revision: 2019-04-27 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-sh-indent " Changelog: +" 20190428 - De-indent fi correctly when typing with +" https://github.com/chrisbra/vim-sh-indent/issues/15 " 20190325 - Indent fi; correctly " https://github.com/chrisbra/vim-sh-indent/issues/14 " 20190319 - Indent arrays (only zsh and bash) @@ -127,7 +129,7 @@ function! GetShIndent() " Current line is a endif line, so get indent from start of "if condition" line " TODO: should we do the same for other "end" lines? if curline =~ '^\s*\%(fi\);\?\s*\%(#.*\)\=$' - let previous_line = searchpair('\', '', '\', 'bnW') + let previous_line = searchpair('\', '', '\\zs', 'bnW') if previous_line > 0 let ind = indent(previous_line) endif diff --git a/runtime/pack/dist/opt/matchit/doc/matchit.txt b/runtime/pack/dist/opt/matchit/doc/matchit.txt index d3f7cea720..81d0e8cdee 100644 --- a/runtime/pack/dist/opt/matchit/doc/matchit.txt +++ b/runtime/pack/dist/opt/matchit/doc/matchit.txt @@ -4,7 +4,7 @@ For instructions on installing this file, type `:help matchit-install` inside Vim. -For Vim version 8.1. Last change: 2019 Jan 28 +For Vim version 8.1. Last change: 2019 May 05 VIM REFERENCE MANUAL by Benji Fisher et al @@ -20,8 +20,6 @@ For Vim version 8.1. Last change: 2019 Jan 28 The functionality mentioned here is a plugin, see |add-plugin|. This plugin is only available if 'compatible' is not set. -{Vi does not have any of this} - ============================================================================== 1. Extended matching with "%" *matchit-intro* diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index 2eb7881f67..2a14ae0c46 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar -" Last Change: 2019 Feb 11 +" Last Change: 2019 Apr 23 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -289,6 +289,22 @@ if !exists("c_no_c11") syn keyword cOperator _Static_assert static_assert syn keyword cStorageClass _Thread_local thread_local syn keyword cType char16_t char32_t + " C11 atomics (take down the shield wall!) + syn keyword cType atomic_bool atomic_char atomic_schar atomic_uchar + syn keyword Ctype atomic_short atomic_ushort atomic_int atomic_uint + syn keyword cType atomic_long atomic_ulong atomic_llong atomic_ullong + syn keyword cType atomic_char16_t atomic_char32_t atomic_wchar_t + syn keyword cType atomic_int_least8_t atomic_uint_least8_t + syn keyword cType atomic_int_least16_t atomic_uint_least16_t + syn keyword cType atomic_int_least32_t atomic_uint_least32_t + syn keyword cType atomic_int_least64_t atomic_uint_least64_t + syn keyword cType atomic_int_fast8_t atomic_uint_fast8_t + syn keyword cType atomic_int_fast16_t atomic_uint_fast16_t + syn keyword cType atomic_int_fast32_t atomic_uint_fast32_t + syn keyword cType atomic_int_fast64_t atomic_uint_fast64_t + syn keyword cType atomic_intptr_t atomic_uintptr_t + syn keyword cType atomic_size_t atomic_ptrdiff_t + syn keyword cType atomic_intmax_t atomic_uintmax_t endif if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index 4ca4c299b2..9d6dfe96a5 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2019 Jan 26 +" Last Change: 2019 Apr 21 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization @@ -21,7 +21,7 @@ let s:binNMU='binary-only=yes' syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " exe 'syn match debchangelogFirstKV contained "; \('.s:urgency.'\|'.s:binNMU.'\)"' exe 'syn match debchangelogOtherKV contained ", \('.s:urgency.'\|'.s:binNMU.'\)"' -syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco)%(-%(security|proposed|updates|backports|commercial|partner))=)+" +syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|%(squeeze|wheezy|jessie)-%(backports%(-sloppy)=|lts|security)|stretch%(-backports%(-sloppy)=|-security)=|buster%(-backports|-security)=|bullseye|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan)%(-%(security|proposed|updates|backports|commercial|partner))=)+" syn match debchangelogVersion contained "(.\{-})" syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*" syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*" diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index 4b2194125d..f90476fe25 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: 2018 Oct 30 +" Last Change: 2019 Apr 21 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization @@ -23,9 +23,10 @@ let s:cpo = &cpo set cpo-=C let s:supported = [ \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', - \ 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy', + \ 'wheezy', 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', + \ 'sid', 'rc-buggy', \ - \ 'trusty', 'xenial', 'bionic', 'cosmic', 'disco', 'devel' + \ 'trusty', 'xenial', 'bionic', 'cosmic', 'disco', 'eoan', 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim index a26389024d..d852d225bc 100644 --- a/runtime/syntax/rmd.vim +++ b/runtime/syntax/rmd.vim @@ -1,7 +1,7 @@ " markdown Text with R statements " Language: markdown with R code chunks " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sat Aug 25, 2018 03:44PM +" Last Change: Thu Apr 18, 2019 09:17PM " " For highlighting pandoc extensions to markdown like citations and TeX and " many other advanced features like folding of markdown sections, it is @@ -54,14 +54,14 @@ runtime syntax/markdown.vim " Now highlight chunks: for s:type in g:rmd_fenced_languages if s:type =~ '=' - let s:lng = substitute(s:type, '=.*', '') - let s:nm = substitute(s:type, '.*=', '') + let s:ft = substitute(s:type, '.*=', '', '') + let s:nm = substitute(s:type, '=.*', '', '') else - let s:lng = s:type + let s:ft = s:type let s:nm = s:type endif unlet! b:current_syntax - exe 'syn include @Rmd'.s:nm.' syntax/'.s:lng.'.vim' + exe 'syn include @Rmd'.s:nm.' syntax/'.s:ft.'.vim' if g:rmd_syn_hl_chunk exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@Rmd'.s:nm exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=rmd'.s:nm.'ChunkDelim,@Rmd'.s:nm diff --git a/runtime/syntax/spec.vim b/runtime/syntax/spec.vim index ae93fe51a4..2d2550559b 100644 --- a/runtime/syntax/spec.vim +++ b/runtime/syntax/spec.vim @@ -3,7 +3,7 @@ " Language: SPEC: Build/install scripts for Linux RPM packages " Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com " Former Maintainer: Donovan Rebbechi elflord@panix.com (until March 2014) -" Last Change: 2019 Feb 12 +" Last Change: 2019 May 07 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -86,9 +86,9 @@ syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start "%% Files Section %% "TODO %config valid parameters: missingok\|noreplace "TODO %verify valid parameters: \(not\)\= \(md5\|atime\|...\) -syn region specFilesArea matchgroup=specSection start='^%[Ff][Ii][Ll][Ee][Ss]\>' skip='%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|license\|verify\|ghost\)\>' end='^%[a-zA-Z]'me=e-2 contains=specFilesOpts,specFilesDirective,@specListedFiles,specComment,specCommandSpecial,specMacroIdentifier +syn region specFilesArea matchgroup=specSection start='^%[Ff][Ii][Ll][Ee][Ss]\>' skip='%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|license\|verify\|ghost\|exclude\)\>' end='^%[a-zA-Z]'me=e-2 contains=specFilesOpts,specFilesDirective,@specListedFiles,specComment,specCommandSpecial,specMacroIdentifier "tip: remember to include new itens in specFilesArea above -syn match specFilesDirective contained '%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|license\|verify\|ghost\)\>' +syn match specFilesDirective contained '%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|license\|verify\|ghost\|exclude\)\>' "valid options for certain section headers syn match specDescriptionOpts contained '\s-[ln]\s*\a'ms=s+1,me=e-1 diff --git a/runtime/syntax/template.vim b/runtime/syntax/template.vim new file mode 100644 index 0000000000..5bf580fc11 --- /dev/null +++ b/runtime/syntax/template.vim @@ -0,0 +1,15 @@ +" Vim syntax file +" Language: Generic template +" Maintainer: Bram Moolenaar +" Last Change: 2019 May 06 + +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +" Known template types are very similar to HTML, E.g. golang and "Xfire User +" Interface Template" +" If you know how to recognize a more specific type for *.tmpl suggest a +" change to runtime/scripts.vim. +runtime! syntax/html.vim diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index b6ac6b54ab..021b90ef27 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -23,8 +23,8 @@ syn keyword vimCommand contained a arga[dd] argu[ment] bad[d] bn[ext] breakd[el] syn keyword vimCommand contained ab argd[elete] as[cii] bd[elete] bo[tright] breakl[ist] cN[ext] caddf[ile] ccl[ose] cfdo chd[ir] cle[arjumps] co[py] con[tinue] cr[ewind] d[elete] deletel delm[arks] diffo[ff] dir dp earlier elsei[f] endw[hile] files fini[sh] folddoc[losed] gr[ep] helpc[lose] his[tory] il[ist] iuna[bbrev] keepalt la[st] later lcs lf[ile] lgr[ep] lli[st] lo[adview] lop[en] lua m[ove] mes mkvie[w] nbc[lose] noautocmd nu[mber] opt[ions] pc[lose] popu[p] prof[ile] ptN[ext] ptn[ext] pw[d] pyf[ile] pyxfile rec[over] reg[isters] ri[ght] rubyf[ile] sIe sIr sav[eas] sbl[ast] sc scl scscope sf[ind] sge sgr sig sip sm[ap] sno[magic] sp[lit] spellu[ndo] src srn startg[replace] sun[hide] sw[apname] syntime tabN[ext] tabfir[st] tabo[nly] tc[l] tf[irst] tma[p] tp[revious] tunma[p] unh[ide] v vie[w] vne[w] wh[ile] wn[ext] wundo xme xunme syn keyword vimCommand contained abc[lear] argdo au bel[owright] bp[revious] bro[wse] cNf[ile] cal[l] cd cfir[st] che[ckpath] clo[se] col[der] conf[irm] cs debug deletep delp diffp[atch] dj[ump] dr[op] ec em[enu] ene[w] filet fir[st] foldo[pen] grepa[dd] helpf[ind] i imapc[lear] j[oin] keepj[umps] lad[dexpr] lb[uffer] lcscope lfdo lgrepa[dd] lmak[e] loadk lp[revious] luado ma[rk] messages mod[e] nbs[tart] noh[lsearch] o[pen] ownsyntax pe[rl] pp[op] profd[el] pta[g] ptp[revious] py3 python3 q[uit] red[o] res[ize] rightb[elow] rundo sIg sN[ext] sbN[ext] sbm[odified] scI scp se[t] sfir[st] sgi sh[ell] sign sir sme snoreme spe[llgood] spellw[rong] sre[wind] srp startr[eplace] sunme sy t tabc[lose] tabl[ast] tabp[revious] tcld[o] th[row] tmapc[lear] tr[ewind] u[ndo] unl ve[rsion] vim[grep] vs[plit] win[size] wp[revious] wv[iminfo] xmenu xunmenu syn keyword vimCommand contained abo[veleft] arge[dit] bN[ext] bf[irst] br[ewind] bufdo c[hange] cat[ch] cdo cg[etfile] checkt[ime] cmapc[lear] colo[rscheme] cope[n] cscope debugg[reedy] deletl dep diffpu[t] dl ds[earch] echoe[rr] en[dif] ex filetype fix[del] for gui helpg[rep] ia in ju[mps] keepp[atterns] laddb[uffer] lbo[ttom] ld[o] lfir[st] lh[elpgrep] lmapc[lear] loadkeymap lpf[ile] luafile mak[e] mk[exrc] mz[scheme] new nor ol[dfiles] p[rint] ped[it] pre[serve] promptf[ind] ptf[irst] ptr[ewind] py3do pythonx qa[ll] redi[r] ret[ab] ru[ntime] rv[iminfo] sIl sa[rgument] sb[uffer] sbn[ext] sce scr[iptnames] setf[iletype] sg sgl si sil[ent] sl[eep] smenu snoremenu spelld[ump] spr[evious] srg st[op] stj[ump] sunmenu syn tN[ext] tabd[o] tabm[ove] tabr[ewind] tclf[ile] tj[ump] tn[ext] try una[bbreviate] unlo[ckvar] verb[ose] vimgrepa[dd] wN[ext] winc[md] wq x[it] xnoreme xwininfo -syn keyword vimCommand contained al[l] argg[lobal] b[uffer] bl[ast] brea[k] buffers cabc[lear] cb[uffer] ce[nter] cgetb[uffer] chi[story] cn[ext] com cp[revious] cstag delc[ommand] deletp di[splay] diffs[plit] dli[st] dsp[lit] echom[sg] endf[unction] exi[t] filt[er] fo[ld] fu[nction] gvim helpt[ags] iabc[lear] intro k lN[ext] laddf[ile] lc[d] le[ft] lg[etfile] lhi[story] lne[xt] loc[kmarks] lr[ewind] lv[imgrep] marks mks[ession] mzf[ile] nmapc[lear] nore omapc[lear] pa[ckadd] perld[o] prev[ious] promptr[epl] ptj[ump] pts[elect] py[thon] pyx quita[ll] redr[aw] retu[rn] rub[y] sI sIn sal[l] sba[ll] sbp[revious] scg scripte[ncoding] setg[lobal] sgI sgn sic sim[alt] sla[st] smile so[urce] spelli[nfo] sr sri sta[g] stopi[nsert] sus[pend] sync ta[g] tabe[dit] tabn[ext] tabs te[aroff] tl[ast] tno[remap] ts[elect] undoj[oin] uns[ilent] vert[ical] viu[sage] w[rite] windo wqa[ll] xa[ll] xnoremenu y[ank] -syn keyword vimCommand contained ar[gs] argl[ocal] ba[ll] bm[odified] breaka[dd] bun[load] cad[dbuffer] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cnew[er] comc[lear] cpf[ile] cuna[bbrev] delel delf[unction] dif[fupdate] difft[his] do e[dit] echon endfo[r] exu[sage] fin[d] foldc[lose] g h[elp] hi if is[earch] kee[pmarks] lNf[ile] lan[guage] lch[dir] lefta[bove] lgetb[uffer] ll lnew[er] lockv[ar] ls lvimgrepa[dd] mat[ch] mksp[ell] n[ext] +syn keyword vimCommand contained al[l] argg[lobal] b[uffer] bl[ast] brea[k] buffers cabc[lear] cb[uffer] ce[nter] cgetb[uffer] chi[story] cn[ext] com cp[revious] cstag delc[ommand] deletp di[splay] diffs[plit] dli[st] dsp[lit] echom[sg] endf[unction] exi[t] filt[er] fo[ld] fu[nction] gvim helpt[ags] iabc[lear] intro k lN[ext] laddf[ile] lc[d] le[ft] lg[etfile] lhi[story] lne[xt] loc[kmarks] lr[ewind] lv[imgrep] marks mks[ession] mzf[ile] nmapc[lear] nore omapc[lear] pa[ckadd] perld[o] prev[ious] promptr[epl] ptj[ump] pts[elect] py[thon] pyx quita[ll] redr[aw] retu[rn] rub[y] sI sIn sal[l] sba[ll] sbp[revious] scg scripte[ncoding] setg[lobal] sgI sgn sic sim[alt] sla[st] smile so[urce] spelli[nfo] sr sri sta[g] stopi[nsert] sus[pend] sync ta[g] tabe[dit] tabn[ext] tabs tcd te[aroff] tl[ast] tno[remap] ts[elect] undoj[oin] uns[ilent] vert[ical] viu[sage] w[rite] windo wqa[ll] xa[ll] xnoremenu y[ank] +syn keyword vimCommand contained ar[gs] argl[ocal] ba[ll] bm[odified] breaka[dd] bun[load] cad[dbuffer] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cnew[er] comc[lear] cpf[ile] cuna[bbrev] delel delf[unction] dif[fupdate] difft[his] do e[dit] echon endfo[r] exu[sage] fin[d] foldc[lose] g h[elp] hi if is[earch] kee[pmarks] lNf[ile] lan[guage] lch[dir] lefta[bove] lgetb[uffer] ll lnew[er] lockv[ar] ls lvimgrepa[dd] mat[ch] mksp[ell] n[ext] tch[dir] syn match vimCommand contained "\" syn keyword vimStdPlugin contained Arguments Break Clear Continue DiffOrig Evaluate Finish Gdb Man N[ext] Over P[rint] Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Winbar XMLent XMLns diff --git a/runtime/vim.desktop b/runtime/vim.desktop index f27de352b5..9efe195089 100644 --- a/runtime/vim.desktop +++ b/runtime/vim.desktop @@ -6,14 +6,15 @@ Name[de]=Vim Name=Vim # Translators: This is the Generic Application Name used in the Vim desktop file GenericName[de]=Texteditor +GenericName[ja]=テキストエディタ GenericName=Text Editor # Translators: This is the comment used in the Vim desktop file Comment[de]=Textdateien bearbeiten +Comment[ja]=テキストファイルを編集します Comment=Edit text files # The translations should come from the po file. Leave them here for now, they will # be overwritten by the po file when generating the desktop.file. GenericName[da]=Teksteditor -GenericName[de]=Texteditor GenericName[pl]=Edytor tekstu GenericName[is]=Ritvinnsluforrit Comment[af]=Redigeer tekslêers @@ -28,7 +29,6 @@ Comment[ca]=Edita fitxers de text Comment[cs]=Úprava textových souborů Comment[cy]=Golygu ffeiliau testun Comment[da]=Rediger tekstfiler -Comment[de]=Textdateien bearbeiten Comment[el]=Επεξεργασία αρχείων κειμένου Comment[en_CA]=Edit text files Comment[en_GB]=Edit text files @@ -47,7 +47,6 @@ Comment[hu]=Szövegfájlok szerkesztése Comment[id]=Edit file teks Comment[is]=Vinna með textaskrár Comment[it]=Modifica file di testo -Comment[ja]=テキストファイルを編集します Comment[kn]=ಪಠ್ಯ ಕಡತಗಳನ್ನು ಸಂಪಾದಿಸು Comment[ko]=텍스트 파일을 편집합니다 Comment[lt]=Redaguoti tekstines bylas @@ -90,6 +89,7 @@ Terminal=true Type=Application # Translators: Search terms to find this application. Do NOT change the semicolons! The list MUST also end with a semicolon! Keywords[de]=Text;Editor; +Keywords[ja]=テキスト;エディタ; Keywords=Text;editor; # Translators: This is the Icon file name. Do NOT translate Icon[de]=gvim diff --git a/src/po/af.po b/src/po/af.po index 9b6fb0accd..2ff73694f6 100644 --- a/src/po/af.po +++ b/src/po/af.po @@ -240,7 +240,7 @@ msgstr " Sleutelwoord voltooiing (^N^P)" msgid " ^X mode (^E^Y^L^]^F^I^K^D^V^N^P)" msgstr " ^X modus (^E^Y^L^]^F^I^K^D^V^N^P)" -#. Scroll has it's own msgs, in it's place there is the msg for local +#. Scroll has its own msgs, in its place there is the msg for local #. * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo msgid " Keyword Local completion (^N^P)" msgstr " Sleutelwoord Lokale voltooiing (^N^P)" diff --git a/src/po/cs.cp1250.po b/src/po/cs.cp1250.po index 181340120f..db3590d98f 100644 --- a/src/po/cs.cp1250.po +++ b/src/po/cs.cp1250.po @@ -218,7 +218,7 @@ msgstr " Dopl msgid " ^X mode (^E/^Y/^L/^]/^F/^I/^K/^D/^V/^N/^P)" msgstr " ^X reim (^E/^Y/^L/^]/^F/^I/^K/^D/^V/^N/^P)" -#. Scroll has it's own msgs, in it's place there is the msg for local +#. Scroll has its own msgs, in its place there is the msg for local #. * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo msgid " Keyword Local completion (^N/^P)" msgstr " Lokln doplovn klovch slov (^N/^P)" diff --git a/src/po/cs.po b/src/po/cs.po index 5b9e686191..df18a13446 100644 --- a/src/po/cs.po +++ b/src/po/cs.po @@ -218,7 +218,7 @@ msgstr " Dopl msgid " ^X mode (^E/^Y/^L/^]/^F/^I/^K/^D/^V/^N/^P)" msgstr " ^X reim (^E/^Y/^L/^]/^F/^I/^K/^D/^V/^N/^P)" -#. Scroll has it's own msgs, in it's place there is the msg for local +#. Scroll has its own msgs, in its place there is the msg for local #. * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo msgid " Keyword Local completion (^N/^P)" msgstr " Lokln doplovn klovch slov (^N/^P)" diff --git a/src/po/es.po b/src/po/es.po index e4efdf9af3..91f8618fe1 100644 --- a/src/po/es.po +++ b/src/po/es.po @@ -357,7 +357,7 @@ msgstr " Completar con método Omni (^O^N^P)" msgid " Spelling suggestion (s^N^P)" msgstr " Sugerencia de ortografía (s^N^P)" -# Scroll has it's own msgs, in it's place there is the msg for local +# Scroll has its own msgs, in its place there is the msg for local # * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo #: edit.c:57 msgid " Keyword Local completion (^N^P)" diff --git a/src/po/gvim.desktop.in b/src/po/gvim.desktop.in index 287a4891b2..7d5234851b 100644 --- a/src/po/gvim.desktop.in +++ b/src/po/gvim.desktop.in @@ -45,7 +45,6 @@ Comment[hu]=Szövegfájlok szerkesztése Comment[id]=Edit file teks Comment[is]=Vinna með textaskrár Comment[it]=Modifica file di testo -Comment[ja]=テキストファイルを編集します Comment[kn]=ಪಠ್ಯ ಕಡತಗಳನ್ನು ಸಂಪಾದಿಸು Comment[ko]=텍스트 파일을 편집합니다 Comment[lt]=Redaguoti tekstines bylas diff --git a/src/po/ja.euc-jp.po b/src/po/ja.euc-jp.po index e503f31264..f2d0115625 100644 --- a/src/po/ja.euc-jp.po +++ b/src/po/ja.euc-jp.po @@ -14,8 +14,8 @@ msgid "" msgstr "" "Project-Id-Version: Vim 8.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-18 19:15+0900\n" -"PO-Revision-Date: 2019-03-12 08:23+0900\n" +"POT-Creation-Date: 2019-05-05 11:27+0900\n" +"PO-Revision-Date: 2019-05-05 13:00+0900\n" "Last-Translator: MURAOKA Taro \n" "Language-Team: Japanese \n" "Language: ja\n" @@ -331,6 +331,51 @@ msgstr " msgid "[crypted]" msgstr "[Ź沽]" +msgid "Entering Debug mode. Type \"cont\" to continue." +msgstr "ǥХå⡼ɤޤ. ³ˤ \"cont\" ϤƤ." + +#, c-format +msgid "Oldval = \"%s\"" +msgstr "Ť = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr " = \"%s\"" + +#, c-format +msgid "line %ld: %s" +msgstr " %ld: %s" + +#, c-format +msgid "cmd: %s" +msgstr "ޥ: %s" + +msgid "frame is zero" +msgstr "ե졼ब 0 Ǥ" + +#, c-format +msgid "frame at highest level: %d" +msgstr "ǹ٥Υե졼: %d" + +#, c-format +msgid "Breakpoint in \"%s%s\" line %ld" +msgstr "֥졼ݥ \"%s%s\" %ld" + +#, c-format +msgid "E161: Breakpoint not found: %s" +msgstr "E161: ֥졼ݥȤĤޤ: %s" + +msgid "No breakpoints defined" +msgstr "֥졼ݥȤƤޤ" + +#, c-format +msgid "%3d %s %s line %ld" +msgstr "%3d %s %s %ld" + +#, c-format +msgid "%3d expr %s" +msgstr "%3d expr %s" + #, c-format msgid "E720: Missing colon in Dictionary: %s" msgstr "E720: 񷿤˥󤬤ޤ: %s" @@ -494,106 +539,6 @@ msgstr "E105: :source msgid "E791: Empty keymap entry" msgstr "E791: Υޥåץȥ" -msgid " Keyword completion (^N^P)" -msgstr " 䴰 (^N^P)" - -msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" -msgstr " ^X ⡼ (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" - -msgid " Whole line completion (^L^N^P)" -msgstr " ()䴰 (^L^N^P)" - -msgid " File name completion (^F^N^P)" -msgstr " ե̾䴰 (^F^N^P)" - -msgid " Tag completion (^]^N^P)" -msgstr " 䴰 (^]^N^P)" - -msgid " Path pattern completion (^N^P)" -msgstr " ѥѥ䴰 (^N^P)" - -msgid " Definition completion (^D^N^P)" -msgstr " 䴰 (^D^N^P)" - -msgid " Dictionary completion (^K^N^P)" -msgstr " 䴰 (^K^N^P)" - -msgid " Thesaurus completion (^T^N^P)" -msgstr " 饹䴰 (^T^N^P)" - -msgid " Command-line completion (^V^N^P)" -msgstr " ޥɥ饤䴰 (^V^N^P)" - -msgid " User defined completion (^U^N^P)" -msgstr " 桼䴰 (^U^N^P)" - -msgid " Omni completion (^O^N^P)" -msgstr " 䴰 (^O^N^P)" - -msgid " Spelling suggestion (s^N^P)" -msgstr " ֤꽤 (s^N^P)" - -msgid " Keyword Local completion (^N^P)" -msgstr " ɽꥭ䴰 (^N^P)" - -msgid "Hit end of paragraph" -msgstr "κǸ˥ҥå" - -msgid "E839: Completion function changed window" -msgstr "E839: ִؿɥѹޤ" - -msgid "E840: Completion function deleted text" -msgstr "E840: 䴰ؿƥȤޤ" - -msgid "'dictionary' option is empty" -msgstr "'dictionary' ץ󤬶Ǥ" - -msgid "'thesaurus' option is empty" -msgstr "'thesaurus' ץ󤬶Ǥ" - -#, c-format -msgid "Scanning dictionary: %s" -msgstr "򥹥: %s" - -msgid " (insert) Scroll (^E/^Y)" -msgstr " () (^E/^Y)" - -msgid " (replace) Scroll (^E/^Y)" -msgstr " (ִ) (^E/^Y)" - -#, c-format -msgid "Scanning: %s" -msgstr ": %s" - -msgid "Scanning tags." -msgstr "򥹥." - -msgid "match in file" -msgstr "եΥޥå" - -msgid " Adding" -msgstr " ɲ" - -msgid "-- Searching..." -msgstr "-- ..." - -msgid "Back at original" -msgstr "Ϥ" - -msgid "Word from other line" -msgstr "¾ιԤñ" - -msgid "The only match" -msgstr "ͣγ" - -#, c-format -msgid "match %d of %d" -msgstr "%d ܤγ ( %d )" - -#, c-format -msgid "match %d" -msgstr "%d ܤγ" - msgid "E18: Unexpected characters in :let" msgstr "E18: ͽʸ :let ˤޤ" @@ -618,6 +563,9 @@ msgstr "E461: msgid "E806: using Float as a String" msgstr "E806: ưʸȤưäƤޤ" +msgid "E985: .= is not supported with script version 2" +msgstr "E985: .= ϥץȥС 2 ǤбƤޤ" + msgid "E687: Less targets than List items" msgstr "E687: åȤꥹȷǤ⾯ʤǤ" @@ -846,6 +794,9 @@ msgstr "E899: %s msgid "E928: String required" msgstr "E928: ʸɬפǤ" +msgid "E957: Invalid window number" +msgstr "E957: ̵ʥɥֹǤ" + msgid "E808: Number or Float required" msgstr "E808: ͤưɬפǤ" @@ -902,9 +853,6 @@ msgstr "E916: ͭ msgid "E701: Invalid type for len()" msgstr "E701: len() ˤ̵ʷǤ" -msgid "E957: Invalid window number" -msgstr "E957: ̵ʥɥֹǤ" - #, c-format msgid "E798: ID is reserved for \":match\": %d" msgstr "E798: ID \":match\" Τͽ󤵤Ƥޤ: %d" @@ -1248,51 +1196,6 @@ msgstr "E150: msgid "No old files" msgstr "ŤեϤޤ" -msgid "Entering Debug mode. Type \"cont\" to continue." -msgstr "ǥХå⡼ɤޤ. ³ˤ \"cont\" ϤƤ." - -#, c-format -msgid "Oldval = \"%s\"" -msgstr "Ť = \"%s\"" - -#, c-format -msgid "Newval = \"%s\"" -msgstr " = \"%s\"" - -#, c-format -msgid "line %ld: %s" -msgstr " %ld: %s" - -#, c-format -msgid "cmd: %s" -msgstr "ޥ: %s" - -msgid "frame is zero" -msgstr "ե졼ब 0 Ǥ" - -#, c-format -msgid "frame at highest level: %d" -msgstr "ǹ٥Υե졼: %d" - -#, c-format -msgid "Breakpoint in \"%s%s\" line %ld" -msgstr "֥졼ݥ \"%s%s\" %ld" - -#, c-format -msgid "E161: Breakpoint not found: %s" -msgstr "E161: ֥졼ݥȤĤޤ: %s" - -msgid "No breakpoints defined" -msgstr "֥졼ݥȤƤޤ" - -#, c-format -msgid "%3d %s %s line %ld" -msgstr "%3d %s %s %ld" - -#, c-format -msgid "%3d expr %s" -msgstr "%3d expr %s" - msgid "E750: First use \":profile start {fname}\"" msgstr "E750: \":profile start {fname}\" ¹ԤƤ" @@ -1396,6 +1299,13 @@ msgstr "W15: msgid "E167: :scriptencoding used outside of a sourced file" msgstr "E167: :scriptencoding ץȰʳǻѤޤ" +msgid "E984: :scriptversion used outside of a sourced file" +msgstr "E984: :scriptversion ץȰʳǻѤޤ" + +#, c-format +msgid "E999: scriptversion not supported: %d" +msgstr "E999: scriptversion ϥݡȤƤޤ: %d" + msgid "E168: :finish used outside of a sourced file" msgstr "E168: :finish ץȰʳǻѤޤ" @@ -1445,6 +1355,12 @@ msgstr " msgid "E494: Use w or w>>" msgstr "E494: w ⤷ w>> ѤƤ" +msgid "" +"INTERNAL: Cannot use DFLALL with ADDR_NONE, ADDR_UNSIGNED or ADDR_QUICKFIX" +msgstr "" +"顼: DFLALL ADDR_NONE, ADDR_UNSIGNED ADDR_QUICKFIX ȤȤ˻Ȥ" +"ȤϤǤޤ" + msgid "E943: Command table needs to be updated, run 'make cmdidxs'" msgstr "" "E943: ޥɥơ֥򹹿ɬפޤ'make cmdidxs' ¹ԤƤ" @@ -1463,69 +1379,6 @@ msgid "E173: %d more file to edit" msgid_plural "E173: %d more files to edit" msgstr[0] "E173: Խ٤ե뤬 %d Ĥޤ" -#, c-format -msgid "E174: Command already exists: add ! to replace it: %s" -msgstr "E174: ޥɤˤޤ: ˤ ! ɲäƤ: %s" - -msgid "" -"\n" -" Name Args Address Complete Definition" -msgstr "" -"\n" -" ̾ ɥ쥹 䴰 " - -msgid "No user-defined commands found" -msgstr "桼ޥɤĤޤǤ" - -msgid "E175: No attribute specified" -msgstr "E175: °Ƥޤ" - -msgid "E176: Invalid number of arguments" -msgstr "E176: ο̵Ǥ" - -msgid "E177: Count cannot be specified twice" -msgstr "E177: Ȥ2Żꤹ뤳ȤϤǤޤ" - -msgid "E178: Invalid default value for count" -msgstr "E178: Ȥξά̵ͤǤ" - -msgid "E179: argument required for -complete" -msgstr "E179: -complete ˤϰɬפǤ" - -msgid "E179: argument required for -addr" -msgstr "E179: -addr ˤϰɬפǤ" - -#, c-format -msgid "E181: Invalid attribute: %s" -msgstr "E181: ̵°Ǥ: %s" - -msgid "E182: Invalid command name" -msgstr "E182: ̵ʥޥ̾Ǥ" - -msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: 桼ޥɤϱʸǻϤޤʤФʤޤ" - -msgid "E841: Reserved name, cannot be used for user defined command" -msgstr "E841: ͽ̾ʤΤǡ桼ޥɤѤǤޤ" - -#, c-format -msgid "E184: No such user-defined command: %s" -msgstr "E184: Υ桼ޥɤϤޤ: %s" - -#, c-format -msgid "E180: Invalid address type value: %s" -msgstr "E180: ̵ʥɥ쥹ͤǤ: %s" - -#, c-format -msgid "E180: Invalid complete value: %s" -msgstr "E180: ̵䴰Ǥ: %s" - -msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: 䴰ϥ䴰ǤѤǤޤ" - -msgid "E467: Custom completion requires a function argument" -msgstr "E467: 䴰ˤϰȤƴؿɬפǤ" - msgid "unknown" msgstr "" @@ -1908,20 +1761,21 @@ msgid "is read-only (add ! to override)" msgstr "ɹѤǤ (ˤ ! ɲ)" msgid "E506: Can't write to backup file (add ! to override)" -msgstr "E506: Хååץե¸Ǥޤ (! ɲäǶ¸)" +msgstr "E506: Хååץե¸Ǥޤ (! ɲäǶ)" msgid "E507: Close error for backup file (add ! to override)" msgstr "" -"E507: ХååץեĤݤ˥顼ȯޤ (! ɲäǶ)" +"E507: ХååץեĤݤ˥顼ȯޤ (! ɲäǶ" +")" msgid "E508: Can't read file for backup (add ! to override)" -msgstr "E508: Хååѥեɹޤ (! ɲäǶɹ)" +msgstr "E508: Хååѥեɹޤ (! ɲäǶ)" msgid "E509: Cannot create backup file (add ! to override)" -msgstr "E509: Хååץեޤ (! ɲäǶ)" +msgstr "E509: Хååץեޤ (! ɲäǶ)" msgid "E510: Can't make backup file (add ! to override)" -msgstr "E510: Хååץեޤ (! ɲäǶ)" +msgstr "E510: Хååץեޤ (! ɲäǶ)" msgid "E214: Can't find temp file for writing" msgstr "E214: ¸Ѱե뤬Ĥޤ" @@ -2391,6 +2245,9 @@ msgstr "E671: msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." msgstr "E243: ϥݡȤޤ: \"-%s\"; OLEǤѤƤ." +msgid "E988: GUI cannot be used. Cannot execute gvim.exe." +msgstr "E988: GUIϻԲǽǤgvim.exeưǤޤ" + msgid "E672: Unable to open window inside MDI application" msgstr "E672: MDIץǤϥɥ򳫤ޤ" @@ -2931,6 +2788,106 @@ msgstr "E573: ̵ msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: VIM ΤϿץѥƥǤ. õޤ!" +msgid " Keyword completion (^N^P)" +msgstr " 䴰 (^N^P)" + +msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" +msgstr " ^X ⡼ (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" + +msgid " Whole line completion (^L^N^P)" +msgstr " ()䴰 (^L^N^P)" + +msgid " File name completion (^F^N^P)" +msgstr " ե̾䴰 (^F^N^P)" + +msgid " Tag completion (^]^N^P)" +msgstr " 䴰 (^]^N^P)" + +msgid " Path pattern completion (^N^P)" +msgstr " ѥѥ䴰 (^N^P)" + +msgid " Definition completion (^D^N^P)" +msgstr " 䴰 (^D^N^P)" + +msgid " Dictionary completion (^K^N^P)" +msgstr " 䴰 (^K^N^P)" + +msgid " Thesaurus completion (^T^N^P)" +msgstr " 饹䴰 (^T^N^P)" + +msgid " Command-line completion (^V^N^P)" +msgstr " ޥɥ饤䴰 (^V^N^P)" + +msgid " User defined completion (^U^N^P)" +msgstr " 桼䴰 (^U^N^P)" + +msgid " Omni completion (^O^N^P)" +msgstr " 䴰 (^O^N^P)" + +msgid " Spelling suggestion (s^N^P)" +msgstr " ֤꽤 (s^N^P)" + +msgid " Keyword Local completion (^N^P)" +msgstr " ɽꥭ䴰 (^N^P)" + +msgid "Hit end of paragraph" +msgstr "κǸ˥ҥå" + +msgid "E839: Completion function changed window" +msgstr "E839: 䴰ؿɥѹޤ" + +msgid "E840: Completion function deleted text" +msgstr "E840: 䴰ؿƥȤޤ" + +msgid "'dictionary' option is empty" +msgstr "'dictionary' ץ󤬶Ǥ" + +msgid "'thesaurus' option is empty" +msgstr "'thesaurus' ץ󤬶Ǥ" + +#, c-format +msgid "Scanning dictionary: %s" +msgstr "򥹥: %s" + +msgid " (insert) Scroll (^E/^Y)" +msgstr " () (^E/^Y)" + +msgid " (replace) Scroll (^E/^Y)" +msgstr " (ִ) (^E/^Y)" + +#, c-format +msgid "Scanning: %s" +msgstr ": %s" + +msgid "Scanning tags." +msgstr "򥹥." + +msgid "match in file" +msgstr "եΥޥå" + +msgid " Adding" +msgstr " ɲ" + +msgid "-- Searching..." +msgstr "-- ..." + +msgid "Back at original" +msgstr "Ϥ" + +msgid "Word from other line" +msgstr "¾ιԤñ" + +msgid "The only match" +msgstr "ͣγ" + +#, c-format +msgid "match %d of %d" +msgstr "%d ܤγ ( %d )" + +#, c-format +msgid "match %d" +msgstr "%d ܤγ" + #, c-format msgid "E938: Duplicate key in JSON: \"%s\"" msgstr "E938: JSON˽ʣޤ: \"%s\"" @@ -3852,6 +3809,9 @@ msgstr "" "\"\n" " äФΥåǤޤ.\n" +msgid "Found a swap file that is not useful, deleting it" +msgstr "פʥåץե뤬Ĥޤޤ" + msgid "Swap file \"" msgstr "åץե \"" @@ -4142,6 +4102,9 @@ msgstr "" "٤Ƥѹ˴Vimλˤ :qa! Ϥ 򲡤Ƥ" "" +msgid "Type :qa and press to exit Vim" +msgstr "Vimλˤ :qa Ϥ 򲡤Ƥ" + #, c-format msgid "%ld line %sed %d time" msgid_plural "%ld line %sed %d times" @@ -4618,15 +4581,6 @@ msgstr "XSMP SmcOpenConnection msgid "At line" msgstr "" -msgid "Could not load vim32.dll!" -msgstr "vim32.dll ɤǤޤǤ" - -msgid "VIM Error" -msgstr "VIM顼" - -msgid "Could not fix up function pointers to the DLL!" -msgstr "DLLؿݥ󥿤ǤޤǤ" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: ٥ %s \n" @@ -4659,6 +4613,9 @@ msgstr "Vim msgid "shell returned %d" msgstr "뤬 %d ǽλޤ" +msgid "E553: No more items" +msgstr "E553: Ǥ⤦ޤ" + msgid "E926: Current location list was changed" msgstr "E926: ߤΥꥹȤѹޤ" @@ -4691,9 +4648,6 @@ msgstr "E378: 'errorformat' msgid "E379: Missing or empty directory name" msgstr "E379: ǥ쥯ȥ̵̾Ǥ" -msgid "E553: No more items" -msgstr "E553: Ǥ⤦ޤ" - msgid "E924: Current window was closed" msgstr "E924: ߤΥɥĤޤ" @@ -5705,6 +5659,12 @@ msgstr "E555: msgid "E556: at top of tag stack" msgstr "E556: åƬǤ" +msgid "E986: cannot modify the tag stack within tagfunc" +msgstr "E986: tagfuncΥåѹǤޤ" + +msgid "E987: invalid return value from tagfunc" +msgstr "E987: tagfunc̵ͤǤ" + msgid "E425: Cannot go before first matching tag" msgstr "E425: ǽγۤ뤳ȤϤǤޤ" @@ -5712,12 +5672,6 @@ msgstr "E425: msgid "E426: tag not found: %s" msgstr "E426: Ĥޤ: %s" -msgid " # pri kind tag" -msgstr " # pri kind tag" - -msgid "file\n" -msgstr "ե\n" - msgid "E427: There is only one matching tag" msgstr "E427: 1Ĥޤ" @@ -5742,6 +5696,12 @@ msgstr " msgid "E429: File \"%s\" does not exist" msgstr "E429: ե \"%s\" ޤ" +msgid " # pri kind tag" +msgstr " # pri kind tag" + +msgid "file\n" +msgstr "ե\n" + msgid "" "\n" " # TO tag FROM line in file/text" @@ -5817,6 +5777,10 @@ msgstr "" msgid "Cannot open $VIMRUNTIME/rgb.txt" msgstr "$VIMRUNTIME/rgb.txt򳫤ޤ" +#, c-format +msgid "E181: Invalid attribute: %s" +msgstr "E181: ̵°Ǥ: %s" + #, c-format msgid "Kill job in \"%s\"?" msgstr "\"%s\" Υ֤λޤ?" @@ -6023,6 +5987,65 @@ msgstr "E439: msgid "E440: undo line missing" msgstr "E440: ɥԤޤ" +msgid "" +"\n" +" Name Args Address Complete Definition" +msgstr "" +"\n" +" ̾ ɥ쥹 䴰 " + +msgid "No user-defined commands found" +msgstr "桼ޥɤĤޤǤ" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: ̵ʥɥ쥹ͤǤ: %s" + +#, c-format +msgid "E180: Invalid complete value: %s" +msgstr "E180: ̵䴰Ǥ: %s" + +msgid "E468: Completion argument only allowed for custom completion" +msgstr "E468: 䴰ϥ䴰ǤѤǤޤ" + +msgid "E467: Custom completion requires a function argument" +msgstr "E467: 䴰ˤϰȤƴؿɬפǤ" + +msgid "E175: No attribute specified" +msgstr "E175: °Ƥޤ" + +msgid "E176: Invalid number of arguments" +msgstr "E176: ο̵Ǥ" + +msgid "E177: Count cannot be specified twice" +msgstr "E177: Ȥ2Żꤹ뤳ȤϤǤޤ" + +msgid "E178: Invalid default value for count" +msgstr "E178: Ȥξά̵ͤǤ" + +msgid "E179: argument required for -complete" +msgstr "E179: -complete ˤϰɬפǤ" + +msgid "E179: argument required for -addr" +msgstr "E179: -addr ˤϰɬפǤ" + +#, c-format +msgid "E174: Command already exists: add ! to replace it: %s" +msgstr "E174: ޥɤˤޤ: ˤ ! ɲäƤ: %s" + +msgid "E182: Invalid command name" +msgstr "E182: ̵ʥޥ̾Ǥ" + +msgid "E183: User defined commands must start with an uppercase letter" +msgstr "E183: 桼ޥɤϱʸǻϤޤʤФʤޤ" + +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "E841: ͽ̾ʤΤǡ桼ޥɤѤǤޤ" + +#, c-format +msgid "E184: No such user-defined command: %s" +msgstr "E184: Υ桼ޥɤϤޤ: %s" + #, c-format msgid "E122: Function %s already exists, add ! to replace it" msgstr "E122: ؿ %s ѤǤˤ ! ɲäƤ" @@ -6155,6 +6178,20 @@ msgstr "E107: msgid "%s (%s, compiled %s)" msgstr "%s (%s, compiled %s)" +msgid "" +"\n" +"MS-Windows 64-bit GUI/console version" +msgstr "" +"\n" +"MS-Windows 64 ӥå GUI/󥽡 " + +msgid "" +"\n" +"MS-Windows 32-bit GUI/console version" +msgstr "" +"\n" +"MS-Windows 32 ӥå GUI/󥽡 " + msgid "" "\n" "MS-Windows 64-bit GUI version" @@ -6593,6 +6630,10 @@ msgstr "E474: ̵ msgid "E475: Invalid argument: %s" msgstr "E475: ̵ʰǤ: %s" +#, c-format +msgid "E983: Duplicate argument: %s" +msgstr "E983: ʣƤޤ: %s" + #, c-format msgid "E475: Invalid value for argument %s" msgstr "E475: %s Ф̵ͤǤ" @@ -7218,3 +7259,21 @@ msgstr "" "C (*.c, *.h)\t*.c;*.h\n" "C++ (*.cpp, *.hpp)\t*.cpp;*.hpp\n" "Vimե (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +#~ msgid "GVim" +#~ msgstr "" + +msgid "Text Editor" +msgstr "ƥȥǥ" + +msgid "Edit text files" +msgstr "ƥȥեԽޤ" + +msgid "Text;editor;" +msgstr "ƥ;ǥ;" + +#~ msgid "gvim" +#~ msgstr "" + +#~ msgid "Vim" +#~ msgstr "" diff --git a/src/po/ja.po b/src/po/ja.po index 38ec535972..f66f2b1df1 100644 --- a/src/po/ja.po +++ b/src/po/ja.po @@ -14,8 +14,8 @@ msgid "" msgstr "" "Project-Id-Version: Vim 8.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-18 19:15+0900\n" -"PO-Revision-Date: 2019-03-12 08:23+0900\n" +"POT-Creation-Date: 2019-05-05 11:27+0900\n" +"PO-Revision-Date: 2019-05-05 13:00+0900\n" "Last-Translator: MURAOKA Taro \n" "Language-Team: Japanese \n" "Language: ja\n" @@ -331,6 +331,51 @@ msgstr "キーが一致しません" msgid "[crypted]" msgstr "[暗号化]" +msgid "Entering Debug mode. Type \"cont\" to continue." +msgstr "デバッグモードに入ります. 続けるには \"cont\" と入力してください." + +#, c-format +msgid "Oldval = \"%s\"" +msgstr "古い値 = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "新しい値 = \"%s\"" + +#, c-format +msgid "line %ld: %s" +msgstr "行 %ld: %s" + +#, c-format +msgid "cmd: %s" +msgstr "コマンド: %s" + +msgid "frame is zero" +msgstr "フレームが 0 です" + +#, c-format +msgid "frame at highest level: %d" +msgstr "最高レベルのフレーム: %d" + +#, c-format +msgid "Breakpoint in \"%s%s\" line %ld" +msgstr "ブレークポイント \"%s%s\" 行 %ld" + +#, c-format +msgid "E161: Breakpoint not found: %s" +msgstr "E161: ブレークポイントが見つかりません: %s" + +msgid "No breakpoints defined" +msgstr "ブレークポイントが定義されていません" + +#, c-format +msgid "%3d %s %s line %ld" +msgstr "%3d %s %s 行 %ld" + +#, c-format +msgid "%3d expr %s" +msgstr "%3d expr %s" + #, c-format msgid "E720: Missing colon in Dictionary: %s" msgstr "E720: 辞書型にコロンがありません: %s" @@ -494,106 +539,6 @@ msgstr "E105: :source で取込むファイル以外では :loadkeymap を使え msgid "E791: Empty keymap entry" msgstr "E791: 空のキーマップエントリ" -msgid " Keyword completion (^N^P)" -msgstr " キーワード補完 (^N^P)" - -msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" -msgstr " ^X モード (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" - -msgid " Whole line completion (^L^N^P)" -msgstr " 行(全体)補完 (^L^N^P)" - -msgid " File name completion (^F^N^P)" -msgstr " ファイル名補完 (^F^N^P)" - -msgid " Tag completion (^]^N^P)" -msgstr " タグ補完 (^]^N^P)" - -msgid " Path pattern completion (^N^P)" -msgstr " パスパターン補完 (^N^P)" - -msgid " Definition completion (^D^N^P)" -msgstr " 定義補完 (^D^N^P)" - -msgid " Dictionary completion (^K^N^P)" -msgstr " 辞書補完 (^K^N^P)" - -msgid " Thesaurus completion (^T^N^P)" -msgstr " シソーラス補完 (^T^N^P)" - -msgid " Command-line completion (^V^N^P)" -msgstr " コマンドライン補完 (^V^N^P)" - -msgid " User defined completion (^U^N^P)" -msgstr " ユーザー定義補完 (^U^N^P)" - -msgid " Omni completion (^O^N^P)" -msgstr " オムニ補完 (^O^N^P)" - -msgid " Spelling suggestion (s^N^P)" -msgstr " 綴り修正候補 (s^N^P)" - -msgid " Keyword Local completion (^N^P)" -msgstr " 局所キーワード補完 (^N^P)" - -msgid "Hit end of paragraph" -msgstr "段落の最後にヒット" - -msgid "E839: Completion function changed window" -msgstr "E839: 補間関数がウィンドウを変更しました" - -msgid "E840: Completion function deleted text" -msgstr "E840: 補完関数がテキストを削除しました" - -msgid "'dictionary' option is empty" -msgstr "'dictionary' オプションが空です" - -msgid "'thesaurus' option is empty" -msgstr "'thesaurus' オプションが空です" - -#, c-format -msgid "Scanning dictionary: %s" -msgstr "辞書をスキャン中: %s" - -msgid " (insert) Scroll (^E/^Y)" -msgstr " (挿入) スクロール(^E/^Y)" - -msgid " (replace) Scroll (^E/^Y)" -msgstr " (置換) スクロール (^E/^Y)" - -#, c-format -msgid "Scanning: %s" -msgstr "スキャン中: %s" - -msgid "Scanning tags." -msgstr "タグをスキャン中." - -msgid "match in file" -msgstr "ファイル内のマッチ" - -msgid " Adding" -msgstr " 追加中" - -msgid "-- Searching..." -msgstr "-- 検索中..." - -msgid "Back at original" -msgstr "始めに戻る" - -msgid "Word from other line" -msgstr "他の行の単語" - -msgid "The only match" -msgstr "唯一の該当" - -#, c-format -msgid "match %d of %d" -msgstr "%d 番目の該当 (全該当 %d 個中)" - -#, c-format -msgid "match %d" -msgstr "%d 番目の該当" - msgid "E18: Unexpected characters in :let" msgstr "E18: 予期せぬ文字が :let にありました" @@ -618,6 +563,9 @@ msgstr "E461: 不正な変数名です: %s" msgid "E806: using Float as a String" msgstr "E806: 浮動小数点数を文字列として扱っています" +msgid "E985: .= is not supported with script version 2" +msgstr "E985: .= はスクリプトバージョン 2 では対応していません" + msgid "E687: Less targets than List items" msgstr "E687: ターゲットがリスト型内の要素よりも少ないです" @@ -846,6 +794,9 @@ msgstr "E899: %s の引数はリスト型またはBlob型でなければなり msgid "E928: String required" msgstr "E928: 文字列が必要です" +msgid "E957: Invalid window number" +msgstr "E957: 無効なウィンドウ番号です" + msgid "E808: Number or Float required" msgstr "E808: 数値か浮動小数点数が必要です" @@ -902,9 +853,6 @@ msgstr "E916: 有効なジョブではありません" msgid "E701: Invalid type for len()" msgstr "E701: len() には無効な型です" -msgid "E957: Invalid window number" -msgstr "E957: 無効なウィンドウ番号です" - #, c-format msgid "E798: ID is reserved for \":match\": %d" msgstr "E798: ID は \":match\" のために予約されています: %d" @@ -1248,51 +1196,6 @@ msgstr "E150: ディレクトリではありません: %s" msgid "No old files" msgstr "古いファイルはありません" -msgid "Entering Debug mode. Type \"cont\" to continue." -msgstr "デバッグモードに入ります. 続けるには \"cont\" と入力してください." - -#, c-format -msgid "Oldval = \"%s\"" -msgstr "古い値 = \"%s\"" - -#, c-format -msgid "Newval = \"%s\"" -msgstr "新しい値 = \"%s\"" - -#, c-format -msgid "line %ld: %s" -msgstr "行 %ld: %s" - -#, c-format -msgid "cmd: %s" -msgstr "コマンド: %s" - -msgid "frame is zero" -msgstr "フレームが 0 です" - -#, c-format -msgid "frame at highest level: %d" -msgstr "最高レベルのフレーム: %d" - -#, c-format -msgid "Breakpoint in \"%s%s\" line %ld" -msgstr "ブレークポイント \"%s%s\" 行 %ld" - -#, c-format -msgid "E161: Breakpoint not found: %s" -msgstr "E161: ブレークポイントが見つかりません: %s" - -msgid "No breakpoints defined" -msgstr "ブレークポイントが定義されていません" - -#, c-format -msgid "%3d %s %s line %ld" -msgstr "%3d %s %s 行 %ld" - -#, c-format -msgid "%3d expr %s" -msgstr "%3d expr %s" - msgid "E750: First use \":profile start {fname}\"" msgstr "E750: 初めに \":profile start {fname}\" を実行してください" @@ -1396,6 +1299,13 @@ msgstr "W15: 警告: 行区切が不正です. ^M がないのでしょう" msgid "E167: :scriptencoding used outside of a sourced file" msgstr "E167: :scriptencoding が取込スクリプト以外で使用されました" +msgid "E984: :scriptversion used outside of a sourced file" +msgstr "E984: :scriptversion が取込スクリプト以外で使用されました" + +#, c-format +msgid "E999: scriptversion not supported: %d" +msgstr "E999: scriptversion はサポートされていません: %d" + msgid "E168: :finish used outside of a sourced file" msgstr "E168: :finish が取込スクリプト以外で使用されました" @@ -1445,6 +1355,12 @@ msgstr "逆さまの範囲が指定されました、入替えますか?" msgid "E494: Use w or w>>" msgstr "E494: w もしくは w>> を使用してください" +msgid "" +"INTERNAL: Cannot use DFLALL with ADDR_NONE, ADDR_UNSIGNED or ADDR_QUICKFIX" +msgstr "" +"内部エラー: DFLALL を ADDR_NONE, ADDR_UNSIGNED や ADDR_QUICKFIX とともに使う" +"ことはできません" + msgid "E943: Command table needs to be updated, run 'make cmdidxs'" msgstr "" "E943: コマンドテーブルを更新する必要があります、'make cmdidxs' を実行してくだ" @@ -1463,69 +1379,6 @@ msgid "E173: %d more file to edit" msgid_plural "E173: %d more files to edit" msgstr[0] "E173: 編集すべきファイルがあと %d 個あります" -#, c-format -msgid "E174: Command already exists: add ! to replace it: %s" -msgstr "E174: コマンドが既にあります: 再定義するには ! を追加してください: %s" - -msgid "" -"\n" -" Name Args Address Complete Definition" -msgstr "" -"\n" -" 名前 引数 アドレス 補完 定義" - -msgid "No user-defined commands found" -msgstr "ユーザー定義コマンドが見つかりませんでした" - -msgid "E175: No attribute specified" -msgstr "E175: 属性は定義されていません" - -msgid "E176: Invalid number of arguments" -msgstr "E176: 引数の数が無効です" - -msgid "E177: Count cannot be specified twice" -msgstr "E177: カウントを2重指定することはできません" - -msgid "E178: Invalid default value for count" -msgstr "E178: カウントの省略値が無効です" - -msgid "E179: argument required for -complete" -msgstr "E179: -complete には引数が必要です" - -msgid "E179: argument required for -addr" -msgstr "E179: -addr には引数が必要です" - -#, c-format -msgid "E181: Invalid attribute: %s" -msgstr "E181: 無効な属性です: %s" - -msgid "E182: Invalid command name" -msgstr "E182: 無効なコマンド名です" - -msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: ユーザー定義コマンドは英大文字で始まらなければなりません" - -msgid "E841: Reserved name, cannot be used for user defined command" -msgstr "E841: 予約名なので、ユーザー定義コマンドに利用できません" - -#, c-format -msgid "E184: No such user-defined command: %s" -msgstr "E184: そのユーザー定義コマンドはありません: %s" - -#, c-format -msgid "E180: Invalid address type value: %s" -msgstr "E180: 無効なアドレスタイプ値です: %s" - -#, c-format -msgid "E180: Invalid complete value: %s" -msgstr "E180: 無効な補完指定です: %s" - -msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: 補完引数はカスタム補完でしか使用できません" - -msgid "E467: Custom completion requires a function argument" -msgstr "E467: カスタム補完には引数として関数が必要です" - msgid "unknown" msgstr "不明" @@ -1908,20 +1761,21 @@ msgid "is read-only (add ! to override)" msgstr "は読込専用です (強制書込には ! を追加)" msgid "E506: Can't write to backup file (add ! to override)" -msgstr "E506: バックアップファイルを保存できません (! を追加で強制保存)" +msgstr "E506: バックアップファイルを保存できません (! を追加で強制書込)" msgid "E507: Close error for backup file (add ! to override)" msgstr "" -"E507: バックアップファイルを閉じる際にエラーが発生しました (! を追加で強制)" +"E507: バックアップファイルを閉じる際にエラーが発生しました (! を追加で強制書" +"込)" msgid "E508: Can't read file for backup (add ! to override)" -msgstr "E508: バックアップ用ファイルを読込めません (! を追加で強制読込)" +msgstr "E508: バックアップ用ファイルを読込めません (! を追加で強制書込)" msgid "E509: Cannot create backup file (add ! to override)" -msgstr "E509: バックアップファイルを作れません (! を追加で強制作成)" +msgstr "E509: バックアップファイルを作れません (! を追加で強制書込)" msgid "E510: Can't make backup file (add ! to override)" -msgstr "E510: バックアップファイルを作れません (! を追加で強制作成)" +msgstr "E510: バックアップファイルを作れません (! を追加で強制書込)" msgid "E214: Can't find temp file for writing" msgstr "E214: 保存用一時ファイルが見つかりません" @@ -2391,6 +2245,9 @@ msgstr "E671: タイトルが \"%s\" のウィンドウは見つかりません" msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." msgstr "E243: 引数はサポートされません: \"-%s\"; OLE版を使用してください." +msgid "E988: GUI cannot be used. Cannot execute gvim.exe." +msgstr "E988: GUIは使用不可能です。gvim.exeを起動できません。" + msgid "E672: Unable to open window inside MDI application" msgstr "E672: MDIアプリの中ではウィンドウを開けません" @@ -2931,6 +2788,106 @@ msgstr "E573: 無効なサーバーIDが使われました: %s" msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: VIM 実体の登録プロパティが不正です. 消去しました!" +msgid " Keyword completion (^N^P)" +msgstr " キーワード補完 (^N^P)" + +msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" +msgstr " ^X モード (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" + +msgid " Whole line completion (^L^N^P)" +msgstr " 行(全体)補完 (^L^N^P)" + +msgid " File name completion (^F^N^P)" +msgstr " ファイル名補完 (^F^N^P)" + +msgid " Tag completion (^]^N^P)" +msgstr " タグ補完 (^]^N^P)" + +msgid " Path pattern completion (^N^P)" +msgstr " パスパターン補完 (^N^P)" + +msgid " Definition completion (^D^N^P)" +msgstr " 定義補完 (^D^N^P)" + +msgid " Dictionary completion (^K^N^P)" +msgstr " 辞書補完 (^K^N^P)" + +msgid " Thesaurus completion (^T^N^P)" +msgstr " シソーラス補完 (^T^N^P)" + +msgid " Command-line completion (^V^N^P)" +msgstr " コマンドライン補完 (^V^N^P)" + +msgid " User defined completion (^U^N^P)" +msgstr " ユーザー定義補完 (^U^N^P)" + +msgid " Omni completion (^O^N^P)" +msgstr " オムニ補完 (^O^N^P)" + +msgid " Spelling suggestion (s^N^P)" +msgstr " 綴り修正候補 (s^N^P)" + +msgid " Keyword Local completion (^N^P)" +msgstr " 局所キーワード補完 (^N^P)" + +msgid "Hit end of paragraph" +msgstr "段落の最後にヒット" + +msgid "E839: Completion function changed window" +msgstr "E839: 補完関数がウィンドウを変更しました" + +msgid "E840: Completion function deleted text" +msgstr "E840: 補完関数がテキストを削除しました" + +msgid "'dictionary' option is empty" +msgstr "'dictionary' オプションが空です" + +msgid "'thesaurus' option is empty" +msgstr "'thesaurus' オプションが空です" + +#, c-format +msgid "Scanning dictionary: %s" +msgstr "辞書をスキャン中: %s" + +msgid " (insert) Scroll (^E/^Y)" +msgstr " (挿入) スクロール(^E/^Y)" + +msgid " (replace) Scroll (^E/^Y)" +msgstr " (置換) スクロール (^E/^Y)" + +#, c-format +msgid "Scanning: %s" +msgstr "スキャン中: %s" + +msgid "Scanning tags." +msgstr "タグをスキャン中." + +msgid "match in file" +msgstr "ファイル内のマッチ" + +msgid " Adding" +msgstr " 追加中" + +msgid "-- Searching..." +msgstr "-- 検索中..." + +msgid "Back at original" +msgstr "始めに戻る" + +msgid "Word from other line" +msgstr "他の行の単語" + +msgid "The only match" +msgstr "唯一の該当" + +#, c-format +msgid "match %d of %d" +msgstr "%d 番目の該当 (全該当 %d 個中)" + +#, c-format +msgid "match %d" +msgstr "%d 番目の該当" + #, c-format msgid "E938: Duplicate key in JSON: \"%s\"" msgstr "E938: JSONに重複キーがあります: \"%s\"" @@ -3852,6 +3809,9 @@ msgstr "" "\"\n" " を消せばこのメッセージを回避できます.\n" +msgid "Found a swap file that is not useful, deleting it" +msgstr "不要なスワップファイルが見つかりました。削除します" + msgid "Swap file \"" msgstr "スワップファイル \"" @@ -4142,6 +4102,9 @@ msgstr "" "すべての変更を破棄し、Vimを終了するには :qa! と入力し を押してくだ" "さい" +msgid "Type :qa and press to exit Vim" +msgstr "Vimを終了するには :qa と入力し を押してください" + #, c-format msgid "%ld line %sed %d time" msgid_plural "%ld line %sed %d times" @@ -4618,15 +4581,6 @@ msgstr "XSMP SmcOpenConnectionが失敗しました: %s" msgid "At line" msgstr "行" -msgid "Could not load vim32.dll!" -msgstr "vim32.dll をロードできませんでした" - -msgid "VIM Error" -msgstr "VIMエラー" - -msgid "Could not fix up function pointers to the DLL!" -msgstr "DLLから関数ポインタを取得できませんでした" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: イベント %s を検知\n" @@ -4659,6 +4613,9 @@ msgstr "Vimの警告" msgid "shell returned %d" msgstr "シェルがコード %d で終了しました" +msgid "E553: No more items" +msgstr "E553: 要素がもうありません" + msgid "E926: Current location list was changed" msgstr "E926: 現在のロケーションリストが変更されました" @@ -4691,9 +4648,6 @@ msgstr "E378: 'errorformat' にパターンが指定されていません" msgid "E379: Missing or empty directory name" msgstr "E379: ディレクトリ名が無いか空です" -msgid "E553: No more items" -msgstr "E553: 要素がもうありません" - msgid "E924: Current window was closed" msgstr "E924: 現在のウィンドウが閉じられました" @@ -5705,6 +5659,12 @@ msgstr "E555: タグスタックの末尾です" msgid "E556: at top of tag stack" msgstr "E556: タグスタックの先頭です" +msgid "E986: cannot modify the tag stack within tagfunc" +msgstr "E986: tagfunc内のタグスタックを変更できません" + +msgid "E987: invalid return value from tagfunc" +msgstr "E987: tagfuncからの戻り値が無効です" + msgid "E425: Cannot go before first matching tag" msgstr "E425: 最初の該当タグを越えて戻ることはできません" @@ -5712,12 +5672,6 @@ msgstr "E425: 最初の該当タグを越えて戻ることはできません" msgid "E426: tag not found: %s" msgstr "E426: タグが見つかりません: %s" -msgid " # pri kind tag" -msgstr " # pri kind tag" - -msgid "file\n" -msgstr "ファイル\n" - msgid "E427: There is only one matching tag" msgstr "E427: 該当タグが1つだけしかありません" @@ -5742,6 +5696,12 @@ msgstr " タグを異なるcaseで使用します!" msgid "E429: File \"%s\" does not exist" msgstr "E429: ファイル \"%s\" がありません" +msgid " # pri kind tag" +msgstr " # pri kind tag" + +msgid "file\n" +msgstr "ファイル\n" + msgid "" "\n" " # TO tag FROM line in file/text" @@ -5817,6 +5777,10 @@ msgstr "" msgid "Cannot open $VIMRUNTIME/rgb.txt" msgstr "$VIMRUNTIME/rgb.txtを開けません" +#, c-format +msgid "E181: Invalid attribute: %s" +msgstr "E181: 無効な属性です: %s" + #, c-format msgid "Kill job in \"%s\"?" msgstr "\"%s\" 内のジョブを終了しますか?" @@ -6023,6 +5987,65 @@ msgstr "E439: アンドゥリストが壊れています" msgid "E440: undo line missing" msgstr "E440: アンドゥ行がありません" +msgid "" +"\n" +" Name Args Address Complete Definition" +msgstr "" +"\n" +" 名前 引数 アドレス 補完 定義" + +msgid "No user-defined commands found" +msgstr "ユーザー定義コマンドが見つかりませんでした" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: 無効なアドレスタイプ値です: %s" + +#, c-format +msgid "E180: Invalid complete value: %s" +msgstr "E180: 無効な補完指定です: %s" + +msgid "E468: Completion argument only allowed for custom completion" +msgstr "E468: 補完引数はカスタム補完でしか使用できません" + +msgid "E467: Custom completion requires a function argument" +msgstr "E467: カスタム補完には引数として関数が必要です" + +msgid "E175: No attribute specified" +msgstr "E175: 属性は定義されていません" + +msgid "E176: Invalid number of arguments" +msgstr "E176: 引数の数が無効です" + +msgid "E177: Count cannot be specified twice" +msgstr "E177: カウントを2重指定することはできません" + +msgid "E178: Invalid default value for count" +msgstr "E178: カウントの省略値が無効です" + +msgid "E179: argument required for -complete" +msgstr "E179: -complete には引数が必要です" + +msgid "E179: argument required for -addr" +msgstr "E179: -addr には引数が必要です" + +#, c-format +msgid "E174: Command already exists: add ! to replace it: %s" +msgstr "E174: コマンドが既にあります: 再定義するには ! を追加してください: %s" + +msgid "E182: Invalid command name" +msgstr "E182: 無効なコマンド名です" + +msgid "E183: User defined commands must start with an uppercase letter" +msgstr "E183: ユーザー定義コマンドは英大文字で始まらなければなりません" + +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "E841: 予約名なので、ユーザー定義コマンドに利用できません" + +#, c-format +msgid "E184: No such user-defined command: %s" +msgstr "E184: そのユーザー定義コマンドはありません: %s" + #, c-format msgid "E122: Function %s already exists, add ! to replace it" msgstr "E122: 関数 %s は定義済です、再定義するには ! を追加してください" @@ -6155,6 +6178,20 @@ msgstr "E107: カッコ '(' がありません: %s" msgid "%s (%s, compiled %s)" msgstr "%s (%s, compiled %s)" +msgid "" +"\n" +"MS-Windows 64-bit GUI/console version" +msgstr "" +"\n" +"MS-Windows 64 ビット GUI/コンソール 版" + +msgid "" +"\n" +"MS-Windows 32-bit GUI/console version" +msgstr "" +"\n" +"MS-Windows 32 ビット GUI/コンソール 版" + msgid "" "\n" "MS-Windows 64-bit GUI version" @@ -6593,6 +6630,10 @@ msgstr "E474: 無効な引数です" msgid "E475: Invalid argument: %s" msgstr "E475: 無効な引数です: %s" +#, c-format +msgid "E983: Duplicate argument: %s" +msgstr "E983: 引数が重複しています: %s" + #, c-format msgid "E475: Invalid value for argument %s" msgstr "E475: 引数 %s に対して無効な値です" @@ -7218,3 +7259,21 @@ msgstr "" "Cソース (*.c, *.h)\t*.c;*.h\n" "C++ソース (*.cpp, *.hpp)\t*.cpp;*.hpp\n" "Vimファイル (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +#~ msgid "GVim" +#~ msgstr "" + +msgid "Text Editor" +msgstr "テキストエディタ" + +msgid "Edit text files" +msgstr "テキストファイルを編集します" + +msgid "Text;editor;" +msgstr "テキスト;エディタ;" + +#~ msgid "gvim" +#~ msgstr "" + +#~ msgid "Vim" +#~ msgstr "" diff --git a/src/po/ja.sjis.po b/src/po/ja.sjis.po index b8d010452d..4327ce7a3c 100644 --- a/src/po/ja.sjis.po +++ b/src/po/ja.sjis.po @@ -14,8 +14,8 @@ msgid "" msgstr "" "Project-Id-Version: Vim 8.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-18 19:15+0900\n" -"PO-Revision-Date: 2019-03-12 08:23+0900\n" +"POT-Creation-Date: 2019-05-05 11:27+0900\n" +"PO-Revision-Date: 2019-05-05 13:00+0900\n" "Last-Translator: MURAOKA Taro \n" "Language-Team: Japanese \n" "Language: ja\n" @@ -331,6 +331,51 @@ msgstr " msgid "[crypted]" msgstr "[Í]" +msgid "Entering Debug mode. Type \"cont\" to continue." +msgstr "fobO[hɓ܂. ɂ \"cont\" Ɠ͂Ă." + +#, c-format +msgid "Oldval = \"%s\"" +msgstr "Âl = \"%s\"" + +#, c-format +msgid "Newval = \"%s\"" +msgstr "Vl = \"%s\"" + +#, c-format +msgid "line %ld: %s" +msgstr "s %ld: %s" + +#, c-format +msgid "cmd: %s" +msgstr "R}h: %s" + +msgid "frame is zero" +msgstr "t[ 0 ł" + +#, c-format +msgid "frame at highest level: %d" +msgstr "ōx̃t[: %d" + +#, c-format +msgid "Breakpoint in \"%s%s\" line %ld" +msgstr "u[N|Cg \"%s%s\" s %ld" + +#, c-format +msgid "E161: Breakpoint not found: %s" +msgstr "E161: u[N|Cg‚܂: %s" + +msgid "No breakpoints defined" +msgstr "u[N|Cg`Ă܂" + +#, c-format +msgid "%3d %s %s line %ld" +msgstr "%3d %s %s s %ld" + +#, c-format +msgid "%3d expr %s" +msgstr "%3d expr %s" + #, c-format msgid "E720: Missing colon in Dictionary: %s" msgstr "E720: ^ɃR܂: %s" @@ -494,106 +539,6 @@ msgstr "E105: :source msgid "E791: Empty keymap entry" msgstr "E791: ̃L[}bvGg" -msgid " Keyword completion (^N^P)" -msgstr " L[[h⊮ (^N^P)" - -msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" -msgstr " ^X [h (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" - -msgid " Whole line completion (^L^N^P)" -msgstr " s(S)⊮ (^L^N^P)" - -msgid " File name completion (^F^N^P)" -msgstr " t@C⊮ (^F^N^P)" - -msgid " Tag completion (^]^N^P)" -msgstr " ^O⊮ (^]^N^P)" - -msgid " Path pattern completion (^N^P)" -msgstr " pXp^[⊮ (^N^P)" - -msgid " Definition completion (^D^N^P)" -msgstr " `⊮ (^D^N^P)" - -msgid " Dictionary completion (^K^N^P)" -msgstr " ⊮ (^K^N^P)" - -msgid " Thesaurus completion (^T^N^P)" -msgstr " V\\[X⊮ (^T^N^P)" - -msgid " Command-line completion (^V^N^P)" -msgstr " R}hC⊮ (^V^N^P)" - -msgid " User defined completion (^U^N^P)" -msgstr " [U[`⊮ (^U^N^P)" - -msgid " Omni completion (^O^N^P)" -msgstr " Ij⊮ (^O^N^P)" - -msgid " Spelling suggestion (s^N^P)" -msgstr " ԂC (s^N^P)" - -msgid " Keyword Local completion (^N^P)" -msgstr " ǏL[[h⊮ (^N^P)" - -msgid "Hit end of paragraph" -msgstr "i̍ŌɃqbg" - -msgid "E839: Completion function changed window" -msgstr "E839: Ԋ֐EBhEύX܂" - -msgid "E840: Completion function deleted text" -msgstr "E840: ⊮֐eLXg폜܂" - -msgid "'dictionary' option is empty" -msgstr "'dictionary' IvVł" - -msgid "'thesaurus' option is empty" -msgstr "'thesaurus' IvVł" - -#, c-format -msgid "Scanning dictionary: %s" -msgstr "XL: %s" - -msgid " (insert) Scroll (^E/^Y)" -msgstr " (}) XN[(^E/^Y)" - -msgid " (replace) Scroll (^E/^Y)" -msgstr " (u) XN[ (^E/^Y)" - -#, c-format -msgid "Scanning: %s" -msgstr "XL: %s" - -msgid "Scanning tags." -msgstr "^OXL." - -msgid "match in file" -msgstr "t@C̃}b`" - -msgid " Adding" -msgstr " lj" - -msgid "-- Searching..." -msgstr "-- ..." - -msgid "Back at original" -msgstr "n߂ɖ߂" - -msgid "Word from other line" -msgstr "̍s̒P" - -msgid "The only match" -msgstr "B̊Y" - -#, c-format -msgid "match %d of %d" -msgstr "%d Ԗڂ̊Y (SY %d ’)" - -#, c-format -msgid "match %d" -msgstr "%d Ԗڂ̊Y" - msgid "E18: Unexpected characters in :let" msgstr "E18: \\ʕ :let ɂ܂" @@ -618,6 +563,9 @@ msgstr "E461: msgid "E806: using Float as a String" msgstr "E806: _𕶎ƂĈĂ܂" +msgid "E985: .= is not supported with script version 2" +msgstr "E985: .= ̓XNvgo[W 2 ł͑ΉĂ܂" + msgid "E687: Less targets than List items" msgstr "E687: ^[QbgXg^̗vfȂł" @@ -846,6 +794,9 @@ msgstr "E899: %s msgid "E928: String required" msgstr "E928: 񂪕Kvł" +msgid "E957: Invalid window number" +msgstr "E957: ȃEBhEԍł" + msgid "E808: Number or Float required" msgstr "E808: l_Kvł" @@ -902,9 +853,6 @@ msgstr "E916: msgid "E701: Invalid type for len()" msgstr "E701: len() ɂ͖Ȍ^ł" -msgid "E957: Invalid window number" -msgstr "E957: ȃEBhEԍł" - #, c-format msgid "E798: ID is reserved for \":match\": %d" msgstr "E798: ID \":match\" ̂߂ɗ\\񂳂Ă܂: %d" @@ -1248,51 +1196,6 @@ msgstr "E150: msgid "No old files" msgstr "Ât@C͂܂" -msgid "Entering Debug mode. Type \"cont\" to continue." -msgstr "fobO[hɓ܂. ɂ \"cont\" Ɠ͂Ă." - -#, c-format -msgid "Oldval = \"%s\"" -msgstr "Âl = \"%s\"" - -#, c-format -msgid "Newval = \"%s\"" -msgstr "Vl = \"%s\"" - -#, c-format -msgid "line %ld: %s" -msgstr "s %ld: %s" - -#, c-format -msgid "cmd: %s" -msgstr "R}h: %s" - -msgid "frame is zero" -msgstr "t[ 0 ł" - -#, c-format -msgid "frame at highest level: %d" -msgstr "ōx̃t[: %d" - -#, c-format -msgid "Breakpoint in \"%s%s\" line %ld" -msgstr "u[N|Cg \"%s%s\" s %ld" - -#, c-format -msgid "E161: Breakpoint not found: %s" -msgstr "E161: u[N|Cg‚܂: %s" - -msgid "No breakpoints defined" -msgstr "u[N|Cg`Ă܂" - -#, c-format -msgid "%3d %s %s line %ld" -msgstr "%3d %s %s s %ld" - -#, c-format -msgid "%3d expr %s" -msgstr "%3d expr %s" - msgid "E750: First use \":profile start {fname}\"" msgstr "E750: ߂ \":profile start {fname}\" sĂ" @@ -1396,6 +1299,13 @@ msgstr "W15: msgid "E167: :scriptencoding used outside of a sourced file" msgstr "E167: :scriptencoding 捞XNvgȊOŎgp܂" +msgid "E984: :scriptversion used outside of a sourced file" +msgstr "E984: :scriptversion 捞XNvgȊOŎgp܂" + +#, c-format +msgid "E999: scriptversion not supported: %d" +msgstr "E999: scriptversion ̓T|[gĂ܂: %d" + msgid "E168: :finish used outside of a sourced file" msgstr "E168: :finish 捞XNvgȊOŎgp܂" @@ -1445,6 +1355,12 @@ msgstr " msgid "E494: Use w or w>>" msgstr "E494: w w>> gpĂ" +msgid "" +"INTERNAL: Cannot use DFLALL with ADDR_NONE, ADDR_UNSIGNED or ADDR_QUICKFIX" +msgstr "" +"G[: DFLALL ADDR_NONE, ADDR_UNSIGNED ADDR_QUICKFIX ƂƂɎg" +"Ƃ͂ł܂" + msgid "E943: Command table needs to be updated, run 'make cmdidxs'" msgstr "" "E943: R}he[uXVKv܂A'make cmdidxs' sĂ" @@ -1463,69 +1379,6 @@ msgid "E173: %d more file to edit" msgid_plural "E173: %d more files to edit" msgstr[0] "E173: ҏWׂt@C %d ‚܂" -#, c-format -msgid "E174: Command already exists: add ! to replace it: %s" -msgstr "E174: R}hɂ܂: Ē`ɂ ! ljĂ: %s" - -msgid "" -"\n" -" Name Args Address Complete Definition" -msgstr "" -"\n" -" O AhX ⊮ `" - -msgid "No user-defined commands found" -msgstr "[U[`R}h‚܂ł" - -msgid "E175: No attribute specified" -msgstr "E175: ͒`Ă܂" - -msgid "E176: Invalid number of arguments" -msgstr "E176: ̐ł" - -msgid "E177: Count cannot be specified twice" -msgstr "E177: JEg2dw肷邱Ƃ͂ł܂" - -msgid "E178: Invalid default value for count" -msgstr "E178: JEg̏ȗlł" - -msgid "E179: argument required for -complete" -msgstr "E179: -complete ɂ͈Kvł" - -msgid "E179: argument required for -addr" -msgstr "E179: -addr ɂ͈Kvł" - -#, c-format -msgid "E181: Invalid attribute: %s" -msgstr "E181: ȑł: %s" - -msgid "E182: Invalid command name" -msgstr "E182: ȃR}hł" - -msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: [U[`R}h͉p啶Ŏn܂Ȃ΂Ȃ܂" - -msgid "E841: Reserved name, cannot be used for user defined command" -msgstr "E841: \\񖼂Ȃ̂ŁA[U[`R}hɗpł܂" - -#, c-format -msgid "E184: No such user-defined command: %s" -msgstr "E184: ̃[U[`R}h͂܂: %s" - -#, c-format -msgid "E180: Invalid address type value: %s" -msgstr "E180: ȃAhX^Cvlł: %s" - -#, c-format -msgid "E180: Invalid complete value: %s" -msgstr "E180: ȕ⊮wł: %s" - -msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: ⊮̓JX^⊮łgpł܂" - -msgid "E467: Custom completion requires a function argument" -msgstr "E467: JX^⊮ɂ͈ƂĊ֐Kvł" - msgid "unknown" msgstr "s" @@ -1908,20 +1761,21 @@ msgid "is read-only (add ! to override)" msgstr "͓Ǎpł (ɂ ! lj)" msgid "E506: Can't write to backup file (add ! to override)" -msgstr "E506: obNAbvt@Cۑł܂ (! ljŋۑ)" +msgstr "E506: obNAbvt@Cۑł܂ (! ljŋ)" msgid "E507: Close error for backup file (add ! to override)" msgstr "" -"E507: obNAbvt@C‚ۂɃG[܂ (! ljŋ)" +"E507: obNAbvt@C‚ۂɃG[܂ (! ljŋ" +")" msgid "E508: Can't read file for backup (add ! to override)" -msgstr "E508: obNAbvpt@CǍ߂܂ (! ljŋǍ)" +msgstr "E508: obNAbvpt@CǍ߂܂ (! ljŋ)" msgid "E509: Cannot create backup file (add ! to override)" -msgstr "E509: obNAbvt@C܂ (! ljŋ쐬)" +msgstr "E509: obNAbvt@C܂ (! ljŋ)" msgid "E510: Can't make backup file (add ! to override)" -msgstr "E510: obNAbvt@C܂ (! ljŋ쐬)" +msgstr "E510: obNAbvt@C܂ (! ljŋ)" msgid "E214: Can't find temp file for writing" msgstr "E214: ۑpꎞt@C‚܂" @@ -2391,6 +2245,9 @@ msgstr "E671: msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." msgstr "E243: ̓T|[g܂: \"-%s\"; OLEłgpĂ." +msgid "E988: GUI cannot be used. Cannot execute gvim.exe." +msgstr "E988: GUI͎gps”\\łBgvim.exeNł܂B" + msgid "E672: Unable to open window inside MDI application" msgstr "E672: MDIAv̒ł̓EBhEJ܂" @@ -2931,6 +2788,106 @@ msgstr "E573: msgid "E251: VIM instance registry property is badly formed. Deleted!" msgstr "E251: VIM ̂̓o^vpeBsł. ܂!" +msgid " Keyword completion (^N^P)" +msgstr " L[[h⊮ (^N^P)" + +msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" +msgstr " ^X [h (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" + +msgid " Whole line completion (^L^N^P)" +msgstr " s(S)⊮ (^L^N^P)" + +msgid " File name completion (^F^N^P)" +msgstr " t@C⊮ (^F^N^P)" + +msgid " Tag completion (^]^N^P)" +msgstr " ^O⊮ (^]^N^P)" + +msgid " Path pattern completion (^N^P)" +msgstr " pXp^[⊮ (^N^P)" + +msgid " Definition completion (^D^N^P)" +msgstr " `⊮ (^D^N^P)" + +msgid " Dictionary completion (^K^N^P)" +msgstr " ⊮ (^K^N^P)" + +msgid " Thesaurus completion (^T^N^P)" +msgstr " V\\[X⊮ (^T^N^P)" + +msgid " Command-line completion (^V^N^P)" +msgstr " R}hC⊮ (^V^N^P)" + +msgid " User defined completion (^U^N^P)" +msgstr " [U[`⊮ (^U^N^P)" + +msgid " Omni completion (^O^N^P)" +msgstr " Ij⊮ (^O^N^P)" + +msgid " Spelling suggestion (s^N^P)" +msgstr " ԂC (s^N^P)" + +msgid " Keyword Local completion (^N^P)" +msgstr " ǏL[[h⊮ (^N^P)" + +msgid "Hit end of paragraph" +msgstr "i̍ŌɃqbg" + +msgid "E839: Completion function changed window" +msgstr "E839: ⊮֐EBhEύX܂" + +msgid "E840: Completion function deleted text" +msgstr "E840: ⊮֐eLXg폜܂" + +msgid "'dictionary' option is empty" +msgstr "'dictionary' IvVł" + +msgid "'thesaurus' option is empty" +msgstr "'thesaurus' IvVł" + +#, c-format +msgid "Scanning dictionary: %s" +msgstr "XL: %s" + +msgid " (insert) Scroll (^E/^Y)" +msgstr " (}) XN[(^E/^Y)" + +msgid " (replace) Scroll (^E/^Y)" +msgstr " (u) XN[ (^E/^Y)" + +#, c-format +msgid "Scanning: %s" +msgstr "XL: %s" + +msgid "Scanning tags." +msgstr "^OXL." + +msgid "match in file" +msgstr "t@C̃}b`" + +msgid " Adding" +msgstr " lj" + +msgid "-- Searching..." +msgstr "-- ..." + +msgid "Back at original" +msgstr "n߂ɖ߂" + +msgid "Word from other line" +msgstr "̍s̒P" + +msgid "The only match" +msgstr "B̊Y" + +#, c-format +msgid "match %d of %d" +msgstr "%d Ԗڂ̊Y (SY %d ’)" + +#, c-format +msgid "match %d" +msgstr "%d Ԗڂ̊Y" + #, c-format msgid "E938: Duplicate key in JSON: \"%s\"" msgstr "E938: JSONɏdL[܂: \"%s\"" @@ -3852,6 +3809,9 @@ msgstr "" "\"\n" " ΂̃bZ[Wł܂.\n" +msgid "Found a swap file that is not useful, deleting it" +msgstr "svȃXbvt@C‚܂B폜܂" + msgid "Swap file \"" msgstr "Xbvt@C \"" @@ -4142,6 +4102,9 @@ msgstr "" "ׂĂ̕ύXjAVimIɂ :qa! Ɠ͂ Ă" "" +msgid "Type :qa and press to exit Vim" +msgstr "VimIɂ :qa Ɠ͂ Ă" + #, c-format msgid "%ld line %sed %d time" msgid_plural "%ld line %sed %d times" @@ -4618,15 +4581,6 @@ msgstr "XSMP SmcOpenConnection msgid "At line" msgstr "s" -msgid "Could not load vim32.dll!" -msgstr "vim32.dll [hł܂ł" - -msgid "VIM Error" -msgstr "VIMG[" - -msgid "Could not fix up function pointers to the DLL!" -msgstr "DLL֐|C^擾ł܂ł" - #, c-format msgid "Vim: Caught %s event\n" msgstr "Vim: Cxg %s m\n" @@ -4659,6 +4613,9 @@ msgstr "Vim msgid "shell returned %d" msgstr "VFR[h %d ŏI܂" +msgid "E553: No more items" +msgstr "E553: vf܂" + msgid "E926: Current location list was changed" msgstr "E926: ݂̃P[VXgύX܂" @@ -4691,9 +4648,6 @@ msgstr "E378: 'errorformat' msgid "E379: Missing or empty directory name" msgstr "E379: fBNgł" -msgid "E553: No more items" -msgstr "E553: vf܂" - msgid "E924: Current window was closed" msgstr "E924: ݂̃EBhE‚܂" @@ -5705,6 +5659,12 @@ msgstr "E555: msgid "E556: at top of tag stack" msgstr "E556: ^OX^bN̐擪ł" +msgid "E986: cannot modify the tag stack within tagfunc" +msgstr "E986: tagfunc̃^OX^bNύXł܂" + +msgid "E987: invalid return value from tagfunc" +msgstr "E987: tagfunc̖߂lł" + msgid "E425: Cannot go before first matching tag" msgstr "E425: ŏ̊Y^OzĖ߂邱Ƃ͂ł܂" @@ -5712,12 +5672,6 @@ msgstr "E425: msgid "E426: tag not found: %s" msgstr "E426: ^O‚܂: %s" -msgid " # pri kind tag" -msgstr " # pri kind tag" - -msgid "file\n" -msgstr "t@C\n" - msgid "E427: There is only one matching tag" msgstr "E427: Y^O1‚܂" @@ -5742,6 +5696,12 @@ msgstr " msgid "E429: File \"%s\" does not exist" msgstr "E429: t@C \"%s\" ܂" +msgid " # pri kind tag" +msgstr " # pri kind tag" + +msgid "file\n" +msgstr "t@C\n" + msgid "" "\n" " # TO tag FROM line in file/text" @@ -5817,6 +5777,10 @@ msgstr "" msgid "Cannot open $VIMRUNTIME/rgb.txt" msgstr "$VIMRUNTIME/rgb.txtJ܂" +#, c-format +msgid "E181: Invalid attribute: %s" +msgstr "E181: ȑł: %s" + #, c-format msgid "Kill job in \"%s\"?" msgstr "\"%s\" ̃WuI܂?" @@ -6023,6 +5987,65 @@ msgstr "E439: msgid "E440: undo line missing" msgstr "E440: AhDs܂" +msgid "" +"\n" +" Name Args Address Complete Definition" +msgstr "" +"\n" +" O AhX ⊮ `" + +msgid "No user-defined commands found" +msgstr "[U[`R}h‚܂ł" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: ȃAhX^Cvlł: %s" + +#, c-format +msgid "E180: Invalid complete value: %s" +msgstr "E180: ȕ⊮wł: %s" + +msgid "E468: Completion argument only allowed for custom completion" +msgstr "E468: ⊮̓JX^⊮łgpł܂" + +msgid "E467: Custom completion requires a function argument" +msgstr "E467: JX^⊮ɂ͈ƂĊ֐Kvł" + +msgid "E175: No attribute specified" +msgstr "E175: ͒`Ă܂" + +msgid "E176: Invalid number of arguments" +msgstr "E176: ̐ł" + +msgid "E177: Count cannot be specified twice" +msgstr "E177: JEg2dw肷邱Ƃ͂ł܂" + +msgid "E178: Invalid default value for count" +msgstr "E178: JEg̏ȗlł" + +msgid "E179: argument required for -complete" +msgstr "E179: -complete ɂ͈Kvł" + +msgid "E179: argument required for -addr" +msgstr "E179: -addr ɂ͈Kvł" + +#, c-format +msgid "E174: Command already exists: add ! to replace it: %s" +msgstr "E174: R}hɂ܂: Ē`ɂ ! ljĂ: %s" + +msgid "E182: Invalid command name" +msgstr "E182: ȃR}hł" + +msgid "E183: User defined commands must start with an uppercase letter" +msgstr "E183: [U[`R}h͉p啶Ŏn܂Ȃ΂Ȃ܂" + +msgid "E841: Reserved name, cannot be used for user defined command" +msgstr "E841: \\񖼂Ȃ̂ŁA[U[`R}hɗpł܂" + +#, c-format +msgid "E184: No such user-defined command: %s" +msgstr "E184: ̃[U[`R}h͂܂: %s" + #, c-format msgid "E122: Function %s already exists, add ! to replace it" msgstr "E122: ֐ %s ͒`ςłAĒ`ɂ ! ljĂ" @@ -6155,6 +6178,20 @@ msgstr "E107: msgid "%s (%s, compiled %s)" msgstr "%s (%s, compiled %s)" +msgid "" +"\n" +"MS-Windows 64-bit GUI/console version" +msgstr "" +"\n" +"MS-Windows 64 rbg GUI/R\\[ " + +msgid "" +"\n" +"MS-Windows 32-bit GUI/console version" +msgstr "" +"\n" +"MS-Windows 32 rbg GUI/R\\[ " + msgid "" "\n" "MS-Windows 64-bit GUI version" @@ -6593,6 +6630,10 @@ msgstr "E474: msgid "E475: Invalid argument: %s" msgstr "E475: Ȉł: %s" +#, c-format +msgid "E983: Duplicate argument: %s" +msgstr "E983: dĂ܂: %s" + #, c-format msgid "E475: Invalid value for argument %s" msgstr "E475: %s ɑ΂ĖȒlł" @@ -7218,3 +7259,21 @@ msgstr "" "C\\[X (*.c, *.h)\t*.c;*.h\n" "C++\\[X (*.cpp, *.hpp)\t*.cpp;*.hpp\n" "Vimt@C (*.vim, _vimrc, _gvimrc)\t*.vim;_vimrc;_gvimrc\n" + +#~ msgid "GVim" +#~ msgstr "" + +msgid "Text Editor" +msgstr "eLXgGfB^" + +msgid "Edit text files" +msgstr "eLXgt@CҏW܂" + +msgid "Text;editor;" +msgstr "eLXg;GfB^;" + +#~ msgid "gvim" +#~ msgstr "" + +#~ msgid "Vim" +#~ msgstr "" diff --git a/src/po/vi.po b/src/po/vi.po index a2221372c7..eee5a1248f 100644 --- a/src/po/vi.po +++ b/src/po/vi.po @@ -222,7 +222,7 @@ msgstr " Tự động kết thúc cho từ khóa (^N^P)" msgid " ^X mode (^E^Y^L^]^F^I^K^D^V^N^P)" msgstr " Chế độ ^X (^E^Y^L^]^F^I^K^D^V^N^P)" -#. Scroll has it's own msgs, in it's place there is the msg for local +#. Scroll has its own msgs, in its place there is the msg for local #. * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo msgid " Keyword Local completion (^N^P)" msgstr " Tự động kết thúc nội bộ cho từ khóa (^N^P)" diff --git a/src/po/vim.desktop.in b/src/po/vim.desktop.in index f1ce31b8f5..e0c49a33c5 100644 --- a/src/po/vim.desktop.in +++ b/src/po/vim.desktop.in @@ -42,7 +42,6 @@ Comment[hu]=Szövegfájlok szerkesztése Comment[id]=Edit file teks Comment[is]=Vinna með textaskrár Comment[it]=Modifica file di testo -Comment[ja]=テキストファイルを編集します Comment[kn]=ಪಠ್ಯ ಕಡತಗಳನ್ನು ಸಂಪಾದಿಸು Comment[ko]=텍스트 파일을 편집합니다 Comment[lt]=Redaguoti tekstines bylas diff --git a/src/po/zh_TW.UTF-8.po b/src/po/zh_TW.UTF-8.po index 8b3656cd9e..c1c554374e 100644 --- a/src/po/zh_TW.UTF-8.po +++ b/src/po/zh_TW.UTF-8.po @@ -261,7 +261,7 @@ msgstr " 關鍵字自動完成 (^N^P)" msgid " ^X mode (^E^Y^L^]^F^I^K^D^V^N^P)" msgstr " ^X 模式 (^E^Y^L^]^F^I^K^D^N^P)" -#. Scroll has it's own msgs, in it's place there is the msg for local +#. Scroll has its own msgs, in its place there is the msg for local #. * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo msgid " Keyword Local completion (^N^P)" msgstr " 區域關鍵字自動完成 (^N^P)" diff --git a/src/po/zh_TW.po b/src/po/zh_TW.po index f29700fea6..0fc5eec435 100644 --- a/src/po/zh_TW.po +++ b/src/po/zh_TW.po @@ -254,7 +254,7 @@ msgstr " msgid " ^X mode (^E^Y^L^]^F^I^K^D^V^N^P)" msgstr " ^X Ҧ (^E^Y^L^]^F^I^K^D^N^P)" -#. Scroll has it's own msgs, in it's place there is the msg for local +#. Scroll has its own msgs, in its place there is the msg for local #. * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo msgid " Keyword Local completion (^N^P)" msgstr " ϰr۰ʧ (^N^P)" From f90b6e03a983b62b66564fc449e32724d6456769 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 19:26:38 +0200 Subject: [PATCH 39/97] patch 8.1.1308: the Normal highlight is not defined when compiled with GUI Problem: The Normal highlight is not defined when compiled with GUI. Solution: Always define Normal. (Christian Brabandt, closes #4072) --- runtime/doc/syntax.txt | 2 ++ src/syntax.c | 7 +------ src/testdir/test_highlight.vim | 7 +++++++ src/version.c | 2 ++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index c3ce75c89f..1eca1c5da8 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -5002,6 +5002,8 @@ Conceal placeholder characters substituted for concealed text (see 'conceallevel') *hl-Cursor* Cursor the character under the cursor +lCursor the character under the cursor when |language-mapping| + is used (see 'guicursor') *hl-CursorIM* CursorIM like Cursor, but used when in IME mode |CursorIM| *hl-CursorColumn* diff --git a/src/syntax.c b/src/syntax.c index 537794a2d8..09491450ba 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -6865,6 +6865,7 @@ static char *(highlight_init_both[]) = { "lCursor guibg=fg guifg=bg", /* should be different, but what? */ #endif "default link QuickFixLine Search", + CENT("Normal cterm=NONE", "Normal gui=NONE"), NULL }; @@ -6946,9 +6947,6 @@ static char *(highlight_init_light[]) = { #endif CENT("MatchParen term=reverse ctermbg=Cyan", "MatchParen term=reverse ctermbg=Cyan guibg=Cyan"), -#ifdef FEAT_GUI - "Normal gui=NONE", -#endif #ifdef FEAT_TERMINAL CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen", "StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen gui=bold guifg=bg guibg=DarkGreen"), @@ -7042,9 +7040,6 @@ static char *(highlight_init_dark[]) = { CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), #endif -#ifdef FEAT_GUI - "Normal gui=NONE", -#endif #ifdef FEAT_TERMINAL CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen", "StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen gui=bold guifg=bg guibg=LightGreen"), diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim index e16abf1837..24379d626e 100644 --- a/src/testdir/test_highlight.vim +++ b/src/testdir/test_highlight.vim @@ -572,3 +572,10 @@ func Test_cursorline_with_visualmode() call StopVimInTerminal(buf) call delete('Xtest_cursorline_with_visualmode') endfunc + +func Test_1_highlight_Normalgroup_exists() + " This test must come before the Test_cursorline test, as it appears this + " defines the Normal highlighting group anyway. + let hlNormal = HighlightArgs('Normal') + call assert_match('hi Normal\s*clear', hlNormal) +endfunc diff --git a/src/version.c b/src/version.c index ea04ff99c1..63cfd8df75 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1308, /**/ 1307, /**/ From 6b528fa062a5ac6bb5d8bd3abc26f32c65691d00 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 20:07:33 +0200 Subject: [PATCH 40/97] patch 8.1.1309: test for Normal highlight fails on MS-Windows GUI Problem: Test for Normal highlight fails on MS-Windows GUI. Solution: Skip the test for MS-Windows GUI. --- src/testdir/test_highlight.vim | 11 +++++++---- src/version.c | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim index 24379d626e..7c6cc64fc5 100644 --- a/src/testdir/test_highlight.vim +++ b/src/testdir/test_highlight.vim @@ -573,9 +573,12 @@ func Test_cursorline_with_visualmode() call delete('Xtest_cursorline_with_visualmode') endfunc +" This test must come before the Test_cursorline test, as it appears this +" defines the Normal highlighting group anyway. func Test_1_highlight_Normalgroup_exists() - " This test must come before the Test_cursorline test, as it appears this - " defines the Normal highlighting group anyway. - let hlNormal = HighlightArgs('Normal') - call assert_match('hi Normal\s*clear', hlNormal) + " MS-Windows GUI sets the font + if !has('win32') || !has('gui_running') + let hlNormal = HighlightArgs('Normal') + call assert_match('hi Normal\s*clear', hlNormal) + endif endfunc diff --git a/src/version.c b/src/version.c index 63cfd8df75..b8acb8f041 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1309, /**/ 1308, /**/ From 42ae78cfff171fbd7412306083fe200245d7a7a6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 21:08:58 +0200 Subject: [PATCH 41/97] patch 8.1.1310: named function arguments are never optional Problem: Named function arguments are never optional. Solution: Support optional function arguments with a default value. (Andy Massimino, closes #3952) --- runtime/doc/eval.txt | 51 +++++++++++++-- src/structs.h | 61 +++++++++--------- src/testdir/test_user_func.vim | 50 +++++++++++++++ src/userfunc.c | 109 +++++++++++++++++++++++++++++---- src/version.c | 2 + 5 files changed, 227 insertions(+), 46 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d5ba286abd..a8109d93a8 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -10920,15 +10920,58 @@ change their contents. Thus you can pass a |List| to a function and have the function add an item to it. If you want to make sure the function cannot change a |List| or |Dictionary| use |:lockvar|. -When not using "...", the number of arguments in a function call must be equal -to the number of named arguments. When using "...", the number of arguments -may be larger. - It is also possible to define a function without any arguments. You must still supply the () then. It is allowed to define another function inside a function body. + *optional-function-argument* +You can provide default values for positional named arguments. This makes +them optional for function calls. When a positional argument is not +specified at a call, the default expression is used to initialize it. +This only works for functions declared with |function|, not for lambda +expressions |expr-lambda|. + +Example: > + function Something(key, value = 10) + echo a:key .. ": " .. value + endfunction + call Something('empty') "empty: 10" + call Something('key, 20) "key: 20" + +The argument default expressions are evaluated at the time of the function +call, not definition. Thus it is possible to use an expression which is +invalid the moment the function is defined. The expressions are are also only +evaluated when arguments are not specified during a call. + +You can pass |v:none| to use the default expression. Note that this means you +cannot pass v:none as an ordinary value when an argument has a default +expression. + +Example: > + function Something(a = 10, b = 20, c = 30) + endfunction + call Something(1, v:none, 3) " b = 20 +< + *E989* +Optional arguments with default expressions must occur after any mandatory +arguments. You can use "..." after all optional named arguments. + +It is possible for later argument defaults to refer to prior arguments, +but not the other way around. They must be prefixed with "a:", as with all +arguments. + +Example that works: > + :function Okay(mandatory, optional = a:mandatory) + :endfunction +Example that does NOT work: > + :function NoGood(first = a:second, second = 10) + :endfunction +< +When not using "...", the number of arguments in a function call must be equal +to the number of mandatory named arguments. When using "...", the number of +arguments may be larger. + *local-variables* Inside a function local variables can be used. These will disappear when the function returns. Global variables need to be accessed with "g:". diff --git a/src/structs.h b/src/structs.h index ca678f83b1..16e5ce3da8 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1402,42 +1402,43 @@ typedef struct funccall_S funccall_T; */ typedef struct { - int uf_varargs; /* variable nr of arguments */ + int uf_varargs; // variable nr of arguments int uf_flags; - int uf_calls; /* nr of active calls */ - int uf_cleared; /* func_clear() was already called */ - garray_T uf_args; /* arguments */ - garray_T uf_lines; /* function lines */ + int uf_calls; // nr of active calls + int uf_cleared; // func_clear() was already called + garray_T uf_args; // arguments + garray_T uf_def_args; // default argument expressions + garray_T uf_lines; // function lines # ifdef FEAT_PROFILE - int uf_profiling; /* TRUE when func is being profiled */ + int uf_profiling; // TRUE when func is being profiled int uf_prof_initialized; - /* profiling the function as a whole */ - int uf_tm_count; /* nr of calls */ - proftime_T uf_tm_total; /* time spent in function + children */ - proftime_T uf_tm_self; /* time spent in function itself */ - proftime_T uf_tm_children; /* time spent in children this call */ - /* profiling the function per line */ - int *uf_tml_count; /* nr of times line was executed */ - proftime_T *uf_tml_total; /* time spent in a line + children */ - proftime_T *uf_tml_self; /* time spent in a line itself */ - proftime_T uf_tml_start; /* start time for current line */ - proftime_T uf_tml_children; /* time spent in children for this line */ - proftime_T uf_tml_wait; /* start wait time for current line */ - int uf_tml_idx; /* index of line being timed; -1 if none */ - int uf_tml_execed; /* line being timed was executed */ + // profiling the function as a whole + int uf_tm_count; // nr of calls + proftime_T uf_tm_total; // time spent in function + children + proftime_T uf_tm_self; // time spent in function itself + proftime_T uf_tm_children; // time spent in children this call + // profiling the function per line + int *uf_tml_count; // nr of times line was executed + proftime_T *uf_tml_total; // time spent in a line + children + proftime_T *uf_tml_self; // time spent in a line itself + proftime_T uf_tml_start; // start time for current line + proftime_T uf_tml_children; // time spent in children for this line + proftime_T uf_tml_wait; // start wait time for current line + int uf_tml_idx; // index of line being timed; -1 if none + int uf_tml_execed; // line being timed was executed # endif - sctx_T uf_script_ctx; /* SCTX where function was defined, - used for s: variables */ - int uf_refcount; /* reference count, see func_name_refcount() */ - funccall_T *uf_scoped; /* l: local variables for closure */ - char_u uf_name[1]; /* name of function (actually longer); can - start with 123_ ( is K_SPECIAL - KS_EXTRA KE_SNR) */ + sctx_T uf_script_ctx; // SCTX where function was defined, + // used for s: variables + int uf_refcount; // reference count, see func_name_refcount() + funccall_T *uf_scoped; // l: local variables for closure + char_u uf_name[1]; // name of function (actually longer); can + // start with 123_ ( is K_SPECIAL + // KS_EXTRA KE_SNR) } ufunc_T; -#define MAX_FUNC_ARGS 20 /* maximum number of function arguments */ -#define VAR_SHORT_LEN 20 /* short variable name length */ -#define FIXVAR_CNT 12 /* number of fixed variables */ +#define MAX_FUNC_ARGS 20 // maximum number of function arguments +#define VAR_SHORT_LEN 20 // short variable name length +#define FIXVAR_CNT 12 // number of fixed variables /* structure to hold info for a function that is currently being executed. */ struct funccall_S diff --git a/src/testdir/test_user_func.vim b/src/testdir/test_user_func.vim index e7a3701386..666c06c13d 100644 --- a/src/testdir/test_user_func.vim +++ b/src/testdir/test_user_func.vim @@ -94,3 +94,53 @@ func Test_user_func() unlet g:retval g:counter enew! endfunc + +func Log(val, base = 10) + return log(a:val) / log(a:base) +endfunc + +func Args(mandatory, optional = v:null, ...) + return deepcopy(a:) +endfunc + +func Args2(a = 1, b = 2, c = 3) + return deepcopy(a:) +endfunc + +func MakeBadFunc() + func s:fcn(a, b=1, c) + endfunc +endfunc + +func Test_default_arg() + call assert_equal(1.0, Log(10)) + call assert_equal(log(10), Log(10, exp(1))) + call assert_fails("call Log(1,2,3)", 'E118') + + let res = Args(1) + call assert_equal(res.mandatory, 1) + call assert_equal(res.optional, v:null) + call assert_equal(res['0'], 0) + + let res = Args(1,2) + call assert_equal(res.mandatory, 1) + call assert_equal(res.optional, 2) + call assert_equal(res['0'], 0) + + let res = Args(1,2,3) + call assert_equal(res.mandatory, 1) + call assert_equal(res.optional, 2) + call assert_equal(res['0'], 1) + + call assert_fails("call MakeBadFunc()", 'E989') + call assert_fails("fu F(a=1 ,) | endf", 'E475') + + let d = Args2(7, v:none, 9) + call assert_equal([7, 2, 9], [d.a, d.b, d.c]) + + call assert_equal("\n" + \ .. " function Args2(a = 1, b = 2, c = 3)\n" + \ .. "1 return deepcopy(a:)\n" + \ .. " endfunction", + \ execute('func Args2')) +endfunc diff --git a/src/userfunc.c b/src/userfunc.c index 28cf8b8a0f..d8cbe635ee 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -75,6 +75,7 @@ get_function_args( char_u endchar, garray_T *newargs, int *varargs, + garray_T *default_args, int skip) { int mustend = FALSE; @@ -82,9 +83,13 @@ get_function_args( char_u *p = arg; int c; int i; + int any_default = FALSE; + char_u *expr; if (newargs != NULL) ga_init2(newargs, (int)sizeof(char_u *), 3); + if (default_args != NULL) + ga_init2(default_args, (int)sizeof(char_u *), 3); if (varargs != NULL) *varargs = FALSE; @@ -140,6 +145,43 @@ get_function_args( *p = c; } + if (*skipwhite(p) == '=' && default_args != NULL) + { + typval_T rettv; + + any_default = TRUE; + p = skipwhite(p) + 1; + p = skipwhite(p); + expr = p; + if (eval1(&p, &rettv, FALSE) != FAIL) + { + if (ga_grow(default_args, 1) == FAIL) + goto err_ret; + + // trim trailing whitespace + while (p > expr && VIM_ISWHITE(p[-1])) + p--; + c = *p; + *p = NUL; + expr = vim_strsave(expr); + if (expr == NULL) + { + *p = c; + goto err_ret; + } + ((char_u **)(default_args->ga_data)) + [default_args->ga_len] = expr; + default_args->ga_len++; + *p = c; + } + else + mustend = TRUE; + } + else if (any_default) + { + emsg(_("E989: Non-default argument follows default argument")); + mustend = TRUE; + } if (*p == ',') ++p; else @@ -163,6 +205,8 @@ get_function_args( err_ret: if (newargs != NULL) ga_clear_strings(newargs); + if (default_args != NULL) + ga_clear_strings(default_args); return FAIL; } @@ -210,7 +254,7 @@ get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate) ga_init(&newlines); /* First, check if this is a lambda expression. "->" must exist. */ - ret = get_function_args(&start, '-', NULL, NULL, TRUE); + ret = get_function_args(&start, '-', NULL, NULL, NULL, TRUE); if (ret == FAIL || *start != '>') return NOTDONE; @@ -220,7 +264,7 @@ get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate) else pnewargs = NULL; *arg = skipwhite(*arg + 1); - ret = get_function_args(arg, '-', pnewargs, &varargs, FALSE); + ret = get_function_args(arg, '-', pnewargs, &varargs, NULL, FALSE); if (ret == FAIL || **arg != '>') goto errret; @@ -272,6 +316,7 @@ get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate) STRCPY(fp->uf_name, name); hash_add(&func_hashtab, UF2HIKEY(fp)); fp->uf_args = newargs; + ga_init(&fp->uf_def_args); fp->uf_lines = newlines; if (current_funccal != NULL && eval_lavars) { @@ -729,6 +774,7 @@ call_user_func( int using_sandbox = FALSE; funccall_T *fc; int save_did_emsg; + int default_arg_err = FALSE; static int depth = 0; dictitem_T *v; int fixvar_idx = 0; /* index in fixvar[] */ @@ -805,12 +851,13 @@ call_user_func( /* * Init a: variables. - * Set a:0 to "argcount". + * Set a:0 to "argcount" less number of named arguments, if >= 0. * Set a:000 to a list with room for the "..." arguments. */ init_var_dict(&fc->l_avars, &fc->l_avars_var, VAR_SCOPE); add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0", - (varnumber_T)(argcount - fp->uf_args.ga_len)); + (varnumber_T)(argcount >= fp->uf_args.ga_len + ? argcount - fp->uf_args.ga_len : 0)); fc->l_avars.dv_lock = VAR_FIXED; /* Use "name" to avoid a warning from some compiler that checks the * destination size. */ @@ -835,9 +882,11 @@ call_user_func( (varnumber_T)firstline); add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline", (varnumber_T)lastline); - for (i = 0; i < argcount; ++i) + for (i = 0; i < argcount || i < fp->uf_args.ga_len; ++i) { int addlocal = FALSE; + typval_T def_rettv; + int isdefault = FALSE; ai = i - fp->uf_args.ga_len; if (ai < 0) @@ -846,6 +895,25 @@ call_user_func( name = FUNCARG(fp, i); if (islambda) addlocal = TRUE; + + // evaluate named argument default expression + isdefault = ai + fp->uf_def_args.ga_len >= 0 + && (i >= argcount || (argvars[i].v_type == VAR_SPECIAL + && argvars[i].vval.v_number == VVAL_NONE)); + if (isdefault) + { + char_u *default_expr = NULL; + def_rettv.v_type = VAR_NUMBER; + def_rettv.vval.v_number = -1; + + default_expr = ((char_u **)(fp->uf_def_args.ga_data)) + [ai + fp->uf_def_args.ga_len]; + if (eval1(&default_expr, &def_rettv, TRUE) == FAIL) + { + default_arg_err = 1; + break; + } + } } else { @@ -867,9 +935,12 @@ call_user_func( v->di_flags |= DI_FLAGS_RO | DI_FLAGS_FIX; } - /* Note: the values are copied directly to avoid alloc/free. - * "argvars" must have VAR_FIXED for v_lock. */ - v->di_tv = argvars[i]; + if (isdefault) + v->di_tv = def_rettv; + else + // Note: the values are copied directly to avoid alloc/free. + // "argvars" must have VAR_FIXED for v_lock. + v->di_tv = argvars[i]; v->di_tv.v_lock = VAR_FIXED; if (addlocal) @@ -988,8 +1059,11 @@ call_user_func( save_did_emsg = did_emsg; did_emsg = FALSE; - /* call do_cmdline() to execute the lines */ - do_cmdline(NULL, get_func_line, (void *)fc, + if (default_arg_err && (fp->uf_flags & FC_ABORT)) + did_emsg = TRUE; + else + // call do_cmdline() to execute the lines + do_cmdline(NULL, get_func_line, (void *)fc, DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); --RedrawingDisabled; @@ -1145,6 +1219,7 @@ func_remove(ufunc_T *fp) func_clear_items(ufunc_T *fp) { ga_clear_strings(&(fp->uf_args)); + ga_clear_strings(&(fp->uf_def_args)); ga_clear_strings(&(fp->uf_lines)); #ifdef FEAT_PROFILE vim_free(fp->uf_tml_count); @@ -1498,7 +1573,7 @@ call_func( if (fp->uf_flags & FC_RANGE) *doesrange = TRUE; - if (argcount < fp->uf_args.ga_len) + if (argcount < fp->uf_args.ga_len - fp->uf_def_args.ga_len) error = ERROR_TOOFEW; else if (!fp->uf_varargs && argcount > fp->uf_args.ga_len) error = ERROR_TOOMANY; @@ -1624,6 +1699,12 @@ list_func_head(ufunc_T *fp, int indent) if (j) msg_puts(", "); msg_puts((char *)FUNCARG(fp, j)); + if (j >= fp->uf_args.ga_len - fp->uf_def_args.ga_len) + { + msg_puts(" = "); + msg_puts(((char **)(fp->uf_def_args.ga_data)) + [j - fp->uf_args.ga_len + fp->uf_def_args.ga_len]); + } } if (fp->uf_varargs) { @@ -1889,6 +1970,7 @@ ex_function(exarg_T *eap) char_u *arg; char_u *line_arg = NULL; garray_T newargs; + garray_T default_args; garray_T newlines; int varargs = FALSE; int flags = 0; @@ -2103,7 +2185,8 @@ ex_function(exarg_T *eap) emsg(_("E862: Cannot use g: here")); } - if (get_function_args(&p, ')', &newargs, &varargs, eap->skip) == FAIL) + if (get_function_args(&p, ')', &newargs, &varargs, + &default_args, eap->skip) == FAIL) goto errret_2; /* find extra arguments "range", "dict", "abort" and "closure" */ @@ -2511,6 +2594,7 @@ ex_function(exarg_T *eap) fp->uf_refcount = 1; } fp->uf_args = newargs; + fp->uf_def_args = default_args; fp->uf_lines = newlines; if ((flags & FC_CLOSURE) != 0) { @@ -2535,6 +2619,7 @@ ex_function(exarg_T *eap) erret: ga_clear_strings(&newargs); + ga_clear_strings(&default_args); errret_2: ga_clear_strings(&newlines); ret_free: diff --git a/src/version.c b/src/version.c index b8acb8f041..57aff32d6d 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1310, /**/ 1309, /**/ From 23b5139234a79567097ca73aba15ea134381b934 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 21:38:43 +0200 Subject: [PATCH 42/97] patch 8.1.1311: aborting an autocmd with an exception is not tested Problem: Aborting an autocmd with an exception is not tested. Solution: Add a test. Also shows how to abort a command by throwing an exception. --- src/testdir/test_autocmd.vim | 19 +++++++++++++++++++ src/version.c | 2 ++ 2 files changed, 21 insertions(+) diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 55d725e48a..48db3e2a99 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -1733,3 +1733,22 @@ func Test_ReadWrite_Autocmds() call delete('Xtest.c') call delete('test.out') endfunc + +func Test_throw_in_BufWritePre() + new + call setline(1, ['one', 'two', 'three']) + call assert_false(filereadable('Xthefile')) + augroup throwing + au BufWritePre X* throw 'do not write' + augroup END + try + w Xthefile + catch + let caught = 1 + endtry + call assert_equal(1, caught) + call assert_false(filereadable('Xthefile')) + + bwipe! + au! throwing +endfunc diff --git a/src/version.c b/src/version.c index 57aff32d6d..a9b376e23b 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1311, /**/ 1310, /**/ From 4ca41534b726c4116d2e430e877e34146b4d4831 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 May 2019 21:48:37 +0200 Subject: [PATCH 43/97] patch 8.1.1312: Coverity warning for using uninitialized variable Problem: Coverity warning for using uninitialized variable. Solution: Clear exarg_T. --- src/channel.c | 2 ++ src/ex_cmds2.c | 6 +++--- src/quickfix.c | 2 ++ src/version.c | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/channel.c b/src/channel.c index aac8656cf1..a29414f69f 100644 --- a/src/channel.c +++ b/src/channel.c @@ -2308,6 +2308,7 @@ channel_exe_cmd(channel_T *channel, ch_part_T part, typval_T *argv) exarg_T ea; ch_log(channel, "Executing normal command '%s'", (char *)arg); + vim_memset(&ea, 0, sizeof(ea)); ea.arg = arg; ea.addr_count = 0; ea.forceit = TRUE; /* no mapping */ @@ -2318,6 +2319,7 @@ channel_exe_cmd(channel_T *channel, ch_part_T part, typval_T *argv) exarg_T ea; ch_log(channel, "redraw"); + vim_memset(&ea, 0, sizeof(ea)); ea.forceit = *arg != NUL; ex_redraw(&ea); showruler(FALSE); diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 1e9d18e833..8bab8536b3 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1190,9 +1190,9 @@ dialog_changed( else ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1); - /* Init ea pseudo-structure, this is needed for the check_overwrite() - * function. */ - ea.append = ea.forceit = FALSE; + // Init ea pseudo-structure, this is needed for the check_overwrite() + // function. + vim_memset(&ea, 0, sizeof(ea)); if (ret == VIM_YES) { diff --git a/src/quickfix.c b/src/quickfix.c index 61576505a9..cf3b274843 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -5809,6 +5809,7 @@ vgr_jump_to_match( { exarg_T ea; + vim_memset(&ea, 0, sizeof(ea)); ea.arg = target_dir; ea.cmdidx = CMD_lcd; ex_cd(&ea); @@ -6109,6 +6110,7 @@ restore_start_dir(char_u *dirname_start) // appropriate ex command and executing it. exarg_T ea; + vim_memset(&ea, 0, sizeof(ea)); ea.arg = dirname_start; ea.cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd; ex_cd(&ea); diff --git a/src/version.c b/src/version.c index a9b376e23b..2b936d772d 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1312, /**/ 1311, /**/ From 63d2555c9cefbbeeca3ec87fdd5d241e9488f9dd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 10 May 2019 21:28:38 +0200 Subject: [PATCH 44/97] patch 8.1.1313: warnings for using localtime() and ctime() Problem: Warnings for using localtime() and ctime(). Solution: Use localtime_r() if available. Avoid using ctime(). --- src/auto/configure | 13 ++++++++- src/config.h.in | 1 + src/configure.ac | 3 +- src/evalfunc.c | 7 +++++ src/hardcopy.c | 12 ++------ src/memline.c | 66 +++++++++++++++++++++++++++++-------------- src/nbdebug.c | 5 ++-- src/proto/memline.pro | 1 + src/undo.c | 8 ++++++ src/version.c | 2 ++ 10 files changed, 83 insertions(+), 35 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index 19982730db..bb613d2793 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -12650,10 +12650,21 @@ $as_echo "$vim_cv_getcwd_broken" >&6; } if test "x$vim_cv_getcwd_broken" = "xyes" ; then $as_echo "#define BAD_GETCWD 1" >>confdefs.h + for ac_func in getwd +do : + ac_fn_c_check_func "$LINENO" "getwd" "ac_cv_func_getwd" +if test "x$ac_cv_func_getwd" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETWD 1 +_ACEOF + +fi +done + fi for ac_func in fchdir fchown fchmod fsync getcwd getpseudotty \ - getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat \ + getpwent getpwnam getpwuid getrlimit gettimeofday localtime_r lstat \ memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \ getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \ diff --git a/src/config.h.in b/src/config.h.in index 3f122fddb2..23e301c90e 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -174,6 +174,7 @@ #undef HAVE_GETTIMEOFDAY #undef HAVE_GETWD #undef HAVE_ICONV +#undef HAVE_LOCALTIME_R #undef HAVE_LSTAT #undef HAVE_MEMSET #undef HAVE_MKDTEMP diff --git a/src/configure.ac b/src/configure.ac index 2a3bc33b40..946c10d36c 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -3736,12 +3736,13 @@ main() if test "x$vim_cv_getcwd_broken" = "xyes" ; then AC_DEFINE(BAD_GETCWD) + AC_CHECK_FUNCS(getwd) fi dnl Check for functions in one big call, to reduce the size of configure. dnl Can only be used for functions that do not require any include. AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \ - getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat \ + getpwent getpwnam getpwuid getrlimit gettimeofday localtime_r lstat \ memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \ getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \ diff --git a/src/evalfunc.c b/src/evalfunc.c index f3b1fafb98..ff51d1210a 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -13213,6 +13213,9 @@ f_str2nr(typval_T *argvars, typval_T *rettv) f_strftime(typval_T *argvars, typval_T *rettv) { char_u result_buf[256]; +# ifdef HAVE_LOCALTIME_R + struct tm tmval; +# endif struct tm *curtime; time_t seconds; char_u *p; @@ -13224,7 +13227,11 @@ f_strftime(typval_T *argvars, typval_T *rettv) seconds = time(NULL); else seconds = (time_t)tv_get_number(&argvars[1]); +# ifdef HAVE_LOCALTIME_R + curtime = localtime_r(&seconds, &tmval); +# else curtime = localtime(&seconds); +# endif /* MSVC returns NULL for an invalid value of seconds. */ if (curtime == NULL) rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)")); diff --git a/src/hardcopy.c b/src/hardcopy.c index 1ceed9916d..a3b1c0e1f0 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -2723,9 +2723,7 @@ prt_add_resource(struct prt_ps_resource_S *resource) int mch_print_begin(prt_settings_T *psettings) { - time_t now; int bbox[4]; - char *p_time; double left; double right; double top; @@ -2734,7 +2732,6 @@ mch_print_begin(prt_settings_T *psettings) struct prt_ps_resource_S *res_encoding; char buffer[256]; char_u *p_encoding; - char_u *p; struct prt_ps_resource_S *res_cidfont; struct prt_ps_resource_S *res_cmap; int retval = FALSE; @@ -2761,13 +2758,8 @@ mch_print_begin(prt_settings_T *psettings) prt_dsc_textline("For", buffer); prt_dsc_textline("Creator", VIM_VERSION_LONG); /* Note: to ensure Clean8bit I don't think we can use LC_TIME */ - now = time(NULL); - p_time = ctime(&now); - /* Note: ctime() adds a \n so we have to remove it :-( */ - p = vim_strchr((char_u *)p_time, '\n'); - if (p != NULL) - *p = NUL; - prt_dsc_textline("CreationDate", p_time); + + prt_dsc_textline("CreationDate", get_ctime(time(NULL), FALSE)); prt_dsc_textline("DocumentData", "Clean8Bit"); prt_dsc_textline("Orientation", "Portrait"); prt_dsc_atend("Pages"); diff --git a/src/memline.c b/src/memline.c index 705bc4bcaa..1ef7ecfd19 100644 --- a/src/memline.c +++ b/src/memline.c @@ -2077,6 +2077,41 @@ get_b0_dict(char_u *fname, dict_T *d) } #endif +/* + * Replacement for ctime(), which is not safe to use. + * Requires strftime(), otherwise returns "(unknown)". + * If "thetime" is invalid returns "(invalid)". Never returns NULL. + * When "add_newline" is TRUE add a newline like ctime() does. + * Uses a static buffer. + */ + char * +get_ctime(time_t thetime, int add_newline) +{ + static char buf[50]; +#ifdef HAVE_STRFTIME +# ifdef HAVE_LOCALTIME_R + struct tm tmval; +# endif + struct tm *curtime; + +# ifdef HAVE_LOCALTIME_R + curtime = localtime_r(&thetime, &tmval); +# else + curtime = localtime(&thetime); +# endif + /* MSVC returns NULL for an invalid value of seconds. */ + if (curtime == NULL) + STRCPY(buf, _("(Invalid)")); + else + (void)strftime(buf, sizeof(buf) - 1, "%a %b %d %H:%M:%S %Y", curtime); +#else + STRCPY(buf, "(unknown)"); +#endif + if (add_newline) + STRCAT(buf, "\n"); + return buf; +} + /* * Give information about an existing swap file. * Returns timestamp (0 when unknown). @@ -2087,17 +2122,15 @@ swapfile_info(char_u *fname) stat_T st; int fd; struct block0 b0; - time_t x = (time_t)0; - char *p; #ifdef UNIX char_u uname[B0_UNAME_SIZE]; #endif - /* print the swap file date */ + // print the swap file date if (mch_stat((char *)fname, &st) != -1) { #ifdef UNIX - /* print name of owner of the file */ + // print name of owner of the file if (mch_get_uname(st.st_uid, uname, B0_UNAME_SIZE) == OK) { msg_puts(_(" owned by: ")); @@ -2107,13 +2140,10 @@ swapfile_info(char_u *fname) else #endif msg_puts(_(" dated: ")); - x = st.st_mtime; /* Manx C can't do &st.st_mtime */ - p = ctime(&x); /* includes '\n' */ - if (p == NULL) - msg_puts("(invalid)\n"); - else - msg_puts(p); + msg_puts(get_ctime(st.st_mtime, TRUE)); } + else + st.st_mtime = 0; /* * print the original file name @@ -2191,7 +2221,7 @@ swapfile_info(char_u *fname) msg_puts(_(" [cannot be opened]")); msg_putchar('\n'); - return x; + return st.st_mtime; } /* @@ -4412,15 +4442,14 @@ attention_message( char_u *fname) /* swap file name */ { stat_T st; - time_t x, sx; - char *p; + time_t swap_mtime; ++no_wait_return; (void)emsg(_("E325: ATTENTION")); msg_puts(_("\nFound a swap file by the name \"")); msg_home_replace(fname); msg_puts("\"\n"); - sx = swapfile_info(fname); + swap_mtime = swapfile_info(fname); msg_puts(_("While opening file \"")); msg_outtrans(buf->b_fname); msg_puts("\"\n"); @@ -4431,13 +4460,8 @@ attention_message( else { msg_puts(_(" dated: ")); - x = st.st_mtime; /* Manx C can't do &st.st_mtime */ - p = ctime(&x); /* includes '\n' */ - if (p == NULL) - msg_puts("(invalid)\n"); - else - msg_puts(p); - if (sx != 0 && x > sx) + msg_puts(get_ctime(st.st_mtime, TRUE)); + if (swap_mtime != 0 && st.st_mtime > swap_mtime) msg_puts(_(" NEWER than swap file!\n")); } /* Some of these messages are long to allow translation to diff --git a/src/nbdebug.c b/src/nbdebug.c index b76d9caf07..2af0288ce4 100644 --- a/src/nbdebug.c +++ b/src/nbdebug.c @@ -80,12 +80,13 @@ nbdebug_log_init( char *file; /* possible nb_debug output file */ char *cp; /* nb_dlevel pointer */ - if (log_var && (file = getenv(log_var)) != NULL) { + if (log_var && (file = getenv(log_var)) != NULL) + { time_t now; nb_debug = fopen(file, "a"); time(&now); - fprintf(nb_debug, "%s", asctime(localtime(&now))); + fprintf(nb_debug, "%s", get_ctime(now, TRUE)); if (level_var && (cp = getenv(level_var)) != NULL) { nb_dlevel = strtoul(cp, NULL, 0); } else { diff --git a/src/proto/memline.pro b/src/proto/memline.pro index 04254b0667..57cc767604 100644 --- a/src/proto/memline.pro +++ b/src/proto/memline.pro @@ -13,6 +13,7 @@ void ml_recover(void); int recover_names(char_u *fname, int list, int nr, char_u **fname_out); char_u *make_percent_swname(char_u *dir, char_u *name); void get_b0_dict(char_u *fname, dict_T *d); +char *get_ctime(time_t thetime, int add_newline); void ml_sync_all(int check_file, int check_char); void ml_preserve(buf_T *buf, int message); char_u *ml_get(linenr_T lnum); diff --git a/src/undo.c b/src/undo.c index 1d26144495..2f1924ce12 100644 --- a/src/undo.c +++ b/src/undo.c @@ -3110,11 +3110,19 @@ ex_undolist(exarg_T *eap UNUSED) u_add_time(char_u *buf, size_t buflen, time_t tt) { #ifdef HAVE_STRFTIME +# ifdef HAVE_LOCALTIME_R + struct tm tmval; +# endif struct tm *curtime; if (vim_time() - tt >= 100) { curtime = localtime(&tt); +# ifdef HAVE_LOCALTIME_R + curtime = localtime_r(&tt, &tmval); +# else + curtime = localtime(&tt); +# endif if (vim_time() - tt < (60L * 60L * 12L)) /* within 12 hours */ (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime); diff --git a/src/version.c b/src/version.c index 2b936d772d..56aff78024 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1313, /**/ 1312, /**/ From c049b52b9013055bcb8abbd8545d35591bc84094 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 10 May 2019 21:38:54 +0200 Subject: [PATCH 45/97] patch 8.1.1314: MSVC makefile is not nicely indented Problem: MSVC makefile is not nicely indented. Solution: Addjust spaces in preprocessor directives. (Ken Takata) --- src/Make_mvc.mak | 390 +++++++++++++++++++++++------------------------ src/version.c | 2 + 2 files changed, 196 insertions(+), 196 deletions(-) diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 44be242e3c..36f18dc056 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -242,7 +242,7 @@ OBJDIR = $(OBJDIR)$(CPU) !if "$(DEBUG)" != "yes" NODEBUG = 1 !else -!undef NODEBUG +! undef NODEBUG MAKEFLAGS_GVIMEXT = DEBUG=yes !endif @@ -251,9 +251,9 @@ MAKEFLAGS_GVIMEXT = DEBUG=yes # if SDK_INCLUDE_DIR is set or USE_WIN32MAK is set to "yes". !ifdef SDK_INCLUDE_DIR -!include $(SDK_INCLUDE_DIR)\Win32.mak +! include $(SDK_INCLUDE_DIR)\Win32.mak !elseif "$(USE_WIN32MAK)"=="yes" -!include +! include !else link = link !endif @@ -261,14 +261,14 @@ link = link # Check VC version. !if [echo MSVCVER=_MSC_VER> msvcver.c && $(CC) /EP msvcver.c > msvcver.~ 2> nul] -!message *** ERROR -!message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH. -!message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed. -!error Make aborted. +! message *** ERROR +! message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH. +! message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed. +! error Make aborted. !else -!include msvcver.~ -!if [del msvcver.c msvcver.~] -!endif +! include msvcver.~ +! if [del msvcver.c msvcver.~] +! endif !endif !if $(MSVCVER) < 1900 @@ -302,9 +302,9 @@ MSVCRT_VER = ($(MSVCVER) / 10 - 50) # Calculate MSVCRT_VER !if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0 -!include msvcrtver.~ -!if [del msvcrtver.~] -!endif +! include msvcrtver.~ +! if [del msvcrtver.~] +! endif !endif # Base name of the msvcrXX.dll @@ -353,11 +353,11 @@ CSCOPE_DEFS = -DFEAT_CSCOPE !endif !ifndef TERMINAL -!if "$(FEATURES)"=="HUGE" +! if "$(FEATURES)"=="HUGE" TERMINAL = yes -!else +! else TERMINAL = no -!endif +! endif !endif !if "$(TERMINAL)" == "yes" @@ -386,73 +386,73 @@ NETBEANS = $(GUI) !endif !ifndef CHANNEL -!if "$(FEATURES)"=="HUGE" +! if "$(FEATURES)"=="HUGE" CHANNEL = yes -!else +! else CHANNEL = $(GUI) -!endif +! endif !endif # GUI specific features. !if "$(GUI)" == "yes" # Only allow NETBEANS for a GUI build and CHANNEL. -!if "$(NETBEANS)" == "yes" && "$(CHANNEL)" == "yes" +! if "$(NETBEANS)" == "yes" && "$(CHANNEL)" == "yes" # NETBEANS - Include support for Netbeans integration NETBEANS_PRO = proto/netbeans.pro NETBEANS_OBJ = $(OBJDIR)/netbeans.obj NETBEANS_DEFS = -DFEAT_NETBEANS_INTG -!if "$(NBDEBUG)" == "yes" +! if "$(NBDEBUG)" == "yes" NBDEBUG_DEFS = -DNBDEBUG NBDEBUG_INCL = nbdebug.h NBDEBUG_SRC = nbdebug.c -!endif +! endif NETBEANS_LIB = WSock32.lib -!endif +! endif # DirectWrite (DirectX) -!if "$(DIRECTX)" == "yes" +! if "$(DIRECTX)" == "yes" DIRECTX_DEFS = -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -!if "$(COLOR_EMOJI)" != "no" +! if "$(COLOR_EMOJI)" != "no" DIRECTX_DEFS = $(DIRECTX_DEFS) -DFEAT_DIRECTX_COLOR_EMOJI -!endif +! endif DIRECTX_INCL = gui_dwrite.h DIRECTX_OBJ = $(OUTDIR)\gui_dwrite.obj -!endif +! endif # Only allow XPM for a GUI build. -!ifndef XPM -!ifndef USE_MSVCRT +! ifndef XPM +! ifndef USE_MSVCRT # Both XPM and USE_MSVCRT are not set, use the included xpm files, depending # on the architecture. -!if "$(CPU)" == "AMD64" +! if "$(CPU)" == "AMD64" XPM = xpm\x64 -!elseif "$(CPU)" == "ARM64" +! elseif "$(CPU)" == "ARM64" XPM = xpm\arm64 -!elseif "$(CPU)" == "i386" +! elseif "$(CPU)" == "i386" XPM = xpm\x86 -!else +! else XPM = no -!endif -!else # USE_MSVCRT +! endif +! else # USE_MSVCRT XPM = no -!endif # USE_MSVCRT -!endif # XPM -!if "$(XPM)" != "no" +! endif # USE_MSVCRT +! endif # XPM +! if "$(XPM)" != "no" # XPM - Include support for XPM signs # See the xpm directory for more information. XPM_OBJ = $(OBJDIR)/xpm_w32.obj XPM_DEFS = -DFEAT_XPM_W32 -!if $(MSVC_MAJOR) >= 14 +! if $(MSVC_MAJOR) >= 14 # VC14 cannot use a library built by VC12 or earlier, because VC14 uses # Universal CRT. XPM_LIB = $(XPM)\lib-vc14\libXpm.lib -!else +! else XPM_LIB = $(XPM)\lib\libXpm.lib -!endif +! endif XPM_INC = -I $(XPM)\include -I $(XPM)\..\include -!endif -!endif +! endif +!endif # GUI !if "$(CHANNEL)" == "yes" CHANNEL_PRO = proto/channel.pro @@ -618,11 +618,9 @@ NODEFAULTLIB = /nodefaultlib !endif # Use multiprocess build on MSVC 10 -!if "$(USE_MP)"=="yes" -!if $(MSVC_MAJOR) >= 10 +!if ("$(USE_MP)" == "yes") && ($(MSVC_MAJOR) >= 10) CFLAGS = $(CFLAGS) /MP !endif -!endif # VC10 or later has stdint.h. !if $(MSVC_MAJOR) >= 10 @@ -632,30 +630,30 @@ CFLAGS = $(CFLAGS) -DHAVE_STDINT_H # Static code analysis generally available starting with VS2012 (VC11) or # Windows SDK 7.1 (VC10) !if ("$(ANALYZE)" == "yes") && ($(MSVC_MAJOR) >= 10) -CFLAGS=$(CFLAGS) /analyze +CFLAGS = $(CFLAGS) /analyze !endif !ifdef NODEBUG VIM = vim -!if "$(OPTIMIZE)" == "SPACE" +! if "$(OPTIMIZE)" == "SPACE" OPTFLAG = /O1 -!elseif "$(OPTIMIZE)" == "SPEED" +! elseif "$(OPTIMIZE)" == "SPEED" OPTFLAG = /O2 -!else # MAXSPEED +! else # MAXSPEED OPTFLAG = /Ox -!endif +! endif -!if $(MSVC_MAJOR) >= 8 +! if $(MSVC_MAJOR) >= 8 # Use link time code generation if not worried about size -!if "$(OPTIMIZE)" != "SPACE" +! if "$(OPTIMIZE)" != "SPACE" OPTFLAG = $(OPTFLAG) /GL -!endif -!endif +! endif +! endif # (/Wp64 is deprecated in VC9 and generates an obnoxious warning.) -!if ($(MSVC_MAJOR) == 7) || ($(MSVC_MAJOR) == 8) -CFLAGS=$(CFLAGS) $(WP64CHECK) -!endif +! if ($(MSVC_MAJOR) == 7) || ($(MSVC_MAJOR) == 8) +CFLAGS = $(CFLAGS) $(WP64CHECK) +! endif CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG $(CPUARG) RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG @@ -782,14 +780,14 @@ OLE_LIB = oleaut32.lib !if "$(IME)" == "yes" CFLAGS = $(CFLAGS) -DFEAT_MBYTE_IME -!ifndef DYNAMIC_IME +! ifndef DYNAMIC_IME DYNAMIC_IME = yes -!endif -!if "$(DYNAMIC_IME)" == "yes" +! endif +! if "$(DYNAMIC_IME)" == "yes" CFLAGS = $(CFLAGS) -DDYNAMIC_IME -!else +! else IME_LIB = imm32.lib -!endif +! endif !endif !if "$(GIME)" == "yes" @@ -880,153 +878,153 @@ CFLAGS = $(CFLAGS) -DDYNAMIC_GETTEXT # TCL interface !ifdef TCL -!ifndef TCL_VER +! ifndef TCL_VER TCL_VER = 86 TCL_VER_LONG = 8.6 -!endif -!message Tcl requested (version $(TCL_VER)) - root dir is "$(TCL)" -!if "$(DYNAMIC_TCL)" == "yes" -!message Tcl DLL will be loaded dynamically -!ifndef TCL_DLL +! endif +! message Tcl requested (version $(TCL_VER)) - root dir is "$(TCL)" +! if "$(DYNAMIC_TCL)" == "yes" +! message Tcl DLL will be loaded dynamically +! ifndef TCL_DLL TCL_DLL = tcl$(TCL_VER).dll -!endif +! endif CFLAGS = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" \ -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\" TCL_OBJ = $(OUTDIR)\if_tcl.obj TCL_INC = /I "$(TCL)\Include" /I "$(TCL)" TCL_LIB = "$(TCL)\lib\tclstub$(TCL_VER).lib" -!else +! else CFLAGS = $(CFLAGS) -DFEAT_TCL TCL_OBJ = $(OUTDIR)\if_tcl.obj TCL_INC = /I "$(TCL)\Include" /I "$(TCL)" TCL_LIB = $(TCL)\lib\tcl$(TCL_VER)vc.lib -!endif +! endif !endif # Lua interface !ifdef LUA -!ifndef LUA_VER +! ifndef LUA_VER LUA_VER = 53 -!endif -!message Lua requested (version $(LUA_VER)) - root dir is "$(LUA)" -!if "$(DYNAMIC_LUA)" == "yes" -!message Lua DLL will be loaded dynamically -!endif +! endif +! message Lua requested (version $(LUA_VER)) - root dir is "$(LUA)" +! if "$(DYNAMIC_LUA)" == "yes" +! message Lua DLL will be loaded dynamically +! endif CFLAGS = $(CFLAGS) -DFEAT_LUA LUA_OBJ = $(OUTDIR)\if_lua.obj LUA_INC = /I "$(LUA)\include" /I "$(LUA)" -!if "$(DYNAMIC_LUA)" == "yes" +! if "$(DYNAMIC_LUA)" == "yes" CFLAGS = $(CFLAGS) -DDYNAMIC_LUA \ -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\" LUA_LIB = /nodefaultlib:lua$(LUA_VER).lib -!else +! else LUA_LIB = "$(LUA)\lib\lua$(LUA_VER).lib" -!endif +! endif !endif !ifdef PYTHON -!ifdef PYTHON3 +! ifdef PYTHON3 DYNAMIC_PYTHON=yes DYNAMIC_PYTHON3=yes -!endif +! endif !endif # PYTHON interface !ifdef PYTHON -!ifndef PYTHON_VER +! ifndef PYTHON_VER PYTHON_VER = 27 -!endif -!message Python requested (version $(PYTHON_VER)) - root dir is "$(PYTHON)" -!if "$(DYNAMIC_PYTHON)" == "yes" -!message Python DLL will be loaded dynamically -!endif +! endif +! message Python requested (version $(PYTHON_VER)) - root dir is "$(PYTHON)" +! if "$(DYNAMIC_PYTHON)" == "yes" +! message Python DLL will be loaded dynamically +! endif CFLAGS = $(CFLAGS) -DFEAT_PYTHON PYTHON_OBJ = $(OUTDIR)\if_python.obj PYTHON_INC = /I "$(PYTHON)\Include" /I "$(PYTHON)\PC" -!if "$(DYNAMIC_PYTHON)" == "yes" +! if "$(DYNAMIC_PYTHON)" == "yes" CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON \ -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" PYTHON_LIB = /nodefaultlib:python$(PYTHON_VER).lib -!else +! else PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib -!endif +! endif !endif # PYTHON3 interface !ifdef PYTHON3 -!ifndef PYTHON3_VER +! ifndef PYTHON3_VER PYTHON3_VER = 36 -!endif -!message Python3 requested (version $(PYTHON3_VER)) - root dir is "$(PYTHON3)" -!if "$(DYNAMIC_PYTHON3)" == "yes" -!message Python3 DLL will be loaded dynamically -!endif +! endif +! message Python3 requested (version $(PYTHON3_VER)) - root dir is "$(PYTHON3)" +! if "$(DYNAMIC_PYTHON3)" == "yes" +! message Python3 DLL will be loaded dynamically +! endif CFLAGS = $(CFLAGS) -DFEAT_PYTHON3 PYTHON3_OBJ = $(OUTDIR)\if_python3.obj PYTHON3_INC = /I "$(PYTHON3)\Include" /I "$(PYTHON3)\PC" -!if "$(DYNAMIC_PYTHON3)" == "yes" +! if "$(DYNAMIC_PYTHON3)" == "yes" CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON3 \ -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\" PYTHON3_LIB = /nodefaultlib:python$(PYTHON3_VER).lib -!else +! else PYTHON3_LIB = $(PYTHON3)\libs\python$(PYTHON3_VER).lib -!endif +! endif !endif # MzScheme interface !ifdef MZSCHEME -!message MzScheme requested - root dir is "$(MZSCHEME)" -!ifndef MZSCHEME_VER +! message MzScheme requested - root dir is "$(MZSCHEME)" +! ifndef MZSCHEME_VER MZSCHEME_VER = 3m_a0solc -!endif -!ifndef MZSCHEME_COLLECTS +! endif +! ifndef MZSCHEME_COLLECTS MZSCHEME_COLLECTS=$(MZSCHEME)\collects -!endif +! endif CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I "$(MZSCHEME)\include" -!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib") +! if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib") MZSCHEME_MAIN_LIB=mzsch -!else +! else MZSCHEME_MAIN_LIB=racket -!endif -!if (EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll") \ +! endif +! if (EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll") \ && !EXIST("$(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll")) \ || (EXIST("$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib") \ && !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib")) -!message Building with Precise GC +! message Building with Precise GC MZSCHEME_PRECISE_GC = yes CFLAGS = $(CFLAGS) -DMZ_PRECISE_GC -!endif -!if "$(DYNAMIC_MZSCHEME)" == "yes" -!message MzScheme DLLs will be loaded dynamically +! endif +! if "$(DYNAMIC_MZSCHEME)" == "yes" +! message MzScheme DLLs will be loaded dynamically CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME -!if "$(MZSCHEME_PRECISE_GC)" == "yes" +! if "$(MZSCHEME_PRECISE_GC)" == "yes" # Precise GC does not use separate dll CFLAGS = $(CFLAGS) \ -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \ -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -!else +! else CFLAGS = $(CFLAGS) \ -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" \ -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" -!endif -!else -!if "$(MZSCHEME_DEBUG)" == "yes" +! endif +! else +! if "$(MZSCHEME_DEBUG)" == "yes" CFLAGS = $(CFLAGS) -DMZSCHEME_FORCE_GC -!endif -!if "$(MZSCHEME_PRECISE_GC)" == "yes" +! endif +! if "$(MZSCHEME_PRECISE_GC)" == "yes" # Precise GC does not use separate dll -!if EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def") +! if EXIST("$(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).def") # create .lib from .def MZSCHEME_LIB = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib MZSCHEME_EXTRA_DEP = lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib -!else +! else MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib" -!endif -!else +! endif +! else MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib" \ "$(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib" -!endif -!endif +! endif +! endif MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj # increase stack size MZSCHEME_LIB = $(MZSCHEME_LIB) /STACK:8388608 @@ -1035,62 +1033,62 @@ MZSCHEME_INCL = if_mzsch.h # Perl interface !ifdef PERL -!ifndef PERL_VER +! ifndef PERL_VER PERL_VER = 524 -!endif -!message Perl requested (version $(PERL_VER)) - root dir is "$(PERL)" -!if "$(DYNAMIC_PERL)" == "yes" -!if $(PERL_VER) >= 56 -!message Perl DLL will be loaded dynamically -!else -!message Dynamic loading is not supported for Perl versions earlier than 5.6.0 -!message Reverting to static loading... -!undef DYNAMIC_PERL -!endif -!endif +! endif +! message Perl requested (version $(PERL_VER)) - root dir is "$(PERL)" +! if "$(DYNAMIC_PERL)" == "yes" +! if $(PERL_VER) >= 56 +! message Perl DLL will be loaded dynamically +! else +! message Dynamic loading is not supported for Perl versions earlier than 5.6.0 +! message Reverting to static loading... +! undef DYNAMIC_PERL +! endif +! endif # Is Perl installed in architecture-specific directories? -!if exist($(PERL)\Bin\MSWin32-x86) +! if exist($(PERL)\Bin\MSWin32-x86) PERL_ARCH = \MSWin32-x86 -!endif +! endif PERL_INCDIR = $(PERL)\Lib$(PERL_ARCH)\Core # Version-dependent stuff -!if $(PERL_VER) == 55 +! if $(PERL_VER) == 55 PERL_LIB = $(PERL_INCDIR)\perl.lib -!else +! else PERL_DLL = perl$(PERL_VER).dll -!if exist($(PERL_INCDIR)\perl$(PERL_VER).lib) +! if exist($(PERL_INCDIR)\perl$(PERL_VER).lib) PERL_LIB = $(PERL_INCDIR)\perl$(PERL_VER).lib -!else +! else # For ActivePerl 5.18 and later PERL_LIB = $(PERL_INCDIR)\libperl$(PERL_VER).a -!endif -!endif +! endif +! endif CFLAGS = $(CFLAGS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS # Do we want to load Perl dynamically? -!if "$(DYNAMIC_PERL)" == "yes" +! if "$(DYNAMIC_PERL)" == "yes" CFLAGS = $(CFLAGS) -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"$(PERL_DLL)\" -!undef PERL_LIB -!endif +! undef PERL_LIB +! endif PERL_EXE = $(PERL)\Bin$(PERL_ARCH)\perl PERL_INC = /I $(PERL_INCDIR) -!if $(MSVC_MAJOR) <= 11 +! if $(MSVC_MAJOR) <= 11 # ActivePerl 5.20+ requires stdbool.h but VC2012 or earlier doesn't have it. # Use a stub stdbool.h. PERL_INC = $(PERL_INC) /I if_perl_msvc -!endif +! endif PERL_OBJ = $(OUTDIR)\if_perl.obj $(OUTDIR)\if_perlsfio.obj XSUBPP = $(PERL)\lib\ExtUtils\xsubpp -!if exist($(XSUBPP)) +! if exist($(XSUBPP)) XSUBPP = $(PERL_EXE) $(XSUBPP) -!else +! else XSUBPP = xsubpp -!endif +! endif XSUBPP_TYPEMAP = $(PERL)\lib\ExtUtils\typemap !endif @@ -1100,71 +1098,71 @@ XSUBPP_TYPEMAP = $(PERL)\lib\ExtUtils\typemap # !ifdef RUBY # Set default value -!ifndef RUBY_VER +! ifndef RUBY_VER RUBY_VER = 22 -!endif -!ifndef RUBY_VER_LONG +! endif +! ifndef RUBY_VER_LONG RUBY_VER_LONG = 2.2.0 -!endif -!ifndef RUBY_API_VER_LONG +! endif +! ifndef RUBY_API_VER_LONG RUBY_API_VER_LONG = $(RUBY_VER_LONG) -!endif -!ifndef RUBY_API_VER +! endif +! ifndef RUBY_API_VER RUBY_API_VER = $(RUBY_API_VER_LONG:.=) -!endif +! endif -!if $(RUBY_VER) >= 18 +! if $(RUBY_VER) >= 18 -!ifndef RUBY_PLATFORM -!if "$(CPU)" == "i386" +! ifndef RUBY_PLATFORM +! if "$(CPU)" == "i386" RUBY_PLATFORM = i386-mswin32 -!else # CPU +! else # CPU RUBY_PLATFORM = x64-mswin64 -!endif # CPU -!if $(MSVCRT_VER) >= 70 && $(RUBY_VER) > 19 +! endif # CPU +! if $(MSVCRT_VER) >= 70 && $(RUBY_VER) > 19 RUBY_PLATFORM = $(RUBY_PLATFORM)_$(MSVCRT_VER) -!endif # MSVCRT_VER -!endif # RUBY_PLATFORM +! endif # MSVCRT_VER +! endif # RUBY_PLATFORM -!ifndef RUBY_INSTALL_NAME -!ifndef RUBY_MSVCRT_NAME +! ifndef RUBY_INSTALL_NAME +! ifndef RUBY_MSVCRT_NAME # Base name of msvcrXX.dll which is used by ruby's dll. RUBY_MSVCRT_NAME = $(MSVCRT_NAME) -!endif # RUBY_MSVCRT_NAME -!if "$(CPU)" == "i386" +! endif # RUBY_MSVCRT_NAME +! if "$(CPU)" == "i386" RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER) -!else # CPU +! else # CPU RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER) -!endif # CPU -!endif # RUBY_INSTALL_NAME +! endif # CPU +! endif # RUBY_INSTALL_NAME -!else # $(RUBY_VER) >= 18 +! else # $(RUBY_VER) >= 18 -!ifndef RUBY_PLATFORM +! ifndef RUBY_PLATFORM RUBY_PLATFORM = i586-mswin32 -!endif -!ifndef RUBY_INSTALL_NAME +! endif +! ifndef RUBY_INSTALL_NAME RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER) -!endif +! endif -!endif # $(RUBY_VER) >= 18 +! endif # $(RUBY_VER) >= 18 -!message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)" +! message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)" CFLAGS = $(CFLAGS) -DFEAT_RUBY RUBY_OBJ = $(OUTDIR)\if_ruby.obj -!if $(RUBY_VER) >= 19 +! if $(RUBY_VER) >= 19 RUBY_INC = /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)" -!else +! else RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)" -!endif +! endif RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib # Do we want to load Ruby dynamically? -!if "$(DYNAMIC_RUBY)" == "yes" -!message Ruby DLL will be loaded dynamically +! if "$(DYNAMIC_RUBY)" == "yes" +! message Ruby DLL will be loaded dynamically CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=$(RUBY_VER) \ -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -!undef RUBY_LIB -!endif +! undef RUBY_LIB +! endif !endif # RUBY # @@ -1221,11 +1219,11 @@ LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(NODEFAULTLIB) $(LIBC) $(OLE_LIB) user32.lib # Report link time code generation progress if used. !ifdef NODEBUG -!if $(MSVC_MAJOR) >= 8 -!if "$(OPTIMIZE)" != "SPACE" +! if $(MSVC_MAJOR) >= 8 +! if "$(OPTIMIZE)" != "SPACE" LINKARGS1 = $(LINKARGS1) /LTCG:STATUS -!endif -!endif +! endif +! endif !endif !if $(MSVC_MAJOR) >= 11 && "$(CPU)" == "AMD64" && "$(GUI)" == "yes" diff --git a/src/version.c b/src/version.c index 56aff78024..50c8339adf 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1314, /**/ 1313, /**/ From afd78266c5096574ec057c36fb4a0e56912e9a71 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 10 May 2019 23:10:31 +0200 Subject: [PATCH 46/97] patch 8.1.1315: there is always a delay if a termrequest is never answered Problem: There is always a delay if a termrequest is never answered. Solution: When the response is not received within two seconds consider the request to have failed. --- src/term.c | 214 ++++++++++++++++++++++++++++++-------------------- src/version.c | 2 + 2 files changed, 130 insertions(+), 86 deletions(-) diff --git a/src/term.c b/src/term.c index 462fe6f981..29d4025053 100644 --- a/src/term.c +++ b/src/term.c @@ -110,19 +110,29 @@ static void log_tr(const char *fmt, ...); # define LOG_TR(msg) do { /**/ } while (0) # endif -# define STATUS_GET 1 /* send request when switching to RAW mode */ -# define STATUS_SENT 2 /* did send request, waiting for response */ -# define STATUS_GOT 3 /* received response */ +typedef enum { + STATUS_GET, // send request when switching to RAW mode + STATUS_SENT, // did send request, checking for response + STATUS_GOT, // received response + STATUS_FAIL // timed out +} request_progress_T; -/* Request Terminal Version status: */ -static int crv_status = STATUS_GET; +typedef struct { + request_progress_T tr_progress; + time_t tr_start; // when request was sent, -1 for never +} termrequest_T; -/* Request Cursor position report: */ -static int u7_status = STATUS_GET; +# define TERMREQUEST_INIT {STATUS_GET, -1} + +// Request Terminal Version status: +static termrequest_T crv_status = TERMREQUEST_INIT; + +// Request Cursor position report: +static termrequest_T u7_status = TERMREQUEST_INIT; # ifdef FEAT_TERMINAL -/* Request foreground color report: */ -static int rfg_status = STATUS_GET; +// Request foreground color report: +static termrequest_T rfg_status = TERMREQUEST_INIT; static int fg_r = 0; static int fg_g = 0; static int fg_b = 0; @@ -132,16 +142,29 @@ static int bg_b = 255; # endif /* Request background color report: */ -static int rbg_status = STATUS_GET; +static termrequest_T rbg_status = TERMREQUEST_INIT; /* Request cursor blinking mode report: */ -static int rbm_status = STATUS_GET; +static termrequest_T rbm_status = TERMREQUEST_INIT; /* Request cursor style report: */ -static int rcs_status = STATUS_GET; +static termrequest_T rcs_status = TERMREQUEST_INIT; /* Request windos position report: */ -static int winpos_status = STATUS_GET; +static termrequest_T winpos_status = TERMREQUEST_INIT; + +static termrequest_T *all_termrequests[] = { + &crv_status, + &u7_status, +# ifdef FEAT_TERMINAL + &rfg_status, +# endif + &rbg_status, + &rbm_status, + &rcs_status, + &winpos_status, + NULL +}; # endif /* @@ -2011,7 +2034,7 @@ set_termname(char_u *term) set_term_defaults(); /* use current values as defaults */ #ifdef FEAT_TERMRESPONSE LOG_TR(("setting crv_status to STATUS_GET")); - crv_status = STATUS_GET; /* Get terminal version later */ + crv_status.tr_progress = STATUS_GET; // Get terminal version later #endif /* @@ -2833,12 +2856,47 @@ can_get_termresponse() { return cur_tmode == TMODE_RAW && termcap_active -# ifdef UNIX +# ifdef UNIX && (is_not_a_term() || (isatty(1) && isatty(read_cmd_fd))) -# endif +# endif && p_ek; } +/* + * Set "status" to STATUS_SENT. + */ + static void +termrequest_sent(termrequest_T *status) +{ + status->tr_progress = STATUS_SENT; + status->tr_start = time(NULL); +} + +/* + * Return TRUE if any of the requests are in STATUS_SENT. + */ + static int +termrequest_any_pending() +{ + int i; + time_t now = time(NULL); + + for (i = 0; all_termrequests[i] != NULL; ++i) + { + if (all_termrequests[i]->tr_progress == STATUS_SENT) + { + if (all_termrequests[i]->tr_start > 0 && now > 0 + && all_termrequests[i]->tr_start + 2 < now) + // Sent the request more than 2 seconds ago and didn't get a + // response, assume it failed. + all_termrequests[i]->tr_progress = STATUS_FAIL; + else + return TRUE; + } + } + return FALSE; +} + static int winpos_x = -1; static int winpos_y = -1; static int did_request_winpos = 0; @@ -2860,7 +2918,7 @@ term_get_winpos(int *x, int *y, varnumber_T timeout) winpos_x = -1; winpos_y = -1; ++did_request_winpos; - winpos_status = STATUS_SENT; + termrequest_sent(&winpos_status); OUT_STR(T_CGP); out_flush(); @@ -3478,18 +3536,10 @@ settmode(int tmode) if (!gui.in_use && !gui.starting) # endif { - /* May need to check for T_CRV response and termcodes, it - * doesn't work in Cooked mode, an external program may get - * them. */ - if (tmode != TMODE_RAW && (crv_status == STATUS_SENT - || u7_status == STATUS_SENT -#ifdef FEAT_TERMINAL - || rfg_status == STATUS_SENT -#endif - || rbg_status == STATUS_SENT - || rbm_status == STATUS_SENT - || rcs_status == STATUS_SENT - || winpos_status == STATUS_SENT)) + // May need to check for T_CRV response and termcodes, it + // doesn't work in Cooked mode, an external program may get + // them. + if (tmode != TMODE_RAW && termrequest_any_pending()) (void)vpeekc_nomap(); check_for_codes_from_term(); } @@ -3540,7 +3590,7 @@ starttermcap(void) may_req_termresponse(); /* Immediately check for a response. If t_Co changes, we don't * want to redraw with wrong colors first. */ - if (crv_status == STATUS_SENT) + if (crv_status.tr_progress == STATUS_SENT) check_for_codes_from_term(); } #endif @@ -3559,23 +3609,15 @@ stoptermcap(void) if (!gui.in_use && !gui.starting) # endif { - /* May need to discard T_CRV, T_U7 or T_RBG response. */ - if (crv_status == STATUS_SENT - || u7_status == STATUS_SENT -# ifdef FEAT_TERMINAL - || rfg_status == STATUS_SENT -# endif - || rbg_status == STATUS_SENT - || rbm_status == STATUS_SENT - || rcs_status == STATUS_SENT - || winpos_status == STATUS_SENT) + // May need to discard T_CRV, T_U7 or T_RBG response. + if (termrequest_any_pending()) { # ifdef UNIX - /* Give the terminal a chance to respond. */ + // Give the terminal a chance to respond. mch_delay(100L, FALSE); # endif # ifdef TCIFLUSH - /* Discard data received but not read. */ + // Discard data received but not read. if (exiting) tcflush(fileno(stdin), TCIFLUSH); # endif @@ -3614,14 +3656,14 @@ stoptermcap(void) void may_req_termresponse(void) { - if (crv_status == STATUS_GET + if (crv_status.tr_progress == STATUS_GET && can_get_termresponse() && starting == 0 && *T_CRV != NUL) { LOG_TR(("Sending CRV request")); out_str(T_CRV); - crv_status = STATUS_SENT; + termrequest_sent(&crv_status); /* check for the characters now, otherwise they might be eaten by * get_keystroke() */ out_flush(); @@ -3641,37 +3683,37 @@ may_req_termresponse(void) void may_req_ambiguous_char_width(void) { - if (u7_status == STATUS_GET + if (u7_status.tr_progress == STATUS_GET && can_get_termresponse() && starting == 0 && *T_U7 != NUL && !option_was_set((char_u *)"ambiwidth")) { - char_u buf[16]; + char_u buf[16]; - LOG_TR(("Sending U7 request")); - /* Do this in the second row. In the first row the returned sequence - * may be CSI 1;2R, which is the same as . */ - term_windgoto(1, 0); - buf[mb_char2bytes(0x25bd, buf)] = 0; - out_str(buf); - out_str(T_U7); - u7_status = STATUS_SENT; - out_flush(); + LOG_TR(("Sending U7 request")); + /* Do this in the second row. In the first row the returned sequence + * may be CSI 1;2R, which is the same as . */ + term_windgoto(1, 0); + buf[mb_char2bytes(0x25bd, buf)] = 0; + out_str(buf); + out_str(T_U7); + termrequest_sent(&u7_status); + out_flush(); - /* This overwrites a few characters on the screen, a redraw is needed - * after this. Clear them out for now. */ - term_windgoto(1, 0); - out_str((char_u *)" "); - term_windgoto(0, 0); + /* This overwrites a few characters on the screen, a redraw is needed + * after this. Clear them out for now. */ + term_windgoto(1, 0); + out_str((char_u *)" "); + term_windgoto(0, 0); - /* Need to reset the known cursor position. */ - screen_start(); + /* Need to reset the known cursor position. */ + screen_start(); - /* check for the characters now, otherwise they might be eaten by - * get_keystroke() */ - out_flush(); - (void)vpeekc_nomap(); + /* check for the characters now, otherwise they might be eaten by + * get_keystroke() */ + out_flush(); + (void)vpeekc_nomap(); } } @@ -3688,21 +3730,21 @@ may_req_bg_color(void) # ifdef FEAT_TERMINAL /* Only request foreground if t_RF is set. */ - if (rfg_status == STATUS_GET && *T_RFG != NUL) + if (rfg_status.tr_progress == STATUS_GET && *T_RFG != NUL) { LOG_TR(("Sending FG request")); out_str(T_RFG); - rfg_status = STATUS_SENT; + termrequest_sent(&rfg_status); didit = TRUE; } # endif /* Only request background if t_RB is set. */ - if (rbg_status == STATUS_GET && *T_RBG != NUL) + if (rbg_status.tr_progress == STATUS_GET && *T_RBG != NUL) { LOG_TR(("Sending BG request")); out_str(T_RBG); - rbg_status = STATUS_SENT; + termrequest_sent(&rbg_status); didit = TRUE; } @@ -3962,7 +4004,7 @@ term_cursor_color(char_u *color) blink_state_is_inverted() { #ifdef FEAT_TERMRESPONSE - return rbm_status == STATUS_GOT && rcs_status == STATUS_GOT + return rbm_status.tr_progress == STATUS_GOT && rcs_status.tr_progress == STATUS_GOT && initial_cursor_blink != initial_cursor_shape_blink; #else return FALSE; @@ -4651,7 +4693,7 @@ check_termcode( char *aw = NULL; LOG_TR(("Received U7 status: %s", tp)); - u7_status = STATUS_GOT; + u7_status.tr_progress = STATUS_GOT; did_cursorhold = TRUE; if (col == 2) aw = "single"; @@ -4689,7 +4731,7 @@ check_termcode( int version = col; LOG_TR(("Received CRV response: %s", tp)); - crv_status = STATUS_GOT; + crv_status.tr_progress = STATUS_GOT; did_cursorhold = TRUE; /* If this code starts with CSI, you can bet that the @@ -4804,7 +4846,7 @@ check_termcode( * 279 (otherwise it returns 0x18). * Not for Terminal.app, it can't handle t_RS, it * echoes the characters to the screen. */ - if (rcs_status == STATUS_GET + if (rcs_status.tr_progress == STATUS_GET && version >= 279 && !is_not_xterm && *T_CSH != NUL @@ -4812,20 +4854,20 @@ check_termcode( { LOG_TR(("Sending cursor style request")); out_str(T_CRS); - rcs_status = STATUS_SENT; + termrequest_sent(&rcs_status); need_flush = TRUE; } /* Only request the cursor blink mode if t_RC set. Not * for Gnome terminal, it can't handle t_RC, it * echoes the characters to the screen. */ - if (rbm_status == STATUS_GET + if (rbm_status.tr_progress == STATUS_GET && !is_not_xterm && *T_CRC != NUL) { LOG_TR(("Sending cursor blink mode request")); out_str(T_CRC); - rbm_status = STATUS_SENT; + termrequest_sent(&rbm_status); need_flush = TRUE; } @@ -4848,7 +4890,7 @@ check_termcode( * * {lead} can be [ or CSI */ - else if (rbm_status == STATUS_SENT + else if (rbm_status.tr_progress == STATUS_SENT && tp[(j = 1 + (tp[0] == ESC))] == '?' && i == j + 6 && tp[j + 1] == '1' @@ -4858,7 +4900,7 @@ check_termcode( && tp[i] == 'y') { initial_cursor_blink = (tp[j + 4] == '1'); - rbm_status = STATUS_GOT; + rbm_status.tr_progress = STATUS_GOT; LOG_TR(("Received cursor blinking mode response: %s", tp)); key_name[0] = (int)KS_EXTRA; key_name[1] = (int)KE_IGNORE; @@ -4896,7 +4938,7 @@ check_termcode( slen = i + 1; if (--did_request_winpos <= 0) - winpos_status = STATUS_GOT; + winpos_status.tr_progress = STATUS_GOT; } } if (i == len) @@ -4948,7 +4990,7 @@ check_termcode( + tp[j+17]) ? "light" : "dark"; LOG_TR(("Received RBG response: %s", tp)); - rbg_status = STATUS_GOT; + rbg_status.tr_progress = STATUS_GOT; # ifdef FEAT_TERMINAL bg_r = rval; bg_g = gval; @@ -4968,7 +5010,7 @@ check_termcode( else { LOG_TR(("Received RFG response: %s", tp)); - rfg_status = STATUS_GOT; + rfg_status.tr_progress = STATUS_GOT; fg_r = rval; fg_g = gval; fg_b = bval; @@ -5008,7 +5050,7 @@ check_termcode( * * Consume any code that starts with "{lead}.+r" or "{lead}.$r". */ - else if ((check_for_codes || rcs_status == STATUS_SENT) + else if ((check_for_codes || rcs_status.tr_progress == STATUS_SENT) && ((tp[0] == ESC && len >= 2 && tp[1] == 'P') || tp[0] == DCS)) { @@ -5061,7 +5103,7 @@ check_termcode( * the value set with T_SH. */ initial_cursor_shape_blink = (number & 1) ? FALSE : TRUE; - rcs_status = STATUS_GOT; + rcs_status.tr_progress = STATUS_GOT; LOG_TR(("Received cursor shape response: %s", tp)); key_name[0] = (int)KS_EXTRA; @@ -6045,7 +6087,7 @@ check_termcode( void term_get_fg_color(char_u *r, char_u *g, char_u *b) { - if (rfg_status == STATUS_GOT) + if (rfg_status.tr_progress == STATUS_GOT) { *r = fg_r; *g = fg_g; @@ -6059,7 +6101,7 @@ term_get_fg_color(char_u *r, char_u *g, char_u *b) void term_get_bg_color(char_u *r, char_u *g, char_u *b) { - if (rbg_status == STATUS_GOT) + if (rbg_status.tr_progress == STATUS_GOT) { *r = bg_r; *g = bg_g; diff --git a/src/version.c b/src/version.c index 50c8339adf..0e40f619a7 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1315, /**/ 1314, /**/ From d6896731ecb74b419389f75d79210e088a9caa77 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 13:09:42 +0200 Subject: [PATCH 47/97] patch 8.1.1316: duplicated localtime() call Problem: Duplicated localtime() call. Solution: Delete one. --- src/undo.c | 1 - src/version.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/undo.c b/src/undo.c index 2f1924ce12..c4558d1c78 100644 --- a/src/undo.c +++ b/src/undo.c @@ -3117,7 +3117,6 @@ u_add_time(char_u *buf, size_t buflen, time_t tt) if (vim_time() - tt >= 100) { - curtime = localtime(&tt); # ifdef HAVE_LOCALTIME_R curtime = localtime_r(&tt, &tmval); # else diff --git a/src/version.c b/src/version.c index 0e40f619a7..d31e611225 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1316, /**/ 1315, /**/ From dc9f9e93f5229fd4325472ed62e7b17872d64060 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 14:34:13 +0200 Subject: [PATCH 48/97] patch 8.1.1317: output from Travis can be improved Problem: Output from Travis can be improved. Solution: Add section headers. Handle errors better. (closes #4098) --- .travis.yml | 17 ++++++++++++----- configure | 2 +- src/version.c | 2 ++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d683b13ef3..1e5ee562d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -130,6 +130,8 @@ before_script: script: - NPROC=$(getconf _NPROCESSORS_ONLN) + - set -o errexit + - echo -e "\\033[33;1mConfiguring Vim\\033[0m" && echo -en "travis_fold:start:configure\\r\\033[0K" - | if [[ "${CHECK_AUTOCONF}" = "yes" ]] && [[ "${CC}" = "gcc" ]]; then make -C src autoconf @@ -138,13 +140,17 @@ script: if [[ -n "${SHADOWOPT}" ]]; then make -C src shadow fi + # "./configure" changes its working directory into "$SRCDIR". + - ./configure --with-features=${FEATURES} ${CONFOPT} --enable-fail-if-missing + - echo -en "travis_fold:end:configure\\r\\033[0K" + - echo -e "\\033[33;1mBuilding Vim\\033[0m" && echo -en "travis_fold:start:build\\r\\033[0K" - | - ( - cd "${SRCDIR}" \ - && ./configure --with-features=${FEATURES} ${CONFOPT} --enable-fail-if-missing - ) && if [[ "${BUILD}" = "yes" ]]; then + if [[ "${BUILD}" = "yes" ]]; then make ${SHADOWOPT} -j${NPROC} fi + - echo -en "travis_fold:end:build\\r\\033[0K" + - set +o errexit + - echo -e "\\033[33;1mTesting Vim\\033[0m" && echo -en "travis_fold:start:test\\r\\033[0K" # Show Vim version and also if_xx versions. - | if [[ "${BUILD}" = "yes" ]]; then @@ -154,12 +160,13 @@ script: cat if_ver.txt fi - make ${SHADOWOPT} ${TEST} + - echo -en "travis_fold:end:test\\r\\033[0K" - | if [[ -n "${ASAN_OPTIONS}" ]]; then while read log; do asan_symbolize < "${log}" + false # exit 1 if there are ASAN logs done < <(find . -type f -name 'asan.*' -size +0) - [[ -z "${log}" ]] # exit 1 if there are ASAN logs fi after_success: diff --git a/configure b/configure index 1d0c5b2ece..d9d99c655e 100755 --- a/configure +++ b/configure @@ -3,4 +3,4 @@ # This is just a stub for the Unix configure script, to provide support for # doing "./configure" in the top Vim directory. -cd src && exec ./configure "$@" +cd "${SRCDIR:-src}" && exec ./configure "$@" diff --git a/src/version.c b/src/version.c index d31e611225..ea97befd37 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1317, /**/ 1316, /**/ From 3f86ca0faa29cb862f876a97f87790f3a46a3858 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 18:30:00 +0200 Subject: [PATCH 49/97] Add missing files from patch 8.1.1318 --- src/change.c | 2165 ++++++++++++++++++++++++++++++++++++++++++ src/proto/change.pro | 24 + 2 files changed, 2189 insertions(+) create mode 100644 src/change.c create mode 100644 src/proto/change.pro diff --git a/src/change.c b/src/change.c new file mode 100644 index 0000000000..750634b26e --- /dev/null +++ b/src/change.c @@ -0,0 +1,2165 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * change.c: functions related to changing text + */ + +#include "vim.h" + +/* + * If the file is readonly, give a warning message with the first change. + * Don't do this for autocommands. + * Doesn't use emsg(), because it flushes the macro buffer. + * If we have undone all changes b_changed will be FALSE, but "b_did_warn" + * will be TRUE. + * "col" is the column for the message; non-zero when in insert mode and + * 'showmode' is on. + * Careful: may trigger autocommands that reload the buffer. + */ + void +change_warning(int col) +{ + static char *w_readonly = N_("W10: Warning: Changing a readonly file"); + + if (curbuf->b_did_warn == FALSE + && curbufIsChanged() == 0 + && !autocmd_busy + && curbuf->b_p_ro) + { + ++curbuf_lock; + apply_autocmds(EVENT_FILECHANGEDRO, NULL, NULL, FALSE, curbuf); + --curbuf_lock; + if (!curbuf->b_p_ro) + return; + + // Do what msg() does, but with a column offset if the warning should + // be after the mode message. + msg_start(); + if (msg_row == Rows - 1) + msg_col = col; + msg_source(HL_ATTR(HLF_W)); + msg_puts_attr(_(w_readonly), HL_ATTR(HLF_W) | MSG_HIST); +#ifdef FEAT_EVAL + set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_readonly), -1); +#endif + msg_clr_eos(); + (void)msg_end(); + if (msg_silent == 0 && !silent_mode +#ifdef FEAT_EVAL + && time_for_testing != 1 +#endif + ) + { + out_flush(); + ui_delay(1000L, TRUE); // give the user time to think about it + } + curbuf->b_did_warn = TRUE; + redraw_cmdline = FALSE; // don't redraw and erase the message + if (msg_row < Rows - 1) + showmode(); + } +} + +/* + * Call this function when something in the current buffer is changed. + * + * Most often called through changed_bytes() and changed_lines(), which also + * mark the area of the display to be redrawn. + * + * Careful: may trigger autocommands that reload the buffer. + */ + void +changed(void) +{ +#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) + if (p_imst == IM_ON_THE_SPOT) + { + // The text of the preediting area is inserted, but this doesn't + // mean a change of the buffer yet. That is delayed until the + // text is committed. (this means preedit becomes empty) + if (im_is_preediting() && !xim_changed_while_preediting) + return; + xim_changed_while_preediting = FALSE; + } +#endif + + if (!curbuf->b_changed) + { + int save_msg_scroll = msg_scroll; + + // Give a warning about changing a read-only file. This may also + // check-out the file, thus change "curbuf"! + change_warning(0); + + // Create a swap file if that is wanted. + // Don't do this for "nofile" and "nowrite" buffer types. + if (curbuf->b_may_swap +#ifdef FEAT_QUICKFIX + && !bt_dontwrite(curbuf) +#endif + ) + { + int save_need_wait_return = need_wait_return; + + need_wait_return = FALSE; + ml_open_file(curbuf); + + // The ml_open_file() can cause an ATTENTION message. + // Wait two seconds, to make sure the user reads this unexpected + // message. Since we could be anywhere, call wait_return() now, + // and don't let the emsg() set msg_scroll. + if (need_wait_return && emsg_silent == 0) + { + out_flush(); + ui_delay(2000L, TRUE); + wait_return(TRUE); + msg_scroll = save_msg_scroll; + } + else + need_wait_return = save_need_wait_return; + } + changed_internal(); + } + ++CHANGEDTICK(curbuf); + +#ifdef FEAT_SEARCH_EXTRA + // If a pattern is highlighted, the position may now be invalid. + highlight_match = FALSE; +#endif +} + +/* + * Internal part of changed(), no user interaction. + * Also used for recovery. + */ + void +changed_internal(void) +{ + curbuf->b_changed = TRUE; + ml_setflags(curbuf); + check_status(curbuf); + redraw_tabline = TRUE; +#ifdef FEAT_TITLE + need_maketitle = TRUE; // set window title later +#endif +} + +/* + * Common code for when a change was made. + * See changed_lines() for the arguments. + * Careful: may trigger autocommands that reload the buffer. + */ + static void +changed_common( + linenr_T lnum, + colnr_T col, + linenr_T lnume, + long xtra) +{ + win_T *wp; + tabpage_T *tp; + int i; +#ifdef FEAT_JUMPLIST + int cols; + pos_T *p; + int add; +#endif + + // mark the buffer as modified + changed(); + +#ifdef FEAT_DIFF + if (curwin->w_p_diff && diff_internal()) + curtab->tp_diff_update = TRUE; +#endif + + // set the '. mark + if (!cmdmod.keepjumps) + { + curbuf->b_last_change.lnum = lnum; + curbuf->b_last_change.col = col; + +#ifdef FEAT_JUMPLIST + // Create a new entry if a new undo-able change was started or we + // don't have an entry yet. + if (curbuf->b_new_change || curbuf->b_changelistlen == 0) + { + if (curbuf->b_changelistlen == 0) + add = TRUE; + else + { + // Don't create a new entry when the line number is the same + // as the last one and the column is not too far away. Avoids + // creating many entries for typing "xxxxx". + p = &curbuf->b_changelist[curbuf->b_changelistlen - 1]; + if (p->lnum != lnum) + add = TRUE; + else + { + cols = comp_textwidth(FALSE); + if (cols == 0) + cols = 79; + add = (p->col + cols < col || col + cols < p->col); + } + } + if (add) + { + // This is the first of a new sequence of undo-able changes + // and it's at some distance of the last change. Use a new + // position in the changelist. + curbuf->b_new_change = FALSE; + + if (curbuf->b_changelistlen == JUMPLISTSIZE) + { + // changelist is full: remove oldest entry + curbuf->b_changelistlen = JUMPLISTSIZE - 1; + mch_memmove(curbuf->b_changelist, curbuf->b_changelist + 1, + sizeof(pos_T) * (JUMPLISTSIZE - 1)); + FOR_ALL_TAB_WINDOWS(tp, wp) + { + // Correct position in changelist for other windows on + // this buffer. + if (wp->w_buffer == curbuf && wp->w_changelistidx > 0) + --wp->w_changelistidx; + } + } + FOR_ALL_TAB_WINDOWS(tp, wp) + { + // For other windows, if the position in the changelist is + // at the end it stays at the end. + if (wp->w_buffer == curbuf + && wp->w_changelistidx == curbuf->b_changelistlen) + ++wp->w_changelistidx; + } + ++curbuf->b_changelistlen; + } + } + curbuf->b_changelist[curbuf->b_changelistlen - 1] = + curbuf->b_last_change; + // The current window is always after the last change, so that "g," + // takes you back to it. + curwin->w_changelistidx = curbuf->b_changelistlen; +#endif + } + + FOR_ALL_TAB_WINDOWS(tp, wp) + { + if (wp->w_buffer == curbuf) + { + // Mark this window to be redrawn later. + if (wp->w_redr_type < VALID) + wp->w_redr_type = VALID; + + // Check if a change in the buffer has invalidated the cached + // values for the cursor. +#ifdef FEAT_FOLDING + // Update the folds for this window. Can't postpone this, because + // a following operator might work on the whole fold: ">>dd". + foldUpdate(wp, lnum, lnume + xtra - 1); + + // The change may cause lines above or below the change to become + // included in a fold. Set lnum/lnume to the first/last line that + // might be displayed differently. + // Set w_cline_folded here as an efficient way to update it when + // inserting lines just above a closed fold. + i = hasFoldingWin(wp, lnum, &lnum, NULL, FALSE, NULL); + if (wp->w_cursor.lnum == lnum) + wp->w_cline_folded = i; + i = hasFoldingWin(wp, lnume, NULL, &lnume, FALSE, NULL); + if (wp->w_cursor.lnum == lnume) + wp->w_cline_folded = i; + + // If the changed line is in a range of previously folded lines, + // compare with the first line in that range. + if (wp->w_cursor.lnum <= lnum) + { + i = find_wl_entry(wp, lnum); + if (i >= 0 && wp->w_cursor.lnum > wp->w_lines[i].wl_lnum) + changed_line_abv_curs_win(wp); + } +#endif + + if (wp->w_cursor.lnum > lnum) + changed_line_abv_curs_win(wp); + else if (wp->w_cursor.lnum == lnum && wp->w_cursor.col >= col) + changed_cline_bef_curs_win(wp); + if (wp->w_botline >= lnum) + { + // Assume that botline doesn't change (inserted lines make + // other lines scroll down below botline). + approximate_botline_win(wp); + } + + // Check if any w_lines[] entries have become invalid. + // For entries below the change: Correct the lnums for + // inserted/deleted lines. Makes it possible to stop displaying + // after the change. + for (i = 0; i < wp->w_lines_valid; ++i) + if (wp->w_lines[i].wl_valid) + { + if (wp->w_lines[i].wl_lnum >= lnum) + { + if (wp->w_lines[i].wl_lnum < lnume) + { + // line included in change + wp->w_lines[i].wl_valid = FALSE; + } + else if (xtra != 0) + { + // line below change + wp->w_lines[i].wl_lnum += xtra; +#ifdef FEAT_FOLDING + wp->w_lines[i].wl_lastlnum += xtra; +#endif + } + } +#ifdef FEAT_FOLDING + else if (wp->w_lines[i].wl_lastlnum >= lnum) + { + // change somewhere inside this range of folded lines, + // may need to be redrawn + wp->w_lines[i].wl_valid = FALSE; + } +#endif + } + +#ifdef FEAT_FOLDING + // Take care of side effects for setting w_topline when folds have + // changed. Esp. when the buffer was changed in another window. + if (hasAnyFolding(wp)) + set_topline(wp, wp->w_topline); +#endif + // relative numbering may require updating more + if (wp->w_p_rnu) + redraw_win_later(wp, SOME_VALID); + } + } + + // Call update_screen() later, which checks out what needs to be redrawn, + // since it notices b_mod_set and then uses b_mod_*. + if (must_redraw < VALID) + must_redraw = VALID; + + // when the cursor line is changed always trigger CursorMoved + if (lnum <= curwin->w_cursor.lnum + && lnume + (xtra < 0 ? -xtra : xtra) > curwin->w_cursor.lnum) + last_cursormoved.lnum = 0; +} + + static void +changedOneline(buf_T *buf, linenr_T lnum) +{ + if (buf->b_mod_set) + { + // find the maximum area that must be redisplayed + if (lnum < buf->b_mod_top) + buf->b_mod_top = lnum; + else if (lnum >= buf->b_mod_bot) + buf->b_mod_bot = lnum + 1; + } + else + { + // set the area that must be redisplayed to one line + buf->b_mod_set = TRUE; + buf->b_mod_top = lnum; + buf->b_mod_bot = lnum + 1; + buf->b_mod_xlines = 0; + } +} + +/* + * Changed bytes within a single line for the current buffer. + * - marks the windows on this buffer to be redisplayed + * - marks the buffer changed by calling changed() + * - invalidates cached values + * Careful: may trigger autocommands that reload the buffer. + */ + void +changed_bytes(linenr_T lnum, colnr_T col) +{ + changedOneline(curbuf, lnum); + changed_common(lnum, col, lnum + 1, 0L); + +#ifdef FEAT_DIFF + // Diff highlighting in other diff windows may need to be updated too. + if (curwin->w_p_diff) + { + win_T *wp; + linenr_T wlnum; + + FOR_ALL_WINDOWS(wp) + if (wp->w_p_diff && wp != curwin) + { + redraw_win_later(wp, VALID); + wlnum = diff_lnum_win(lnum, wp); + if (wlnum > 0) + changedOneline(wp->w_buffer, wlnum); + } + } +#endif +} + +/* + * Like changed_bytes() but also adjust text properties for "added" bytes. + * When "added" is negative text was deleted. + */ + void +inserted_bytes(linenr_T lnum, colnr_T col, int added UNUSED) +{ + changed_bytes(lnum, col); + +#ifdef FEAT_TEXT_PROP + if (curbuf->b_has_textprop && added != 0) + adjust_prop_columns(lnum, col, added); +#endif +} + +/* + * Appended "count" lines below line "lnum" in the current buffer. + * Must be called AFTER the change and after mark_adjust(). + * Takes care of marking the buffer to be redrawn and sets the changed flag. + */ + void +appended_lines(linenr_T lnum, long count) +{ + changed_lines(lnum + 1, 0, lnum + 1, count); +} + +/* + * Like appended_lines(), but adjust marks first. + */ + void +appended_lines_mark(linenr_T lnum, long count) +{ + // Skip mark_adjust when adding a line after the last one, there can't + // be marks there. But it's still needed in diff mode. + if (lnum + count < curbuf->b_ml.ml_line_count +#ifdef FEAT_DIFF + || curwin->w_p_diff +#endif + ) + mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L); + changed_lines(lnum + 1, 0, lnum + 1, count); +} + +/* + * Deleted "count" lines at line "lnum" in the current buffer. + * Must be called AFTER the change and after mark_adjust(). + * Takes care of marking the buffer to be redrawn and sets the changed flag. + */ + void +deleted_lines(linenr_T lnum, long count) +{ + changed_lines(lnum, 0, lnum + count, -count); +} + +/* + * Like deleted_lines(), but adjust marks first. + * Make sure the cursor is on a valid line before calling, a GUI callback may + * be triggered to display the cursor. + */ + void +deleted_lines_mark(linenr_T lnum, long count) +{ + mark_adjust(lnum, (linenr_T)(lnum + count - 1), (long)MAXLNUM, -count); + changed_lines(lnum, 0, lnum + count, -count); +} + +/* + * Marks the area to be redrawn after a change. + */ + static void +changed_lines_buf( + buf_T *buf, + linenr_T lnum, // first line with change + linenr_T lnume, // line below last changed line + long xtra) // number of extra lines (negative when deleting) +{ + if (buf->b_mod_set) + { + // find the maximum area that must be redisplayed + if (lnum < buf->b_mod_top) + buf->b_mod_top = lnum; + if (lnum < buf->b_mod_bot) + { + // adjust old bot position for xtra lines + buf->b_mod_bot += xtra; + if (buf->b_mod_bot < lnum) + buf->b_mod_bot = lnum; + } + if (lnume + xtra > buf->b_mod_bot) + buf->b_mod_bot = lnume + xtra; + buf->b_mod_xlines += xtra; + } + else + { + // set the area that must be redisplayed + buf->b_mod_set = TRUE; + buf->b_mod_top = lnum; + buf->b_mod_bot = lnume + xtra; + buf->b_mod_xlines = xtra; + } +} + +/* + * Changed lines for the current buffer. + * Must be called AFTER the change and after mark_adjust(). + * - mark the buffer changed by calling changed() + * - mark the windows on this buffer to be redisplayed + * - invalidate cached values + * "lnum" is the first line that needs displaying, "lnume" the first line + * below the changed lines (BEFORE the change). + * When only inserting lines, "lnum" and "lnume" are equal. + * Takes care of calling changed() and updating b_mod_*. + * Careful: may trigger autocommands that reload the buffer. + */ + void +changed_lines( + linenr_T lnum, // first line with change + colnr_T col, // column in first line with change + linenr_T lnume, // line below last changed line + long xtra) // number of extra lines (negative when deleting) +{ + changed_lines_buf(curbuf, lnum, lnume, xtra); + +#ifdef FEAT_DIFF + if (xtra == 0 && curwin->w_p_diff && !diff_internal()) + { + // When the number of lines doesn't change then mark_adjust() isn't + // called and other diff buffers still need to be marked for + // displaying. + win_T *wp; + linenr_T wlnum; + + FOR_ALL_WINDOWS(wp) + if (wp->w_p_diff && wp != curwin) + { + redraw_win_later(wp, VALID); + wlnum = diff_lnum_win(lnum, wp); + if (wlnum > 0) + changed_lines_buf(wp->w_buffer, wlnum, + lnume - lnum + wlnum, 0L); + } + } +#endif + + changed_common(lnum, col, lnume, xtra); +} + +/* + * Called when the changed flag must be reset for buffer "buf". + * When "ff" is TRUE also reset 'fileformat'. + */ + void +unchanged(buf_T *buf, int ff) +{ + if (buf->b_changed || (ff && file_ff_differs(buf, FALSE))) + { + buf->b_changed = 0; + ml_setflags(buf); + if (ff) + save_file_ff(buf); + check_status(buf); + redraw_tabline = TRUE; +#ifdef FEAT_TITLE + need_maketitle = TRUE; // set window title later +#endif + } + ++CHANGEDTICK(buf); +#ifdef FEAT_NETBEANS_INTG + netbeans_unmodified(buf); +#endif +} + +/* + * Insert string "p" at the cursor position. Stops at a NUL byte. + * Handles Replace mode and multi-byte characters. + */ + void +ins_bytes(char_u *p) +{ + ins_bytes_len(p, (int)STRLEN(p)); +} + +/* + * Insert string "p" with length "len" at the cursor position. + * Handles Replace mode and multi-byte characters. + */ + void +ins_bytes_len(char_u *p, int len) +{ + int i; + int n; + + if (has_mbyte) + for (i = 0; i < len; i += n) + { + if (enc_utf8) + // avoid reading past p[len] + n = utfc_ptr2len_len(p + i, len - i); + else + n = (*mb_ptr2len)(p + i); + ins_char_bytes(p + i, n); + } + else + for (i = 0; i < len; ++i) + ins_char(p[i]); +} + +/* + * Insert or replace a single character at the cursor position. + * When in REPLACE or VREPLACE mode, replace any existing character. + * Caller must have prepared for undo. + * For multi-byte characters we get the whole character, the caller must + * convert bytes to a character. + */ + void +ins_char(int c) +{ + char_u buf[MB_MAXBYTES + 1]; + int n = (*mb_char2bytes)(c, buf); + + // When "c" is 0x100, 0x200, etc. we don't want to insert a NUL byte. + // Happens for CTRL-Vu9900. + if (buf[0] == 0) + buf[0] = '\n'; + + ins_char_bytes(buf, n); +} + + void +ins_char_bytes(char_u *buf, int charlen) +{ + int c = buf[0]; + int newlen; // nr of bytes inserted + int oldlen; // nr of bytes deleted (0 when not replacing) + char_u *p; + char_u *newp; + char_u *oldp; + int linelen; // length of old line including NUL + colnr_T col; + linenr_T lnum = curwin->w_cursor.lnum; + int i; + + // Break tabs if needed. + if (virtual_active() && curwin->w_cursor.coladd > 0) + coladvance_force(getviscol()); + + col = curwin->w_cursor.col; + oldp = ml_get(lnum); + linelen = (int)STRLEN(oldp) + 1; + + // The lengths default to the values for when not replacing. + oldlen = 0; + newlen = charlen; + + if (State & REPLACE_FLAG) + { + if (State & VREPLACE_FLAG) + { + colnr_T new_vcol = 0; // init for GCC + colnr_T vcol; + int old_list; + + // Disable 'list' temporarily, unless 'cpo' contains the 'L' flag. + // Returns the old value of list, so when finished, + // curwin->w_p_list should be set back to this. + old_list = curwin->w_p_list; + if (old_list && vim_strchr(p_cpo, CPO_LISTWM) == NULL) + curwin->w_p_list = FALSE; + + // In virtual replace mode each character may replace one or more + // characters (zero if it's a TAB). Count the number of bytes to + // be deleted to make room for the new character, counting screen + // cells. May result in adding spaces to fill a gap. + getvcol(curwin, &curwin->w_cursor, NULL, &vcol, NULL); + new_vcol = vcol + chartabsize(buf, vcol); + while (oldp[col + oldlen] != NUL && vcol < new_vcol) + { + vcol += chartabsize(oldp + col + oldlen, vcol); + // Don't need to remove a TAB that takes us to the right + // position. + if (vcol > new_vcol && oldp[col + oldlen] == TAB) + break; + oldlen += (*mb_ptr2len)(oldp + col + oldlen); + // Deleted a bit too much, insert spaces. + if (vcol > new_vcol) + newlen += vcol - new_vcol; + } + curwin->w_p_list = old_list; + } + else if (oldp[col] != NUL) + { + // normal replace + oldlen = (*mb_ptr2len)(oldp + col); + } + + + // Push the replaced bytes onto the replace stack, so that they can be + // put back when BS is used. The bytes of a multi-byte character are + // done the other way around, so that the first byte is popped off + // first (it tells the byte length of the character). + replace_push(NUL); + for (i = 0; i < oldlen; ++i) + { + if (has_mbyte) + i += replace_push_mb(oldp + col + i) - 1; + else + replace_push(oldp[col + i]); + } + } + + newp = alloc_check((unsigned)(linelen + newlen - oldlen)); + if (newp == NULL) + return; + + // Copy bytes before the cursor. + if (col > 0) + mch_memmove(newp, oldp, (size_t)col); + + // Copy bytes after the changed character(s). + p = newp + col; + if (linelen > col + oldlen) + mch_memmove(p + newlen, oldp + col + oldlen, + (size_t)(linelen - col - oldlen)); + + // Insert or overwrite the new character. + mch_memmove(p, buf, charlen); + i = charlen; + + // Fill with spaces when necessary. + while (i < newlen) + p[i++] = ' '; + + // Replace the line in the buffer. + ml_replace(lnum, newp, FALSE); + + // mark the buffer as changed and prepare for displaying + inserted_bytes(lnum, col, newlen - oldlen); + + // If we're in Insert or Replace mode and 'showmatch' is set, then briefly + // show the match for right parens and braces. + if (p_sm && (State & INSERT) + && msg_silent == 0 +#ifdef FEAT_INS_EXPAND + && !ins_compl_active() +#endif + ) + { + if (has_mbyte) + showmatch(mb_ptr2char(buf)); + else + showmatch(c); + } + +#ifdef FEAT_RIGHTLEFT + if (!p_ri || (State & REPLACE_FLAG)) +#endif + { + // Normal insert: move cursor right + curwin->w_cursor.col += charlen; + } + + // TODO: should try to update w_row here, to avoid recomputing it later. +} + +/* + * Insert a string at the cursor position. + * Note: Does NOT handle Replace mode. + * Caller must have prepared for undo. + */ + void +ins_str(char_u *s) +{ + char_u *oldp, *newp; + int newlen = (int)STRLEN(s); + int oldlen; + colnr_T col; + linenr_T lnum = curwin->w_cursor.lnum; + + if (virtual_active() && curwin->w_cursor.coladd > 0) + coladvance_force(getviscol()); + + col = curwin->w_cursor.col; + oldp = ml_get(lnum); + oldlen = (int)STRLEN(oldp); + + newp = alloc_check((unsigned)(oldlen + newlen + 1)); + if (newp == NULL) + return; + if (col > 0) + mch_memmove(newp, oldp, (size_t)col); + mch_memmove(newp + col, s, (size_t)newlen); + mch_memmove(newp + col + newlen, oldp + col, (size_t)(oldlen - col + 1)); + ml_replace(lnum, newp, FALSE); + inserted_bytes(lnum, col, newlen); + curwin->w_cursor.col += newlen; +} + +/* + * Delete one character under the cursor. + * If "fixpos" is TRUE, don't leave the cursor on the NUL after the line. + * Caller must have prepared for undo. + * + * return FAIL for failure, OK otherwise + */ + int +del_char(int fixpos) +{ + if (has_mbyte) + { + // Make sure the cursor is at the start of a character. + mb_adjust_cursor(); + if (*ml_get_cursor() == NUL) + return FAIL; + return del_chars(1L, fixpos); + } + return del_bytes(1L, fixpos, TRUE); +} + +/* + * Like del_bytes(), but delete characters instead of bytes. + */ + int +del_chars(long count, int fixpos) +{ + long bytes = 0; + long i; + char_u *p; + int l; + + p = ml_get_cursor(); + for (i = 0; i < count && *p != NUL; ++i) + { + l = (*mb_ptr2len)(p); + bytes += l; + p += l; + } + return del_bytes(bytes, fixpos, TRUE); +} + +/* + * Delete "count" bytes under the cursor. + * If "fixpos" is TRUE, don't leave the cursor on the NUL after the line. + * Caller must have prepared for undo. + * + * Return FAIL for failure, OK otherwise. + */ + int +del_bytes( + long count, + int fixpos_arg, + int use_delcombine UNUSED) // 'delcombine' option applies +{ + char_u *oldp, *newp; + colnr_T oldlen; + colnr_T newlen; + linenr_T lnum = curwin->w_cursor.lnum; + colnr_T col = curwin->w_cursor.col; + int alloc_newp; + long movelen; + int fixpos = fixpos_arg; + + oldp = ml_get(lnum); + oldlen = (int)STRLEN(oldp); + + // Can't do anything when the cursor is on the NUL after the line. + if (col >= oldlen) + return FAIL; + + // If "count" is zero there is nothing to do. + if (count == 0) + return OK; + + // If "count" is negative the caller must be doing something wrong. + if (count < 1) + { + siemsg("E950: Invalid count for del_bytes(): %ld", count); + return FAIL; + } + + // If 'delcombine' is set and deleting (less than) one character, only + // delete the last combining character. + if (p_deco && use_delcombine && enc_utf8 + && utfc_ptr2len(oldp + col) >= count) + { + int cc[MAX_MCO]; + int n; + + (void)utfc_ptr2char(oldp + col, cc); + if (cc[0] != NUL) + { + // Find the last composing char, there can be several. + n = col; + do + { + col = n; + count = utf_ptr2len(oldp + n); + n += count; + } while (UTF_COMPOSINGLIKE(oldp + col, oldp + n)); + fixpos = 0; + } + } + + // When count is too big, reduce it. + movelen = (long)oldlen - (long)col - count + 1; // includes trailing NUL + if (movelen <= 1) + { + // If we just took off the last character of a non-blank line, and + // fixpos is TRUE, we don't want to end up positioned at the NUL, + // unless "restart_edit" is set or 'virtualedit' contains "onemore". + if (col > 0 && fixpos && restart_edit == 0 + && (ve_flags & VE_ONEMORE) == 0) + { + --curwin->w_cursor.col; + curwin->w_cursor.coladd = 0; + if (has_mbyte) + curwin->w_cursor.col -= + (*mb_head_off)(oldp, oldp + curwin->w_cursor.col); + } + count = oldlen - col; + movelen = 1; + } + newlen = oldlen - count; + + // If the old line has been allocated the deletion can be done in the + // existing line. Otherwise a new line has to be allocated + // Can't do this when using Netbeans, because we would need to invoke + // netbeans_removed(), which deallocates the line. Let ml_replace() take + // care of notifying Netbeans. +#ifdef FEAT_NETBEANS_INTG + if (netbeans_active()) + alloc_newp = TRUE; + else +#endif + alloc_newp = !ml_line_alloced(); // check if oldp was allocated + if (!alloc_newp) + newp = oldp; // use same allocated memory + else + { // need to allocate a new line + newp = alloc((unsigned)(newlen + 1)); + if (newp == NULL) + return FAIL; + mch_memmove(newp, oldp, (size_t)col); + } + mch_memmove(newp + col, oldp + col + count, (size_t)movelen); + if (alloc_newp) + ml_replace(lnum, newp, FALSE); +#ifdef FEAT_TEXT_PROP + else + { + // Also move any following text properties. + if (oldlen + 1 < curbuf->b_ml.ml_line_len) + mch_memmove(newp + newlen + 1, oldp + oldlen + 1, + (size_t)curbuf->b_ml.ml_line_len - oldlen - 1); + curbuf->b_ml.ml_line_len -= count; + } +#endif + + // mark the buffer as changed and prepare for displaying + inserted_bytes(lnum, curwin->w_cursor.col, -count); + + return OK; +} + +/* + * Copy the indent from ptr to the current line (and fill to size) + * Leaves the cursor on the first non-blank in the line. + * Returns TRUE if the line was changed. + */ + static int +copy_indent(int size, char_u *src) +{ + char_u *p = NULL; + char_u *line = NULL; + char_u *s; + int todo; + int ind_len; + int line_len = 0; + int tab_pad; + int ind_done; + int round; +#ifdef FEAT_VARTABS + int ind_col; +#endif + + // Round 1: compute the number of characters needed for the indent + // Round 2: copy the characters. + for (round = 1; round <= 2; ++round) + { + todo = size; + ind_len = 0; + ind_done = 0; +#ifdef FEAT_VARTABS + ind_col = 0; +#endif + s = src; + + // Count/copy the usable portion of the source line + while (todo > 0 && VIM_ISWHITE(*s)) + { + if (*s == TAB) + { +#ifdef FEAT_VARTABS + tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts, + curbuf->b_p_vts_array); +#else + tab_pad = (int)curbuf->b_p_ts + - (ind_done % (int)curbuf->b_p_ts); +#endif + // Stop if this tab will overshoot the target + if (todo < tab_pad) + break; + todo -= tab_pad; + ind_done += tab_pad; +#ifdef FEAT_VARTABS + ind_col += tab_pad; +#endif + } + else + { + --todo; + ++ind_done; +#ifdef FEAT_VARTABS + ++ind_col; +#endif + } + ++ind_len; + if (p != NULL) + *p++ = *s; + ++s; + } + + // Fill to next tabstop with a tab, if possible +#ifdef FEAT_VARTABS + tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts, + curbuf->b_p_vts_array); +#else + tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts); +#endif + if (todo >= tab_pad && !curbuf->b_p_et) + { + todo -= tab_pad; + ++ind_len; +#ifdef FEAT_VARTABS + ind_col += tab_pad; +#endif + if (p != NULL) + *p++ = TAB; + } + + // Add tabs required for indent + if (!curbuf->b_p_et) + { +#ifdef FEAT_VARTABS + for (;;) + { + tab_pad = tabstop_padding(ind_col, curbuf->b_p_ts, + curbuf->b_p_vts_array); + if (todo < tab_pad) + break; + todo -= tab_pad; + ++ind_len; + ind_col += tab_pad; + if (p != NULL) + *p++ = TAB; + } +#else + while (todo >= (int)curbuf->b_p_ts) + { + todo -= (int)curbuf->b_p_ts; + ++ind_len; + if (p != NULL) + *p++ = TAB; + } +#endif + } + + // Count/add spaces required for indent + while (todo > 0) + { + --todo; + ++ind_len; + if (p != NULL) + *p++ = ' '; + } + + if (p == NULL) + { + // Allocate memory for the result: the copied indent, new indent + // and the rest of the line. + line_len = (int)STRLEN(ml_get_curline()) + 1; + line = alloc(ind_len + line_len); + if (line == NULL) + return FALSE; + p = line; + } + } + + // Append the original line + mch_memmove(p, ml_get_curline(), (size_t)line_len); + + // Replace the line + ml_replace(curwin->w_cursor.lnum, line, FALSE); + + // Put the cursor after the indent. + curwin->w_cursor.col = ind_len; + return TRUE; +} + +/* + * open_line: Add a new line below or above the current line. + * + * For VREPLACE mode, we only add a new line when we get to the end of the + * file, otherwise we just start replacing the next line. + * + * Caller must take care of undo. Since VREPLACE may affect any number of + * lines however, it may call u_save_cursor() again when starting to change a + * new line. + * "flags": OPENLINE_DELSPACES delete spaces after cursor + * OPENLINE_DO_COM format comments + * OPENLINE_KEEPTRAIL keep trailing spaces + * OPENLINE_MARKFIX adjust mark positions after the line break + * OPENLINE_COM_LIST format comments with list or 2nd line indent + * + * "second_line_indent": indent for after ^^D in Insert mode or if flag + * OPENLINE_COM_LIST + * + * Return OK for success, FAIL for failure + */ + int +open_line( + int dir, // FORWARD or BACKWARD + int flags, + int second_line_indent) +{ + char_u *saved_line; // copy of the original line + char_u *next_line = NULL; // copy of the next line + char_u *p_extra = NULL; // what goes to next line + int less_cols = 0; // less columns for mark in new line + int less_cols_off = 0; // columns to skip for mark adjust + pos_T old_cursor; // old cursor position + int newcol = 0; // new cursor column + int newindent = 0; // auto-indent of the new line + int n; + int trunc_line = FALSE; // truncate current line afterwards + int retval = FAIL; // return value +#ifdef FEAT_COMMENTS + int extra_len = 0; // length of p_extra string + int lead_len; // length of comment leader + char_u *lead_flags; // position in 'comments' for comment leader + char_u *leader = NULL; // copy of comment leader +#endif + char_u *allocated = NULL; // allocated memory + char_u *p; + int saved_char = NUL; // init for GCC +#if defined(FEAT_SMARTINDENT) || defined(FEAT_COMMENTS) + pos_T *pos; +#endif +#ifdef FEAT_SMARTINDENT + int do_si = (!p_paste && curbuf->b_p_si +# ifdef FEAT_CINDENT + && !curbuf->b_p_cin +# endif +# ifdef FEAT_EVAL + && *curbuf->b_p_inde == NUL +# endif + ); + int no_si = FALSE; // reset did_si afterwards + int first_char = NUL; // init for GCC +#endif +#if defined(FEAT_LISP) || defined(FEAT_CINDENT) + int vreplace_mode; +#endif + int did_append; // appended a new line + int saved_pi = curbuf->b_p_pi; // copy of preserveindent setting + + // make a copy of the current line so we can mess with it + saved_line = vim_strsave(ml_get_curline()); + if (saved_line == NULL) /* out of memory! */ + return FALSE; + + if (State & VREPLACE_FLAG) + { + // With VREPLACE we make a copy of the next line, which we will be + // starting to replace. First make the new line empty and let vim play + // with the indenting and comment leader to its heart's content. Then + // we grab what it ended up putting on the new line, put back the + // original line, and call ins_char() to put each new character onto + // the line, replacing what was there before and pushing the right + // stuff onto the replace stack. -- webb. + if (curwin->w_cursor.lnum < orig_line_count) + next_line = vim_strsave(ml_get(curwin->w_cursor.lnum + 1)); + else + next_line = vim_strsave((char_u *)""); + if (next_line == NULL) // out of memory! + goto theend; + + // In VREPLACE mode, a NL replaces the rest of the line, and starts + // replacing the next line, so push all of the characters left on the + // line onto the replace stack. We'll push any other characters that + // might be replaced at the start of the next line (due to autoindent + // etc) a bit later. + replace_push(NUL); // Call twice because BS over NL expects it + replace_push(NUL); + p = saved_line + curwin->w_cursor.col; + while (*p != NUL) + { + if (has_mbyte) + p += replace_push_mb(p); + else + replace_push(*p++); + } + saved_line[curwin->w_cursor.col] = NUL; + } + + if ((State & INSERT) && !(State & VREPLACE_FLAG)) + { + p_extra = saved_line + curwin->w_cursor.col; +#ifdef FEAT_SMARTINDENT + if (do_si) // need first char after new line break + { + p = skipwhite(p_extra); + first_char = *p; + } +#endif +#ifdef FEAT_COMMENTS + extra_len = (int)STRLEN(p_extra); +#endif + saved_char = *p_extra; + *p_extra = NUL; + } + + u_clearline(); // cannot do "U" command when adding lines +#ifdef FEAT_SMARTINDENT + did_si = FALSE; +#endif + ai_col = 0; + + // If we just did an auto-indent, then we didn't type anything on + // the prior line, and it should be truncated. Do this even if 'ai' is not + // set because automatically inserting a comment leader also sets did_ai. + if (dir == FORWARD && did_ai) + trunc_line = TRUE; + + // If 'autoindent' and/or 'smartindent' is set, try to figure out what + // indent to use for the new line. + if (curbuf->b_p_ai +#ifdef FEAT_SMARTINDENT + || do_si +#endif + ) + { + // count white space on current line +#ifdef FEAT_VARTABS + newindent = get_indent_str_vtab(saved_line, curbuf->b_p_ts, + curbuf->b_p_vts_array, FALSE); +#else + newindent = get_indent_str(saved_line, (int)curbuf->b_p_ts, FALSE); +#endif + if (newindent == 0 && !(flags & OPENLINE_COM_LIST)) + newindent = second_line_indent; // for ^^D command in insert mode + +#ifdef FEAT_SMARTINDENT + // Do smart indenting. + // In insert/replace mode (only when dir == FORWARD) + // we may move some text to the next line. If it starts with '{' + // don't add an indent. Fixes inserting a NL before '{' in line + // "if (condition) {" + if (!trunc_line && do_si && *saved_line != NUL + && (p_extra == NULL || first_char != '{')) + { + char_u *ptr; + char_u last_char; + + old_cursor = curwin->w_cursor; + ptr = saved_line; +# ifdef FEAT_COMMENTS + if (flags & OPENLINE_DO_COM) + lead_len = get_leader_len(ptr, NULL, FALSE, TRUE); + else + lead_len = 0; +# endif + if (dir == FORWARD) + { + // Skip preprocessor directives, unless they are + // recognised as comments. + if ( +# ifdef FEAT_COMMENTS + lead_len == 0 && +# endif + ptr[0] == '#') + { + while (ptr[0] == '#' && curwin->w_cursor.lnum > 1) + ptr = ml_get(--curwin->w_cursor.lnum); + newindent = get_indent(); + } +# ifdef FEAT_COMMENTS + if (flags & OPENLINE_DO_COM) + lead_len = get_leader_len(ptr, NULL, FALSE, TRUE); + else + lead_len = 0; + if (lead_len > 0) + { + // This case gets the following right: + // /* + // * A comment (read '\' as '/'). + // */ + // #define IN_THE_WAY + // This should line up here; + p = skipwhite(ptr); + if (p[0] == '/' && p[1] == '*') + p++; + if (p[0] == '*') + { + for (p++; *p; p++) + { + if (p[0] == '/' && p[-1] == '*') + { + // End of C comment, indent should line up + // with the line containing the start of + // the comment + curwin->w_cursor.col = (colnr_T)(p - ptr); + if ((pos = findmatch(NULL, NUL)) != NULL) + { + curwin->w_cursor.lnum = pos->lnum; + newindent = get_indent(); + } + } + } + } + } + else // Not a comment line +# endif + { + // Find last non-blank in line + p = ptr + STRLEN(ptr) - 1; + while (p > ptr && VIM_ISWHITE(*p)) + --p; + last_char = *p; + + // find the character just before the '{' or ';' + if (last_char == '{' || last_char == ';') + { + if (p > ptr) + --p; + while (p > ptr && VIM_ISWHITE(*p)) + --p; + } + // Try to catch lines that are split over multiple + // lines. eg: + // if (condition && + // condition) { + // Should line up here! + // } + if (*p == ')') + { + curwin->w_cursor.col = (colnr_T)(p - ptr); + if ((pos = findmatch(NULL, '(')) != NULL) + { + curwin->w_cursor.lnum = pos->lnum; + newindent = get_indent(); + ptr = ml_get_curline(); + } + } + // If last character is '{' do indent, without + // checking for "if" and the like. + if (last_char == '{') + { + did_si = TRUE; // do indent + no_si = TRUE; // don't delete it when '{' typed + } + // Look for "if" and the like, use 'cinwords'. + // Don't do this if the previous line ended in ';' or + // '}'. + else if (last_char != ';' && last_char != '}' + && cin_is_cinword(ptr)) + did_si = TRUE; + } + } + else // dir == BACKWARD + { + // Skip preprocessor directives, unless they are + // recognised as comments. + if ( +# ifdef FEAT_COMMENTS + lead_len == 0 && +# endif + ptr[0] == '#') + { + int was_backslashed = FALSE; + + while ((ptr[0] == '#' || was_backslashed) && + curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) + { + if (*ptr && ptr[STRLEN(ptr) - 1] == '\\') + was_backslashed = TRUE; + else + was_backslashed = FALSE; + ptr = ml_get(++curwin->w_cursor.lnum); + } + if (was_backslashed) + newindent = 0; // Got to end of file + else + newindent = get_indent(); + } + p = skipwhite(ptr); + if (*p == '}') // if line starts with '}': do indent + did_si = TRUE; + else // can delete indent when '{' typed + can_si_back = TRUE; + } + curwin->w_cursor = old_cursor; + } + if (do_si) + can_si = TRUE; +#endif // FEAT_SMARTINDENT + + did_ai = TRUE; + } + +#ifdef FEAT_COMMENTS + // Find out if the current line starts with a comment leader. + // This may then be inserted in front of the new line. + end_comment_pending = NUL; + if (flags & OPENLINE_DO_COM) + lead_len = get_leader_len(saved_line, &lead_flags, + dir == BACKWARD, TRUE); + else + lead_len = 0; + if (lead_len > 0) + { + char_u *lead_repl = NULL; // replaces comment leader + int lead_repl_len = 0; // length of *lead_repl + char_u lead_middle[COM_MAX_LEN]; // middle-comment string + char_u lead_end[COM_MAX_LEN]; // end-comment string + char_u *comment_end = NULL; // where lead_end has been found + int extra_space = FALSE; // append extra space + int current_flag; + int require_blank = FALSE; // requires blank after middle + char_u *p2; + + // If the comment leader has the start, middle or end flag, it may not + // be used or may be replaced with the middle leader. + for (p = lead_flags; *p && *p != ':'; ++p) + { + if (*p == COM_BLANK) + { + require_blank = TRUE; + continue; + } + if (*p == COM_START || *p == COM_MIDDLE) + { + current_flag = *p; + if (*p == COM_START) + { + // Doing "O" on a start of comment does not insert leader. + if (dir == BACKWARD) + { + lead_len = 0; + break; + } + + // find start of middle part + (void)copy_option_part(&p, lead_middle, COM_MAX_LEN, ","); + require_blank = FALSE; + } + + // Isolate the strings of the middle and end leader. + while (*p && p[-1] != ':') /* find end of middle flags */ + { + if (*p == COM_BLANK) + require_blank = TRUE; + ++p; + } + (void)copy_option_part(&p, lead_middle, COM_MAX_LEN, ","); + + while (*p && p[-1] != ':') // find end of end flags + { + // Check whether we allow automatic ending of comments + if (*p == COM_AUTO_END) + end_comment_pending = -1; // means we want to set it + ++p; + } + n = copy_option_part(&p, lead_end, COM_MAX_LEN, ","); + + if (end_comment_pending == -1) // we can set it now + end_comment_pending = lead_end[n - 1]; + + // If the end of the comment is in the same line, don't use + // the comment leader. + if (dir == FORWARD) + { + for (p = saved_line + lead_len; *p; ++p) + if (STRNCMP(p, lead_end, n) == 0) + { + comment_end = p; + lead_len = 0; + break; + } + } + + // Doing "o" on a start of comment inserts the middle leader. + if (lead_len > 0) + { + if (current_flag == COM_START) + { + lead_repl = lead_middle; + lead_repl_len = (int)STRLEN(lead_middle); + } + + // If we have hit RETURN immediately after the start + // comment leader, then put a space after the middle + // comment leader on the next line. + if (!VIM_ISWHITE(saved_line[lead_len - 1]) + && ((p_extra != NULL + && (int)curwin->w_cursor.col == lead_len) + || (p_extra == NULL + && saved_line[lead_len] == NUL) + || require_blank)) + extra_space = TRUE; + } + break; + } + if (*p == COM_END) + { + // Doing "o" on the end of a comment does not insert leader. + // Remember where the end is, might want to use it to find the + // start (for C-comments). + if (dir == FORWARD) + { + comment_end = skipwhite(saved_line); + lead_len = 0; + break; + } + + // Doing "O" on the end of a comment inserts the middle leader. + // Find the string for the middle leader, searching backwards. + while (p > curbuf->b_p_com && *p != ',') + --p; + for (lead_repl = p; lead_repl > curbuf->b_p_com + && lead_repl[-1] != ':'; --lead_repl) + ; + lead_repl_len = (int)(p - lead_repl); + + // We can probably always add an extra space when doing "O" on + // the comment-end + extra_space = TRUE; + + // Check whether we allow automatic ending of comments + for (p2 = p; *p2 && *p2 != ':'; p2++) + { + if (*p2 == COM_AUTO_END) + end_comment_pending = -1; // means we want to set it + } + if (end_comment_pending == -1) + { + // Find last character in end-comment string + while (*p2 && *p2 != ',') + p2++; + end_comment_pending = p2[-1]; + } + break; + } + if (*p == COM_FIRST) + { + // Comment leader for first line only: Don't repeat leader + // when using "O", blank out leader when using "o". + if (dir == BACKWARD) + lead_len = 0; + else + { + lead_repl = (char_u *)""; + lead_repl_len = 0; + } + break; + } + } + if (lead_len) + { + // allocate buffer (may concatenate p_extra later) + leader = alloc(lead_len + lead_repl_len + extra_space + extra_len + + (second_line_indent > 0 ? second_line_indent : 0) + 1); + allocated = leader; // remember to free it later + + if (leader == NULL) + lead_len = 0; + else + { + vim_strncpy(leader, saved_line, lead_len); + + // Replace leader with lead_repl, right or left adjusted + if (lead_repl != NULL) + { + int c = 0; + int off = 0; + + for (p = lead_flags; *p != NUL && *p != ':'; ) + { + if (*p == COM_RIGHT || *p == COM_LEFT) + c = *p++; + else if (VIM_ISDIGIT(*p) || *p == '-') + off = getdigits(&p); + else + ++p; + } + if (c == COM_RIGHT) // right adjusted leader + { + // find last non-white in the leader to line up with + for (p = leader + lead_len - 1; p > leader + && VIM_ISWHITE(*p); --p) + ; + ++p; + + // Compute the length of the replaced characters in + // screen characters, not bytes. + { + int repl_size = vim_strnsize(lead_repl, + lead_repl_len); + int old_size = 0; + char_u *endp = p; + int l; + + while (old_size < repl_size && p > leader) + { + MB_PTR_BACK(leader, p); + old_size += ptr2cells(p); + } + l = lead_repl_len - (int)(endp - p); + if (l != 0) + mch_memmove(endp + l, endp, + (size_t)((leader + lead_len) - endp)); + lead_len += l; + } + mch_memmove(p, lead_repl, (size_t)lead_repl_len); + if (p + lead_repl_len > leader + lead_len) + p[lead_repl_len] = NUL; + + // blank-out any other chars from the old leader. + while (--p >= leader) + { + int l = mb_head_off(leader, p); + + if (l > 1) + { + p -= l; + if (ptr2cells(p) > 1) + { + p[1] = ' '; + --l; + } + mch_memmove(p + 1, p + l + 1, + (size_t)((leader + lead_len) - (p + l + 1))); + lead_len -= l; + *p = ' '; + } + else if (!VIM_ISWHITE(*p)) + *p = ' '; + } + } + else // left adjusted leader + { + p = skipwhite(leader); + + // Compute the length of the replaced characters in + // screen characters, not bytes. Move the part that is + // not to be overwritten. + { + int repl_size = vim_strnsize(lead_repl, + lead_repl_len); + int i; + int l; + + for (i = 0; i < lead_len && p[i] != NUL; i += l) + { + l = (*mb_ptr2len)(p + i); + if (vim_strnsize(p, i + l) > repl_size) + break; + } + if (i != lead_repl_len) + { + mch_memmove(p + lead_repl_len, p + i, + (size_t)(lead_len - i - (p - leader))); + lead_len += lead_repl_len - i; + } + } + mch_memmove(p, lead_repl, (size_t)lead_repl_len); + + // Replace any remaining non-white chars in the old + // leader by spaces. Keep Tabs, the indent must + // remain the same. + for (p += lead_repl_len; p < leader + lead_len; ++p) + if (!VIM_ISWHITE(*p)) + { + // Don't put a space before a TAB. + if (p + 1 < leader + lead_len && p[1] == TAB) + { + --lead_len; + mch_memmove(p, p + 1, + (leader + lead_len) - p); + } + else + { + int l = (*mb_ptr2len)(p); + + if (l > 1) + { + if (ptr2cells(p) > 1) + { + // Replace a double-wide char with + // two spaces + --l; + *p++ = ' '; + } + mch_memmove(p + 1, p + l, + (leader + lead_len) - p); + lead_len -= l - 1; + } + *p = ' '; + } + } + *p = NUL; + } + + // Recompute the indent, it may have changed. + if (curbuf->b_p_ai +#ifdef FEAT_SMARTINDENT + || do_si +#endif + ) +#ifdef FEAT_VARTABS + newindent = get_indent_str_vtab(leader, curbuf->b_p_ts, + curbuf->b_p_vts_array, FALSE); +#else + newindent = get_indent_str(leader, + (int)curbuf->b_p_ts, FALSE); +#endif + + // Add the indent offset + if (newindent + off < 0) + { + off = -newindent; + newindent = 0; + } + else + newindent += off; + + // Correct trailing spaces for the shift, so that + // alignment remains equal. + while (off > 0 && lead_len > 0 + && leader[lead_len - 1] == ' ') + { + // Don't do it when there is a tab before the space + if (vim_strchr(skipwhite(leader), '\t') != NULL) + break; + --lead_len; + --off; + } + + // If the leader ends in white space, don't add an + // extra space + if (lead_len > 0 && VIM_ISWHITE(leader[lead_len - 1])) + extra_space = FALSE; + leader[lead_len] = NUL; + } + + if (extra_space) + { + leader[lead_len++] = ' '; + leader[lead_len] = NUL; + } + + newcol = lead_len; + + // if a new indent will be set below, remove the indent that + // is in the comment leader + if (newindent +#ifdef FEAT_SMARTINDENT + || did_si +#endif + ) + { + while (lead_len && VIM_ISWHITE(*leader)) + { + --lead_len; + --newcol; + ++leader; + } + } + + } +#ifdef FEAT_SMARTINDENT + did_si = can_si = FALSE; +#endif + } + else if (comment_end != NULL) + { + // We have finished a comment, so we don't use the leader. + // If this was a C-comment and 'ai' or 'si' is set do a normal + // indent to align with the line containing the start of the + // comment. + if (comment_end[0] == '*' && comment_end[1] == '/' && + (curbuf->b_p_ai +#ifdef FEAT_SMARTINDENT + || do_si +#endif + )) + { + old_cursor = curwin->w_cursor; + curwin->w_cursor.col = (colnr_T)(comment_end - saved_line); + if ((pos = findmatch(NULL, NUL)) != NULL) + { + curwin->w_cursor.lnum = pos->lnum; + newindent = get_indent(); + } + curwin->w_cursor = old_cursor; + } + } + } +#endif + + // (State == INSERT || State == REPLACE), only when dir == FORWARD + if (p_extra != NULL) + { + *p_extra = saved_char; // restore char that NUL replaced + + // When 'ai' set or "flags" has OPENLINE_DELSPACES, skip to the first + // non-blank. + // + // When in REPLACE mode, put the deleted blanks on the replace stack, + // preceded by a NUL, so they can be put back when a BS is entered. + if (REPLACE_NORMAL(State)) + replace_push(NUL); /* end of extra blanks */ + if (curbuf->b_p_ai || (flags & OPENLINE_DELSPACES)) + { + while ((*p_extra == ' ' || *p_extra == '\t') + && (!enc_utf8 + || !utf_iscomposing(utf_ptr2char(p_extra + 1)))) + { + if (REPLACE_NORMAL(State)) + replace_push(*p_extra); + ++p_extra; + ++less_cols_off; + } + } + + // columns for marks adjusted for removed columns + less_cols = (int)(p_extra - saved_line); + } + + if (p_extra == NULL) + p_extra = (char_u *)""; // append empty line + +#ifdef FEAT_COMMENTS + // concatenate leader and p_extra, if there is a leader + if (lead_len) + { + if (flags & OPENLINE_COM_LIST && second_line_indent > 0) + { + int i; + int padding = second_line_indent + - (newindent + (int)STRLEN(leader)); + + // Here whitespace is inserted after the comment char. + // Below, set_indent(newindent, SIN_INSERT) will insert the + // whitespace needed before the comment char. + for (i = 0; i < padding; i++) + { + STRCAT(leader, " "); + less_cols--; + newcol++; + } + } + STRCAT(leader, p_extra); + p_extra = leader; + did_ai = TRUE; // So truncating blanks works with comments + less_cols -= lead_len; + } + else + end_comment_pending = NUL; // turns out there was no leader +#endif + + old_cursor = curwin->w_cursor; + if (dir == BACKWARD) + --curwin->w_cursor.lnum; + if (!(State & VREPLACE_FLAG) || old_cursor.lnum >= orig_line_count) + { + if (ml_append(curwin->w_cursor.lnum, p_extra, (colnr_T)0, FALSE) + == FAIL) + goto theend; + // Postpone calling changed_lines(), because it would mess up folding + // with markers. + // Skip mark_adjust when adding a line after the last one, there can't + // be marks there. But still needed in diff mode. + if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count +#ifdef FEAT_DIFF + || curwin->w_p_diff +#endif + ) + mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); + did_append = TRUE; + } + else + { + // In VREPLACE mode we are starting to replace the next line. + curwin->w_cursor.lnum++; + if (curwin->w_cursor.lnum >= Insstart.lnum + vr_lines_changed) + { + // In case we NL to a new line, BS to the previous one, and NL + // again, we don't want to save the new line for undo twice. + (void)u_save_cursor(); /* errors are ignored! */ + vr_lines_changed++; + } + ml_replace(curwin->w_cursor.lnum, p_extra, TRUE); + changed_bytes(curwin->w_cursor.lnum, 0); + curwin->w_cursor.lnum--; + did_append = FALSE; + } + + if (newindent +#ifdef FEAT_SMARTINDENT + || did_si +#endif + ) + { + ++curwin->w_cursor.lnum; +#ifdef FEAT_SMARTINDENT + if (did_si) + { + int sw = (int)get_sw_value(curbuf); + + if (p_sr) + newindent -= newindent % sw; + newindent += sw; + } +#endif + // Copy the indent + if (curbuf->b_p_ci) + { + (void)copy_indent(newindent, saved_line); + + // Set the 'preserveindent' option so that any further screwing + // with the line doesn't entirely destroy our efforts to preserve + // it. It gets restored at the function end. + curbuf->b_p_pi = TRUE; + } + else + (void)set_indent(newindent, SIN_INSERT); + less_cols -= curwin->w_cursor.col; + + ai_col = curwin->w_cursor.col; + + // In REPLACE mode, for each character in the new indent, there must + // be a NUL on the replace stack, for when it is deleted with BS + if (REPLACE_NORMAL(State)) + for (n = 0; n < (int)curwin->w_cursor.col; ++n) + replace_push(NUL); + newcol += curwin->w_cursor.col; +#ifdef FEAT_SMARTINDENT + if (no_si) + did_si = FALSE; +#endif + } + +#ifdef FEAT_COMMENTS + // In REPLACE mode, for each character in the extra leader, there must be + // a NUL on the replace stack, for when it is deleted with BS. + if (REPLACE_NORMAL(State)) + while (lead_len-- > 0) + replace_push(NUL); +#endif + + curwin->w_cursor = old_cursor; + + if (dir == FORWARD) + { + if (trunc_line || (State & INSERT)) + { + // truncate current line at cursor + saved_line[curwin->w_cursor.col] = NUL; + // Remove trailing white space, unless OPENLINE_KEEPTRAIL used. + if (trunc_line && !(flags & OPENLINE_KEEPTRAIL)) + truncate_spaces(saved_line); + ml_replace(curwin->w_cursor.lnum, saved_line, FALSE); + saved_line = NULL; + if (did_append) + { + changed_lines(curwin->w_cursor.lnum, curwin->w_cursor.col, + curwin->w_cursor.lnum + 1, 1L); + did_append = FALSE; + + // Move marks after the line break to the new line. + if (flags & OPENLINE_MARKFIX) + mark_col_adjust(curwin->w_cursor.lnum, + curwin->w_cursor.col + less_cols_off, + 1L, (long)-less_cols, 0); + } + else + changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col); + } + + // Put the cursor on the new line. Careful: the scrollup() above may + // have moved w_cursor, we must use old_cursor. + curwin->w_cursor.lnum = old_cursor.lnum + 1; + } + if (did_append) + changed_lines(curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L); + + curwin->w_cursor.col = newcol; + curwin->w_cursor.coladd = 0; + +#if defined(FEAT_LISP) || defined(FEAT_CINDENT) + // In VREPLACE mode, we are handling the replace stack ourselves, so stop + // fixthisline() from doing it (via change_indent()) by telling it we're in + // normal INSERT mode. + if (State & VREPLACE_FLAG) + { + vreplace_mode = State; // So we know to put things right later + State = INSERT; + } + else + vreplace_mode = 0; +#endif +#ifdef FEAT_LISP + // May do lisp indenting. + if (!p_paste +# ifdef FEAT_COMMENTS + && leader == NULL +# endif + && curbuf->b_p_lisp + && curbuf->b_p_ai) + { + fixthisline(get_lisp_indent); + ai_col = (colnr_T)getwhitecols_curline(); + } +#endif +#ifdef FEAT_CINDENT + // May do indenting after opening a new line. + if (!p_paste + && (curbuf->b_p_cin +# ifdef FEAT_EVAL + || *curbuf->b_p_inde != NUL +# endif + ) + && in_cinkeys(dir == FORWARD + ? KEY_OPEN_FORW + : KEY_OPEN_BACK, ' ', linewhite(curwin->w_cursor.lnum))) + { + do_c_expr_indent(); + ai_col = (colnr_T)getwhitecols_curline(); + } +#endif +#if defined(FEAT_LISP) || defined(FEAT_CINDENT) + if (vreplace_mode != 0) + State = vreplace_mode; +#endif + + // Finally, VREPLACE gets the stuff on the new line, then puts back the + // original line, and inserts the new stuff char by char, pushing old stuff + // onto the replace stack (via ins_char()). + if (State & VREPLACE_FLAG) + { + // Put new line in p_extra + p_extra = vim_strsave(ml_get_curline()); + if (p_extra == NULL) + goto theend; + + // Put back original line + ml_replace(curwin->w_cursor.lnum, next_line, FALSE); + + // Insert new stuff into line again + curwin->w_cursor.col = 0; + curwin->w_cursor.coladd = 0; + ins_bytes(p_extra); // will call changed_bytes() + vim_free(p_extra); + next_line = NULL; + } + + retval = OK; // success! +theend: + curbuf->b_p_pi = saved_pi; + vim_free(saved_line); + vim_free(next_line); + vim_free(allocated); + return retval; +} + +/* + * Delete from cursor to end of line. + * Caller must have prepared for undo. + * If "fixpos" is TRUE fix the cursor position when done. + * + * Return FAIL for failure, OK otherwise. + */ + int +truncate_line(int fixpos) +{ + char_u *newp; + linenr_T lnum = curwin->w_cursor.lnum; + colnr_T col = curwin->w_cursor.col; + + if (col == 0) + newp = vim_strsave((char_u *)""); + else + newp = vim_strnsave(ml_get(lnum), col); + + if (newp == NULL) + return FAIL; + + ml_replace(lnum, newp, FALSE); + + // mark the buffer as changed and prepare for displaying + changed_bytes(lnum, curwin->w_cursor.col); + + // If "fixpos" is TRUE we don't want to end up positioned at the NUL. + if (fixpos && curwin->w_cursor.col > 0) + --curwin->w_cursor.col; + + return OK; +} + +/* + * Delete "nlines" lines at the cursor. + * Saves the lines for undo first if "undo" is TRUE. + */ + void +del_lines(long nlines, int undo) +{ + long n; + linenr_T first = curwin->w_cursor.lnum; + + if (nlines <= 0) + return; + + // save the deleted lines for undo + if (undo && u_savedel(first, nlines) == FAIL) + return; + + for (n = 0; n < nlines; ) + { + if (curbuf->b_ml.ml_flags & ML_EMPTY) // nothing to delete + break; + + ml_delete(first, TRUE); + ++n; + + // If we delete the last line in the file, stop + if (first > curbuf->b_ml.ml_line_count) + break; + } + + // Correct the cursor position before calling deleted_lines_mark(), it may + // trigger a callback to display the cursor. + curwin->w_cursor.col = 0; + check_cursor_lnum(); + + // adjust marks, mark the buffer as changed and prepare for displaying + deleted_lines_mark(first, n); +} diff --git a/src/proto/change.pro b/src/proto/change.pro new file mode 100644 index 0000000000..34733f502a --- /dev/null +++ b/src/proto/change.pro @@ -0,0 +1,24 @@ +/* change.c */ +void change_warning(int col); +void changed(void); +void changed_internal(void); +void changed_bytes(linenr_T lnum, colnr_T col); +void inserted_bytes(linenr_T lnum, colnr_T col, int added); +void appended_lines(linenr_T lnum, long count); +void appended_lines_mark(linenr_T lnum, long count); +void deleted_lines(linenr_T lnum, long count); +void deleted_lines_mark(linenr_T lnum, long count); +void changed_lines(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra); +void unchanged(buf_T *buf, int ff); +void ins_bytes(char_u *p); +void ins_bytes_len(char_u *p, int len); +void ins_char(int c); +void ins_char_bytes(char_u *buf, int charlen); +void ins_str(char_u *s); +int del_char(int fixpos); +int del_chars(long count, int fixpos); +int del_bytes(long count, int fixpos_arg, int use_delcombine); +int open_line(int dir, int flags, int second_line_indent); +int truncate_line(int fixpos); +void del_lines(long nlines, int undo); +/* vim: set ft=c : */ From ec28d1516eb8bb5dcaa42de145953a6d49aebb6f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 18:36:34 +0200 Subject: [PATCH 50/97] patch 8.1.1318: code for text changes is in a "misc" file Problem: Code for text changes is in a "misc" file. Solution: Move the code to change.c. --- Filelist | 2 + src/Make_cyg_ming.mak | 1 + src/Make_dice.mak | 4 + src/Make_manx.mak | 6 + src/Make_morph.mak | 1 + src/Make_mvc.mak | 4 + src/Make_sas.mak | 5 + src/Make_vms.mms | 10 +- src/Makefile | 10 + src/README.md | 1 + src/memline.c | 4 +- src/misc1.c | 2249 ----------------------------------------- src/proto.h | 1 + src/proto/misc1.pro | 22 - 14 files changed, 44 insertions(+), 2276 deletions(-) diff --git a/Filelist b/Filelist index 4f73cc7ef1..7cca776849 100644 --- a/Filelist +++ b/Filelist @@ -20,6 +20,7 @@ SRC_ALL = \ src/blob.c \ src/blowfish.c \ src/buffer.c \ + src/change.c \ src/channel.c \ src/charset.c \ src/crypt.c \ @@ -155,6 +156,7 @@ SRC_ALL = \ src/proto/blob.pro \ src/proto/blowfish.pro \ src/proto/buffer.pro \ + src/proto/change.pro \ src/proto/channel.pro \ src/proto/charset.pro \ src/proto/crypt.pro \ diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index a2ff64af20..3e38a27cfe 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -705,6 +705,7 @@ OBJ = \ $(OUTDIR)/blob.o \ $(OUTDIR)/blowfish.o \ $(OUTDIR)/buffer.o \ + $(OUTDIR)/change.o \ $(OUTDIR)/charset.o \ $(OUTDIR)/crypt.o \ $(OUTDIR)/crypt_zip.o \ diff --git a/src/Make_dice.mak b/src/Make_dice.mak index 89fa589459..440955eb34 100644 --- a/src/Make_dice.mak +++ b/src/Make_dice.mak @@ -30,6 +30,7 @@ SRC = \ autocmd.c \ blowfish.c \ buffer.c \ + change.c \ charset.c \ crypt.c \ crypt_zip.c \ @@ -92,6 +93,7 @@ OBJ = o/arabic.o \ o/autocmd.o \ o/blowfish.o \ o/buffer.o \ + o/change.o \ o/charset.o \ o/crypt.o \ o/crypt_zip.o \ @@ -177,6 +179,8 @@ o/blowfish.o: blowfish.c $(SYMS) o/buffer.o: buffer.c $(SYMS) +o/change.o: change.c $(SYMS) + o/charset.o: charset.c $(SYMS) o/crypt.o: crypt.c $(SYMS) diff --git a/src/Make_manx.mak b/src/Make_manx.mak index e53522f06e..211d8ccebf 100644 --- a/src/Make_manx.mak +++ b/src/Make_manx.mak @@ -40,6 +40,7 @@ SRC = arabic.c \ autocmd.c \ blowfish.c \ buffer.c \ + change.c \ charset.c \ crypt.c \ crypt_zip.c \ @@ -104,6 +105,7 @@ OBJ = obj/arabic.o \ obj/autocmd.o \ obj/blowfish.o \ obj/buffer.o \ + obj/change.o \ obj/charset.o \ obj/crypt.o \ obj/crypt_zip.o \ @@ -166,6 +168,7 @@ PRO = proto/arabic.pro \ proto/autocmd.pro \ proto/blowfish.pro \ proto/buffer.pro \ + proto/change.pro \ proto/charset.pro \ proto/crypt.pro \ proto/crypt_zip.pro \ @@ -280,6 +283,9 @@ obj/blowfish.o: blowfish.c obj/buffer.o: buffer.c $(CCSYM) $@ buffer.c +obj/change.o: change.c + $(CCSYM) $@ change.c + obj/charset.o: charset.c $(CCSYM) $@ charset.c diff --git a/src/Make_morph.mak b/src/Make_morph.mak index a5ce62b8c6..1eb5ff52d7 100644 --- a/src/Make_morph.mak +++ b/src/Make_morph.mak @@ -28,6 +28,7 @@ SRC = arabic.c \ autocmd.c \ blowfish.c \ buffer.c \ + change.c \ charset.c \ crypt.c \ crypt_zip.c \ diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 36f18dc056..89f4e13fbb 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -700,6 +700,7 @@ OBJ = \ $(OUTDIR)\blob.obj \ $(OUTDIR)\blowfish.obj \ $(OUTDIR)\buffer.obj \ + $(OUTDIR)\change.obj \ $(OUTDIR)\charset.obj \ $(OUTDIR)\crypt.obj \ $(OUTDIR)\crypt_zip.obj \ @@ -1410,6 +1411,8 @@ $(OUTDIR)/blowfish.obj: $(OUTDIR) blowfish.c $(INCL) $(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL) +$(OUTDIR)/change.obj: $(OUTDIR) change.c $(INCL) + $(OUTDIR)/charset.obj: $(OUTDIR) charset.c $(INCL) $(OUTDIR)/crypt.obj: $(OUTDIR) crypt.c $(INCL) @@ -1700,6 +1703,7 @@ proto.h: \ proto/blob.pro \ proto/blowfish.pro \ proto/buffer.pro \ + proto/change.pro \ proto/charset.pro \ proto/crypt.pro \ proto/crypt_zip.pro \ diff --git a/src/Make_sas.mak b/src/Make_sas.mak index 0d8eb3d9ec..7090119d75 100644 --- a/src/Make_sas.mak +++ b/src/Make_sas.mak @@ -93,6 +93,7 @@ SRC = \ autocmd.c \ blowfish.c \ buffer.c \ + change.c \ charset.c \ crypt.c \ crypt_zip.c \ @@ -156,6 +157,7 @@ OBJ = \ autocmd.o \ blowfish.o \ buffer.o \ + change.o \ charset.o \ crypt.o \ crypt_zip.o \ @@ -219,6 +221,7 @@ PRO = \ proto/autocmd.pro \ proto/blowfish.pro \ proto/buffer.pro \ + proto/change.pro \ proto/charset.pro \ proto/crypt.pro \ proto/crypt_zip.pro \ @@ -340,6 +343,8 @@ blowfish.o: blowfish.c proto/blowfish.pro: blowfish.c buffer.o: buffer.c proto/buffer.pro: buffer.c +change.o: change.c +proto/change.pro: change.c charset.o: charset.c proto/charset.pro: charset.c crypt.o: crypt.c diff --git a/src/Make_vms.mms b/src/Make_vms.mms index e25e426fd5..3c41cc0548 100644 --- a/src/Make_vms.mms +++ b/src/Make_vms.mms @@ -2,7 +2,7 @@ # Makefile for Vim on OpenVMS # # Maintainer: Zoltan Arpadffy -# Last change: 2019 Apr 26 +# Last change: 2019 May 11 # # This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64 # with MMS and MMK @@ -307,7 +307,7 @@ ALL_CFLAGS_VER = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) - ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) \ $(PERL_LIB) $(PYTHON_LIB) $(TCL_LIB) $(RUBY_LIB) -SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c charset.c \ +SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c change.c, charset.c \ crypt.c crypt_zip.c debugger.c dict.c diff.c digraph.c edit.c eval.c \ evalfunc.c ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c \ if_cscope.c if_xcmdsrv.c fileio.c findfile.c fold.c getchar.c \ @@ -320,7 +320,7 @@ SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c charset.c \ $(GUI_SRC) $(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) \ $(RUBY_SRC) $(HANGULIN_SRC) $(MZSCH_SRC) $(XDIFF_SRC) -OBJ = arabic.obj autocmd.obj beval.obj blob.obj blowfish.obj buffer.obj \ +OBJ = arabic.obj autocmd.obj beval.obj blob.obj blowfish.obj buffer.obj change.obj \ charset.obj crypt.obj crypt_zip.obj debugger.obj dict.obj diff.obj \ digraph.obj edit.obj eval.obj evalfunc.obj ex_cmds.obj ex_cmds2.obj \ ex_docmd.obj ex_eval.obj ex_getln.obj if_cscope.obj if_xcmdsrv.obj \ @@ -510,6 +510,10 @@ buffer.obj : buffer.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h version.h +change.obj : change.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h \ + gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + globals.h version.h charset.obj : charset.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ diff --git a/src/Makefile b/src/Makefile index 10ba8755b7..e50438c178 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1576,6 +1576,7 @@ BASIC_SRC = \ blob.c \ blowfish.c \ buffer.c \ + change.c \ charset.c \ crypt.c \ crypt_zip.c \ @@ -1691,6 +1692,7 @@ OBJ_COMMON = \ objects/autocmd.o \ objects/beval.o \ objects/buffer.o \ + objects/change.o \ objects/blob.o \ objects/blowfish.o \ objects/crypt.o \ @@ -1821,6 +1823,7 @@ PRO_AUTO = \ autocmd.pro \ blowfish.pro \ buffer.pro \ + change.pro \ charset.pro \ crypt.pro \ crypt_zip.pro \ @@ -2965,6 +2968,9 @@ objects/blowfish.o: blowfish.c objects/buffer.o: buffer.c $(CCC) -o $@ buffer.c +objects/change.o: change.c + $(CCC) -o $@ change.c + objects/charset.o: charset.c $(CCC) -o $@ charset.c @@ -3430,6 +3436,10 @@ objects/buffer.o: buffer.c vim.h protodef.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ proto.h globals.h version.h +objects/change.o: change.c vim.h protodef.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ + proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ + proto.h globals.h version.h objects/charset.o: charset.c vim.h protodef.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \ proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ diff --git a/src/README.md b/src/README.md index c6bb8ac25c..ff9f93ac6d 100644 --- a/src/README.md +++ b/src/README.md @@ -25,6 +25,7 @@ File name | Description --------- | ----------- autocmd.c | autocommands buffer.c | manipulating buffers (loaded files) +change.c | handling changes to text debugger.c | vim script debugger diff.c | diff mode (vimdiff) eval.c | expression evaluation diff --git a/src/memline.c b/src/memline.c index 1ef7ecfd19..812d10dc1a 100644 --- a/src/memline.c +++ b/src/memline.c @@ -1637,7 +1637,7 @@ ml_recover(void) * empty. Don't set the modified flag then. */ if (!(curbuf->b_ml.ml_line_count == 2 && *ml_get(1) == NUL)) { - changed_int(); + changed_internal(); ++CHANGEDTICK(curbuf); } } @@ -1651,7 +1651,7 @@ ml_recover(void) vim_free(p); if (i != 0) { - changed_int(); + changed_internal(); ++CHANGEDTICK(curbuf); break; } diff --git a/src/misc1.c b/src/misc1.c index a1c9a82711..5dcf268481 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -446,151 +446,6 @@ set_indent( return retval; } -/* - * Copy the indent from ptr to the current line (and fill to size) - * Leaves the cursor on the first non-blank in the line. - * Returns TRUE if the line was changed. - */ - static int -copy_indent(int size, char_u *src) -{ - char_u *p = NULL; - char_u *line = NULL; - char_u *s; - int todo; - int ind_len; - int line_len = 0; - int tab_pad; - int ind_done; - int round; -#ifdef FEAT_VARTABS - int ind_col; -#endif - - /* Round 1: compute the number of characters needed for the indent - * Round 2: copy the characters. */ - for (round = 1; round <= 2; ++round) - { - todo = size; - ind_len = 0; - ind_done = 0; -#ifdef FEAT_VARTABS - ind_col = 0; -#endif - s = src; - - /* Count/copy the usable portion of the source line */ - while (todo > 0 && VIM_ISWHITE(*s)) - { - if (*s == TAB) - { -#ifdef FEAT_VARTABS - tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts, - curbuf->b_p_vts_array); -#else - tab_pad = (int)curbuf->b_p_ts - - (ind_done % (int)curbuf->b_p_ts); -#endif - /* Stop if this tab will overshoot the target */ - if (todo < tab_pad) - break; - todo -= tab_pad; - ind_done += tab_pad; -#ifdef FEAT_VARTABS - ind_col += tab_pad; -#endif - } - else - { - --todo; - ++ind_done; -#ifdef FEAT_VARTABS - ++ind_col; -#endif - } - ++ind_len; - if (p != NULL) - *p++ = *s; - ++s; - } - - /* Fill to next tabstop with a tab, if possible */ -#ifdef FEAT_VARTABS - tab_pad = tabstop_padding(ind_done, curbuf->b_p_ts, - curbuf->b_p_vts_array); -#else - tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts); -#endif - if (todo >= tab_pad && !curbuf->b_p_et) - { - todo -= tab_pad; - ++ind_len; -#ifdef FEAT_VARTABS - ind_col += tab_pad; -#endif - if (p != NULL) - *p++ = TAB; - } - - /* Add tabs required for indent */ - if (!curbuf->b_p_et) - { -#ifdef FEAT_VARTABS - for (;;) - { - tab_pad = tabstop_padding(ind_col, curbuf->b_p_ts, - curbuf->b_p_vts_array); - if (todo < tab_pad) - break; - todo -= tab_pad; - ++ind_len; - ind_col += tab_pad; - if (p != NULL) - *p++ = TAB; - } -#else - while (todo >= (int)curbuf->b_p_ts) - { - todo -= (int)curbuf->b_p_ts; - ++ind_len; - if (p != NULL) - *p++ = TAB; - } -#endif - } - - /* Count/add spaces required for indent */ - while (todo > 0) - { - --todo; - ++ind_len; - if (p != NULL) - *p++ = ' '; - } - - if (p == NULL) - { - /* Allocate memory for the result: the copied indent, new indent - * and the rest of the line. */ - line_len = (int)STRLEN(ml_get_curline()) + 1; - line = alloc(ind_len + line_len); - if (line == NULL) - return FALSE; - p = line; - } - } - - /* Append the original line */ - mch_memmove(p, ml_get_curline(), (size_t)line_len); - - /* Replace the line */ - ml_replace(curwin->w_cursor.lnum, line, FALSE); - - /* Put the cursor after the indent. */ - curwin->w_cursor.col = ind_len; - return TRUE; -} - /* * Return the indent of the current line after a number. Return -1 if no * number was found. Used for 'n' in 'formatoptions': numbered list. @@ -704,1060 +559,6 @@ get_breakindent_win( } #endif - -/* - * open_line: Add a new line below or above the current line. - * - * For VREPLACE mode, we only add a new line when we get to the end of the - * file, otherwise we just start replacing the next line. - * - * Caller must take care of undo. Since VREPLACE may affect any number of - * lines however, it may call u_save_cursor() again when starting to change a - * new line. - * "flags": OPENLINE_DELSPACES delete spaces after cursor - * OPENLINE_DO_COM format comments - * OPENLINE_KEEPTRAIL keep trailing spaces - * OPENLINE_MARKFIX adjust mark positions after the line break - * OPENLINE_COM_LIST format comments with list or 2nd line indent - * - * "second_line_indent": indent for after ^^D in Insert mode or if flag - * OPENLINE_COM_LIST - * - * Return OK for success, FAIL for failure - */ - int -open_line( - int dir, /* FORWARD or BACKWARD */ - int flags, - int second_line_indent) -{ - char_u *saved_line; /* copy of the original line */ - char_u *next_line = NULL; /* copy of the next line */ - char_u *p_extra = NULL; /* what goes to next line */ - int less_cols = 0; /* less columns for mark in new line */ - int less_cols_off = 0; /* columns to skip for mark adjust */ - pos_T old_cursor; /* old cursor position */ - int newcol = 0; /* new cursor column */ - int newindent = 0; /* auto-indent of the new line */ - int n; - int trunc_line = FALSE; /* truncate current line afterwards */ - int retval = FAIL; /* return value */ -#ifdef FEAT_COMMENTS - int extra_len = 0; /* length of p_extra string */ - int lead_len; /* length of comment leader */ - char_u *lead_flags; /* position in 'comments' for comment leader */ - char_u *leader = NULL; /* copy of comment leader */ -#endif - char_u *allocated = NULL; /* allocated memory */ - char_u *p; - int saved_char = NUL; /* init for GCC */ -#if defined(FEAT_SMARTINDENT) || defined(FEAT_COMMENTS) - pos_T *pos; -#endif -#ifdef FEAT_SMARTINDENT - int do_si = (!p_paste && curbuf->b_p_si -# ifdef FEAT_CINDENT - && !curbuf->b_p_cin -# endif -# ifdef FEAT_EVAL - && *curbuf->b_p_inde == NUL -# endif - ); - int no_si = FALSE; /* reset did_si afterwards */ - int first_char = NUL; /* init for GCC */ -#endif -#if defined(FEAT_LISP) || defined(FEAT_CINDENT) - int vreplace_mode; -#endif - int did_append; /* appended a new line */ - int saved_pi = curbuf->b_p_pi; /* copy of preserveindent setting */ - - /* - * make a copy of the current line so we can mess with it - */ - saved_line = vim_strsave(ml_get_curline()); - if (saved_line == NULL) /* out of memory! */ - return FALSE; - - if (State & VREPLACE_FLAG) - { - /* - * With VREPLACE we make a copy of the next line, which we will be - * starting to replace. First make the new line empty and let vim play - * with the indenting and comment leader to its heart's content. Then - * we grab what it ended up putting on the new line, put back the - * original line, and call ins_char() to put each new character onto - * the line, replacing what was there before and pushing the right - * stuff onto the replace stack. -- webb. - */ - if (curwin->w_cursor.lnum < orig_line_count) - next_line = vim_strsave(ml_get(curwin->w_cursor.lnum + 1)); - else - next_line = vim_strsave((char_u *)""); - if (next_line == NULL) /* out of memory! */ - goto theend; - - /* - * In VREPLACE mode, a NL replaces the rest of the line, and starts - * replacing the next line, so push all of the characters left on the - * line onto the replace stack. We'll push any other characters that - * might be replaced at the start of the next line (due to autoindent - * etc) a bit later. - */ - replace_push(NUL); /* Call twice because BS over NL expects it */ - replace_push(NUL); - p = saved_line + curwin->w_cursor.col; - while (*p != NUL) - { - if (has_mbyte) - p += replace_push_mb(p); - else - replace_push(*p++); - } - saved_line[curwin->w_cursor.col] = NUL; - } - - if ((State & INSERT) && !(State & VREPLACE_FLAG)) - { - p_extra = saved_line + curwin->w_cursor.col; -#ifdef FEAT_SMARTINDENT - if (do_si) /* need first char after new line break */ - { - p = skipwhite(p_extra); - first_char = *p; - } -#endif -#ifdef FEAT_COMMENTS - extra_len = (int)STRLEN(p_extra); -#endif - saved_char = *p_extra; - *p_extra = NUL; - } - - u_clearline(); /* cannot do "U" command when adding lines */ -#ifdef FEAT_SMARTINDENT - did_si = FALSE; -#endif - ai_col = 0; - - /* - * If we just did an auto-indent, then we didn't type anything on - * the prior line, and it should be truncated. Do this even if 'ai' is not - * set because automatically inserting a comment leader also sets did_ai. - */ - if (dir == FORWARD && did_ai) - trunc_line = TRUE; - - /* - * If 'autoindent' and/or 'smartindent' is set, try to figure out what - * indent to use for the new line. - */ - if (curbuf->b_p_ai -#ifdef FEAT_SMARTINDENT - || do_si -#endif - ) - { - /* - * count white space on current line - */ -#ifdef FEAT_VARTABS - newindent = get_indent_str_vtab(saved_line, curbuf->b_p_ts, - curbuf->b_p_vts_array, FALSE); -#else - newindent = get_indent_str(saved_line, (int)curbuf->b_p_ts, FALSE); -#endif - if (newindent == 0 && !(flags & OPENLINE_COM_LIST)) - newindent = second_line_indent; /* for ^^D command in insert mode */ - -#ifdef FEAT_SMARTINDENT - /* - * Do smart indenting. - * In insert/replace mode (only when dir == FORWARD) - * we may move some text to the next line. If it starts with '{' - * don't add an indent. Fixes inserting a NL before '{' in line - * "if (condition) {" - */ - if (!trunc_line && do_si && *saved_line != NUL - && (p_extra == NULL || first_char != '{')) - { - char_u *ptr; - char_u last_char; - - old_cursor = curwin->w_cursor; - ptr = saved_line; -# ifdef FEAT_COMMENTS - if (flags & OPENLINE_DO_COM) - lead_len = get_leader_len(ptr, NULL, FALSE, TRUE); - else - lead_len = 0; -# endif - if (dir == FORWARD) - { - /* - * Skip preprocessor directives, unless they are - * recognised as comments. - */ - if ( -# ifdef FEAT_COMMENTS - lead_len == 0 && -# endif - ptr[0] == '#') - { - while (ptr[0] == '#' && curwin->w_cursor.lnum > 1) - ptr = ml_get(--curwin->w_cursor.lnum); - newindent = get_indent(); - } -# ifdef FEAT_COMMENTS - if (flags & OPENLINE_DO_COM) - lead_len = get_leader_len(ptr, NULL, FALSE, TRUE); - else - lead_len = 0; - if (lead_len > 0) - { - /* - * This case gets the following right: - * \* - * * A comment (read '\' as '/'). - * *\ - * #define IN_THE_WAY - * This should line up here; - */ - p = skipwhite(ptr); - if (p[0] == '/' && p[1] == '*') - p++; - if (p[0] == '*') - { - for (p++; *p; p++) - { - if (p[0] == '/' && p[-1] == '*') - { - /* - * End of C comment, indent should line up - * with the line containing the start of - * the comment - */ - curwin->w_cursor.col = (colnr_T)(p - ptr); - if ((pos = findmatch(NULL, NUL)) != NULL) - { - curwin->w_cursor.lnum = pos->lnum; - newindent = get_indent(); - } - } - } - } - } - else /* Not a comment line */ -# endif - { - /* Find last non-blank in line */ - p = ptr + STRLEN(ptr) - 1; - while (p > ptr && VIM_ISWHITE(*p)) - --p; - last_char = *p; - - /* - * find the character just before the '{' or ';' - */ - if (last_char == '{' || last_char == ';') - { - if (p > ptr) - --p; - while (p > ptr && VIM_ISWHITE(*p)) - --p; - } - /* - * Try to catch lines that are split over multiple - * lines. eg: - * if (condition && - * condition) { - * Should line up here! - * } - */ - if (*p == ')') - { - curwin->w_cursor.col = (colnr_T)(p - ptr); - if ((pos = findmatch(NULL, '(')) != NULL) - { - curwin->w_cursor.lnum = pos->lnum; - newindent = get_indent(); - ptr = ml_get_curline(); - } - } - /* - * If last character is '{' do indent, without - * checking for "if" and the like. - */ - if (last_char == '{') - { - did_si = TRUE; /* do indent */ - no_si = TRUE; /* don't delete it when '{' typed */ - } - /* - * Look for "if" and the like, use 'cinwords'. - * Don't do this if the previous line ended in ';' or - * '}'. - */ - else if (last_char != ';' && last_char != '}' - && cin_is_cinword(ptr)) - did_si = TRUE; - } - } - else /* dir == BACKWARD */ - { - /* - * Skip preprocessor directives, unless they are - * recognised as comments. - */ - if ( -# ifdef FEAT_COMMENTS - lead_len == 0 && -# endif - ptr[0] == '#') - { - int was_backslashed = FALSE; - - while ((ptr[0] == '#' || was_backslashed) && - curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) - { - if (*ptr && ptr[STRLEN(ptr) - 1] == '\\') - was_backslashed = TRUE; - else - was_backslashed = FALSE; - ptr = ml_get(++curwin->w_cursor.lnum); - } - if (was_backslashed) - newindent = 0; /* Got to end of file */ - else - newindent = get_indent(); - } - p = skipwhite(ptr); - if (*p == '}') /* if line starts with '}': do indent */ - did_si = TRUE; - else /* can delete indent when '{' typed */ - can_si_back = TRUE; - } - curwin->w_cursor = old_cursor; - } - if (do_si) - can_si = TRUE; -#endif /* FEAT_SMARTINDENT */ - - did_ai = TRUE; - } - -#ifdef FEAT_COMMENTS - /* - * Find out if the current line starts with a comment leader. - * This may then be inserted in front of the new line. - */ - end_comment_pending = NUL; - if (flags & OPENLINE_DO_COM) - lead_len = get_leader_len(saved_line, &lead_flags, dir == BACKWARD, TRUE); - else - lead_len = 0; - if (lead_len > 0) - { - char_u *lead_repl = NULL; /* replaces comment leader */ - int lead_repl_len = 0; /* length of *lead_repl */ - char_u lead_middle[COM_MAX_LEN]; /* middle-comment string */ - char_u lead_end[COM_MAX_LEN]; /* end-comment string */ - char_u *comment_end = NULL; /* where lead_end has been found */ - int extra_space = FALSE; /* append extra space */ - int current_flag; - int require_blank = FALSE; /* requires blank after middle */ - char_u *p2; - - /* - * If the comment leader has the start, middle or end flag, it may not - * be used or may be replaced with the middle leader. - */ - for (p = lead_flags; *p && *p != ':'; ++p) - { - if (*p == COM_BLANK) - { - require_blank = TRUE; - continue; - } - if (*p == COM_START || *p == COM_MIDDLE) - { - current_flag = *p; - if (*p == COM_START) - { - /* - * Doing "O" on a start of comment does not insert leader. - */ - if (dir == BACKWARD) - { - lead_len = 0; - break; - } - - /* find start of middle part */ - (void)copy_option_part(&p, lead_middle, COM_MAX_LEN, ","); - require_blank = FALSE; - } - - /* - * Isolate the strings of the middle and end leader. - */ - while (*p && p[-1] != ':') /* find end of middle flags */ - { - if (*p == COM_BLANK) - require_blank = TRUE; - ++p; - } - (void)copy_option_part(&p, lead_middle, COM_MAX_LEN, ","); - - while (*p && p[-1] != ':') /* find end of end flags */ - { - /* Check whether we allow automatic ending of comments */ - if (*p == COM_AUTO_END) - end_comment_pending = -1; /* means we want to set it */ - ++p; - } - n = copy_option_part(&p, lead_end, COM_MAX_LEN, ","); - - if (end_comment_pending == -1) /* we can set it now */ - end_comment_pending = lead_end[n - 1]; - - /* - * If the end of the comment is in the same line, don't use - * the comment leader. - */ - if (dir == FORWARD) - { - for (p = saved_line + lead_len; *p; ++p) - if (STRNCMP(p, lead_end, n) == 0) - { - comment_end = p; - lead_len = 0; - break; - } - } - - /* - * Doing "o" on a start of comment inserts the middle leader. - */ - if (lead_len > 0) - { - if (current_flag == COM_START) - { - lead_repl = lead_middle; - lead_repl_len = (int)STRLEN(lead_middle); - } - - /* - * If we have hit RETURN immediately after the start - * comment leader, then put a space after the middle - * comment leader on the next line. - */ - if (!VIM_ISWHITE(saved_line[lead_len - 1]) - && ((p_extra != NULL - && (int)curwin->w_cursor.col == lead_len) - || (p_extra == NULL - && saved_line[lead_len] == NUL) - || require_blank)) - extra_space = TRUE; - } - break; - } - if (*p == COM_END) - { - /* - * Doing "o" on the end of a comment does not insert leader. - * Remember where the end is, might want to use it to find the - * start (for C-comments). - */ - if (dir == FORWARD) - { - comment_end = skipwhite(saved_line); - lead_len = 0; - break; - } - - /* - * Doing "O" on the end of a comment inserts the middle leader. - * Find the string for the middle leader, searching backwards. - */ - while (p > curbuf->b_p_com && *p != ',') - --p; - for (lead_repl = p; lead_repl > curbuf->b_p_com - && lead_repl[-1] != ':'; --lead_repl) - ; - lead_repl_len = (int)(p - lead_repl); - - /* We can probably always add an extra space when doing "O" on - * the comment-end */ - extra_space = TRUE; - - /* Check whether we allow automatic ending of comments */ - for (p2 = p; *p2 && *p2 != ':'; p2++) - { - if (*p2 == COM_AUTO_END) - end_comment_pending = -1; /* means we want to set it */ - } - if (end_comment_pending == -1) - { - /* Find last character in end-comment string */ - while (*p2 && *p2 != ',') - p2++; - end_comment_pending = p2[-1]; - } - break; - } - if (*p == COM_FIRST) - { - /* - * Comment leader for first line only: Don't repeat leader - * when using "O", blank out leader when using "o". - */ - if (dir == BACKWARD) - lead_len = 0; - else - { - lead_repl = (char_u *)""; - lead_repl_len = 0; - } - break; - } - } - if (lead_len) - { - /* allocate buffer (may concatenate p_extra later) */ - leader = alloc(lead_len + lead_repl_len + extra_space + extra_len - + (second_line_indent > 0 ? second_line_indent : 0) + 1); - allocated = leader; /* remember to free it later */ - - if (leader == NULL) - lead_len = 0; - else - { - vim_strncpy(leader, saved_line, lead_len); - - /* - * Replace leader with lead_repl, right or left adjusted - */ - if (lead_repl != NULL) - { - int c = 0; - int off = 0; - - for (p = lead_flags; *p != NUL && *p != ':'; ) - { - if (*p == COM_RIGHT || *p == COM_LEFT) - c = *p++; - else if (VIM_ISDIGIT(*p) || *p == '-') - off = getdigits(&p); - else - ++p; - } - if (c == COM_RIGHT) /* right adjusted leader */ - { - /* find last non-white in the leader to line up with */ - for (p = leader + lead_len - 1; p > leader - && VIM_ISWHITE(*p); --p) - ; - ++p; - - /* Compute the length of the replaced characters in - * screen characters, not bytes. */ - { - int repl_size = vim_strnsize(lead_repl, - lead_repl_len); - int old_size = 0; - char_u *endp = p; - int l; - - while (old_size < repl_size && p > leader) - { - MB_PTR_BACK(leader, p); - old_size += ptr2cells(p); - } - l = lead_repl_len - (int)(endp - p); - if (l != 0) - mch_memmove(endp + l, endp, - (size_t)((leader + lead_len) - endp)); - lead_len += l; - } - mch_memmove(p, lead_repl, (size_t)lead_repl_len); - if (p + lead_repl_len > leader + lead_len) - p[lead_repl_len] = NUL; - - /* blank-out any other chars from the old leader. */ - while (--p >= leader) - { - int l = mb_head_off(leader, p); - - if (l > 1) - { - p -= l; - if (ptr2cells(p) > 1) - { - p[1] = ' '; - --l; - } - mch_memmove(p + 1, p + l + 1, - (size_t)((leader + lead_len) - (p + l + 1))); - lead_len -= l; - *p = ' '; - } - else if (!VIM_ISWHITE(*p)) - *p = ' '; - } - } - else /* left adjusted leader */ - { - p = skipwhite(leader); - - /* Compute the length of the replaced characters in - * screen characters, not bytes. Move the part that is - * not to be overwritten. */ - { - int repl_size = vim_strnsize(lead_repl, - lead_repl_len); - int i; - int l; - - for (i = 0; i < lead_len && p[i] != NUL; i += l) - { - l = (*mb_ptr2len)(p + i); - if (vim_strnsize(p, i + l) > repl_size) - break; - } - if (i != lead_repl_len) - { - mch_memmove(p + lead_repl_len, p + i, - (size_t)(lead_len - i - (p - leader))); - lead_len += lead_repl_len - i; - } - } - mch_memmove(p, lead_repl, (size_t)lead_repl_len); - - /* Replace any remaining non-white chars in the old - * leader by spaces. Keep Tabs, the indent must - * remain the same. */ - for (p += lead_repl_len; p < leader + lead_len; ++p) - if (!VIM_ISWHITE(*p)) - { - /* Don't put a space before a TAB. */ - if (p + 1 < leader + lead_len && p[1] == TAB) - { - --lead_len; - mch_memmove(p, p + 1, - (leader + lead_len) - p); - } - else - { - int l = (*mb_ptr2len)(p); - - if (l > 1) - { - if (ptr2cells(p) > 1) - { - /* Replace a double-wide char with - * two spaces */ - --l; - *p++ = ' '; - } - mch_memmove(p + 1, p + l, - (leader + lead_len) - p); - lead_len -= l - 1; - } - *p = ' '; - } - } - *p = NUL; - } - - /* Recompute the indent, it may have changed. */ - if (curbuf->b_p_ai -#ifdef FEAT_SMARTINDENT - || do_si -#endif - ) -#ifdef FEAT_VARTABS - newindent = get_indent_str_vtab(leader, curbuf->b_p_ts, - curbuf->b_p_vts_array, FALSE); -#else - newindent = get_indent_str(leader, - (int)curbuf->b_p_ts, FALSE); -#endif - - /* Add the indent offset */ - if (newindent + off < 0) - { - off = -newindent; - newindent = 0; - } - else - newindent += off; - - /* Correct trailing spaces for the shift, so that - * alignment remains equal. */ - while (off > 0 && lead_len > 0 - && leader[lead_len - 1] == ' ') - { - /* Don't do it when there is a tab before the space */ - if (vim_strchr(skipwhite(leader), '\t') != NULL) - break; - --lead_len; - --off; - } - - /* If the leader ends in white space, don't add an - * extra space */ - if (lead_len > 0 && VIM_ISWHITE(leader[lead_len - 1])) - extra_space = FALSE; - leader[lead_len] = NUL; - } - - if (extra_space) - { - leader[lead_len++] = ' '; - leader[lead_len] = NUL; - } - - newcol = lead_len; - - /* - * if a new indent will be set below, remove the indent that - * is in the comment leader - */ - if (newindent -#ifdef FEAT_SMARTINDENT - || did_si -#endif - ) - { - while (lead_len && VIM_ISWHITE(*leader)) - { - --lead_len; - --newcol; - ++leader; - } - } - - } -#ifdef FEAT_SMARTINDENT - did_si = can_si = FALSE; -#endif - } - else if (comment_end != NULL) - { - /* - * We have finished a comment, so we don't use the leader. - * If this was a C-comment and 'ai' or 'si' is set do a normal - * indent to align with the line containing the start of the - * comment. - */ - if (comment_end[0] == '*' && comment_end[1] == '/' && - (curbuf->b_p_ai -#ifdef FEAT_SMARTINDENT - || do_si -#endif - )) - { - old_cursor = curwin->w_cursor; - curwin->w_cursor.col = (colnr_T)(comment_end - saved_line); - if ((pos = findmatch(NULL, NUL)) != NULL) - { - curwin->w_cursor.lnum = pos->lnum; - newindent = get_indent(); - } - curwin->w_cursor = old_cursor; - } - } - } -#endif - - /* (State == INSERT || State == REPLACE), only when dir == FORWARD */ - if (p_extra != NULL) - { - *p_extra = saved_char; /* restore char that NUL replaced */ - - /* - * When 'ai' set or "flags" has OPENLINE_DELSPACES, skip to the first - * non-blank. - * - * When in REPLACE mode, put the deleted blanks on the replace stack, - * preceded by a NUL, so they can be put back when a BS is entered. - */ - if (REPLACE_NORMAL(State)) - replace_push(NUL); /* end of extra blanks */ - if (curbuf->b_p_ai || (flags & OPENLINE_DELSPACES)) - { - while ((*p_extra == ' ' || *p_extra == '\t') - && (!enc_utf8 - || !utf_iscomposing(utf_ptr2char(p_extra + 1)))) - { - if (REPLACE_NORMAL(State)) - replace_push(*p_extra); - ++p_extra; - ++less_cols_off; - } - } - - /* columns for marks adjusted for removed columns */ - less_cols = (int)(p_extra - saved_line); - } - - if (p_extra == NULL) - p_extra = (char_u *)""; /* append empty line */ - -#ifdef FEAT_COMMENTS - /* concatenate leader and p_extra, if there is a leader */ - if (lead_len) - { - if (flags & OPENLINE_COM_LIST && second_line_indent > 0) - { - int i; - int padding = second_line_indent - - (newindent + (int)STRLEN(leader)); - - /* Here whitespace is inserted after the comment char. - * Below, set_indent(newindent, SIN_INSERT) will insert the - * whitespace needed before the comment char. */ - for (i = 0; i < padding; i++) - { - STRCAT(leader, " "); - less_cols--; - newcol++; - } - } - STRCAT(leader, p_extra); - p_extra = leader; - did_ai = TRUE; /* So truncating blanks works with comments */ - less_cols -= lead_len; - } - else - end_comment_pending = NUL; /* turns out there was no leader */ -#endif - - old_cursor = curwin->w_cursor; - if (dir == BACKWARD) - --curwin->w_cursor.lnum; - if (!(State & VREPLACE_FLAG) || old_cursor.lnum >= orig_line_count) - { - if (ml_append(curwin->w_cursor.lnum, p_extra, (colnr_T)0, FALSE) - == FAIL) - goto theend; - /* Postpone calling changed_lines(), because it would mess up folding - * with markers. - * Skip mark_adjust when adding a line after the last one, there can't - * be marks there. But still needed in diff mode. */ - if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count -#ifdef FEAT_DIFF - || curwin->w_p_diff -#endif - ) - mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); - did_append = TRUE; - } - else - { - /* - * In VREPLACE mode we are starting to replace the next line. - */ - curwin->w_cursor.lnum++; - if (curwin->w_cursor.lnum >= Insstart.lnum + vr_lines_changed) - { - /* In case we NL to a new line, BS to the previous one, and NL - * again, we don't want to save the new line for undo twice. - */ - (void)u_save_cursor(); /* errors are ignored! */ - vr_lines_changed++; - } - ml_replace(curwin->w_cursor.lnum, p_extra, TRUE); - changed_bytes(curwin->w_cursor.lnum, 0); - curwin->w_cursor.lnum--; - did_append = FALSE; - } - - if (newindent -#ifdef FEAT_SMARTINDENT - || did_si -#endif - ) - { - ++curwin->w_cursor.lnum; -#ifdef FEAT_SMARTINDENT - if (did_si) - { - int sw = (int)get_sw_value(curbuf); - - if (p_sr) - newindent -= newindent % sw; - newindent += sw; - } -#endif - /* Copy the indent */ - if (curbuf->b_p_ci) - { - (void)copy_indent(newindent, saved_line); - - /* - * Set the 'preserveindent' option so that any further screwing - * with the line doesn't entirely destroy our efforts to preserve - * it. It gets restored at the function end. - */ - curbuf->b_p_pi = TRUE; - } - else - (void)set_indent(newindent, SIN_INSERT); - less_cols -= curwin->w_cursor.col; - - ai_col = curwin->w_cursor.col; - - /* - * In REPLACE mode, for each character in the new indent, there must - * be a NUL on the replace stack, for when it is deleted with BS - */ - if (REPLACE_NORMAL(State)) - for (n = 0; n < (int)curwin->w_cursor.col; ++n) - replace_push(NUL); - newcol += curwin->w_cursor.col; -#ifdef FEAT_SMARTINDENT - if (no_si) - did_si = FALSE; -#endif - } - -#ifdef FEAT_COMMENTS - /* - * In REPLACE mode, for each character in the extra leader, there must be - * a NUL on the replace stack, for when it is deleted with BS. - */ - if (REPLACE_NORMAL(State)) - while (lead_len-- > 0) - replace_push(NUL); -#endif - - curwin->w_cursor = old_cursor; - - if (dir == FORWARD) - { - if (trunc_line || (State & INSERT)) - { - /* truncate current line at cursor */ - saved_line[curwin->w_cursor.col] = NUL; - /* Remove trailing white space, unless OPENLINE_KEEPTRAIL used. */ - if (trunc_line && !(flags & OPENLINE_KEEPTRAIL)) - truncate_spaces(saved_line); - ml_replace(curwin->w_cursor.lnum, saved_line, FALSE); - saved_line = NULL; - if (did_append) - { - changed_lines(curwin->w_cursor.lnum, curwin->w_cursor.col, - curwin->w_cursor.lnum + 1, 1L); - did_append = FALSE; - - /* Move marks after the line break to the new line. */ - if (flags & OPENLINE_MARKFIX) - mark_col_adjust(curwin->w_cursor.lnum, - curwin->w_cursor.col + less_cols_off, - 1L, (long)-less_cols, 0); - } - else - changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col); - } - - /* - * Put the cursor on the new line. Careful: the scrollup() above may - * have moved w_cursor, we must use old_cursor. - */ - curwin->w_cursor.lnum = old_cursor.lnum + 1; - } - if (did_append) - changed_lines(curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L); - - curwin->w_cursor.col = newcol; - curwin->w_cursor.coladd = 0; - -#if defined(FEAT_LISP) || defined(FEAT_CINDENT) - /* - * In VREPLACE mode, we are handling the replace stack ourselves, so stop - * fixthisline() from doing it (via change_indent()) by telling it we're in - * normal INSERT mode. - */ - if (State & VREPLACE_FLAG) - { - vreplace_mode = State; /* So we know to put things right later */ - State = INSERT; - } - else - vreplace_mode = 0; -#endif -#ifdef FEAT_LISP - /* - * May do lisp indenting. - */ - if (!p_paste -# ifdef FEAT_COMMENTS - && leader == NULL -# endif - && curbuf->b_p_lisp - && curbuf->b_p_ai) - { - fixthisline(get_lisp_indent); - ai_col = (colnr_T)getwhitecols_curline(); - } -#endif -#ifdef FEAT_CINDENT - /* - * May do indenting after opening a new line. - */ - if (!p_paste - && (curbuf->b_p_cin -# ifdef FEAT_EVAL - || *curbuf->b_p_inde != NUL -# endif - ) - && in_cinkeys(dir == FORWARD - ? KEY_OPEN_FORW - : KEY_OPEN_BACK, ' ', linewhite(curwin->w_cursor.lnum))) - { - do_c_expr_indent(); - ai_col = (colnr_T)getwhitecols_curline(); - } -#endif -#if defined(FEAT_LISP) || defined(FEAT_CINDENT) - if (vreplace_mode != 0) - State = vreplace_mode; -#endif - - /* - * Finally, VREPLACE gets the stuff on the new line, then puts back the - * original line, and inserts the new stuff char by char, pushing old stuff - * onto the replace stack (via ins_char()). - */ - if (State & VREPLACE_FLAG) - { - /* Put new line in p_extra */ - p_extra = vim_strsave(ml_get_curline()); - if (p_extra == NULL) - goto theend; - - /* Put back original line */ - ml_replace(curwin->w_cursor.lnum, next_line, FALSE); - - /* Insert new stuff into line again */ - curwin->w_cursor.col = 0; - curwin->w_cursor.coladd = 0; - ins_bytes(p_extra); /* will call changed_bytes() */ - vim_free(p_extra); - next_line = NULL; - } - - retval = OK; /* success! */ -theend: - curbuf->b_p_pi = saved_pi; - vim_free(saved_line); - vim_free(next_line); - vim_free(allocated); - return retval; -} - #if defined(FEAT_COMMENTS) || defined(PROTO) /* * get_leader_len() returns the length in bytes of the prefix of the given @@ -2242,487 +1043,6 @@ plines_m_win(win_T *wp, linenr_T first, linenr_T last) return (count); } -/* - * Insert string "p" at the cursor position. Stops at a NUL byte. - * Handles Replace mode and multi-byte characters. - */ - void -ins_bytes(char_u *p) -{ - ins_bytes_len(p, (int)STRLEN(p)); -} - -/* - * Insert string "p" with length "len" at the cursor position. - * Handles Replace mode and multi-byte characters. - */ - void -ins_bytes_len(char_u *p, int len) -{ - int i; - int n; - - if (has_mbyte) - for (i = 0; i < len; i += n) - { - if (enc_utf8) - // avoid reading past p[len] - n = utfc_ptr2len_len(p + i, len - i); - else - n = (*mb_ptr2len)(p + i); - ins_char_bytes(p + i, n); - } - else - for (i = 0; i < len; ++i) - ins_char(p[i]); -} - -/* - * Insert or replace a single character at the cursor position. - * When in REPLACE or VREPLACE mode, replace any existing character. - * Caller must have prepared for undo. - * For multi-byte characters we get the whole character, the caller must - * convert bytes to a character. - */ - void -ins_char(int c) -{ - char_u buf[MB_MAXBYTES + 1]; - int n = (*mb_char2bytes)(c, buf); - - /* When "c" is 0x100, 0x200, etc. we don't want to insert a NUL byte. - * Happens for CTRL-Vu9900. */ - if (buf[0] == 0) - buf[0] = '\n'; - - ins_char_bytes(buf, n); -} - - void -ins_char_bytes(char_u *buf, int charlen) -{ - int c = buf[0]; - int newlen; // nr of bytes inserted - int oldlen; // nr of bytes deleted (0 when not replacing) - char_u *p; - char_u *newp; - char_u *oldp; - int linelen; // length of old line including NUL - colnr_T col; - linenr_T lnum = curwin->w_cursor.lnum; - int i; - - /* Break tabs if needed. */ - if (virtual_active() && curwin->w_cursor.coladd > 0) - coladvance_force(getviscol()); - - col = curwin->w_cursor.col; - oldp = ml_get(lnum); - linelen = (int)STRLEN(oldp) + 1; - - /* The lengths default to the values for when not replacing. */ - oldlen = 0; - newlen = charlen; - - if (State & REPLACE_FLAG) - { - if (State & VREPLACE_FLAG) - { - colnr_T new_vcol = 0; /* init for GCC */ - colnr_T vcol; - int old_list; - - /* - * Disable 'list' temporarily, unless 'cpo' contains the 'L' flag. - * Returns the old value of list, so when finished, - * curwin->w_p_list should be set back to this. - */ - old_list = curwin->w_p_list; - if (old_list && vim_strchr(p_cpo, CPO_LISTWM) == NULL) - curwin->w_p_list = FALSE; - - /* - * In virtual replace mode each character may replace one or more - * characters (zero if it's a TAB). Count the number of bytes to - * be deleted to make room for the new character, counting screen - * cells. May result in adding spaces to fill a gap. - */ - getvcol(curwin, &curwin->w_cursor, NULL, &vcol, NULL); - new_vcol = vcol + chartabsize(buf, vcol); - while (oldp[col + oldlen] != NUL && vcol < new_vcol) - { - vcol += chartabsize(oldp + col + oldlen, vcol); - /* Don't need to remove a TAB that takes us to the right - * position. */ - if (vcol > new_vcol && oldp[col + oldlen] == TAB) - break; - oldlen += (*mb_ptr2len)(oldp + col + oldlen); - /* Deleted a bit too much, insert spaces. */ - if (vcol > new_vcol) - newlen += vcol - new_vcol; - } - curwin->w_p_list = old_list; - } - else if (oldp[col] != NUL) - { - /* normal replace */ - oldlen = (*mb_ptr2len)(oldp + col); - } - - - /* Push the replaced bytes onto the replace stack, so that they can be - * put back when BS is used. The bytes of a multi-byte character are - * done the other way around, so that the first byte is popped off - * first (it tells the byte length of the character). */ - replace_push(NUL); - for (i = 0; i < oldlen; ++i) - { - if (has_mbyte) - i += replace_push_mb(oldp + col + i) - 1; - else - replace_push(oldp[col + i]); - } - } - - newp = alloc_check((unsigned)(linelen + newlen - oldlen)); - if (newp == NULL) - return; - - /* Copy bytes before the cursor. */ - if (col > 0) - mch_memmove(newp, oldp, (size_t)col); - - /* Copy bytes after the changed character(s). */ - p = newp + col; - if (linelen > col + oldlen) - mch_memmove(p + newlen, oldp + col + oldlen, - (size_t)(linelen - col - oldlen)); - - /* Insert or overwrite the new character. */ - mch_memmove(p, buf, charlen); - i = charlen; - - /* Fill with spaces when necessary. */ - while (i < newlen) - p[i++] = ' '; - - // Replace the line in the buffer. - ml_replace(lnum, newp, FALSE); - - // mark the buffer as changed and prepare for displaying - inserted_bytes(lnum, col, newlen - oldlen); - - /* - * If we're in Insert or Replace mode and 'showmatch' is set, then briefly - * show the match for right parens and braces. - */ - if (p_sm && (State & INSERT) - && msg_silent == 0 -#ifdef FEAT_INS_EXPAND - && !ins_compl_active() -#endif - ) - { - if (has_mbyte) - showmatch(mb_ptr2char(buf)); - else - showmatch(c); - } - -#ifdef FEAT_RIGHTLEFT - if (!p_ri || (State & REPLACE_FLAG)) -#endif - { - /* Normal insert: move cursor right */ - curwin->w_cursor.col += charlen; - } - /* - * TODO: should try to update w_row here, to avoid recomputing it later. - */ -} - -/* - * Insert a string at the cursor position. - * Note: Does NOT handle Replace mode. - * Caller must have prepared for undo. - */ - void -ins_str(char_u *s) -{ - char_u *oldp, *newp; - int newlen = (int)STRLEN(s); - int oldlen; - colnr_T col; - linenr_T lnum = curwin->w_cursor.lnum; - - if (virtual_active() && curwin->w_cursor.coladd > 0) - coladvance_force(getviscol()); - - col = curwin->w_cursor.col; - oldp = ml_get(lnum); - oldlen = (int)STRLEN(oldp); - - newp = alloc_check((unsigned)(oldlen + newlen + 1)); - if (newp == NULL) - return; - if (col > 0) - mch_memmove(newp, oldp, (size_t)col); - mch_memmove(newp + col, s, (size_t)newlen); - mch_memmove(newp + col + newlen, oldp + col, (size_t)(oldlen - col + 1)); - ml_replace(lnum, newp, FALSE); - inserted_bytes(lnum, col, newlen); - curwin->w_cursor.col += newlen; -} - -/* - * Delete one character under the cursor. - * If "fixpos" is TRUE, don't leave the cursor on the NUL after the line. - * Caller must have prepared for undo. - * - * return FAIL for failure, OK otherwise - */ - int -del_char(int fixpos) -{ - if (has_mbyte) - { - /* Make sure the cursor is at the start of a character. */ - mb_adjust_cursor(); - if (*ml_get_cursor() == NUL) - return FAIL; - return del_chars(1L, fixpos); - } - return del_bytes(1L, fixpos, TRUE); -} - -/* - * Like del_bytes(), but delete characters instead of bytes. - */ - int -del_chars(long count, int fixpos) -{ - long bytes = 0; - long i; - char_u *p; - int l; - - p = ml_get_cursor(); - for (i = 0; i < count && *p != NUL; ++i) - { - l = (*mb_ptr2len)(p); - bytes += l; - p += l; - } - return del_bytes(bytes, fixpos, TRUE); -} - -/* - * Delete "count" bytes under the cursor. - * If "fixpos" is TRUE, don't leave the cursor on the NUL after the line. - * Caller must have prepared for undo. - * - * Return FAIL for failure, OK otherwise. - */ - int -del_bytes( - long count, - int fixpos_arg, - int use_delcombine UNUSED) /* 'delcombine' option applies */ -{ - char_u *oldp, *newp; - colnr_T oldlen; - colnr_T newlen; - linenr_T lnum = curwin->w_cursor.lnum; - colnr_T col = curwin->w_cursor.col; - int alloc_newp; - long movelen; - int fixpos = fixpos_arg; - - oldp = ml_get(lnum); - oldlen = (int)STRLEN(oldp); - - /* Can't do anything when the cursor is on the NUL after the line. */ - if (col >= oldlen) - return FAIL; - - /* If "count" is zero there is nothing to do. */ - if (count == 0) - return OK; - - /* If "count" is negative the caller must be doing something wrong. */ - if (count < 1) - { - siemsg("E950: Invalid count for del_bytes(): %ld", count); - return FAIL; - } - - /* If 'delcombine' is set and deleting (less than) one character, only - * delete the last combining character. */ - if (p_deco && use_delcombine && enc_utf8 - && utfc_ptr2len(oldp + col) >= count) - { - int cc[MAX_MCO]; - int n; - - (void)utfc_ptr2char(oldp + col, cc); - if (cc[0] != NUL) - { - /* Find the last composing char, there can be several. */ - n = col; - do - { - col = n; - count = utf_ptr2len(oldp + n); - n += count; - } while (UTF_COMPOSINGLIKE(oldp + col, oldp + n)); - fixpos = 0; - } - } - - /* - * When count is too big, reduce it. - */ - movelen = (long)oldlen - (long)col - count + 1; /* includes trailing NUL */ - if (movelen <= 1) - { - /* - * If we just took off the last character of a non-blank line, and - * fixpos is TRUE, we don't want to end up positioned at the NUL, - * unless "restart_edit" is set or 'virtualedit' contains "onemore". - */ - if (col > 0 && fixpos && restart_edit == 0 - && (ve_flags & VE_ONEMORE) == 0) - { - --curwin->w_cursor.col; - curwin->w_cursor.coladd = 0; - if (has_mbyte) - curwin->w_cursor.col -= - (*mb_head_off)(oldp, oldp + curwin->w_cursor.col); - } - count = oldlen - col; - movelen = 1; - } - newlen = oldlen - count; - - /* - * If the old line has been allocated the deletion can be done in the - * existing line. Otherwise a new line has to be allocated - * Can't do this when using Netbeans, because we would need to invoke - * netbeans_removed(), which deallocates the line. Let ml_replace() take - * care of notifying Netbeans. - */ -#ifdef FEAT_NETBEANS_INTG - if (netbeans_active()) - alloc_newp = TRUE; - else -#endif - alloc_newp = !ml_line_alloced(); // check if oldp was allocated - if (!alloc_newp) - newp = oldp; // use same allocated memory - else - { // need to allocate a new line - newp = alloc((unsigned)(newlen + 1)); - if (newp == NULL) - return FAIL; - mch_memmove(newp, oldp, (size_t)col); - } - mch_memmove(newp + col, oldp + col + count, (size_t)movelen); - if (alloc_newp) - ml_replace(lnum, newp, FALSE); -#ifdef FEAT_TEXT_PROP - else - { - // Also move any following text properties. - if (oldlen + 1 < curbuf->b_ml.ml_line_len) - mch_memmove(newp + newlen + 1, oldp + oldlen + 1, - (size_t)curbuf->b_ml.ml_line_len - oldlen - 1); - curbuf->b_ml.ml_line_len -= count; - } -#endif - - // mark the buffer as changed and prepare for displaying - inserted_bytes(lnum, curwin->w_cursor.col, -count); - - return OK; -} - -/* - * Delete from cursor to end of line. - * Caller must have prepared for undo. - * - * return FAIL for failure, OK otherwise - */ - int -truncate_line( - int fixpos) /* if TRUE fix the cursor position when done */ -{ - char_u *newp; - linenr_T lnum = curwin->w_cursor.lnum; - colnr_T col = curwin->w_cursor.col; - - if (col == 0) - newp = vim_strsave((char_u *)""); - else - newp = vim_strnsave(ml_get(lnum), col); - - if (newp == NULL) - return FAIL; - - ml_replace(lnum, newp, FALSE); - - /* mark the buffer as changed and prepare for displaying */ - changed_bytes(lnum, curwin->w_cursor.col); - - /* - * If "fixpos" is TRUE we don't want to end up positioned at the NUL. - */ - if (fixpos && curwin->w_cursor.col > 0) - --curwin->w_cursor.col; - - return OK; -} - -/* - * Delete "nlines" lines at the cursor. - * Saves the lines for undo first if "undo" is TRUE. - */ - void -del_lines( - long nlines, /* number of lines to delete */ - int undo) /* if TRUE, prepare for undo */ -{ - long n; - linenr_T first = curwin->w_cursor.lnum; - - if (nlines <= 0) - return; - - /* save the deleted lines for undo */ - if (undo && u_savedel(first, nlines) == FAIL) - return; - - for (n = 0; n < nlines; ) - { - if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to delete */ - break; - - ml_delete(first, TRUE); - ++n; - - /* If we delete the last line in the file, stop */ - if (first > curbuf->b_ml.ml_line_count) - break; - } - - /* Correct the cursor position before calling deleted_lines_mark(), it may - * trigger a callback to display the cursor. */ - curwin->w_cursor.col = 0; - check_cursor_lnum(); - - /* adjust marks, mark the buffer as changed and prepare for displaying */ - deleted_lines_mark(first, n); -} - int gchar_pos(pos_T *pos) { @@ -2789,520 +1109,6 @@ skip_to_option_part(char_u *p) return p; } -/* - * Call this function when something in the current buffer is changed. - * - * Most often called through changed_bytes() and changed_lines(), which also - * mark the area of the display to be redrawn. - * - * Careful: may trigger autocommands that reload the buffer. - */ - void -changed(void) -{ -#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) - if (p_imst == IM_ON_THE_SPOT) - { - /* The text of the preediting area is inserted, but this doesn't - * mean a change of the buffer yet. That is delayed until the - * text is committed. (this means preedit becomes empty) */ - if (im_is_preediting() && !xim_changed_while_preediting) - return; - xim_changed_while_preediting = FALSE; - } -#endif - - if (!curbuf->b_changed) - { - int save_msg_scroll = msg_scroll; - - /* Give a warning about changing a read-only file. This may also - * check-out the file, thus change "curbuf"! */ - change_warning(0); - - /* Create a swap file if that is wanted. - * Don't do this for "nofile" and "nowrite" buffer types. */ - if (curbuf->b_may_swap -#ifdef FEAT_QUICKFIX - && !bt_dontwrite(curbuf) -#endif - ) - { - int save_need_wait_return = need_wait_return; - - need_wait_return = FALSE; - ml_open_file(curbuf); - - /* The ml_open_file() can cause an ATTENTION message. - * Wait two seconds, to make sure the user reads this unexpected - * message. Since we could be anywhere, call wait_return() now, - * and don't let the emsg() set msg_scroll. */ - if (need_wait_return && emsg_silent == 0) - { - out_flush(); - ui_delay(2000L, TRUE); - wait_return(TRUE); - msg_scroll = save_msg_scroll; - } - else - need_wait_return = save_need_wait_return; - } - changed_int(); - } - ++CHANGEDTICK(curbuf); - -#ifdef FEAT_SEARCH_EXTRA - // If a pattern is highlighted, the position may now be invalid. - highlight_match = FALSE; -#endif -} - -/* - * Internal part of changed(), no user interaction. - */ - void -changed_int(void) -{ - curbuf->b_changed = TRUE; - ml_setflags(curbuf); - check_status(curbuf); - redraw_tabline = TRUE; -#ifdef FEAT_TITLE - need_maketitle = TRUE; /* set window title later */ -#endif -} - -static void changedOneline(buf_T *buf, linenr_T lnum); -static void changed_lines_buf(buf_T *buf, linenr_T lnum, linenr_T lnume, long xtra); -static void changed_common(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra); - -/* - * Changed bytes within a single line for the current buffer. - * - marks the windows on this buffer to be redisplayed - * - marks the buffer changed by calling changed() - * - invalidates cached values - * Careful: may trigger autocommands that reload the buffer. - */ - void -changed_bytes(linenr_T lnum, colnr_T col) -{ - changedOneline(curbuf, lnum); - changed_common(lnum, col, lnum + 1, 0L); - -#ifdef FEAT_DIFF - /* Diff highlighting in other diff windows may need to be updated too. */ - if (curwin->w_p_diff) - { - win_T *wp; - linenr_T wlnum; - - FOR_ALL_WINDOWS(wp) - if (wp->w_p_diff && wp != curwin) - { - redraw_win_later(wp, VALID); - wlnum = diff_lnum_win(lnum, wp); - if (wlnum > 0) - changedOneline(wp->w_buffer, wlnum); - } - } -#endif -} - -/* - * Like changed_bytes() but also adjust text properties for "added" bytes. - * When "added" is negative text was deleted. - */ - void -inserted_bytes(linenr_T lnum, colnr_T col, int added UNUSED) -{ - changed_bytes(lnum, col); - -#ifdef FEAT_TEXT_PROP - if (curbuf->b_has_textprop && added != 0) - adjust_prop_columns(lnum, col, added); -#endif -} - - static void -changedOneline(buf_T *buf, linenr_T lnum) -{ - if (buf->b_mod_set) - { - /* find the maximum area that must be redisplayed */ - if (lnum < buf->b_mod_top) - buf->b_mod_top = lnum; - else if (lnum >= buf->b_mod_bot) - buf->b_mod_bot = lnum + 1; - } - else - { - /* set the area that must be redisplayed to one line */ - buf->b_mod_set = TRUE; - buf->b_mod_top = lnum; - buf->b_mod_bot = lnum + 1; - buf->b_mod_xlines = 0; - } -} - -/* - * Appended "count" lines below line "lnum" in the current buffer. - * Must be called AFTER the change and after mark_adjust(). - * Takes care of marking the buffer to be redrawn and sets the changed flag. - */ - void -appended_lines(linenr_T lnum, long count) -{ - changed_lines(lnum + 1, 0, lnum + 1, count); -} - -/* - * Like appended_lines(), but adjust marks first. - */ - void -appended_lines_mark(linenr_T lnum, long count) -{ - /* Skip mark_adjust when adding a line after the last one, there can't - * be marks there. But it's still needed in diff mode. */ - if (lnum + count < curbuf->b_ml.ml_line_count -#ifdef FEAT_DIFF - || curwin->w_p_diff -#endif - ) - mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L); - changed_lines(lnum + 1, 0, lnum + 1, count); -} - -/* - * Deleted "count" lines at line "lnum" in the current buffer. - * Must be called AFTER the change and after mark_adjust(). - * Takes care of marking the buffer to be redrawn and sets the changed flag. - */ - void -deleted_lines(linenr_T lnum, long count) -{ - changed_lines(lnum, 0, lnum + count, -count); -} - -/* - * Like deleted_lines(), but adjust marks first. - * Make sure the cursor is on a valid line before calling, a GUI callback may - * be triggered to display the cursor. - */ - void -deleted_lines_mark(linenr_T lnum, long count) -{ - mark_adjust(lnum, (linenr_T)(lnum + count - 1), (long)MAXLNUM, -count); - changed_lines(lnum, 0, lnum + count, -count); -} - -/* - * Changed lines for the current buffer. - * Must be called AFTER the change and after mark_adjust(). - * - mark the buffer changed by calling changed() - * - mark the windows on this buffer to be redisplayed - * - invalidate cached values - * "lnum" is the first line that needs displaying, "lnume" the first line - * below the changed lines (BEFORE the change). - * When only inserting lines, "lnum" and "lnume" are equal. - * Takes care of calling changed() and updating b_mod_*. - * Careful: may trigger autocommands that reload the buffer. - */ - void -changed_lines( - linenr_T lnum, /* first line with change */ - colnr_T col, /* column in first line with change */ - linenr_T lnume, /* line below last changed line */ - long xtra) /* number of extra lines (negative when deleting) */ -{ - changed_lines_buf(curbuf, lnum, lnume, xtra); - -#ifdef FEAT_DIFF - if (xtra == 0 && curwin->w_p_diff && !diff_internal()) - { - /* When the number of lines doesn't change then mark_adjust() isn't - * called and other diff buffers still need to be marked for - * displaying. */ - win_T *wp; - linenr_T wlnum; - - FOR_ALL_WINDOWS(wp) - if (wp->w_p_diff && wp != curwin) - { - redraw_win_later(wp, VALID); - wlnum = diff_lnum_win(lnum, wp); - if (wlnum > 0) - changed_lines_buf(wp->w_buffer, wlnum, - lnume - lnum + wlnum, 0L); - } - } -#endif - - changed_common(lnum, col, lnume, xtra); -} - - static void -changed_lines_buf( - buf_T *buf, - linenr_T lnum, /* first line with change */ - linenr_T lnume, /* line below last changed line */ - long xtra) /* number of extra lines (negative when deleting) */ -{ - if (buf->b_mod_set) - { - /* find the maximum area that must be redisplayed */ - if (lnum < buf->b_mod_top) - buf->b_mod_top = lnum; - if (lnum < buf->b_mod_bot) - { - /* adjust old bot position for xtra lines */ - buf->b_mod_bot += xtra; - if (buf->b_mod_bot < lnum) - buf->b_mod_bot = lnum; - } - if (lnume + xtra > buf->b_mod_bot) - buf->b_mod_bot = lnume + xtra; - buf->b_mod_xlines += xtra; - } - else - { - /* set the area that must be redisplayed */ - buf->b_mod_set = TRUE; - buf->b_mod_top = lnum; - buf->b_mod_bot = lnume + xtra; - buf->b_mod_xlines = xtra; - } -} - -/* - * Common code for when a change is was made. - * See changed_lines() for the arguments. - * Careful: may trigger autocommands that reload the buffer. - */ - static void -changed_common( - linenr_T lnum, - colnr_T col, - linenr_T lnume, - long xtra) -{ - win_T *wp; - tabpage_T *tp; - int i; -#ifdef FEAT_JUMPLIST - int cols; - pos_T *p; - int add; -#endif - - /* mark the buffer as modified */ - changed(); - -#ifdef FEAT_DIFF - if (curwin->w_p_diff && diff_internal()) - curtab->tp_diff_update = TRUE; -#endif - - /* set the '. mark */ - if (!cmdmod.keepjumps) - { - curbuf->b_last_change.lnum = lnum; - curbuf->b_last_change.col = col; - -#ifdef FEAT_JUMPLIST - /* Create a new entry if a new undo-able change was started or we - * don't have an entry yet. */ - if (curbuf->b_new_change || curbuf->b_changelistlen == 0) - { - if (curbuf->b_changelistlen == 0) - add = TRUE; - else - { - /* Don't create a new entry when the line number is the same - * as the last one and the column is not too far away. Avoids - * creating many entries for typing "xxxxx". */ - p = &curbuf->b_changelist[curbuf->b_changelistlen - 1]; - if (p->lnum != lnum) - add = TRUE; - else - { - cols = comp_textwidth(FALSE); - if (cols == 0) - cols = 79; - add = (p->col + cols < col || col + cols < p->col); - } - } - if (add) - { - /* This is the first of a new sequence of undo-able changes - * and it's at some distance of the last change. Use a new - * position in the changelist. */ - curbuf->b_new_change = FALSE; - - if (curbuf->b_changelistlen == JUMPLISTSIZE) - { - /* changelist is full: remove oldest entry */ - curbuf->b_changelistlen = JUMPLISTSIZE - 1; - mch_memmove(curbuf->b_changelist, curbuf->b_changelist + 1, - sizeof(pos_T) * (JUMPLISTSIZE - 1)); - FOR_ALL_TAB_WINDOWS(tp, wp) - { - /* Correct position in changelist for other windows on - * this buffer. */ - if (wp->w_buffer == curbuf && wp->w_changelistidx > 0) - --wp->w_changelistidx; - } - } - FOR_ALL_TAB_WINDOWS(tp, wp) - { - /* For other windows, if the position in the changelist is - * at the end it stays at the end. */ - if (wp->w_buffer == curbuf - && wp->w_changelistidx == curbuf->b_changelistlen) - ++wp->w_changelistidx; - } - ++curbuf->b_changelistlen; - } - } - curbuf->b_changelist[curbuf->b_changelistlen - 1] = - curbuf->b_last_change; - /* The current window is always after the last change, so that "g," - * takes you back to it. */ - curwin->w_changelistidx = curbuf->b_changelistlen; -#endif - } - - FOR_ALL_TAB_WINDOWS(tp, wp) - { - if (wp->w_buffer == curbuf) - { - /* Mark this window to be redrawn later. */ - if (wp->w_redr_type < VALID) - wp->w_redr_type = VALID; - - /* Check if a change in the buffer has invalidated the cached - * values for the cursor. */ -#ifdef FEAT_FOLDING - /* - * Update the folds for this window. Can't postpone this, because - * a following operator might work on the whole fold: ">>dd". - */ - foldUpdate(wp, lnum, lnume + xtra - 1); - - /* The change may cause lines above or below the change to become - * included in a fold. Set lnum/lnume to the first/last line that - * might be displayed differently. - * Set w_cline_folded here as an efficient way to update it when - * inserting lines just above a closed fold. */ - i = hasFoldingWin(wp, lnum, &lnum, NULL, FALSE, NULL); - if (wp->w_cursor.lnum == lnum) - wp->w_cline_folded = i; - i = hasFoldingWin(wp, lnume, NULL, &lnume, FALSE, NULL); - if (wp->w_cursor.lnum == lnume) - wp->w_cline_folded = i; - - /* If the changed line is in a range of previously folded lines, - * compare with the first line in that range. */ - if (wp->w_cursor.lnum <= lnum) - { - i = find_wl_entry(wp, lnum); - if (i >= 0 && wp->w_cursor.lnum > wp->w_lines[i].wl_lnum) - changed_line_abv_curs_win(wp); - } -#endif - - if (wp->w_cursor.lnum > lnum) - changed_line_abv_curs_win(wp); - else if (wp->w_cursor.lnum == lnum && wp->w_cursor.col >= col) - changed_cline_bef_curs_win(wp); - if (wp->w_botline >= lnum) - { - /* Assume that botline doesn't change (inserted lines make - * other lines scroll down below botline). */ - approximate_botline_win(wp); - } - - /* Check if any w_lines[] entries have become invalid. - * For entries below the change: Correct the lnums for - * inserted/deleted lines. Makes it possible to stop displaying - * after the change. */ - for (i = 0; i < wp->w_lines_valid; ++i) - if (wp->w_lines[i].wl_valid) - { - if (wp->w_lines[i].wl_lnum >= lnum) - { - if (wp->w_lines[i].wl_lnum < lnume) - { - /* line included in change */ - wp->w_lines[i].wl_valid = FALSE; - } - else if (xtra != 0) - { - /* line below change */ - wp->w_lines[i].wl_lnum += xtra; -#ifdef FEAT_FOLDING - wp->w_lines[i].wl_lastlnum += xtra; -#endif - } - } -#ifdef FEAT_FOLDING - else if (wp->w_lines[i].wl_lastlnum >= lnum) - { - /* change somewhere inside this range of folded lines, - * may need to be redrawn */ - wp->w_lines[i].wl_valid = FALSE; - } -#endif - } - -#ifdef FEAT_FOLDING - /* Take care of side effects for setting w_topline when folds have - * changed. Esp. when the buffer was changed in another window. */ - if (hasAnyFolding(wp)) - set_topline(wp, wp->w_topline); -#endif - /* relative numbering may require updating more */ - if (wp->w_p_rnu) - redraw_win_later(wp, SOME_VALID); - } - } - - /* Call update_screen() later, which checks out what needs to be redrawn, - * since it notices b_mod_set and then uses b_mod_*. */ - if (must_redraw < VALID) - must_redraw = VALID; - - /* when the cursor line is changed always trigger CursorMoved */ - if (lnum <= curwin->w_cursor.lnum - && lnume + (xtra < 0 ? -xtra : xtra) > curwin->w_cursor.lnum) - last_cursormoved.lnum = 0; -} - -/* - * unchanged() is called when the changed flag must be reset for buffer 'buf' - */ - void -unchanged( - buf_T *buf, - int ff) /* also reset 'fileformat' */ -{ - if (buf->b_changed || (ff && file_ff_differs(buf, FALSE))) - { - buf->b_changed = 0; - ml_setflags(buf); - if (ff) - save_file_ff(buf); - check_status(buf); - redraw_tabline = TRUE; -#ifdef FEAT_TITLE - need_maketitle = TRUE; /* set window title later */ -#endif - } - ++CHANGEDTICK(buf); -#ifdef FEAT_NETBEANS_INTG - netbeans_unmodified(buf); -#endif -} - /* * check_status: called when the status bars for the buffer 'buf' * need to be updated @@ -3321,61 +1127,6 @@ check_status(buf_T *buf) } } -/* - * If the file is readonly, give a warning message with the first change. - * Don't do this for autocommands. - * Don't use emsg(), because it flushes the macro buffer. - * If we have undone all changes b_changed will be FALSE, but "b_did_warn" - * will be TRUE. - * Careful: may trigger autocommands that reload the buffer. - */ - void -change_warning( - int col) /* column for message; non-zero when in insert - mode and 'showmode' is on */ -{ - static char *w_readonly = N_("W10: Warning: Changing a readonly file"); - - if (curbuf->b_did_warn == FALSE - && curbufIsChanged() == 0 - && !autocmd_busy - && curbuf->b_p_ro) - { - ++curbuf_lock; - apply_autocmds(EVENT_FILECHANGEDRO, NULL, NULL, FALSE, curbuf); - --curbuf_lock; - if (!curbuf->b_p_ro) - return; - /* - * Do what msg() does, but with a column offset if the warning should - * be after the mode message. - */ - msg_start(); - if (msg_row == Rows - 1) - msg_col = col; - msg_source(HL_ATTR(HLF_W)); - msg_puts_attr(_(w_readonly), HL_ATTR(HLF_W) | MSG_HIST); -#ifdef FEAT_EVAL - set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_readonly), -1); -#endif - msg_clr_eos(); - (void)msg_end(); - if (msg_silent == 0 && !silent_mode -#ifdef FEAT_EVAL - && time_for_testing != 1 -#endif - ) - { - out_flush(); - ui_delay(1000L, TRUE); /* give the user time to think about it */ - } - curbuf->b_did_warn = TRUE; - redraw_cmdline = FALSE; /* don't redraw and erase the message */ - if (msg_row < Rows - 1) - showmode(); - } -} - /* * Ask for a reply from the user, a 'y' or a 'n'. * No other characters are accepted, the message is repeated until a valid diff --git a/src/proto.h b/src/proto.h index 80272327c3..4d2edede9f 100644 --- a/src/proto.h +++ b/src/proto.h @@ -63,6 +63,7 @@ extern int _stricoll(char *a, char *b); # endif # include "autocmd.pro" # include "buffer.pro" +# include "change.pro" # include "charset.pro" # ifdef FEAT_CSCOPE # include "if_cscope.pro" diff --git a/src/proto/misc1.pro b/src/proto/misc1.pro index 6a2a5f1142..ed8e99c083 100644 --- a/src/proto/misc1.pro +++ b/src/proto/misc1.pro @@ -7,7 +7,6 @@ int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list); int set_indent(int size, int flags); int get_number_indent(linenr_T lnum); int get_breakindent_win(win_T *wp, char_u *line); -int open_line(int dir, int flags, int second_line_indent); int get_leader_len(char_u *line, char_u **flags, int backward, int include_space); int get_last_leader_offset(char_u *line, char_u **flags); int plines(linenr_T lnum); @@ -17,33 +16,12 @@ int plines_win_nofill(win_T *wp, linenr_T lnum, int winheight); int plines_win_nofold(win_T *wp, linenr_T lnum); int plines_win_col(win_T *wp, linenr_T lnum, long column); int plines_m_win(win_T *wp, linenr_T first, linenr_T last); -void ins_bytes(char_u *p); -void ins_bytes_len(char_u *p, int len); -void ins_char(int c); -void ins_char_bytes(char_u *buf, int charlen); -void ins_str(char_u *s); -int del_char(int fixpos); -int del_chars(long count, int fixpos); -int del_bytes(long count, int fixpos_arg, int use_delcombine); -int truncate_line(int fixpos); -void del_lines(long nlines, int undo); int gchar_pos(pos_T *pos); int gchar_cursor(void); void pchar_cursor(int c); int inindent(int extra); char_u *skip_to_option_part(char_u *p); -void changed(void); -void changed_int(void); -void changed_bytes(linenr_T lnum, colnr_T col); -void inserted_bytes(linenr_T lnum, colnr_T col, int added); -void appended_lines(linenr_T lnum, long count); -void appended_lines_mark(linenr_T lnum, long count); -void deleted_lines(linenr_T lnum, long count); -void deleted_lines_mark(linenr_T lnum, long count); -void changed_lines(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra); -void unchanged(buf_T *buf, int ff); void check_status(buf_T *buf); -void change_warning(int col); int ask_yesno(char_u *str, int direct); int is_mouse_key(int c); int get_keystroke(void); From 6ed8819822994512c160006bd1204aa11ae3c494 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 18:37:44 +0200 Subject: [PATCH 51/97] patch 8.1.1319: computing function length name in many places Problem: Computing function length name in many places. Solution: compute name length in call_func(). --- src/channel.c | 12 +++++------- src/eval.c | 8 ++++---- src/evalfunc.c | 9 +++++---- src/ex_cmds2.c | 2 +- src/regexp.c | 4 ++-- src/terminal.c | 2 +- src/userfunc.c | 50 +++++++++++++++++++++++++------------------------- src/version.c | 4 ++++ 8 files changed, 47 insertions(+), 44 deletions(-) diff --git a/src/channel.c b/src/channel.c index a29414f69f..31c9bbe229 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1650,7 +1650,7 @@ invoke_callback(channel_T *channel, char_u *callback, partial_T *partial, argv[0].v_type = VAR_CHANNEL; argv[0].vval.v_channel = channel; - call_func(callback, (int)STRLEN(callback), &rettv, 2, argv, NULL, + call_func(callback, -1, &rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE, partial, NULL); clear_tv(&rettv); channel_need_redraw = TRUE; @@ -2989,7 +2989,7 @@ channel_close(channel_T *channel, int invoke_close_cb) (char *)channel->ch_close_cb); argv[0].v_type = VAR_CHANNEL; argv[0].vval.v_channel = channel; - call_func(channel->ch_close_cb, (int)STRLEN(channel->ch_close_cb), + call_func(channel->ch_close_cb, -1, &rettv, 1, argv, NULL, 0L, 0L, &dummy, TRUE, channel->ch_close_partial, NULL); clear_tv(&rettv); @@ -5478,7 +5478,7 @@ job_cleanup(job_T *job) argv[0].vval.v_job = job; argv[1].v_type = VAR_NUMBER; argv[1].vval.v_number = job->jv_exitval; - call_func(job->jv_exit_cb, (int)STRLEN(job->jv_exit_cb), + call_func(job->jv_exit_cb, -1, &rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE, job->jv_exit_partial, NULL); clear_tv(&rettv); @@ -6069,8 +6069,7 @@ invoke_prompt_callback(void) argv[0].vval.v_string = vim_strsave(text); argv[1].v_type = VAR_UNKNOWN; - call_func(curbuf->b_prompt_callback, - (int)STRLEN(curbuf->b_prompt_callback), + call_func(curbuf->b_prompt_callback, -1, &rettv, 1, argv, NULL, 0L, 0L, &dummy, TRUE, curbuf->b_prompt_partial, NULL); clear_tv(&argv[0]); @@ -6093,8 +6092,7 @@ invoke_prompt_interrupt(void) argv[0].v_type = VAR_UNKNOWN; got_int = FALSE; // don't skip executing commands - call_func(curbuf->b_prompt_interrupt, - (int)STRLEN(curbuf->b_prompt_interrupt), + call_func(curbuf->b_prompt_interrupt, -1, &rettv, 0, argv, NULL, 0L, 0L, &dummy, TRUE, curbuf->b_prompt_int_partial, NULL); clear_tv(&rettv); diff --git a/src/eval.c b/src/eval.c index fe8a8efe77..7df5455849 100644 --- a/src/eval.c +++ b/src/eval.c @@ -765,7 +765,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv) s = expr->vval.v_string; if (s == NULL || *s == NUL) return FAIL; - if (call_func(s, (int)STRLEN(s), rettv, argc, argv, NULL, + if (call_func(s, -1, rettv, argc, argv, NULL, 0L, 0L, &dummy, TRUE, NULL, NULL) == FAIL) return FAIL; } @@ -776,7 +776,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv) s = partial_name(partial); if (s == NULL || *s == NUL) return FAIL; - if (call_func(s, (int)STRLEN(s), rettv, argc, argv, NULL, + if (call_func(s, -1, rettv, argc, argv, NULL, 0L, 0L, &dummy, TRUE, partial, NULL) == FAIL) return FAIL; } @@ -1088,7 +1088,7 @@ call_vim_function( int ret; rettv->v_type = VAR_UNKNOWN; /* clear_tv() uses this */ - ret = call_func(func, (int)STRLEN(func), rettv, argc, argv, NULL, + ret = call_func(func, -1, rettv, argc, argv, NULL, curwin->w_cursor.lnum, curwin->w_cursor.lnum, &doesrange, TRUE, NULL, NULL); if (ret == FAIL) @@ -7109,7 +7109,7 @@ handle_subscript( } else s = (char_u *)""; - ret = get_func_tv(s, (int)STRLEN(s), rettv, arg, + ret = get_func_tv(s, -1, rettv, arg, curwin->w_cursor.lnum, curwin->w_cursor.lnum, &len, evaluate, pt, selfdict); diff --git a/src/evalfunc.c b/src/evalfunc.c index ff51d1210a..02ca1ae828 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -767,6 +767,8 @@ static struct fst {"line2byte", 1, 1, f_line2byte}, {"lispindent", 1, 1, f_lispindent}, {"list2str", 1, 2, f_list2str}, + {"listener_add", 1, 2, f_listener_add}, + {"listener_remove", 1, 1, f_listener_remove}, {"localtime", 0, 0, f_localtime}, #ifdef FEAT_FLOAT {"log", 1, 1, f_log}, @@ -9746,9 +9748,9 @@ f_readfile(typval_T *argvars, typval_T *rettv) if (failed) { + // an empty list is returned on error list_free(rettv->vval.v_list); - /* readfile doc says an empty list is returned on error */ - rettv->vval.v_list = list_alloc(); + rettv_list_alloc(rettv); } vim_free(prev); @@ -12644,8 +12646,7 @@ item_compare2(const void *s1, const void *s2) copy_tv(&si2->item->li_tv, &argv[1]); rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ - res = call_func(func_name, (int)STRLEN(func_name), - &rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE, + res = call_func(func_name, -1, &rettv, 2, argv, NULL, 0L, 0L, &dummy, TRUE, partial, sortinfo->item_compare_selfdict); clear_tv(&argv[0]); clear_tv(&argv[1]); diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 8bab8536b3..18c438ce0c 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -325,7 +325,7 @@ timer_callback(timer_T *timer) argv[0].vval.v_number = (varnumber_T)timer->tr_id; argv[1].v_type = VAR_UNKNOWN; - call_func(timer->tr_callback, (int)STRLEN(timer->tr_callback), + call_func(timer->tr_callback, -1, &rettv, 1, argv, NULL, 0L, 0L, &dummy, TRUE, timer->tr_partial, NULL); clear_tv(&rettv); diff --git a/src/regexp.c b/src/regexp.c index ceeb899ad2..ee485a3ab5 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -7423,7 +7423,7 @@ vim_regsub_both( if (expr->v_type == VAR_FUNC) { s = expr->vval.v_string; - call_func(s, (int)STRLEN(s), &rettv, + call_func(s, -1, &rettv, 1, argv, fill_submatch_list, 0L, 0L, &dummy, TRUE, NULL, NULL); } @@ -7432,7 +7432,7 @@ vim_regsub_both( partial_T *partial = expr->vval.v_partial; s = partial_name(partial); - call_func(s, (int)STRLEN(s), &rettv, + call_func(s, -1, &rettv, 1, argv, fill_submatch_list, 0L, 0L, &dummy, TRUE, partial, NULL); } diff --git a/src/terminal.c b/src/terminal.c index f007bf23ae..bc57d641fa 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -3779,7 +3779,7 @@ handle_call_command(term_T *term, channel_T *channel, listitem_T *item) argvars[0].v_type = VAR_NUMBER; argvars[0].vval.v_number = term->tl_buffer->b_fnum; argvars[1] = item->li_next->li_tv; - if (call_func(func, (int)STRLEN(func), &rettv, + if (call_func(func, -1, &rettv, 2, argvars, /* argv_func */ NULL, /* firstline */ 1, /* lastline */ 1, &doesrange, /* evaluate */ TRUE, diff --git a/src/userfunc.c b/src/userfunc.c index d8cbe635ee..4959b0d6a5 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -432,16 +432,16 @@ emsg_funcname(char *ermsg, char_u *name) */ int get_func_tv( - char_u *name, /* name of the function */ - int len, /* length of "name" */ + char_u *name, // name of the function + int len, // length of "name" or -1 to use strlen() typval_T *rettv, - char_u **arg, /* argument, pointing to the '(' */ - linenr_T firstline, /* first line of range */ - linenr_T lastline, /* last line of range */ - int *doesrange, /* return: function handled range */ + char_u **arg, // argument, pointing to the '(' + linenr_T firstline, // first line of range + linenr_T lastline, // last line of range + int *doesrange, // return: function handled range int evaluate, - partial_T *partial, /* for extra arguments */ - dict_T *selfdict) /* Dictionary for "self" */ + partial_T *partial, // for extra arguments + dict_T *selfdict) // Dictionary for "self" { char_u *argp; int ret = OK; @@ -1435,7 +1435,7 @@ func_call( } if (item == NULL) - r = call_func(name, (int)STRLEN(name), rettv, argc, argv, NULL, + r = call_func(name, -1, rettv, argc, argv, NULL, curwin->w_cursor.lnum, curwin->w_cursor.lnum, &dummy, TRUE, partial, selfdict); @@ -1458,20 +1458,20 @@ func_call( */ int call_func( - char_u *funcname, /* name of the function */ - int len, /* length of "name" */ - typval_T *rettv, /* return value goes here */ - int argcount_in, /* number of "argvars" */ - typval_T *argvars_in, /* vars for arguments, must have "argcount" - PLUS ONE elements! */ + char_u *funcname, // name of the function + int len, // length of "name" or -1 to use strlen() + typval_T *rettv, // return value goes here + int argcount_in, // number of "argvars" + typval_T *argvars_in, // vars for arguments, must have "argcount" + // PLUS ONE elements! int (* argv_func)(int, typval_T *, int), - /* function to fill in argvars */ - linenr_T firstline, /* first line of range */ - linenr_T lastline, /* last line of range */ - int *doesrange, /* return: function handled range */ + // function to fill in argvars + linenr_T firstline, // first line of range + linenr_T lastline, // last line of range + int *doesrange, // return: function handled range int evaluate, - partial_T *partial, /* optional, can be NULL */ - dict_T *selfdict_in) /* Dictionary for "self" */ + partial_T *partial, // optional, can be NULL + dict_T *selfdict_in) // Dictionary for "self" { int ret = FAIL; int error = ERROR_NONE; @@ -1487,9 +1487,9 @@ call_func( typval_T argv[MAX_FUNC_ARGS + 1]; /* used when "partial" is not NULL */ int argv_clear = 0; - /* Make a copy of the name, if it comes from a funcref variable it could - * be changed or deleted in the called function. */ - name = vim_strnsave(funcname, len); + // Make a copy of the name, if it comes from a funcref variable it could + // be changed or deleted in the called function. + name = len > 0 ? vim_strnsave(funcname, len) : vim_strsave(funcname); if (name == NULL) return ret; @@ -3285,7 +3285,7 @@ ex_call(exarg_T *eap) curwin->w_cursor.coladd = 0; } arg = startarg; - if (get_func_tv(name, (int)STRLEN(name), &rettv, &arg, + if (get_func_tv(name, -1, &rettv, &arg, eap->line1, eap->line2, &doesrange, !eap->skip, partial, fudi.fd_dict) == FAIL) { diff --git a/src/version.c b/src/version.c index ea97befd37..7bcb8c8735 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,10 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1319, +/**/ + 1318, /**/ 1317, /**/ From 6d2399bd1053b367e13cc2b8991d3ff0bf724c7c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 19:14:16 +0200 Subject: [PATCH 52/97] patch 8.1.1320: it is not possible to track changes to a buffer Problem: It is not possible to track changes to a buffer. Solution: Add listener_add() and listener_remove(). No docs or tests yet. --- src/change.c | 131 +++++++++++++++++++++++++++++++++++++++++++ src/proto/change.pro | 3 + src/structs.h | 15 +++++ src/version.c | 2 + 4 files changed, 151 insertions(+) diff --git a/src/change.c b/src/change.c index 750634b26e..06d20f4ac2 100644 --- a/src/change.c +++ b/src/change.c @@ -151,6 +151,134 @@ changed_internal(void) #endif } +#ifdef FEAT_EVAL +static list_T *recorded_changes = NULL; +static long next_listener_id = 0; + +/* + * Record a change for listeners added with listener_add(). + */ + static void +may_record_change( + linenr_T lnum, + colnr_T col, + linenr_T lnume, + long xtra) +{ + dict_T *dict; + + if (curbuf->b_listener == NULL) + return; + if (recorded_changes == NULL) + { + recorded_changes = list_alloc(); + if (recorded_changes == NULL) // out of memory + return; + ++recorded_changes->lv_refcount; + recorded_changes->lv_lock = VAR_FIXED; + } + + dict = dict_alloc(); + if (dict == NULL) + return; + dict_add_number(dict, "lnum", (varnumber_T)lnum); + dict_add_number(dict, "end", (varnumber_T)lnume); + dict_add_number(dict, "added", (varnumber_T)xtra); + dict_add_number(dict, "col", (varnumber_T)col); + + list_append_dict(recorded_changes, dict); +} + +/* + * listener_add() function + */ + void +f_listener_add(typval_T *argvars, typval_T *rettv) +{ + char_u *callback; + partial_T *partial; + listener_T *lnr; + + callback = get_callback(&argvars[0], &partial); + if (callback == NULL) + return; + + lnr = (listener_T *)alloc_clear((sizeof(listener_T))); + if (lnr == NULL) + { + free_callback(callback, partial); + return; + } + lnr->lr_next = curbuf->b_listener; + curbuf->b_listener = lnr; + + if (partial == NULL) + lnr->lr_callback = vim_strsave(callback); + else + lnr->lr_callback = callback; // pointer into the partial + lnr->lr_partial = partial; + + lnr->lr_id = ++next_listener_id; + rettv->vval.v_number = lnr->lr_id; +} + +/* + * listener_remove() function + */ + void +f_listener_remove(typval_T *argvars, typval_T *rettv UNUSED) +{ + listener_T *lnr; + listener_T *next; + listener_T *prev = NULL; + int id = tv_get_number(argvars); + buf_T *buf = curbuf; + + for (lnr = buf->b_listener; lnr != NULL; lnr = next) + { + next = lnr->lr_next; + if (lnr->lr_id == id) + { + if (prev != NULL) + prev->lr_next = lnr->lr_next; + else + buf->b_listener = lnr->lr_next; + free_callback(lnr->lr_callback, lnr->lr_partial); + vim_free(lnr); + } + prev = lnr; + } +} + +/* + * Called when a sequence of changes is done: invoke listeners added with + * listener_add(). + */ + void +invoke_listeners(void) +{ + listener_T *lnr; + typval_T rettv; + int dummy; + typval_T argv[2]; + + if (recorded_changes == NULL) // nothing changed + return; + argv[0].v_type = VAR_LIST; + argv[0].vval.v_list = recorded_changes; + + for (lnr = curbuf->b_listener; lnr != NULL; lnr = lnr->lr_next) + { + call_func(lnr->lr_callback, -1, &rettv, + 1, argv, NULL, 0L, 0L, &dummy, TRUE, lnr->lr_partial, NULL); + clear_tv(&rettv); + } + + list_unref(recorded_changes); + recorded_changes = NULL; +} +#endif + /* * Common code for when a change was made. * See changed_lines() for the arguments. @@ -175,6 +303,9 @@ changed_common( // mark the buffer as modified changed(); +#ifdef FEAT_EVAL + may_record_change(lnum, col, lnume, xtra); +#endif #ifdef FEAT_DIFF if (curwin->w_p_diff && diff_internal()) curtab->tp_diff_update = TRUE; diff --git a/src/proto/change.pro b/src/proto/change.pro index 34733f502a..4e8a1e64c7 100644 --- a/src/proto/change.pro +++ b/src/proto/change.pro @@ -2,6 +2,9 @@ void change_warning(int col); void changed(void); void changed_internal(void); +void f_listener_add(typval_T *argvars, typval_T *rettv); +void f_listener_remove(typval_T *argvars, typval_T *rettv); +void invoke_listeners(void); void changed_bytes(linenr_T lnum, colnr_T col); void inserted_bytes(linenr_T lnum, colnr_T col, int added); void appended_lines(linenr_T lnum, long count); diff --git a/src/structs.h b/src/structs.h index 16e5ce3da8..36bdf9a53e 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1873,6 +1873,19 @@ typedef struct #endif } jobopt_T; +#ifdef FEAT_EVAL +/* + * Structure used for listeners added with listener_add(). + */ +typedef struct listener_S listener_T; +struct listener_S +{ + listener_T *lr_next; + int lr_id; + char_u *lr_callback; + partial_T *lr_partial; +}; +#endif /* structure used for explicit stack while garbage collecting hash tables */ typedef struct ht_stack_S @@ -2424,6 +2437,8 @@ struct file_buffer #ifdef FEAT_EVAL dictitem_T b_bufvar; /* variable for "b:" Dictionary */ dict_T *b_vars; /* internal variables, local to buffer */ + + listener_T *b_listener; #endif #ifdef FEAT_TEXT_PROP int b_has_textprop; // TRUE when text props were added diff --git a/src/version.c b/src/version.c index 7bcb8c8735..1829fa338a 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1320, /**/ 1319, /**/ From a334772967de25764ed7b11d768e8b977818d0c6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 21:14:24 +0200 Subject: [PATCH 53/97] patch 8.1.1321: no docs or tests for listener functions Problem: No docs or tests for listener functions. Solution: Add help and tests for listener_add() and listener_remove(). Invoke the callbacks before redrawing. --- runtime/doc/eval.txt | 50 +++++++++++++++++++++++ runtime/doc/usr_41.txt | 2 + src/change.c | 41 +++++++++++-------- src/evalfunc.c | 4 +- src/proto/evalfunc.pro | 1 + src/screen.c | 5 +++ src/testdir/Make_all.mak | 2 + src/testdir/test_listener.vim | 77 +++++++++++++++++++++++++++++++++++ src/version.c | 2 + 9 files changed, 165 insertions(+), 19 deletions(-) create mode 100644 src/testdir/test_listener.vim diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index a8109d93a8..0b71c44dab 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2457,6 +2457,9 @@ line({expr}) Number line nr of cursor, last line or mark line2byte({lnum}) Number byte count of line {lnum} lispindent({lnum}) Number Lisp indent for line {lnum} list2str({list} [, {utf8}]) String turn numbers in {list} into a String +listener_add({callback} [, {buf}]) + Number add a callback to listen to changes +listener_remove({id}) none remove a listener callback localtime() Number current time log({expr}) Float natural logarithm (base e) of {expr} log10({expr}) Float logarithm of Float {expr} to base 10 @@ -6311,6 +6314,53 @@ list2str({list} [, {utf8}]) *list2str()* With utf-8 composing characters work as expected: > list2str([97, 769]) returns "á" < +listener_add({callback} [, {buf}]) *listener_add()* + Add a callback function that will be invoked when changes have + been made to buffer {buf}. + {buf} refers to a buffer name or number. For the accepted + values, see |bufname()|. When {buf} is omitted the current + buffer is used. + Returns a unique ID that can be passed to |listener_remove()|. + + The {callback} is invoked with a list of items that indicate a + change. Each list item is a dictionary with these entries: + lnum the first line number of the change + end the first line below the change + added number of lines added; negative if lines were + deleted + col first column in "lnum" that was affected by + the change; one if unknown or the whole line + was affected; this is a byte index, first + character has a value of one. + When lines are inserted the values are: + lnum line below which the new line is added + end equal to "lnum" + added number of lines inserted + col one + When lines are deleted the values are: + lnum the first deleted line + end the line below the first deleted line, before + the deletion was done + added negative, number of lines deleted + col one + When lines are changed: + lnum the first changed line + end the line below the last changed line + added zero + col first column with a change or one + + The {callback} is invoked just before the screen is updated. + To trigger this in a script use the `:redraw` command. + + The {callback} is not invoked when the buffer is first loaded. + Use the |BufReadPost| autocmd event to handle the initial text + of a buffer. + The {callback} is also not invoked when the buffer is + unloaded, use the |BufUnload| autocmd event for that. + +listener_remove({id}) *listener_remove()* + Remove a listener previously added with listener_add(). + localtime() *localtime()* Return the current time, measured as seconds since 1st Jan 1970. See also |strftime()| and |getftime()|. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index c5317e231e..866664c4df 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -812,6 +812,8 @@ Buffers, windows and the argument list: setbufline() replace a line in the specified buffer appendbufline() append a list of lines in the specified buffer deletebufline() delete lines from a specified buffer + listener_add() add a callback to listen to changes + listener_remove() remove a listener callback win_findbuf() find windows containing a buffer win_getid() get window ID of a window win_gotoid() go to window with ID diff --git a/src/change.c b/src/change.c index 06d20f4ac2..27ea9ac8fb 100644 --- a/src/change.c +++ b/src/change.c @@ -184,7 +184,7 @@ may_record_change( dict_add_number(dict, "lnum", (varnumber_T)lnum); dict_add_number(dict, "end", (varnumber_T)lnume); dict_add_number(dict, "added", (varnumber_T)xtra); - dict_add_number(dict, "col", (varnumber_T)col); + dict_add_number(dict, "col", (varnumber_T)col + 1); list_append_dict(recorded_changes, dict); } @@ -198,19 +198,27 @@ f_listener_add(typval_T *argvars, typval_T *rettv) char_u *callback; partial_T *partial; listener_T *lnr; + buf_T *buf = curbuf; callback = get_callback(&argvars[0], &partial); if (callback == NULL) return; + if (argvars[1].v_type != VAR_UNKNOWN) + { + buf = get_buf_arg(&argvars[1]); + if (buf == NULL) + return; + } + lnr = (listener_T *)alloc_clear((sizeof(listener_T))); if (lnr == NULL) { free_callback(callback, partial); return; } - lnr->lr_next = curbuf->b_listener; - curbuf->b_listener = lnr; + lnr->lr_next = buf->b_listener; + buf->b_listener = lnr; if (partial == NULL) lnr->lr_callback = vim_strsave(callback); @@ -232,22 +240,23 @@ f_listener_remove(typval_T *argvars, typval_T *rettv UNUSED) listener_T *next; listener_T *prev = NULL; int id = tv_get_number(argvars); - buf_T *buf = curbuf; + buf_T *buf; - for (lnr = buf->b_listener; lnr != NULL; lnr = next) - { - next = lnr->lr_next; - if (lnr->lr_id == id) + for (buf = firstbuf; buf != NULL; buf = buf->b_next) + for (lnr = buf->b_listener; lnr != NULL; lnr = next) { - if (prev != NULL) - prev->lr_next = lnr->lr_next; - else - buf->b_listener = lnr->lr_next; - free_callback(lnr->lr_callback, lnr->lr_partial); - vim_free(lnr); + next = lnr->lr_next; + if (lnr->lr_id == id) + { + if (prev != NULL) + prev->lr_next = lnr->lr_next; + else + buf->b_listener = lnr->lr_next; + free_callback(lnr->lr_callback, lnr->lr_partial); + vim_free(lnr); + } + prev = lnr; } - prev = lnr; - } } /* diff --git a/src/evalfunc.c b/src/evalfunc.c index 02ca1ae828..b67aeb8d7f 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -2009,12 +2009,11 @@ tv_get_buf(typval_T *tv, int curtab_only) return buf; } -#ifdef FEAT_SIGNS /* * Get the buffer from "arg" and give an error and return NULL if it is not * valid. */ - static buf_T * + buf_T * get_buf_arg(typval_T *arg) { buf_T *buf; @@ -2026,7 +2025,6 @@ get_buf_arg(typval_T *arg) semsg(_("E158: Invalid buffer name: %s"), tv_get_string(arg)); return buf; } -#endif /* * "bufname(expr)" function diff --git a/src/proto/evalfunc.pro b/src/proto/evalfunc.pro index c0ada9d9fe..5a53136cfd 100644 --- a/src/proto/evalfunc.pro +++ b/src/proto/evalfunc.pro @@ -5,6 +5,7 @@ int find_internal_func(char_u *name); int call_internal_func(char_u *name, int argcount, typval_T *argvars, typval_T *rettv); buf_T *buflist_find_by_name(char_u *name, int curtab_only); buf_T *tv_get_buf(typval_T *tv, int curtab_only); +buf_T *get_buf_arg(typval_T *arg); void execute_redir_str(char_u *value, int value_len); void mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv); float_T vim_round(float_T f); diff --git a/src/screen.c b/src/screen.c index 3ebc244f58..5cdbd2c87f 100644 --- a/src/screen.c +++ b/src/screen.c @@ -564,6 +564,11 @@ update_screen(int type_arg) type = 0; } +#ifdef FEAT_EVAL + // Before updating the screen, notify any listeners of changed text. + invoke_listeners(); +#endif + if (must_redraw) { if (type < must_redraw) /* use maximal type */ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 1f50bd8cf8..7dc7e368ac 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -168,6 +168,7 @@ NEW_TESTS = \ test_lispwords \ test_listchars \ test_listdict \ + test_listener \ test_listlbr \ test_listlbr_utf8 \ test_lua \ @@ -359,6 +360,7 @@ NEW_TESTS_RES = \ test_lineending.res \ test_listchars.res \ test_listdict.res \ + test_listener.res \ test_listlbr.res \ test_lua.res \ test_makeencoding.res \ diff --git a/src/testdir/test_listener.vim b/src/testdir/test_listener.vim new file mode 100644 index 0000000000..87183e5b78 --- /dev/null +++ b/src/testdir/test_listener.vim @@ -0,0 +1,77 @@ +" tests for listener_add() and listener_remove() + +func StoreList(l) + let g:list = a:l +endfunc + +func AnotherStoreList(l) + let g:list2 = a:l +endfunc + +func EvilStoreList(l) + let g:list3 = a:l + call assert_fails("call add(a:l, 'myitem')", "E742:") +endfunc + +func Test_listening() + new + call setline(1, ['one', 'two']) + let id = listener_add({l -> StoreList(l)}) + call setline(1, 'one one') + redraw + call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], g:list) + + " Two listeners, both get called. + let id2 = listener_add({l -> AnotherStoreList(l)}) + let g:list = [] + let g:list2 = [] + exe "normal $asome\" + redraw + call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], g:list) + call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], g:list2) + + call listener_remove(id2) + let g:list = [] + let g:list2 = [] + call setline(3, 'three') + redraw + call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}], g:list) + call assert_equal([], g:list2) + + " the "o" command first adds an empty line and then changes it + let g:list = [] + exe "normal Gofour\" + redraw + call assert_equal([{'lnum': 4, 'end': 4, 'col': 1, 'added': 1}, + \ {'lnum': 4, 'end': 5, 'col': 1, 'added': 0}], g:list) + + let g:list = [] + call listener_remove(id) + call setline(1, 'asdfasdf') + redraw + call assert_equal([], g:list) + + " Trying to change the list fails + let id = listener_add({l -> EvilStoreList(l)}) + let g:list3 = [] + call setline(1, 'asdfasdf') + redraw + call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], g:list3) + + bwipe! +endfunc + +func Test_listening_other_buf() + new + call setline(1, ['one', 'two']) + let bufnr = bufnr('') + normal ww + let id = listener_add({l -> StoreList(l)}, bufnr) + let g:list = [] + call setbufline(bufnr, 1, 'hello') + redraw + call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], g:list) + + exe "buf " .. bufnr + bwipe! +endfunc diff --git a/src/version.c b/src/version.c index 1829fa338a..85704a6203 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1321, /**/ 1320, /**/ From 6e75e0a400d85cbcc27e2190ff448196bca025a8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 21:24:26 +0200 Subject: [PATCH 54/97] patch 8.1.1322: Cygwin makefile is not nicely indented Problem: Cygwin makefile is not nicely indented. Solution: Addjust spaces in preprocessor directives. (Ken Takata) --- src/Make_cyg_ming.mak | 440 +++++++++++++++++++++--------------------- src/version.c | 2 + 2 files changed, 217 insertions(+), 225 deletions(-) diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index 3e38a27cfe..811f1985f3 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -163,17 +163,17 @@ INTLLIB=gnu_gettext # Command definitions (depends on cross-compiling and shell) ifeq ($(CROSS),yes) # cross-compiler prefix: -ifndef CROSS_COMPILE + ifndef CROSS_COMPILE CROSS_COMPILE = i586-pc-mingw32msvc- -endif + endif DEL = rm MKDIR = mkdir -p DIRSLASH = / else # normal (Windows) compilation: -ifndef CROSS_COMPILE + ifndef CROSS_COMPILE CROSS_COMPILE = -endif + endif # About the "sh.exe" condition, as explained by Ken Takata: # @@ -193,15 +193,15 @@ endif # $SHELL is set with the unix-style path (e.g. "/bin/bash"). # In this case, unix-like commands can be used. # -ifneq (sh.exe, $(SHELL)) + ifneq (sh.exe, $(SHELL)) DEL = rm MKDIR = mkdir -p DIRSLASH = / -else + else DEL = del MKDIR = mkdir DIRSLASH = \\ -endif + endif endif CC := $(CROSS_COMPILE)gcc CXX := $(CROSS_COMPILE)g++ @@ -223,31 +223,31 @@ endif # DYNAMIC_PERL=yes (to load the Perl DLL dynamically) # PERL_VER=[Perl version, eg 56, 58, 510] (default is 524) ifdef PERL -ifndef PERL_VER + ifndef PERL_VER PERL_VER=524 -endif -ifndef DYNAMIC_PERL + endif + ifndef DYNAMIC_PERL DYNAMIC_PERL=yes -endif + endif # on Linux, for cross-compile, it's here: #PERLLIB=/home/ron/ActivePerl/lib # on NT, it's here: PERLEXE=$(PERL)/bin/perl PERLLIB=$(PERL)/lib PERLLIBS=$(PERLLIB)/Core -ifeq ($(UNDER_CYGWIN),yes) + ifeq ($(UNDER_CYGWIN),yes) PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap) XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp) -else + else PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp -endif + endif XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'") -ifeq "$(XSUBPP_EXISTS)" "" + ifeq "$(XSUBPP_EXISTS)" "" XSUBPP=$(PERLEXE) $(XSUBPPTRY) -else + else XSUBPP=xsubpp -endif + endif endif # Lua interface: @@ -257,18 +257,18 @@ endif # DYNAMIC_LUA=yes (to load the Lua DLL dynamically) # LUA_VER=[Lua version, eg 51, 52] (default is 53) ifdef LUA -ifndef DYNAMIC_LUA + ifndef DYNAMIC_LUA DYNAMIC_LUA=yes -endif + endif -ifndef LUA_VER + ifndef LUA_VER LUA_VER=53 -endif + endif -ifeq (no,$(DYNAMIC_LUA)) + ifeq (no,$(DYNAMIC_LUA)) LUA_LIBDIR = $(LUA)/lib LUA_LIB = -L$(LUA_LIBDIR) -llua -endif + endif endif @@ -280,53 +280,53 @@ endif # C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll # MZSCHEME_DEBUG=no ifdef MZSCHEME -ifndef DYNAMIC_MZSCHEME + ifndef DYNAMIC_MZSCHEME DYNAMIC_MZSCHEME=yes -endif + endif -ifndef MZSCHEME_VER + ifndef MZSCHEME_VER MZSCHEME_VER=3m_a0solc -endif + endif # for version 4.x we need to generate byte-code for Scheme base -ifndef MZSCHEME_GENERATE_BASE + ifndef MZSCHEME_GENERATE_BASE MZSCHEME_GENERATE_BASE=no -endif + endif -ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),) + ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),) MZSCHEME_MAIN_LIB=mzsch -else + else MZSCHEME_MAIN_LIB=racket -endif + endif -ifndef MZSCHEME_PRECISE_GC + ifndef MZSCHEME_PRECISE_GC MZSCHEME_PRECISE_GC=no -ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),) -ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),) + ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),) + ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),) MZSCHEME_PRECISE_GC=yes -endif -else -ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),) -ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),) + endif + else + ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),) + ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),) MZSCHEME_PRECISE_GC=yes -endif -endif -endif -endif + endif + endif + endif + endif -ifeq (no,$(DYNAMIC_MZSCHEME)) -ifeq (yes,$(MZSCHEME_PRECISE_GC)) + ifeq (no,$(DYNAMIC_MZSCHEME)) + ifeq (yes,$(MZSCHEME_PRECISE_GC)) MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -else + else MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER) -endif + endif # the modern MinGW can dynamically link to dlls directly. # point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll -ifndef MZSCHEME_DLLS + ifndef MZSCHEME_DLLS MZSCHEME_DLLS=$(MZSCHEME) -endif + endif MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib -endif + endif endif @@ -335,32 +335,32 @@ endif # DYNAMIC_PYTHON=yes (to load the Python DLL dynamically) # PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27) ifdef PYTHON -ifndef DYNAMIC_PYTHON + ifndef DYNAMIC_PYTHON DYNAMIC_PYTHON=yes -endif + endif -ifndef PYTHON_VER + ifndef PYTHON_VER PYTHON_VER=27 -endif -ifndef DYNAMIC_PYTHON_DLL + endif + ifndef DYNAMIC_PYTHON_DLL DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll -endif -ifdef PYTHON_HOME + endif + ifdef PYTHON_HOME PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\" -endif + endif -ifeq (no,$(DYNAMIC_PYTHON)) + ifeq (no,$(DYNAMIC_PYTHON)) PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER) -endif + endif # my include files are in 'win32inc' on Linux, and 'include' in the standard # NT distro (ActiveState) -ifndef PYTHONINC -ifeq ($(CROSS),no) + ifndef PYTHONINC + ifeq ($(CROSS),no) PYTHONINC=-I $(PYTHON)/include -else + else PYTHONINC=-I $(PYTHON)/win32inc -endif -endif + endif + endif endif # Python3 interface: @@ -368,31 +368,31 @@ endif # DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically) # PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36) ifdef PYTHON3 -ifndef DYNAMIC_PYTHON3 + ifndef DYNAMIC_PYTHON3 DYNAMIC_PYTHON3=yes -endif + endif -ifndef PYTHON3_VER + ifndef PYTHON3_VER PYTHON3_VER=36 -endif -ifndef DYNAMIC_PYTHON3_DLL + endif + ifndef DYNAMIC_PYTHON3_DLL DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll -endif -ifdef PYTHON3_HOME + endif + ifdef PYTHON3_HOME PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\" -endif + endif -ifeq (no,$(DYNAMIC_PYTHON3)) + ifeq (no,$(DYNAMIC_PYTHON3)) PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER) -endif + endif -ifndef PYTHON3INC -ifeq ($(CROSS),no) + ifndef PYTHON3INC + ifeq ($(CROSS),no) PYTHON3INC=-I $(PYTHON3)/include -else + else PYTHON3INC=-I $(PYTHON3)/win32inc -endif -endif + endif + endif endif # TCL interface: @@ -403,18 +403,18 @@ endif # You must set TCL_VER_LONG when you set TCL_VER. # TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll) ifdef TCL -ifndef DYNAMIC_TCL + ifndef DYNAMIC_TCL DYNAMIC_TCL=yes -endif -ifndef TCL_VER + endif + ifndef TCL_VER TCL_VER = 86 -endif -ifndef TCL_VER_LONG + endif + ifndef TCL_VER_LONG TCL_VER_LONG = 8.6 -endif -ifndef TCL_DLL + endif + ifndef TCL_DLL TCL_DLL = tcl$(TCL_VER).dll -endif + endif TCLINC += -I$(TCL)/include endif @@ -430,67 +430,63 @@ endif # RUBY_VER=19 # RUBY_API_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.) ifdef RUBY -ifndef DYNAMIC_RUBY + ifndef DYNAMIC_RUBY DYNAMIC_RUBY=yes -endif + endif # Set default value -ifndef RUBY_VER + ifndef RUBY_VER RUBY_VER = 22 -endif -ifndef RUBY_VER_LONG + endif + ifndef RUBY_VER_LONG RUBY_VER_LONG = 2.2.0 -endif -ifndef RUBY_API_VER_LONG + endif + ifndef RUBY_API_VER_LONG RUBY_API_VER_LONG = $(RUBY_VER_LONG) -endif -ifndef RUBY_API_VER + endif + ifndef RUBY_API_VER RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG)) -endif + endif -ifndef RUBY_PLATFORM -ifeq ($(RUBY_VER), 16) + ifndef RUBY_PLATFORM + ifeq ($(RUBY_VER), 16) RUBY_PLATFORM = i586-mswin32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),) + else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),) RUBY_PLATFORM = i386-mingw32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),) + else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),) RUBY_PLATFORM = x64-mingw32 -else + else RUBY_PLATFORM = i386-mswin32 -endif -endif -endif -endif + endif + endif -ifndef RUBY_INSTALL_NAME -ifeq ($(RUBY_VER), 16) + ifndef RUBY_INSTALL_NAME + ifeq ($(RUBY_VER), 16) RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER) -else -ifndef RUBY_MSVCRT_NAME + else + ifndef RUBY_MSVCRT_NAME # Base name of msvcrXX.dll which is used by ruby's dll. RUBY_MSVCRT_NAME = msvcrt -endif -ifeq ($(ARCH),x86-64) + endif + ifeq ($(ARCH),x86-64) RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER) -else + else RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER) -endif -endif -endif + endif + endif + endif -ifeq (19, $(word 1,$(sort 19 $(RUBY_VER)))) + ifeq (19, $(word 1,$(sort 19 $(RUBY_VER)))) RUBY_19_OR_LATER = 1 -endif + endif -ifdef RUBY_19_OR_LATER + ifdef RUBY_19_OR_LATER RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM) -else + else RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM) -endif -ifeq (no, $(DYNAMIC_RUBY)) + endif + ifeq (no, $(DYNAMIC_RUBY)) RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME) -endif + endif endif # RUBY @@ -515,89 +511,87 @@ ifdef GETTEXT DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H GETTEXTINCLUDE = $(GETTEXT)/include GETTEXTLIB = $(INTLPATH) -ifeq (yes, $(GETTEXT)) + ifeq (yes, $(GETTEXT)) DEFINES += -DDYNAMIC_GETTEXT -else -ifdef DYNAMIC_GETTEXT + else ifdef DYNAMIC_GETTEXT DEFINES += -D$(DYNAMIC_GETTEXT) -ifdef GETTEXT_DYNAMIC + ifdef GETTEXT_DYNAMIC DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\" -endif -endif -endif + endif + endif endif ifdef PERL CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -ifeq (yes, $(DYNAMIC_PERL)) + ifeq (yes, $(DYNAMIC_PERL)) CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\" EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER) -endif + endif endif ifdef LUA LUA_INCDIR = $(LUA)/include CFLAGS += -I$(LUA_INCDIR) -I$(LUA) -DFEAT_LUA -ifeq (yes, $(DYNAMIC_LUA)) + ifeq (yes, $(DYNAMIC_LUA)) CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\" -endif + endif endif ifdef MZSCHEME -ifndef MZSCHEME_COLLECTS + ifndef MZSCHEME_COLLECTS MZSCHEME_COLLECTS=$(MZSCHEME)/collects -ifeq (yes, $(UNDER_CYGWIN)) + ifeq (yes, $(UNDER_CYGWIN)) MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g') -endif -endif + endif + endif CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\" -ifeq (yes, $(DYNAMIC_MZSCHEME)) -ifeq (yes, $(MZSCHEME_PRECISE_GC)) + ifeq (yes, $(DYNAMIC_MZSCHEME)) + ifeq (yes, $(MZSCHEME_PRECISE_GC)) # Precise GC does not use separate dll CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -else + else CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" -endif -endif -ifeq (yes, "$(MZSCHEME_DEBUG)") + endif + endif + ifeq (yes, "$(MZSCHEME_DEBUG)") CFLAGS += -DMZSCHEME_FORCE_GC -endif + endif endif ifdef RUBY CFLAGS += -DFEAT_RUBY $(RUBYINC) -ifeq (yes, $(DYNAMIC_RUBY)) + ifeq (yes, $(DYNAMIC_RUBY)) CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER) -endif -ifeq (no, $(DYNAMIC_RUBY)) + endif + ifeq (no, $(DYNAMIC_RUBY)) CFLAGS += -DRUBY_VERSION=$(RUBY_VER) -endif -ifneq ($(findstring w64-mingw32,$(CC)),) + endif + ifneq ($(findstring w64-mingw32,$(CC)),) # A workaround for MinGW-w64 CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE -endif + endif endif ifdef PYTHON CFLAGS += -DFEAT_PYTHON -ifeq (yes, $(DYNAMIC_PYTHON)) + ifeq (yes, $(DYNAMIC_PYTHON)) CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\" -endif + endif endif ifdef PYTHON3 CFLAGS += -DFEAT_PYTHON3 -ifeq (yes, $(DYNAMIC_PYTHON3)) + ifeq (yes, $(DYNAMIC_PYTHON3)) CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\" -endif + endif endif ifdef TCL CFLAGS += -DFEAT_TCL $(TCLINC) -ifeq (yes, $(DYNAMIC_TCL)) + ifeq (yes, $(DYNAMIC_TCL)) CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\" -endif + endif endif ifeq ($(POSTSCRIPT),yes) @@ -614,15 +608,15 @@ endif ifeq ($(NETBEANS),yes) # Only allow NETBEANS for a GUI build. -ifeq (yes, $(GUI)) + ifeq (yes, $(GUI)) DEFINES += -DFEAT_NETBEANS_INTG -ifeq ($(NBDEBUG), yes) + ifeq ($(NBDEBUG), yes) DEFINES += -DNBDEBUG NBDEBUG_INCL = nbdebug.h NBDEBUG_SRC = nbdebug.c -endif -endif + endif + endif endif ifeq ($(CHANNEL),yes) @@ -642,39 +636,39 @@ endif # DirectWrite (DirectX) ifeq ($(DIRECTX),yes) # Only allow DirectWrite for a GUI build. -ifeq (yes, $(GUI)) + ifeq (yes, $(GUI)) DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -ifneq ($(COLOR_EMOJI),no) + ifneq ($(COLOR_EMOJI),no) DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI -endif -endif + endif + endif endif # Only allow XPM for a GUI build. ifeq (yes, $(GUI)) -ifndef XPM -ifeq ($(ARCH),i386) + ifndef XPM + ifeq ($(ARCH),i386) XPM = xpm/x86 -endif -ifeq ($(ARCH),i486) + endif + ifeq ($(ARCH),i486) XPM = xpm/x86 -endif -ifeq ($(ARCH),i586) + endif + ifeq ($(ARCH),i586) XPM = xpm/x86 -endif -ifeq ($(ARCH),i686) + endif + ifeq ($(ARCH),i686) XPM = xpm/x86 -endif -ifeq ($(ARCH),x86-64) + endif + ifeq ($(ARCH),x86-64) XPM = xpm/x64 -endif -endif -ifdef XPM -ifneq ($(XPM),no) + endif + endif + ifdef XPM + ifneq ($(XPM),no) CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include -endif -endif + endif + endif endif @@ -682,16 +676,14 @@ ifeq ($(DEBUG),yes) CFLAGS += -g -fstack-check DEBUG_SUFFIX=d else -ifeq ($(OPTIMIZE), SIZE) + ifeq ($(OPTIMIZE), SIZE) CFLAGS += -Os -else -ifeq ($(OPTIMIZE), MAXSPEED) + else ifeq ($(OPTIMIZE), MAXSPEED) CFLAGS += -O3 CFLAGS += -fomit-frame-pointer -freg-struct-return -else # SPEED + else # SPEED CFLAGS += -O2 -endif -endif + endif LFLAGS += -s endif @@ -785,13 +777,13 @@ endif ifdef MZSCHEME OBJ += $(OUTDIR)/if_mzsch.o MZSCHEME_INCL = if_mzsch.h -ifeq (yes,$(MZSCHEME_GENERATE_BASE)) + ifeq (yes,$(MZSCHEME_GENERATE_BASE)) CFLAGS += -DINCLUDE_MZSCHEME_BASE MZ_EXTRA_DEP += mzscheme_base.c -endif -ifeq (yes,$(MZSCHEME_PRECISE_GC)) + endif + ifeq (yes,$(MZSCHEME_PRECISE_GC)) CFLAGS += -DMZ_PRECISE_GC -endif + endif endif ifdef PYTHON OBJ += $(OUTDIR)/if_python.o @@ -810,17 +802,15 @@ OBJ += $(OUTDIR)/if_cscope.o endif ifeq ($(NETBEANS),yes) -ifneq ($(CHANNEL),yes) + ifneq ($(CHANNEL),yes) # Cannot use Netbeans without CHANNEL NETBEANS=no -else -ifneq (yes, $(GUI)) + else ifneq (yes, $(GUI)) # Cannot use Netbeans without GUI. NETBEANS=no -else + else OBJ += $(OUTDIR)/netbeans.o -endif -endif + endif endif ifeq ($(CHANNEL),yes) @@ -830,19 +820,19 @@ endif ifeq ($(DIRECTX),yes) # Only allow DIRECTX for a GUI build. -ifeq (yes, $(GUI)) + ifeq (yes, $(GUI)) OBJ += $(OUTDIR)/gui_dwrite.o LIB += -ld2d1 -ldwrite USE_STDCPLUS = yes -endif + endif endif ifneq ($(XPM),no) # Only allow XPM for a GUI build. -ifeq (yes, $(GUI)) + ifeq (yes, $(GUI)) OBJ += $(OUTDIR)/xpm_w32.o # You'll need libXpm.a from http://gnuwin32.sf.net LIB += -L$(XPM)/lib -lXpm -endif + endif endif ifeq ($(TERMINAL),yes) @@ -915,32 +905,32 @@ MAIN_TARGET = $(TARGET) endif ifdef GETTEXT -ifneq (yes, $(GETTEXT)) + ifneq (yes, $(GETTEXT)) CFLAGS += -I$(GETTEXTINCLUDE) -ifndef STATIC_GETTEXT + ifndef STATIC_GETTEXT LIB += -L$(GETTEXTLIB) -l$(INTLLIB) -ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT)) + ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT)) OBJ+=$(SAFE_GETTEXT_DLL_OBJ) -endif -else + endif + else LIB += -L$(GETTEXTLIB) -lintl -endif -endif + endif + endif endif ifdef PERL -ifeq (no, $(DYNAMIC_PERL)) + ifeq (no, $(DYNAMIC_PERL)) LIB += -L$(PERLLIBS) -lperl$(PERL_VER) -endif + endif endif ifdef TCL LIB += -L$(TCL)/lib -ifeq (yes, $(DYNAMIC_TCL)) + ifeq (yes, $(DYNAMIC_TCL)) LIB += -ltclstub$(TCL_VER) -else + else LIB += -ltcl$(TCL_VER) -endif + endif endif ifeq (yes, $(OLE)) @@ -951,35 +941,35 @@ endif ifeq (yes, $(IME)) DEFINES += -DFEAT_MBYTE_IME -ifeq (yes, $(DYNAMIC_IME)) + ifeq (yes, $(DYNAMIC_IME)) DEFINES += -DDYNAMIC_IME -else + else LIB += -limm32 -endif + endif endif ifdef ICONV -ifneq (yes, $(ICONV)) + ifneq (yes, $(ICONV)) LIB += -L$(ICONV) CFLAGS += -I$(ICONV) -endif + endif DEFINES+=-DDYNAMIC_ICONV endif ifeq (yes, $(USE_STDCPLUS)) LINK = $(CXX) -ifeq (yes, $(STATIC_STDCPLUS)) + ifeq (yes, $(STATIC_STDCPLUS)) #LIB += -static-libstdc++ -static-libgcc LIB += -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic -endif + endif else LINK = $(CC) endif ifeq (yes, $(STATIC_WINPTHREAD)) -ifeq (yes, $(HAS_GCC_EH)) + ifeq (yes, $(HAS_GCC_EH)) LIB += -lgcc_eh -endif + endif LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic endif diff --git a/src/version.c b/src/version.c index 85704a6203..2c49841ed9 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1322, /**/ 1321, /**/ From 5d0183b706c618bf043380f7e995987cde9e7d56 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 21:38:58 +0200 Subject: [PATCH 55/97] patch 8.1.1323: 'mouse' option is reset when using GPM mouse Problem: 'mouse' option is reset when using GPM mouse. Solution: Add flag for GPM mouse. --- src/term.c | 15 +++++++++++++-- src/version.c | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/term.c b/src/term.c index 29d4025053..fb002ec81b 100644 --- a/src/term.c +++ b/src/term.c @@ -2108,8 +2108,9 @@ set_termname(char_u *term) # define HMT_JSBTERM 8 # define HMT_PTERM 16 # define HMT_URXVT 32 -# define HMT_SGR 64 -# define HMT_SGR_REL 128 +# define HMT_GPM 64 +# define HMT_SGR 128 +# define HMT_SGR_REL 256 static int has_mouse_termcode = 0; # endif @@ -2149,6 +2150,11 @@ set_mouse_termcode( if (n == KS_URXVT_MOUSE) has_mouse_termcode |= HMT_URXVT; else +# endif +# ifdef FEAT_MOUSE_GPM + if (n == KS_GPM_MOUSE) + has_mouse_termcode |= HMT_GPM; + else # endif if (n == KS_SGR_MOUSE) has_mouse_termcode |= HMT_SGR; @@ -2196,6 +2202,11 @@ del_mouse_termcode( if (n == KS_URXVT_MOUSE) has_mouse_termcode &= ~HMT_URXVT; else +# endif +# ifdef FEAT_MOUSE_GPM + if (n == KS_GPM_MOUSE) + has_mouse_termcode &= ~HMT_GPM; + else # endif if (n == KS_SGR_MOUSE) has_mouse_termcode &= ~HMT_SGR; diff --git a/src/version.c b/src/version.c index 2c49841ed9..f41ca61328 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1323, /**/ 1322, /**/ From b73fbc76c6fc446da90dd2cdac620155e37e5514 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 May 2019 21:50:07 +0200 Subject: [PATCH 56/97] patch 8.1.1324: stray comma in VMS makefile Problem: Stray comma in VMS makefile. Solution: Remove the comma. (Naruhiko Nishino, closes #4368) --- src/Make_vms.mms | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Make_vms.mms b/src/Make_vms.mms index 3c41cc0548..1a0537bc8a 100644 --- a/src/Make_vms.mms +++ b/src/Make_vms.mms @@ -307,7 +307,7 @@ ALL_CFLAGS_VER = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) - ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) \ $(PERL_LIB) $(PYTHON_LIB) $(TCL_LIB) $(RUBY_LIB) -SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c change.c, charset.c \ +SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c change.c charset.c \ crypt.c crypt_zip.c debugger.c dict.c diff.c digraph.c edit.c eval.c \ evalfunc.c ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c \ if_cscope.c if_xcmdsrv.c fileio.c findfile.c fold.c getchar.c \ diff --git a/src/version.c b/src/version.c index f41ca61328..d489880f44 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1324, /**/ 1323, /**/ From 97b0075b0d733cc58c29247b09e7887b9991d7bf Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 12 May 2019 13:07:14 +0200 Subject: [PATCH 57/97] patch 8.1.1325: cannot build with +eval but without +channel and +timers Problem: Cannot build with +eval but without +channel and +timers. (John Marriott) Solution: Adjust #ifdef for get_callback(). --- src/evalfunc.c | 2 -- src/testdir/test_autocmd.vim | 48 +++++++++++++++++++----------------- src/version.c | 2 ++ 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index b67aeb8d7f..eda18e546f 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -14675,7 +14675,6 @@ f_test_settime(typval_T *argvars, typval_T *rettv UNUSED) time_for_testing = (time_t)tv_get_number(&argvars[0]); } -#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_TIMERS) || defined(PROTO) /* * Get a callback from "arg". It can be a Funcref or a function name. * When "arg" is zero return an empty string. @@ -14716,7 +14715,6 @@ free_callback(char_u *callback, partial_T *partial) vim_free(callback); } } -#endif #ifdef FEAT_TIMERS /* diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 48db3e2a99..b22718aee6 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -18,6 +18,7 @@ func Test_vim_did_enter() endfunc if has('timers') + func ExitInsertMode(id) call feedkeys("\") endfunc @@ -70,7 +71,30 @@ if has('timers') au! CursorHoldI set updatetime& endfunc -endif + + func Test_OptionSet_modeline() + call test_override('starting', 1) + au! OptionSet + augroup set_tabstop + au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler called'", "")}) + augroup END + call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline') + set modeline + let v:errmsg = '' + call assert_fails('split XoptionsetModeline', 'E12:') + call assert_equal(7, &ts) + call assert_equal('', v:errmsg) + + augroup set_tabstop + au! + augroup END + bwipe! + set ts& + call delete('XoptionsetModeline') + call test_override('starting', 0) + endfunc + +endif "has('timers') func Test_bufunload() augroup test_bufunload_group @@ -673,28 +697,6 @@ func Test_OptionSet_diffmode_close() "delfunc! AutoCommandOptionSet endfunc -func Test_OptionSet_modeline() - call test_override('starting', 1) - au! OptionSet - augroup set_tabstop - au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler called'", "")}) - augroup END - call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline') - set modeline - let v:errmsg = '' - call assert_fails('split XoptionsetModeline', 'E12:') - call assert_equal(7, &ts) - call assert_equal('', v:errmsg) - - augroup set_tabstop - au! - augroup END - bwipe! - set ts& - call delete('XoptionsetModeline') - call test_override('starting', 0) -endfunc - " Test for Bufleave autocommand that deletes the buffer we are about to edit. func Test_BufleaveWithDelete() new | edit Xfile1 diff --git a/src/version.c b/src/version.c index d489880f44..24f4bea8db 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1325, /**/ 1324, /**/ From 8aad88d8de256e58f04054eb7230c9613e26502f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 12 May 2019 13:53:50 +0200 Subject: [PATCH 58/97] patch 8.1.1326: no test for listener with partial Problem: No test for listener with partial. Solution: Add a test. Add example to help. --- runtime/doc/eval.txt | 23 ++++++++++--- src/testdir/test_listener.vim | 63 ++++++++++++++++++++--------------- src/version.c | 2 ++ 3 files changed, 57 insertions(+), 31 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 0b71c44dab..c1123ab6fa 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -6323,7 +6323,8 @@ listener_add({callback} [, {buf}]) *listener_add()* Returns a unique ID that can be passed to |listener_remove()|. The {callback} is invoked with a list of items that indicate a - change. Each list item is a dictionary with these entries: + change. The list cannot be changed. Each list item is a + dictionary with these entries: lnum the first line number of the change end the first line below the change added number of lines added; negative if lines were @@ -6349,7 +6350,21 @@ listener_add({callback} [, {buf}]) *listener_add()* added zero col first column with a change or one - The {callback} is invoked just before the screen is updated. + The entries are in the order the changes was made, thus the + most recent change is at the end. One has to go through the + list from end to start to compute the line numbers in the + current state of the text. + + When using the same function for multiple buffers, you can + pass the buffer to that function using a |Partial|. + Example: > + func Listener(bufnr, changes) + " ... + endfunc + let bufnr = ... + call listener_add(function('Listener', [bufnr]), bufnr) + +< The {callback} is invoked just before the screen is updated. To trigger this in a script use the `:redraw` command. The {callback} is not invoked when the buffer is first loaded. @@ -10984,10 +10999,10 @@ expressions |expr-lambda|. Example: > function Something(key, value = 10) - echo a:key .. ": " .. value + echo a:key .. ": " .. a:value endfunction call Something('empty') "empty: 10" - call Something('key, 20) "key: 20" + call Something('key', 20) "key: 20" The argument default expressions are evaluated at the time of the function call, not definition. Thus it is possible to use an expression which is diff --git a/src/testdir/test_listener.vim b/src/testdir/test_listener.vim index 87183e5b78..d0e4366a20 100644 --- a/src/testdir/test_listener.vim +++ b/src/testdir/test_listener.vim @@ -1,77 +1,86 @@ " tests for listener_add() and listener_remove() -func StoreList(l) - let g:list = a:l +func s:StoreList(l) + let s:list = a:l endfunc -func AnotherStoreList(l) - let g:list2 = a:l +func s:AnotherStoreList(l) + let s:list2 = a:l endfunc -func EvilStoreList(l) - let g:list3 = a:l +func s:EvilStoreList(l) + let s:list3 = a:l call assert_fails("call add(a:l, 'myitem')", "E742:") endfunc func Test_listening() new call setline(1, ['one', 'two']) - let id = listener_add({l -> StoreList(l)}) + let id = listener_add({l -> s:StoreList(l)}) call setline(1, 'one one') redraw - call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], g:list) + call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list) " Two listeners, both get called. - let id2 = listener_add({l -> AnotherStoreList(l)}) - let g:list = [] - let g:list2 = [] + let id2 = listener_add({l -> s:AnotherStoreList(l)}) + let s:list = [] + let s:list2 = [] exe "normal $asome\" redraw - call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], g:list) - call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], g:list2) + call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], s:list) + call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], s:list2) call listener_remove(id2) - let g:list = [] - let g:list2 = [] + let s:list = [] + let s:list2 = [] call setline(3, 'three') redraw - call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}], g:list) - call assert_equal([], g:list2) + call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}], s:list) + call assert_equal([], s:list2) " the "o" command first adds an empty line and then changes it - let g:list = [] + let s:list = [] exe "normal Gofour\" redraw call assert_equal([{'lnum': 4, 'end': 4, 'col': 1, 'added': 1}, - \ {'lnum': 4, 'end': 5, 'col': 1, 'added': 0}], g:list) + \ {'lnum': 4, 'end': 5, 'col': 1, 'added': 0}], s:list) - let g:list = [] + " Remove last listener + let s:list = [] call listener_remove(id) call setline(1, 'asdfasdf') redraw - call assert_equal([], g:list) + call assert_equal([], s:list) " Trying to change the list fails - let id = listener_add({l -> EvilStoreList(l)}) - let g:list3 = [] + let id = listener_add({l -> s:EvilStoreList(l)}) + let s:list3 = [] call setline(1, 'asdfasdf') redraw - call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], g:list3) + call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list3) + call listener_remove(id) bwipe! endfunc +func s:StoreBufList(buf, l) + let s:bufnr = a:buf + let s:list = a:l +endfunc + func Test_listening_other_buf() new call setline(1, ['one', 'two']) let bufnr = bufnr('') normal ww - let id = listener_add({l -> StoreList(l)}, bufnr) - let g:list = [] + let id = listener_add(function('s:StoreBufList', [bufnr]), bufnr) + let s:list = [] call setbufline(bufnr, 1, 'hello') redraw - call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], g:list) + call assert_equal(bufnr, s:bufnr) + call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list) + call listener_remove(id) exe "buf " .. bufnr bwipe! endfunc diff --git a/src/version.c b/src/version.c index 24f4bea8db..a957025eeb 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1326, /**/ 1325, /**/ From a9b2535f44f3265940a18d08520a9ad4ef7bda82 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 12 May 2019 14:25:30 +0200 Subject: [PATCH 59/97] patch 8.1.1327: unnecessary scroll after horizontal split Problem: Unnecessary scroll after horizontal split. Solution: Don't adjust to fraction if all the text fits in the window. (Martin Kunev, closes #4367) --- src/testdir/test_window_cmd.vim | 36 +++++++++++++++++++++++++++++++++ src/version.c | 2 ++ src/window.c | 10 ++++++--- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index 38fd10d948..c7be133b5f 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -743,6 +743,42 @@ func Test_relative_cursor_second_line_after_resize() let &so = so_save endfunc +func Test_split_noscroll() + let so_save = &so + new + only + + " Make sure windows can hold all content after split. + for i in range(1, 20) + wincmd + + redraw! + endfor + + call setline (1, range(1, 8)) + normal 100% + split + + 1wincmd w + let winid1 = win_getid() + let info1 = getwininfo(winid1)[0] + + 2wincmd w + let winid2 = win_getid() + let info2 = getwininfo(winid2)[0] + + call assert_equal(1, info1.topline) + call assert_equal(1, info2.topline) + + " Restore original state. + for i in range(1, 20) + wincmd - + redraw! + endfor + only! + bwipe! + let &so = so_save +endfunc + " Tests for the winnr() function func Test_winnr() only | tabonly diff --git a/src/version.c b/src/version.c index a957025eeb..d45484fed1 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1327, /**/ 1326, /**/ diff --git a/src/window.c b/src/window.c index f8df1cc315..f031989197 100644 --- a/src/window.c +++ b/src/window.c @@ -5827,9 +5827,13 @@ scroll_to_fraction(win_T *wp, int prev_height) int sline, line_size; int height = wp->w_height; - // Don't change w_topline when height is zero. Don't set w_topline when - // 'scrollbind' is set and this isn't the current window. - if (height > 0 && (!wp->w_p_scb || wp == curwin)) + // Don't change w_topline in any of these cases: + // - window height is 0 + // - 'scrollbind' is set and this isn't the current window + // - window height is sufficient to display the whole buffer + if (height > 0 + && (!wp->w_p_scb || wp == curwin) + && (height < wp->w_buffer->b_ml.ml_line_count)) { /* * Find a value for w_topline that shows the cursor at the same From bc4fd43160739efb93c39589dcc9ffd5d5a951d0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 12 May 2019 14:36:27 +0200 Subject: [PATCH 60/97] patch 8.1.1328: no test for listener with undo operation Problem: No test for listener with undo operation. Solution: Add a test. --- src/testdir/test_listener.vim | 9 +++++++++ src/version.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/testdir/test_listener.vim b/src/testdir/test_listener.vim index d0e4366a20..26cf2d3193 100644 --- a/src/testdir/test_listener.vim +++ b/src/testdir/test_listener.vim @@ -21,6 +21,15 @@ func Test_listening() redraw call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list) + " Undo is also a change + set undolevels& " start new undo block + call append(2, 'two two') + undo + redraw + call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}, + \ {'lnum': 3, 'end': 4, 'col': 1, 'added': -1}, ], s:list) + 1 + " Two listeners, both get called. let id2 = listener_add({l -> s:AnotherStoreList(l)}) let s:list = [] diff --git a/src/version.c b/src/version.c index d45484fed1..74dba7cae6 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1328, /**/ 1327, /**/ From 957f85d54ebd5a3bd0d930de9603190f0876f977 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 12 May 2019 21:43:48 +0200 Subject: [PATCH 61/97] patch 8.1.1329: plans for popup window support are spread out Problem: Plans for popup window support are spread out. Solution: Add a first version of the popup window help. --- runtime/doc/Makefile | 2 + runtime/doc/help.txt | 1 + runtime/doc/popup.txt | 274 ++++++++++++++++++++++++++++++++++++++++++ src/version.c | 2 + 4 files changed, 279 insertions(+) create mode 100644 runtime/doc/popup.txt diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile index 7dbb2bae1a..3db1190a0a 100644 --- a/runtime/doc/Makefile +++ b/runtime/doc/Makefile @@ -83,6 +83,7 @@ DOCS = \ pi_tar.txt \ pi_vimball.txt \ pi_zip.txt \ + popup.txt \ print.txt \ quickfix.txt \ quickref.txt \ @@ -220,6 +221,7 @@ HTMLS = \ pi_tar.html \ pi_vimball.html \ pi_zip.html \ + popup.html \ print.html \ quickfix.html \ quickref.html \ diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index c8ff75aec9..c2c9c1c887 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -143,6 +143,7 @@ Special issues ~ |remote.txt| using Vim as a server or client |term.txt| using different terminals and mice |terminal.txt| Terminal window support +|popup.txt| popop window support Programming language support ~ |indent.txt| automatic indenting for C and other languages diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt new file mode 100644 index 0000000000..1ffaf87669 --- /dev/null +++ b/runtime/doc/popup.txt @@ -0,0 +1,274 @@ +*popup.txt* For Vim version 8.1. Last change: 2019 May 12 + + + VIM REFERENCE MANUAL by Bram Moolenaar + + +Displaying text with properties attached. *popup* *popup-window* + +THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE + +1. Introduction |popup-intro| +2. Functions |popup-functions| +3. Examples |popup-examples| + + +{not able to use text properties when the |+textprop| feature was +disabled at compile time} + +============================================================================== +1. Introduction *popup-intro* + +We are talking about popup windows here, text that goes on top of the buffer +text and is under control of a plugin. Other popup functionality: +- popup menu, see |popup-menu| +- balloon, see |balloon-eval| + +TODO + +============================================================================== +2. Functions *popup-functions* + +THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE + +Proposal and discussion on issue #4063: https://github.com/vim/vim/issues/4063 + +[to be moved to eval.txt later] + +popup_show({lines}, {options}) *popup_show()* + Open a popup window showing {lines}, which is a list of lines, + where each line has text and text properties. + + {options} is a dictionary with many possible entries. + + Returns a unique ID to be used with |popup_close()|. + + See |popup_show-usage| for details. + + +popup_dialog({lines}, {options}) *popup_dialog()* + Just like |popup_show()| but with different default options: + pos "center" + zindex 200 + border [] + + +popup_notification({text}, {options}) *popup_notification()* + Show the string {text} for 3 seconds at the top of the Vim + window. This works like: > + call popup_show([{'text': {text}}], { + \ 'line': 1, + \ 'col': 10, + \ 'time': 3000, + \ 'zindex': 200, + \ 'highlight': 'WarningMsg', + \ 'border: [], + \ }) +< Use {options} to change the properties. + +popup_atcursor({text}, {options}) *popup_atcursor()* + Show the string {text} above the cursor, and close it when the + cursor moves. This works like: > + call popup_show([{'text': {text}}], { + \ 'line': 'cursor-1', + \ 'col': 'cursor', + \ 'zindex': 50, + \ 'moved': 'WORD', + \ }) +< Use {options} to change the properties. + + +popup_menu({lines}, {options}) *popup_atcursor()* + Show the {lines} near the cursor, handle selecting one of the + items with cursorkeys, and close it an item is selected with + Space or Enter. This works like: > + call popup_show({lines}, { + \ 'pos': 'center', + \ 'zindex': 200, + \ 'wrap': 0, + \ 'border': [], + \ 'filter': 'popup_filter_menu', + \ }) +< Use {options} to change the properties. Should at least set + "callback" to a function that handles the selected item. + + +popup_move({id}, {options}) *popup_move()* + Move popup {id} to the position speficied with {options}. + {options} may contain the items from |popup_show()| that + specify the popup position: "line", "col", "pos", "maxheight", + "minheight", "maxwidth" and "minwidth". + + +popup_filter_menu({id}, {key}) *popup_filter_menu()* + Filter that can be used for a popup. It handles the cursor + keys to move the selected index in the popup. Space and Enter + can be used to select an item. Invokes the "callback" of the + popup menu with the index of the selected line as the second + argument. + + +popup_filter_yesno({id}, {key}) *popup_filter_yesno()* + Filter that can be used for a popup. It handles only the keys + 'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the + popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N' + as the second argument. Pressing Esc and CTRL-C works like + pressing 'n'. + + +popup_setlines({id}, {lnum}, {lines}) *popup_setlines()* + In popup {id} set line {lnum} and following to {lines}. + + {lnum} is one-based and must be either an existing line or + just one below the last line, in which case the line gets + appended. + + {lines} has the same format as one item in {lines} of + |popup_show()|. Existing lines are replaced. When {lines} + extends below the last line of the popup lines are appended. + +popup_getlines({id}) *popup_getlines()* + Return the {lines} for popup {id}. + + +popup_setoptions({id}, {options}) *popup_setoptions()* + Override options in popup {id} with entries in {options}. + + +popup_getoptions({id}) *popup_getoptions()* + Return the {options} for popup {id}. + + +popup_close({id}) *popup_close()* + Close popup {id}. + + +POPUP_SHOW() ARGUMENTS *popup_show-usage* + +The first argument of |popup_show()| is a list of text lines. Each item in +the list is a dictionary with these entries: + text The text to display. + props A list of text properties. Optional. + Each entry is a dictionary, like the third argument of + |prop_add()|, but specifying the column in the + dictionary with a "col" entry, see below: + |popup-props|. + +The second argument of |popup_show()| is a dictionary with options: + line screen line where to position the popup; can use + "cursor", "cursor+1" or "cursor-1" to use the line of + the cursor and add or subtract a number of lines; + default is "cursor-1". + col screen column where to position the popup; can use + "cursor" to use the column of the cursor, "cursor+99" + and "cursor-99" to add or subtract a number of + columns; default is "cursor" + pos "topleft", "topright", "botleft" or "botright": + defines what corner of the popup "line" and "col" are + used for. Default is "botleft". Alternatively + "center" can be used to position the popup somewhere + near the cursor. + maxheight maximum height + minheight minimum height + maxwidth maximum width + minwidth minimum width + title text to be displayed above the first item in the + popup, on top of any border + wrap TRUE to make the lines wrap (default TRUE) + highlight highlight group name to use for the text, defines the + background and foreground color + border list with numbers, defining the border thickness + above/right/below/left of the popup; an empty list + uses a border of 1 all around + borderhighlight highlight group name to use for the border + borderchars list with characters, defining the character to use + for the top/right/bottom/left border; optionally + followed by the character to use for the + topright/botright/botleft/topleft corner; an empty + list can be used to show a double line all around + zindex priority for the popup, default 50 + time time in milliseconds after which the popup will close; + when omitted |popup_close()| must be used. + moved "cell": close the popup if the cursor moved at least + one screen cell; "word" allows for moving within + ||, "WORD" allows for moving within ||, + a list with two numbers specifies the start and end + column + filter a callback that can filter typed characters, see + |popup-filter| + callback a callback to be used when the popup closes, e.g. when + using |popup_filter_menu()|, see |popup-callback|. + +Depending on the "zindex" the popup goes under or above other popups. The +completion menu (|popup-menu|) has zindex 100. For messages that occur for a +short time the suggestion is to use zindex 1000. + +By default text wraps, which causes a line in {lines} to occupy more than one +screen line. When "wrap" is FALSE then the text outside of the popup or +outside of the Vim window will not be displayed, thus truncated. + + +POPUP TEXT PROPERTIES *popup-props* + +These are similar to the third argument of |prop_add()|, but not exactly the +same, since they only apply to one line. + col starting column, counted in bytes, use one for the + first column. + length length of text in bytes; can be zero + end_col column just after the text; not used when "length" is + present; when {col} and "end_col" are equal, this is a + zero-width text property + id user defined ID for the property; when omitted zero is + used + type name of the text property type, as added with + |prop_type_add()| + transparent do not show these characters, show the text under it; + if there is an border character to the right or below + it will be made transparent as well + + +POPUP FILTER *popup-filter* + +A callback that gets any typed keys while a popup is displayed. It can return +TRUE to indicate the key has been handled and is to be discarded, or FALSE to +let Vim handle the key as usual in the current state. + +The filter function is called with two arguments: the ID of the popup and the +key. + +Some common key actions: + Esc close the popup + cursor keys select another entry + Tab accept current suggestion + +Vim provides standard filters |popup_filter_menu()| and +|popup_filter_yesno()|. + + +POPUP CALLBACK *popup-callback* + +A callback that is invoked when the popup closes. Used by +|popup_filter_menu()|. Invoked with two arguments: the ID of the popup and +the result, which would usually be an index in the popup lines, or whatever +the filter wants to pass. + +============================================================================== +3. Examples *popup-examples* + +TODO + +Prompt the user to press y/Y or n/N: > + + func MyDialogHandler(id, result) + if a:result + " ... 'y' or 'Y' was pressed + endif + endfunc + + call popup_show([{'text': 'Continue? y/n'}], { + \ 'filter': 'popup_filter_yesno', + \ 'callback': 'MyDialogHandler', + \ }) +< + + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/src/version.c b/src/version.c index 74dba7cae6..8defe6a77a 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1329, /**/ 1328, /**/ From 9e58787de737479fb210a3bfef7458d667406d17 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 13 May 2019 20:27:23 +0200 Subject: [PATCH 62/97] patch 8.1.1330: using bold attribute in terminal changes the color Problem: Using bold attribute in terminal changes the color. (Jason Franklin) Solution: Don't set the "bold-highbright" flag in vterm unless the terminal supports less than 16 colors. --- src/terminal.c | 4 +++- src/testdir/dumps/Test_terminal_all_ansi_colors.dump | 2 +- src/testdir/test_terminal.vim | 8 +++++++- src/version.c | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/terminal.c b/src/terminal.c index bc57d641fa..caa4c85734 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -3976,7 +3976,9 @@ create_vterm(term_T *term, int rows, int cols) &term->tl_default_color.fg, &term->tl_default_color.bg); - if (t_colors >= 16) + if (t_colors < 16) + // Less than 16 colors: assume that bold means using a bright color for + // the foreground color. vterm_state_set_bold_highbright(vterm_obtain_state(vterm), 1); /* Required to initialize most things. */ diff --git a/src/testdir/dumps/Test_terminal_all_ansi_colors.dump b/src/testdir/dumps/Test_terminal_all_ansi_colors.dump index 232f60d848..57a085aa8e 100644 --- a/src/testdir/dumps/Test_terminal_all_ansi_colors.dump +++ b/src/testdir/dumps/Test_terminal_all_ansi_colors.dump @@ -1,4 +1,4 @@ ->A+0#0000001#8080809@1|B+0#e000002#ff404010@1|C+0#00e0003#40ff4011@1|D+0#e0e0004#ffff4012@1|E+0#0000e05#4040ff13@1|F+0#e000e06#ff40ff14@1|G+0#00e0e07#40ffff15@1|H+0#e0e0e08#ffffff16@1|I+0#8080809#0000001@1|J+0#ff404010#e000002@1|K+0#40ff4011#00e0003@1|L+0#ffff4012#e0e0004@1|M+0#4040ff13#0000e05@1|N+0#ff40ff14#e000e06@1|O+0#40ffff15#00e0e07@1|P+0#ffffff16#e0e0e08@1| +0#0000000#ffffff0@42 +>A+0#0000001#8080809@1|B+0#e000002#ff404010@1|C+0#00e0003#40ff4011@1|D+0#e0e0004#ffff4012@1|E+0#0000e05#4040ff13@1|F+0#e000e06#ff40ff14@1|G+0#00e0e07#40ffff15@1|H+0#e0e0e08#ffffff16@1|I+0#8080809#0000001@1|J+0#ff404010#e000002@1|K+0#40ff4011#00e0003@1|L+0#ffff4012#e0e0004@1|M+0#4040ff13#0000e05@1|N+0#ff40ff14#e000e06@1|O+0#40ffff15#00e0e07@1|P+0#ffffff16#e0e0e08@1| +0#0000000#ffffff0|X+2#e000002&@1|Y+2#40ff4011&@1|Z+2#ff40ff14#e000e06@1| +0#0000000#ffffff0@35 @2| +0#4040ff13&@72 |~| @73 |~| @73 diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 36e513e30d..fcad972b1a 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -1491,7 +1491,7 @@ func Test_terminal_all_ansi_colors() " Use all the ANSI colors. call writefile([ - \ 'call setline(1, "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP")', + \ 'call setline(1, "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPP XXYYZZ")', \ 'hi Tblack ctermfg=0 ctermbg=8', \ 'hi Tdarkred ctermfg=1 ctermbg=9', \ 'hi Tdarkgreen ctermfg=2 ctermbg=10', @@ -1508,6 +1508,9 @@ func Test_terminal_all_ansi_colors() \ 'hi Tmagenta ctermfg=13 ctermbg=5', \ 'hi Tcyan ctermfg=14 ctermbg=6', \ 'hi Twhite ctermfg=15 ctermbg=7', + \ 'hi TdarkredBold ctermfg=1 cterm=bold', + \ 'hi TgreenBold ctermfg=10 cterm=bold', + \ 'hi TmagentaBold ctermfg=13 cterm=bold ctermbg=5', \ '', \ 'call matchadd("Tblack", "A")', \ 'call matchadd("Tdarkred", "B")', @@ -1525,6 +1528,9 @@ func Test_terminal_all_ansi_colors() \ 'call matchadd("Tmagenta", "N")', \ 'call matchadd("Tcyan", "O")', \ 'call matchadd("Twhite", "P")', + \ 'call matchadd("TdarkredBold", "X")', + \ 'call matchadd("TgreenBold", "Y")', + \ 'call matchadd("TmagentaBold", "Z")', \ 'redraw', \ ], 'Xcolorscript') let buf = RunVimInTerminal('-S Xcolorscript', {'rows': 10}) diff --git a/src/version.c b/src/version.c index 8defe6a77a..9ce9ab4223 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1330, /**/ 1329, /**/ From fb222df28d5158516104a21cba7141a6240f4817 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 14 May 2019 17:57:19 +0200 Subject: [PATCH 63/97] patch 8.1.1331: test 29 is old style Problem: Test 29 is old style. Solution: Turn it into a new style test. (Yegappan Lakshmanan, closes #4370) --- src/Makefile | 2 +- src/testdir/Make_all.mak | 1 - src/testdir/Make_vms.mms | 1 - src/testdir/test29.in | 231 ----------------- src/testdir/test29.ok | 97 -------- src/testdir/test_backspace_opt.vim | 51 ++++ src/testdir/test_join.vim | 388 +++++++++++++++++++++++++++++ src/version.c | 2 + 8 files changed, 442 insertions(+), 331 deletions(-) delete mode 100644 src/testdir/test29.in delete mode 100644 src/testdir/test29.ok diff --git a/src/Makefile b/src/Makefile index e50438c178..b6dfe75483 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2179,7 +2179,7 @@ test_libvterm: test1 \ test_eval \ test3 \ - test29 test30 test37 test39 \ + test30 test37 test39 \ test42 test44 test48 test49 \ test52 test59 \ test64 test69 \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 7dc7e368ac..f9f2b65043 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -14,7 +14,6 @@ SCRIPTS_FIRST = \ # Tests that run on all systems. SCRIPTS_ALL = \ test3.out \ - test29.out \ test37.out \ test39.out \ test42.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index d72b9dac42..8217cc3303 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -74,7 +74,6 @@ VIMPROG = <->vim.exe .SUFFIXES : .out .in SCRIPT = test1.out test3.out \ - test29.out \ test30.out test37.out test39.out \ test42.out test44.out test48.out test49.out \ test64.out test69.out \ diff --git a/src/testdir/test29.in b/src/testdir/test29.in deleted file mode 100644 index 366a551a26..0000000000 --- a/src/testdir/test29.in +++ /dev/null @@ -1,231 +0,0 @@ -Test for joining lines and marks in them - in compatible and nocompatible modes - and with 'joinspaces' set or not - and with 'cpoptions' flag 'j' set or not - -STARTTEST -:so small.vim -:set nocompatible viminfo+=nviminfo -:set nojoinspaces -:set cpoptions-=j -/firstline/ -j"td/^STARTTEST/-1 -PJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j -j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions-=j joinspaces -j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions+=j -j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p:set cpoptions-=j nojoinspaces compatible -j"tpJjJjJjJjJjJjJjJjJjJjJjJjJjJj4Jy3l$pjd/STARTTEST/-2 -ENDTEST - -firstline -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf. -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -asdfasdf -asdf -zx cvn. -as dfg? -hjkl iop! -ert -zx cvn. -as dfg? -hjkl iop! -ert - -STARTTEST -/^{/+1 -:set comments=s1:/*,mb:*,ex:*/,:// -:set nojoinspaces fo=j -:set backspace=eol,start -:.,+3join -j4J -:.,+2join -j3J -:.,+2join -j3J -:.,+2join -jj3J -ENDTEST - -{ - -/* - * Make sure the previous comment leader is not removed. - */ - -/* - * Make sure the previous comment leader is not removed. - */ - -// Should the next comment leader be left alone? -// Yes. - -// Should the next comment leader be left alone? -// Yes. - -/* Here the comment leader should be left intact. */ -// And so should this one. - -/* Here the comment leader should be left intact. */ -// And so should this one. - -if (condition) // Remove the next comment leader! - // OK, I will. - action(); - -if (condition) // Remove the next comment leader! - // OK, I will. - action(); -} - -STARTTEST -:" Test with backspace set to the non-compatible setting -:set belloff=all -/^\d\+ this -:set cp bs=2 -Avim1 -Avim2u -:set cpo-=< -:inoremap -Avim3 -:iunmap -Avim4 -:" Test with backspace set to the compatible setting -:set backspace= visualbell -A vim5A -A vim6Azweiu -:inoremap -A vim7 -:set compatible novisualbell -ENDTEST -1 this shouldn't be deleted -2 this shouldn't be deleted -3 this shouldn't be deleted -4 this should be deleted -5 this shouldn't be deleted -6 this shouldn't be deleted -7 this shouldn't be deleted -8 this shouldn't be deleted (not touched yet) - -STARTTEST -/^{/+1 -:set comments=sO:*\ -,mO:*\ \ ,exO:*/ -:set comments+=s1:/*,mb:*,ex:*/,:// -:set comments+=s1:>#,mb:#,ex:#<,:< -:set cpoptions-=j joinspaces fo=j -:set backspace=eol,start -:.,+3join -j4J -:.,+8join -j9J -:.,+2join -j3J -:.,+2join -j3J -:.,+2join -jj3J -j:.,+2join -jj3J -j:.,+5join -j6J -oSome code! // Make sure backspacing does not remove this comment leader.0i -ENDTEST - -{ - -/* - * Make sure the previous comment leader is not removed. - */ - -/* - * Make sure the previous comment leader is not removed. - */ - -/* List: - * - item1 - * foo bar baz - * foo bar baz - * - item2 - * foo bar baz - * foo bar baz - */ - -/* List: - * - item1 - * foo bar baz - * foo bar baz - * - item2 - * foo bar baz - * foo bar baz - */ - -// Should the next comment leader be left alone? -// Yes. - -// Should the next comment leader be left alone? -// Yes. - -/* Here the comment leader should be left intact. */ -// And so should this one. - -/* Here the comment leader should be left intact. */ -// And so should this one. - -if (condition) // Remove the next comment leader! - // OK, I will. - action(); - -if (condition) // Remove the next comment leader! - // OK, I will. - action(); - -int i = 7 /* foo *// 3 - // comment - ; - -int i = 7 /* foo *// 3 - // comment - ; - -># Note that the last character of the ending comment leader (left angle - # bracket) is a comment leader itself. Make sure that this comment leader is - # not removed from the next line #< -< On this line a new comment is opened which spans 2 lines. This comment should -< retain its comment leader. - -># Note that the last character of the ending comment leader (left angle - # bracket) is a comment leader itself. Make sure that this comment leader is - # not removed from the next line #< -< On this line a new comment is opened which spans 2 lines. This comment should -< retain its comment leader. - -} - -STARTTEST -:g/^STARTTEST/.,/^ENDTEST/d -:?firstline?+1,$w! test.out -:qa! -ENDTEST diff --git a/src/testdir/test29.ok b/src/testdir/test29.ok deleted file mode 100644 index 9dc07ed46b..0000000000 --- a/src/testdir/test29.ok +++ /dev/null @@ -1,97 +0,0 @@ -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -zx cvn. as dfg? hjkl iop! ert ernop -zx cvn. as dfg? hjkl iop! ert ernop - -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -zx cvn. as dfg? hjkl iop! ert enop -zx cvn. as dfg? hjkl iop! ert ernop - -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -zx cvn. as dfg? hjkl iop! ert a - - -{ -/* Make sure the previous comment leader is not removed. */ -/* Make sure the previous comment leader is not removed. */ -// Should the next comment leader be left alone? Yes. -// Should the next comment leader be left alone? Yes. -/* Here the comment leader should be left intact. */ // And so should this one. -/* Here the comment leader should be left intact. */ // And so should this one. -if (condition) // Remove the next comment leader! OK, I will. - action(); -if (condition) // Remove the next comment leader! OK, I will. - action(); -} - -1 this shouldn't be deleted -2 this shouldn't be deleted -3 this shouldn't be deleted -4 this should be deleted3 - -6 this shouldn't be deleted vim5 -7 this shouldn't be deleted vim6 -8 this shouldn't be deleted (not touched yet) vim7 - - -{ -/* Make sure the previous comment leader is not removed. */ -/* Make sure the previous comment leader is not removed. */ -/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ -/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ -// Should the next comment leader be left alone? Yes. -// Should the next comment leader be left alone? Yes. -/* Here the comment leader should be left intact. */ // And so should this one. -/* Here the comment leader should be left intact. */ // And so should this one. -if (condition) // Remove the next comment leader! OK, I will. - action(); -if (condition) // Remove the next comment leader! OK, I will. - action(); -int i = 7 /* foo *// 3 // comment - ; -int i = 7 /* foo *// 3 // comment - ; -># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. -># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. - -Some code!// Make sure backspacing does not remove this comment leader. -} - diff --git a/src/testdir/test_backspace_opt.vim b/src/testdir/test_backspace_opt.vim index fd81f42b66..e6ea0bcf5a 100644 --- a/src/testdir/test_backspace_opt.vim +++ b/src/testdir/test_backspace_opt.vim @@ -56,4 +56,55 @@ func Test_backspace_option() set nocompatible viminfo+=nviminfo endfunc +" Test with backspace set to the non-compatible setting +func Test_backspace_ctrl_u() + new + call append(0, [ + \ "1 this shouldn't be deleted", + \ "2 this shouldn't be deleted", + \ "3 this shouldn't be deleted", + \ "4 this should be deleted", + \ "5 this shouldn't be deleted", + \ "6 this shouldn't be deleted", + \ "7 this shouldn't be deleted", + \ "8 this shouldn't be deleted (not touched yet)"]) + call cursor(2, 1) + + set compatible + set backspace=2 + + exe "normal Avim1\\\" + exe "normal Avim2\u\\\" + + set cpo-=< + inoremap + exe "normal Avim3\\\" + iunmap + exe "normal Avim4\\\\" + + " Test with backspace set to the compatible setting + set backspace= visualbell + exe "normal A vim5\A\\\\" + exe "normal A vim6\Azwei\u\\\" + + inoremap + exe "normal A vim7\\\\" + + call assert_equal([ + \ "1 this shouldn't be deleted", + \ "2 this shouldn't be deleted", + \ "3 this shouldn't be deleted", + \ "4 this should be deleted3", + \ "", + \ "6 this shouldn't be deleted vim5", + \ "7 this shouldn't be deleted vim6", + \ "8 this shouldn't be deleted (not touched yet) vim7", + \ ""], getline(1, '$')) + + set compatible&vim + set visualbell&vim + set backspace&vim + close! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_join.vim b/src/testdir/test_join.vim index 1c97414164..e5ef41ee0a 100644 --- a/src/testdir/test_join.vim +++ b/src/testdir/test_join.vim @@ -33,3 +33,391 @@ func Test_join_marks() call assert_equal([0, 4, 67, 0], getpos("']")) enew! endfunc + +" Test for joining lines and marks in them +" in compatible and nocompatible modes +" and with 'joinspaces' set or not +" and with 'cpoptions' flag 'j' set or not +func Test_join_spaces_marks() + new + " Text used for the test + insert +asdfasdf. +asdf +asdfasdf. +asdf +asdfasdf. +asdf +asdfasdf. +asdf +asdfasdf. +asdf +asdfasdf. +asdf +asdfasdf. +asdf +asdfasdf +asdf +asdfasdf +asdf +asdfasdf +asdf +asdfasdf +asdf +asdfasdf +asdf +asdfasdf +asdf +asdfasdf +asdf +zx cvn. +as dfg? +hjkl iop! +ert +zx cvn. +as dfg? +hjkl iop! +ert +. + let text = getline(1, '$') + normal gg + + set nojoinspaces + set cpoptions-=j + normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ + normal j05lmx + normal 2j06lmy + normal 2k4Jy3l$p + normal `xyl$p + normal `yy2l$p + + set cpoptions+=j + normal j05lmx + normal 2j06lmy + normal 2k4Jy3l$p + normal `xyl$p + normal `yy2l$p + + normal G + let last_line = line('$') + + " Expected output + append +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +zx cvn. as dfg? hjkl iop! ert ernop +zx cvn. as dfg? hjkl iop! ert ernop +. + + call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + + enew! + call append(0, text) + normal gg + + set cpoptions-=j + set joinspaces + normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ + normal j05lmx + normal 2j06lmy + normal 2k4Jy3l$p + normal `xyl$p + normal `yy2l$p + + set cpoptions+=j + normal j05lmx + normal 2j06lmy + normal 2k4Jy3l$p + normal `xyl$p + normal `yy2l$p + + normal G + let last_line = line('$') + + " Expected output + append +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +zx cvn. as dfg? hjkl iop! ert enop +zx cvn. as dfg? hjkl iop! ert ernop + +. + + call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + + enew! + call append(0, text) + normal gg + + set cpoptions-=j + set nojoinspaces + set compatible + + normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ + normal j4Jy3l$pjdG + + normal G + let last_line = line('$') + + " Expected output + append +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf. asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +asdfasdf asdf +zx cvn. as dfg? hjkl iop! ert a +. + + call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + + set nocompatible + set cpoptions&vim + set joinspaces&vim + close! +endfunc + +" Test for joining lines with comments +func Test_join_lines_with_comments() + new + + " Text used by the test + insert +{ + +/* +* Make sure the previous comment leader is not removed. +*/ + +/* +* Make sure the previous comment leader is not removed. +*/ + +// Should the next comment leader be left alone? +// Yes. + +// Should the next comment leader be left alone? +// Yes. + +/* Here the comment leader should be left intact. */ +// And so should this one. + +/* Here the comment leader should be left intact. */ +// And so should this one. + +if (condition) // Remove the next comment leader! +// OK, I will. +action(); + +if (condition) // Remove the next comment leader! +// OK, I will. +action(); +} +. + + call cursor(2, 1) + set comments=s1:/*,mb:*,ex:*/,:// + set nojoinspaces fo=j + set backspace=eol,start + + .,+3join + exe "normal j4J\" + .,+2join + exe "normal j3J\" + .,+2join + exe "normal j3J\" + .,+2join + exe "normal jj3J\" + + normal G + let last_line = line('$') + + " Expected output + append +{ +/* Make sure the previous comment leader is not removed. */ +/* Make sure the previous comment leader is not removed. */ +// Should the next comment leader be left alone? Yes. +// Should the next comment leader be left alone? Yes. +/* Here the comment leader should be left intact. */ // And so should this one. +/* Here the comment leader should be left intact. */ // And so should this one. +if (condition) // Remove the next comment leader! OK, I will. +action(); +if (condition) // Remove the next comment leader! OK, I will. +action(); +} +. + + call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + + set comments&vim + set joinspaces&vim + set fo&vim + set backspace&vim + close! +endfunc + +" Test for joining lines with different comment leaders +func Test_join_comments_2() + new + + insert +{ + +/* + * Make sure the previous comment leader is not removed. + */ + +/* + * Make sure the previous comment leader is not removed. + */ + +/* List: + * - item1 + * foo bar baz + * foo bar baz + * - item2 + * foo bar baz + * foo bar baz + */ + +/* List: + * - item1 + * foo bar baz + * foo bar baz + * - item2 + * foo bar baz + * foo bar baz + */ + +// Should the next comment leader be left alone? +// Yes. + +// Should the next comment leader be left alone? +// Yes. + +/* Here the comment leader should be left intact. */ +// And so should this one. + +/* Here the comment leader should be left intact. */ +// And so should this one. + +if (condition) // Remove the next comment leader! + // OK, I will. + action(); + +if (condition) // Remove the next comment leader! + // OK, I will. + action(); + +int i = 7 /* foo *// 3 + // comment + ; + +int i = 7 /* foo *// 3 + // comment + ; + +># Note that the last character of the ending comment leader (left angle + # bracket) is a comment leader itself. Make sure that this comment leader is + # not removed from the next line #< +< On this line a new comment is opened which spans 2 lines. This comment should +< retain its comment leader. + +># Note that the last character of the ending comment leader (left angle + # bracket) is a comment leader itself. Make sure that this comment leader is + # not removed from the next line #< +< On this line a new comment is opened which spans 2 lines. This comment should +< retain its comment leader. + +} +. + + call cursor(2, 1) + set comments=sO:*\ -,mO:*\ \ ,exO:*/ + set comments+=s1:/*,mb:*,ex:*/,:// + set comments+=s1:>#,mb:#,ex:#<,:< + set cpoptions-=j joinspaces fo=j + set backspace=eol,start + + .,+3join + exe "normal j4J\" + .,+8join + exe "normal j9J\" + .,+2join + exe "normal j3J\" + .,+2join + exe "normal j3J\" + .,+2join + exe "normal jj3J\j" + .,+2join + exe "normal jj3J\j" + .,+5join + exe "normal j6J\" + exe "normal oSome code!\// Make sure backspacing does not remove this comment leader.\0i\\" + + normal G + let last_line = line('$') + + " Expected output + append +{ +/* Make sure the previous comment leader is not removed. */ +/* Make sure the previous comment leader is not removed. */ +/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ +/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ +// Should the next comment leader be left alone? Yes. +// Should the next comment leader be left alone? Yes. +/* Here the comment leader should be left intact. */ // And so should this one. +/* Here the comment leader should be left intact. */ // And so should this one. +if (condition) // Remove the next comment leader! OK, I will. + action(); +if (condition) // Remove the next comment leader! OK, I will. + action(); +int i = 7 /* foo *// 3 // comment + ; +int i = 7 /* foo *// 3 // comment + ; +># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. +># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. + +Some code!// Make sure backspacing does not remove this comment leader. +} +. + + call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + close! +endfunc diff --git a/src/version.c b/src/version.c index 9ce9ab4223..c8623638be 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1331, /**/ 1330, /**/ From fe1ade0a78a70a4c7ddaebb6964497f037f4997a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 14 May 2019 21:20:36 +0200 Subject: [PATCH 64/97] patch 8.1.1332: cannot flush listeners without redrawing, mix of changes Problem: Cannot flush change listeners without also redrawing. The line numbers in the list of changes may become invalid. Solution: Add listener_flush(). Invoke listeners before adding a change that makes line numbers invalid. --- runtime/doc/eval.txt | 59 +++++++++++------ src/change.c | 102 +++++++++++++++++++++++++++--- src/evalfunc.c | 1 + src/proto/change.pro | 3 +- src/screen.c | 9 ++- src/testdir/test_listener.vim | 115 ++++++++++++++++++++++++++++++---- src/version.c | 2 + 7 files changed, 249 insertions(+), 42 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index c1123ab6fa..eb7a8211fa 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2459,6 +2459,7 @@ lispindent({lnum}) Number Lisp indent for line {lnum} list2str({list} [, {utf8}]) String turn numbers in {list} into a String listener_add({callback} [, {buf}]) Number add a callback to listen to changes +listener_flush([{buf}]) none invoke listener callbacks listener_remove({id}) none remove a listener callback localtime() Number current time log({expr}) Float natural logarithm (base e) of {expr} @@ -6322,8 +6323,21 @@ listener_add({callback} [, {buf}]) *listener_add()* buffer is used. Returns a unique ID that can be passed to |listener_remove()|. - The {callback} is invoked with a list of items that indicate a - change. The list cannot be changed. Each list item is a + The {callback} is invoked with four arguments: + a:bufnr the buffer that was changed + a:start first changed line number + a:end first line number below the change + a:added total number of lines added, negative if lines + were deleted + a:changes a List of items with details about the changes + + Example: > + func Listener(bufnr, start, end, added, changes) + echo 'lines ' .. a:start .. ' until ' .. a:end .. ' changed' + endfunc + call listener_add('Listener', bufnr) + +< The List cannot be changed. Each item in a:changes is a dictionary with these entries: lnum the first line number of the change end the first line below the change @@ -6337,35 +6351,32 @@ listener_add({callback} [, {buf}]) *listener_add()* lnum line below which the new line is added end equal to "lnum" added number of lines inserted - col one + col 1 When lines are deleted the values are: lnum the first deleted line end the line below the first deleted line, before the deletion was done added negative, number of lines deleted - col one + col 1 When lines are changed: lnum the first changed line end the line below the last changed line - added zero - col first column with a change or one + added 0 + col first column with a change or 1 - The entries are in the order the changes was made, thus the - most recent change is at the end. One has to go through the - list from end to start to compute the line numbers in the - current state of the text. + The entries are in the order the changes were made, thus the + most recent change is at the end. The line numbers are valid + when the callback is invoked, but later changes may make them + invalid, thus keeping a copy for later might not work. - When using the same function for multiple buffers, you can - pass the buffer to that function using a |Partial|. - Example: > - func Listener(bufnr, changes) - " ... - endfunc - let bufnr = ... - call listener_add(function('Listener', [bufnr]), bufnr) + The {callback} is invoked just before the screen is updated, + when |listener_flush()| is called or when a change is being + made that changes the line count in a way it causes a line + number in the list of changes to become invalid. -< The {callback} is invoked just before the screen is updated. - To trigger this in a script use the `:redraw` command. + The {callback} is invoked with the text locked, see + |textlock|. If you do need to make changes to the buffer, use + a timer to do this later |timer_start()|. The {callback} is not invoked when the buffer is first loaded. Use the |BufReadPost| autocmd event to handle the initial text @@ -6373,6 +6384,14 @@ listener_add({callback} [, {buf}]) *listener_add()* The {callback} is also not invoked when the buffer is unloaded, use the |BufUnload| autocmd event for that. +listener_flush([{buf}]) *listener_flush()* + Invoke listener callbacks for buffer {buf}. If there are no + pending changes then no callbacks are invoked. + + {buf} refers to a buffer name or number. For the accepted + values, see |bufname()|. When {buf} is omitted the current + buffer is used. + listener_remove({id}) *listener_remove()* Remove a listener previously added with listener_add(). diff --git a/src/change.c b/src/change.c index 27ea9ac8fb..9b71596ec7 100644 --- a/src/change.c +++ b/src/change.c @@ -169,6 +169,46 @@ may_record_change( if (curbuf->b_listener == NULL) return; + + // If the new change is going to change the line numbers in already listed + // changes, then flush. + if (recorded_changes != NULL && xtra != 0) + { + listitem_T *li; + linenr_T nr; + + for (li = recorded_changes->lv_first; li != NULL; li = li->li_next) + { + nr = (linenr_T)dict_get_number( + li->li_tv.vval.v_dict, (char_u *)"lnum"); + if (nr >= lnum || nr > lnume) + { + if (li->li_next == NULL && lnum == nr + && col + 1 == (colnr_T)dict_get_number( + li->li_tv.vval.v_dict, (char_u *)"col")) + { + dictitem_T *di; + + // Same start point and nothing is following, entries can + // be merged. + di = dict_find(li->li_tv.vval.v_dict, (char_u *)"end", -1); + nr = tv_get_number(&di->di_tv); + if (lnume > nr) + di->di_tv.vval.v_number = lnume; + di = dict_find(li->li_tv.vval.v_dict, + (char_u *)"added", -1); + di->di_tv.vval.v_number += xtra; + return; + } + + // the current change is going to make the line number in the + // older change invalid, flush now + invoke_listeners(curbuf); + break; + } + } + } + if (recorded_changes == NULL) { recorded_changes = list_alloc(); @@ -230,6 +270,23 @@ f_listener_add(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = lnr->lr_id; } +/* + * listener_flush() function + */ + void +f_listener_flush(typval_T *argvars, typval_T *rettv UNUSED) +{ + buf_T *buf = curbuf; + + if (argvars[0].v_type != VAR_UNKNOWN) + { + buf = get_buf_arg(&argvars[0]); + if (buf == NULL) + return; + } + invoke_listeners(buf); +} + /* * listener_remove() function */ @@ -264,25 +321,56 @@ f_listener_remove(typval_T *argvars, typval_T *rettv UNUSED) * listener_add(). */ void -invoke_listeners(void) +invoke_listeners(buf_T *buf) { listener_T *lnr; typval_T rettv; int dummy; - typval_T argv[2]; + typval_T argv[6]; + listitem_T *li; + linenr_T start = MAXLNUM; + linenr_T end = 0; + linenr_T added = 0; - if (recorded_changes == NULL) // nothing changed + if (recorded_changes == NULL // nothing changed + || buf->b_listener == NULL) // no listeners return; - argv[0].v_type = VAR_LIST; - argv[0].vval.v_list = recorded_changes; - for (lnr = curbuf->b_listener; lnr != NULL; lnr = lnr->lr_next) + argv[0].v_type = VAR_NUMBER; + argv[0].vval.v_number = buf->b_fnum; // a:bufnr + + + for (li = recorded_changes->lv_first; li != NULL; li = li->li_next) + { + varnumber_T lnum; + + lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"lnum"); + if (start > lnum) + start = lnum; + lnum = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"end"); + if (lnum > end) + end = lnum; + added = dict_get_number(li->li_tv.vval.v_dict, (char_u *)"added"); + } + argv[1].v_type = VAR_NUMBER; + argv[1].vval.v_number = start; + argv[2].v_type = VAR_NUMBER; + argv[2].vval.v_number = end; + argv[3].v_type = VAR_NUMBER; + argv[3].vval.v_number = added; + + argv[4].v_type = VAR_LIST; + argv[4].vval.v_list = recorded_changes; + ++textlock; + + for (lnr = buf->b_listener; lnr != NULL; lnr = lnr->lr_next) { call_func(lnr->lr_callback, -1, &rettv, - 1, argv, NULL, 0L, 0L, &dummy, TRUE, lnr->lr_partial, NULL); + 5, argv, NULL, 0L, 0L, &dummy, TRUE, lnr->lr_partial, NULL); clear_tv(&rettv); } + --textlock; list_unref(recorded_changes); recorded_changes = NULL; } diff --git a/src/evalfunc.c b/src/evalfunc.c index eda18e546f..0dbd6514ec 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -768,6 +768,7 @@ static struct fst {"lispindent", 1, 1, f_lispindent}, {"list2str", 1, 2, f_list2str}, {"listener_add", 1, 2, f_listener_add}, + {"listener_flush", 0, 1, f_listener_flush}, {"listener_remove", 1, 1, f_listener_remove}, {"localtime", 0, 0, f_localtime}, #ifdef FEAT_FLOAT diff --git a/src/proto/change.pro b/src/proto/change.pro index 4e8a1e64c7..f0f390b05b 100644 --- a/src/proto/change.pro +++ b/src/proto/change.pro @@ -3,8 +3,9 @@ void change_warning(int col); void changed(void); void changed_internal(void); void f_listener_add(typval_T *argvars, typval_T *rettv); +void f_listener_flush(typval_T *argvars, typval_T *rettv); void f_listener_remove(typval_T *argvars, typval_T *rettv); -void invoke_listeners(void); +void invoke_listeners(buf_T *buf); void changed_bytes(linenr_T lnum, colnr_T col); void inserted_bytes(linenr_T lnum, colnr_T col, int added); void appended_lines(linenr_T lnum, long count); diff --git a/src/screen.c b/src/screen.c index 5cdbd2c87f..cbb0fa4c7d 100644 --- a/src/screen.c +++ b/src/screen.c @@ -565,8 +565,13 @@ update_screen(int type_arg) } #ifdef FEAT_EVAL - // Before updating the screen, notify any listeners of changed text. - invoke_listeners(); + { + buf_T *buf; + + // Before updating the screen, notify any listeners of changed text. + FOR_ALL_BUFFERS(buf) + invoke_listeners(buf); + } #endif if (must_redraw) diff --git a/src/testdir/test_listener.vim b/src/testdir/test_listener.vim index 26cf2d3193..d5d633274e 100644 --- a/src/testdir/test_listener.vim +++ b/src/testdir/test_listener.vim @@ -16,9 +16,10 @@ endfunc func Test_listening() new call setline(1, ['one', 'two']) - let id = listener_add({l -> s:StoreList(l)}) + let s:list = [] + let id = listener_add({b, s, e, a, l -> s:StoreList(l)}) call setline(1, 'one one') - redraw + call listener_flush() call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list) " Undo is also a change @@ -26,12 +27,14 @@ func Test_listening() call append(2, 'two two') undo redraw - call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}, - \ {'lnum': 3, 'end': 4, 'col': 1, 'added': -1}, ], s:list) + " the two changes get merged + call assert_equal([{'lnum': 3, 'end': 4, 'col': 1, 'added': 0}], s:list) 1 - " Two listeners, both get called. - let id2 = listener_add({l -> s:AnotherStoreList(l)}) + " Two listeners, both get called. Also check column. + call setline(1, ['one one', 'two']) + call listener_flush() + let id2 = listener_add({b, s, e, a, l -> s:AnotherStoreList(l)}) let s:list = [] let s:list2 = [] exe "normal $asome\" @@ -39,7 +42,10 @@ func Test_listening() call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], s:list) call assert_equal([{'lnum': 1, 'end': 2, 'col': 8, 'added': 0}], s:list2) + " removing listener works call listener_remove(id2) + call setline(1, ['one one', 'two']) + call listener_flush() let s:list = [] let s:list2 = [] call setline(3, 'three') @@ -47,12 +53,42 @@ func Test_listening() call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}], s:list) call assert_equal([], s:list2) + " a change above a previous change without a line number change is reported + " together + call setline(1, ['one one', 'two']) + call listener_flush() + call append(2, 'two two') + call setline(1, 'something') + call listener_flush() + call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}, + \ {'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list) + + " an insert just above a previous change that was the last one gets merged + call setline(1, ['one one', 'two']) + call listener_flush() + call setline(2, 'something') + call append(1, 'two two') + call listener_flush() + call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 1}], s:list) + + " an insert above a previous change causes a flush + call setline(1, ['one one', 'two']) + call listener_flush() + call setline(2, 'something') + call append(0, 'two two') + call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 0}], s:list) + call listener_flush() + call assert_equal([{'lnum': 1, 'end': 1, 'col': 1, 'added': 1}], s:list) + " the "o" command first adds an empty line and then changes it + %del + call setline(1, ['one one', 'two']) + call listener_flush() let s:list = [] exe "normal Gofour\" redraw - call assert_equal([{'lnum': 4, 'end': 4, 'col': 1, 'added': 1}, - \ {'lnum': 4, 'end': 5, 'col': 1, 'added': 0}], s:list) + call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}, + \ {'lnum': 3, 'end': 4, 'col': 1, 'added': 0}], s:list) " Remove last listener let s:list = [] @@ -62,7 +98,7 @@ func Test_listening() call assert_equal([], s:list) " Trying to change the list fails - let id = listener_add({l -> s:EvilStoreList(l)}) + let id = listener_add({b, s, e, a, l -> s:EvilStoreList(l)}) let s:list3 = [] call setline(1, 'asdfasdf') redraw @@ -72,9 +108,64 @@ func Test_listening() bwipe! endfunc -func s:StoreBufList(buf, l) +func s:StoreListArgs(buf, start, end, added, list) + let s:buf = a:buf + let s:start = a:start + let s:end = a:end + let s:added = a:added + let s:list = a:list +endfunc + +func Test_listener_args() + new + call setline(1, ['one', 'two']) + let s:list = [] + let id = listener_add('s:StoreListArgs') + + " just one change + call setline(1, 'one one') + call listener_flush() + call assert_equal(bufnr(''), s:buf) + call assert_equal(1, s:start) + call assert_equal(2, s:end) + call assert_equal(0, s:added) + call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list) + + " two disconnected changes + call setline(1, ['one', 'two', 'three', 'four']) + call listener_flush() + call setline(1, 'one one') + call setline(3, 'three three') + call listener_flush() + call assert_equal(bufnr(''), s:buf) + call assert_equal(1, s:start) + call assert_equal(4, s:end) + call assert_equal(0, s:added) + call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}, + \ {'lnum': 3, 'end': 4, 'col': 1, 'added': 0}], s:list) + + " add and remove lines + call setline(1, ['one', 'two', 'three', 'four', 'five', 'six']) + call listener_flush() + call append(2, 'two two') + 4del + call append(5, 'five five') + call listener_flush() + call assert_equal(bufnr(''), s:buf) + call assert_equal(3, s:start) + call assert_equal(6, s:end) + call assert_equal(1, s:added) + call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}, + \ {'lnum': 4, 'end': 5, 'col': 1, 'added': -1}, + \ {'lnum': 6, 'end': 6, 'col': 1, 'added': 1}], s:list) + + call listener_remove(id) + bwipe! +endfunc + +func s:StoreBufList(buf, start, end, added, list) let s:bufnr = a:buf - let s:list = a:l + let s:list = a:list endfunc func Test_listening_other_buf() @@ -82,7 +173,7 @@ func Test_listening_other_buf() call setline(1, ['one', 'two']) let bufnr = bufnr('') normal ww - let id = listener_add(function('s:StoreBufList', [bufnr]), bufnr) + let id = listener_add(function('s:StoreBufList'), bufnr) let s:list = [] call setbufline(bufnr, 1, 'hello') redraw diff --git a/src/version.c b/src/version.c index c8623638be..0c61dab206 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1332, /**/ 1331, /**/ From 45dd07f10af9bea86f8df77e92788209e209fdab Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 15 May 2019 22:45:37 +0200 Subject: [PATCH 65/97] patch 8.1.1333: text properties don't always move after changes Problem: Text properties don't always move after changes. Solution: Update properties before reporting changes to listeners. Move text property when splitting a line. --- src/change.c | 10 ++++-- src/ex_cmds.c | 2 +- src/proto/textprop.pro | 2 +- src/testdir/test_textprop.vim | 61 +++++++++++++++++++++++++++++++++++ src/textprop.c | 36 +++++++++++---------- src/version.c | 2 ++ 6 files changed, 92 insertions(+), 21 deletions(-) diff --git a/src/change.c b/src/change.c index 9b71596ec7..86f1ffcfb4 100644 --- a/src/change.c +++ b/src/change.c @@ -641,12 +641,12 @@ changed_bytes(linenr_T lnum, colnr_T col) void inserted_bytes(linenr_T lnum, colnr_T col, int added UNUSED) { - changed_bytes(lnum, col); - #ifdef FEAT_TEXT_PROP if (curbuf->b_has_textprop && added != 0) adjust_prop_columns(lnum, col, added); #endif + + changed_bytes(lnum, col); } /* @@ -2133,6 +2133,12 @@ open_line( ) mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); did_append = TRUE; +#ifdef FEAT_TEXT_PROP + if ((State & INSERT) && !(State & VREPLACE_FLAG)) + // properties after the split move to the next line + adjust_props_for_split(curwin->w_cursor.lnum, curwin->w_cursor.lnum, + curwin->w_cursor.col + 1, 0); +#endif } else { diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 8da5dfd7ca..b99e54bce3 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5728,7 +5728,7 @@ do_sub(exarg_T *eap) last_line = lnum + 1; } #ifdef FEAT_TEXT_PROP - adjust_props_for_split(lnum, plen, 1); + adjust_props_for_split(lnum + 1, lnum, plen, 1); #endif // all line numbers increase ++sub_firstlnum; diff --git a/src/proto/textprop.pro b/src/proto/textprop.pro index 0eac557e3e..6d9553e287 100644 --- a/src/proto/textprop.pro +++ b/src/proto/textprop.pro @@ -14,5 +14,5 @@ void f_prop_type_list(typval_T *argvars, typval_T *rettv); void clear_global_prop_types(void); void clear_buf_prop_types(buf_T *buf); void adjust_prop_columns(linenr_T lnum, colnr_T col, int bytes_added); -void adjust_props_for_split(linenr_T lnum, int kept, int deleted); +void adjust_props_for_split(linenr_T lnum_props, linenr_T lnum_top, int kept, int deleted); /* vim: set ft=c : */ diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index a48aa91a43..6cc38d5663 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -151,6 +151,7 @@ endfunc func SetupOneLine() call setline(1, 'xonex xtwoxx') + normal gg0 call AddPropTypes() call prop_add(1, 2, {'length': 3, 'id': 11, 'type': 'one'}) call prop_add(1, 8, {'length': 3, 'id': 12, 'type': 'two'}) @@ -272,6 +273,66 @@ func Test_prop_replace() set bs& endfunc +func Test_prop_open_line() + new + + " open new line, props stay in top line + let expected = SetupOneLine() " 'xonex xtwoxx' + exe "normal o\" + call assert_equal('xonex xtwoxx', getline(1)) + call assert_equal('', getline(2)) + call assert_equal(expected, prop_list(1)) + call DeletePropTypes() + + " move all props to next line + let expected = SetupOneLine() " 'xonex xtwoxx' + exe "normal 0i\\" + call assert_equal('', getline(1)) + call assert_equal('xonex xtwoxx', getline(2)) + call assert_equal(expected, prop_list(2)) + call DeletePropTypes() + + " split just before prop, move all props to next line + let expected = SetupOneLine() " 'xonex xtwoxx' + exe "normal 0li\\" + call assert_equal('x', getline(1)) + call assert_equal('onex xtwoxx', getline(2)) + let expected[0].col -= 1 + let expected[1].col -= 1 + call assert_equal(expected, prop_list(2)) + call DeletePropTypes() + + " split inside prop, split first prop + let expected = SetupOneLine() " 'xonex xtwoxx' + exe "normal 0lli\\" + call assert_equal('xo', getline(1)) + call assert_equal('nex xtwoxx', getline(2)) + let exp_first = [deepcopy(expected[0])] + let exp_first[0].length = 1 + call assert_equal(exp_first, prop_list(1)) + let expected[0].col = 1 + let expected[0].length = 2 + let expected[1].col -= 2 + call assert_equal(expected, prop_list(2)) + call DeletePropTypes() + + " split just after first prop, empty prop and second prop move to next line + let expected = SetupOneLine() " 'xonex xtwoxx' + exe "normal 0fea\\" + call assert_equal('xone', getline(1)) + call assert_equal('x xtwoxx', getline(2)) + let exp_first = expected[0:0] + call assert_equal(exp_first, prop_list(1)) + let expected[0].col = 1 + let expected[0].length = 0 + let expected[1].col -= 4 + call assert_equal(expected, prop_list(2)) + call DeletePropTypes() + + bwipe! + set bs& +endfunc + func Test_prop_clear() new call AddPropTypes() diff --git a/src/textprop.c b/src/textprop.c index b44810a827..8c1e46ca68 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -8,18 +8,15 @@ */ /* - * Text properties implementation. - * - * Text properties are attached to the text. They move with the text when - * text is inserted/deleted. - * - * Text properties have a user specified ID number, which can be unique. - * Text properties have a type, which can be used to specify highlighting. + * Text properties implementation. See ":help text-properties". * * TODO: * - When using 'cursorline' attributes should be merged. (#3912) * - Adjust text property column and length when text is inserted/deleted. + * -> splitting a line can create a zero-length property. Don't highlight it + * and extend it when inserting text. * -> a :substitute with a multi-line match + * -> join two lines, also with BS in Insert mode * -> search for changed_bytes() from misc1.c * - Perhaps we only need TP_FLAG_CONT_NEXT and can drop TP_FLAG_CONT_PREV? * - Add an arrray for global_proptypes, to quickly lookup a prop type by ID @@ -28,8 +25,6 @@ * the index, like DB_MARKED? * - Also test line2byte() with many lines, so that ml_updatechunk() is taken * into account. - * - Add mechanism to keep track of changed lines, so that plugin can update - * text properties in these. * - Perhaps have a window-local option to disable highlighting from text * properties? */ @@ -1033,12 +1028,17 @@ adjust_prop_columns( /* * Adjust text properties for a line that was split in two. - * "lnum" is the newly inserted line. The text properties are now on the line - * below it. "kept" is the number of bytes kept in the first line, while + * "lnum_props" is the line that has the properties from before the split. + * "lnum_top" is the top line. + * "kept" is the number of bytes kept in the first line, while * "deleted" is the number of bytes deleted. */ void -adjust_props_for_split(linenr_T lnum, int kept, int deleted) +adjust_props_for_split( + linenr_T lnum_props, + linenr_T lnum_top, + int kept, + int deleted) { char_u *props; int count; @@ -1049,11 +1049,12 @@ adjust_props_for_split(linenr_T lnum, int kept, int deleted) if (!curbuf->b_has_textprop) return; - count = get_text_props(curbuf, lnum + 1, &props, FALSE); + + // Get the text properties from "lnum_props". + count = get_text_props(curbuf, lnum_props, &props, FALSE); ga_init2(&prevprop, sizeof(textprop_T), 10); ga_init2(&nextprop, sizeof(textprop_T), 10); - // Get the text properties, which are at "lnum + 1". // Keep the relevant ones in the first line, reducing the length if needed. // Copy the ones that include the split to the second line. // Move the ones after the split to the second line. @@ -1089,10 +1090,11 @@ adjust_props_for_split(linenr_T lnum, int kept, int deleted) } } - set_text_props(lnum, prevprop.ga_data, prevprop.ga_len * sizeof(textprop_T)); + set_text_props(lnum_top, prevprop.ga_data, + prevprop.ga_len * sizeof(textprop_T)); ga_clear(&prevprop); - - set_text_props(lnum + 1, nextprop.ga_data, nextprop.ga_len * sizeof(textprop_T)); + set_text_props(lnum_top + 1, nextprop.ga_data, + nextprop.ga_len * sizeof(textprop_T)); ga_clear(&nextprop); } diff --git a/src/version.c b/src/version.c index 0c61dab206..3a6c0c0080 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1333, /**/ 1332, /**/ From eda652215abf696f86b872888945a2d2dd8c7192 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 16 May 2019 20:29:44 +0200 Subject: [PATCH 66/97] patch 8.1.1334: when buffer is hidden "F" in 'shortmess' is not used Problem: When buffer is hidden "F" in 'shortmess' is not used. Solution: Check the "F" flag in 'shortmess' when the buffer is already loaded. (Jason Franklin) Add test_getvalue() to be able to test this. --- runtime/doc/eval.txt | 6 ++++++ src/buffer.c | 9 ++++++--- src/evalfunc.c | 21 +++++++++++++++++++++ src/testdir/test_options.vim | 6 ++++++ src/version.c | 2 ++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index eb7a8211fa..e43f57bc0c 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2701,6 +2701,7 @@ test_alloc_fail({id}, {countdown}, {repeat}) test_autochdir() none enable 'autochdir' during startup test_feedinput({string}) none add key sequence to input buffer test_garbagecollect_now() none free memory right now for testing +test_getvalue({string}) any get value of an internal variable test_ignore_error({expr}) none ignore a specific error test_null_blob() Blob null value for testing test_null_channel() Channel null value for testing @@ -9894,6 +9895,11 @@ test_garbagecollect_now() *test_garbagecollect_now()* internally, and |v:testing| must have been set before calling any function. +test_getvalue({name}) *test_getvalue()* + Get the value of an internal variable. These values for + {name} are supported: + need_fileinfo + test_ignore_error({expr}) *test_ignore_error()* Ignore any error containing {expr}. A normal message is given instead. diff --git a/src/buffer.c b/src/buffer.c index e825a99a42..e10368483d 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1742,9 +1742,12 @@ enter_buffer(buf_T *buf) } else { - if (!msg_silent) - need_fileinfo = TRUE; /* display file info after redraw */ - (void)buf_check_timestamp(curbuf, FALSE); /* check if file changed */ + if (!msg_silent && !shortmess(SHM_FILEINFO)) + need_fileinfo = TRUE; // display file info after redraw + + // check if file changed + (void)buf_check_timestamp(curbuf, FALSE); + curwin->w_topline = 1; #ifdef FEAT_DIFF curwin->w_topfill = 0; diff --git a/src/evalfunc.c b/src/evalfunc.c index 0dbd6514ec..b5a6d685c6 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -442,6 +442,7 @@ static void f_tempname(typval_T *argvars, typval_T *rettv); static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv); static void f_test_autochdir(typval_T *argvars, typval_T *rettv); static void f_test_feedinput(typval_T *argvars, typval_T *rettv); +static void f_test_getvalue(typval_T *argvars, typval_T *rettv); static void f_test_option_not_set(typval_T *argvars, typval_T *rettv); static void f_test_override(typval_T *argvars, typval_T *rettv); static void f_test_refcount(typval_T *argvars, typval_T *rettv); @@ -991,6 +992,7 @@ static struct fst {"test_autochdir", 0, 0, f_test_autochdir}, {"test_feedinput", 1, 1, f_test_feedinput}, {"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now}, + {"test_getvalue", 1, 1, f_test_getvalue}, {"test_ignore_error", 1, 1, f_test_ignore_error}, {"test_null_blob", 0, 0, f_test_null_blob}, #ifdef FEAT_JOB_CHANNEL @@ -14412,6 +14414,25 @@ f_test_feedinput(typval_T *argvars, typval_T *rettv UNUSED) #endif } +/* + * "test_getvalue({name})" function + */ + static void +f_test_getvalue(typval_T *argvars, typval_T *rettv) +{ + if (argvars[0].v_type != VAR_STRING) + emsg(_(e_invarg)); + else + { + char_u *name = tv_get_string(&argvars[0]); + + if (STRCMP(name, (char_u *)"need_fileinfo") == 0) + rettv->vval.v_number = need_fileinfo; + else + semsg(_(e_invarg2), name); + } +} + /* * "test_option_not_set({name})" function */ diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim index 6cc0c1a180..c5dbb9f4c4 100644 --- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -470,13 +470,19 @@ func Test_shortmess_F2() call assert_match('file2', execute('bn', '')) set shortmess+=F call assert_true(empty(execute('bn', ''))) + call assert_false(test_getvalue('need_fileinfo')) call assert_true(empty(execute('bn', ''))) + call assert_false(test_getvalue('need_fileinfo')) set hidden call assert_true(empty(execute('bn', ''))) + call assert_false(test_getvalue('need_fileinfo')) call assert_true(empty(execute('bn', ''))) + call assert_false(test_getvalue('need_fileinfo')) set nohidden call assert_true(empty(execute('bn', ''))) + call assert_false(test_getvalue('need_fileinfo')) call assert_true(empty(execute('bn', ''))) + call assert_false(test_getvalue('need_fileinfo')) set shortmess& call assert_match('file1', execute('bn', '')) call assert_match('file2', execute('bn', '')) diff --git a/src/version.c b/src/version.c index 3a6c0c0080..ad16cd5706 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1334, /**/ 1333, /**/ From dda4144d39a9d685b8dda830978e7410bd372c40 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 16 May 2019 22:11:47 +0200 Subject: [PATCH 67/97] patch 8.1.1335: listener callback is called after inserting text Problem: Listener callback is called after inserting text. Solution: Flush the changes before inserting or deleting a line. Store changes per buffer. --- src/change.c | 135 ++++++++++++++++++++++------------ src/memline.c | 11 +++ src/proto/change.pro | 1 + src/structs.h | 1 + src/testdir/test_listener.vim | 32 +++++++- src/version.c | 2 + 6 files changed, 131 insertions(+), 51 deletions(-) diff --git a/src/change.c b/src/change.c index 86f1ffcfb4..f1c3cc4d02 100644 --- a/src/change.c +++ b/src/change.c @@ -152,11 +152,72 @@ changed_internal(void) } #ifdef FEAT_EVAL -static list_T *recorded_changes = NULL; static long next_listener_id = 0; +/* + * Check if the change at "lnum" / "col" is above or overlaps with an existing + * changed. If above then flush changes and invoke listeners. + * If "merge" is TRUE do the merge. + * Returns TRUE if the change was merged. + */ + static int +check_recorded_changes( + buf_T *buf, + linenr_T lnum, + colnr_T col, + linenr_T lnume, + long xtra, + int merge) +{ + if (buf->b_recorded_changes != NULL && xtra != 0) + { + listitem_T *li; + linenr_T nr; + + for (li = buf->b_recorded_changes->lv_first; li != NULL; + li = li->li_next) + { + nr = (linenr_T)dict_get_number( + li->li_tv.vval.v_dict, (char_u *)"lnum"); + if (nr >= lnum || nr > lnume) + { + if (li->li_next == NULL && lnum == nr + && col + 1 == (colnr_T)dict_get_number( + li->li_tv.vval.v_dict, (char_u *)"col")) + { + if (merge) + { + dictitem_T *di; + + // Same start point and nothing is following, entries + // can be merged. + di = dict_find(li->li_tv.vval.v_dict, + (char_u *)"end", -1); + nr = tv_get_number(&di->di_tv); + if (lnume > nr) + di->di_tv.vval.v_number = lnume; + di = dict_find(li->li_tv.vval.v_dict, + (char_u *)"added", -1); + di->di_tv.vval.v_number += xtra; + return TRUE; + } + } + else + { + // the current change is going to make the line number in + // the older change invalid, flush now + invoke_listeners(curbuf); + break; + } + } + } + } + return FALSE; +} + /* * Record a change for listeners added with listener_add(). + * Always for the current buffer. */ static void may_record_change( @@ -172,50 +233,16 @@ may_record_change( // If the new change is going to change the line numbers in already listed // changes, then flush. - if (recorded_changes != NULL && xtra != 0) + if (check_recorded_changes(curbuf, lnum, col, lnume, xtra, TRUE)) + return; + + if (curbuf->b_recorded_changes == NULL) { - listitem_T *li; - linenr_T nr; - - for (li = recorded_changes->lv_first; li != NULL; li = li->li_next) - { - nr = (linenr_T)dict_get_number( - li->li_tv.vval.v_dict, (char_u *)"lnum"); - if (nr >= lnum || nr > lnume) - { - if (li->li_next == NULL && lnum == nr - && col + 1 == (colnr_T)dict_get_number( - li->li_tv.vval.v_dict, (char_u *)"col")) - { - dictitem_T *di; - - // Same start point and nothing is following, entries can - // be merged. - di = dict_find(li->li_tv.vval.v_dict, (char_u *)"end", -1); - nr = tv_get_number(&di->di_tv); - if (lnume > nr) - di->di_tv.vval.v_number = lnume; - di = dict_find(li->li_tv.vval.v_dict, - (char_u *)"added", -1); - di->di_tv.vval.v_number += xtra; - return; - } - - // the current change is going to make the line number in the - // older change invalid, flush now - invoke_listeners(curbuf); - break; - } - } - } - - if (recorded_changes == NULL) - { - recorded_changes = list_alloc(); - if (recorded_changes == NULL) // out of memory + curbuf->b_recorded_changes = list_alloc(); + if (curbuf->b_recorded_changes == NULL) // out of memory return; - ++recorded_changes->lv_refcount; - recorded_changes->lv_lock = VAR_FIXED; + ++curbuf->b_recorded_changes->lv_refcount; + curbuf->b_recorded_changes->lv_lock = VAR_FIXED; } dict = dict_alloc(); @@ -226,7 +253,7 @@ may_record_change( dict_add_number(dict, "added", (varnumber_T)xtra); dict_add_number(dict, "col", (varnumber_T)col + 1); - list_append_dict(recorded_changes, dict); + list_append_dict(curbuf->b_recorded_changes, dict); } /* @@ -316,6 +343,16 @@ f_listener_remove(typval_T *argvars, typval_T *rettv UNUSED) } } +/* + * Called before inserting a line above "lnum"/"lnum3" or deleting line "lnum" + * to "lnume". + */ + void +may_invoke_listeners(buf_T *buf, linenr_T lnum, linenr_T lnume, int added) +{ + check_recorded_changes(buf, lnum, 0, lnume, added, FALSE); +} + /* * Called when a sequence of changes is done: invoke listeners added with * listener_add(). @@ -332,7 +369,7 @@ invoke_listeners(buf_T *buf) linenr_T end = 0; linenr_T added = 0; - if (recorded_changes == NULL // nothing changed + if (buf->b_recorded_changes == NULL // nothing changed || buf->b_listener == NULL) // no listeners return; @@ -340,7 +377,7 @@ invoke_listeners(buf_T *buf) argv[0].vval.v_number = buf->b_fnum; // a:bufnr - for (li = recorded_changes->lv_first; li != NULL; li = li->li_next) + for (li = buf->b_recorded_changes->lv_first; li != NULL; li = li->li_next) { varnumber_T lnum; @@ -360,7 +397,7 @@ invoke_listeners(buf_T *buf) argv[3].vval.v_number = added; argv[4].v_type = VAR_LIST; - argv[4].vval.v_list = recorded_changes; + argv[4].vval.v_list = buf->b_recorded_changes; ++textlock; for (lnr = buf->b_listener; lnr != NULL; lnr = lnr->lr_next) @@ -371,8 +408,8 @@ invoke_listeners(buf_T *buf) } --textlock; - list_unref(recorded_changes); - recorded_changes = NULL; + list_unref(buf->b_recorded_changes); + buf->b_recorded_changes = NULL; } #endif diff --git a/src/memline.c b/src/memline.c index 812d10dc1a..006a8b52df 100644 --- a/src/memline.c +++ b/src/memline.c @@ -2790,6 +2790,12 @@ ml_append_int( if (len == 0) len = (colnr_T)STRLEN(line) + 1; // space needed for the text +#ifdef FEAT_EVAL + // When inserting above recorded changes: flush the changes before changing + // the text. + may_invoke_listeners(buf, lnum + 1, lnum + 1, 1); +#endif + #ifdef FEAT_TEXT_PROP if (curbuf->b_has_textprop && lnum > 0) // Add text properties that continue from the previous line. @@ -3526,6 +3532,11 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message) if (lnum < 1 || lnum > buf->b_ml.ml_line_count) return FAIL; +#ifdef FEAT_EVAL + // When inserting above recorded changes: flush the changes before changing + // the text. + may_invoke_listeners(buf, lnum, lnum + 1, -1); +#endif if (lowest_marked && lowest_marked > lnum) lowest_marked--; diff --git a/src/proto/change.pro b/src/proto/change.pro index f0f390b05b..79306e3061 100644 --- a/src/proto/change.pro +++ b/src/proto/change.pro @@ -5,6 +5,7 @@ void changed_internal(void); void f_listener_add(typval_T *argvars, typval_T *rettv); void f_listener_flush(typval_T *argvars, typval_T *rettv); void f_listener_remove(typval_T *argvars, typval_T *rettv); +void may_invoke_listeners(buf_T *buf, linenr_T lnum, linenr_T lnume, int added); void invoke_listeners(buf_T *buf); void changed_bytes(linenr_T lnum, colnr_T col); void inserted_bytes(linenr_T lnum, colnr_T col, int added); diff --git a/src/structs.h b/src/structs.h index 36bdf9a53e..afd3e02813 100644 --- a/src/structs.h +++ b/src/structs.h @@ -2439,6 +2439,7 @@ struct file_buffer dict_T *b_vars; /* internal variables, local to buffer */ listener_T *b_listener; + list_T *b_recorded_changes; #endif #ifdef FEAT_TEXT_PROP int b_has_textprop; // TRUE when text props were added diff --git a/src/testdir/test_listener.vim b/src/testdir/test_listener.vim index d5d633274e..66c3d51439 100644 --- a/src/testdir/test_listener.vim +++ b/src/testdir/test_listener.vim @@ -1,6 +1,8 @@ " tests for listener_add() and listener_remove() -func s:StoreList(l) +func s:StoreList(s, l) + let s:start = a:s + let s:text = getline(a:s) let s:list = a:l endfunc @@ -17,7 +19,7 @@ func Test_listening() new call setline(1, ['one', 'two']) let s:list = [] - let id = listener_add({b, s, e, a, l -> s:StoreList(l)}) + let id = listener_add({b, s, e, a, l -> s:StoreList(s, l)}) call setline(1, 'one one') call listener_flush() call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list) @@ -66,8 +68,10 @@ func Test_listening() " an insert just above a previous change that was the last one gets merged call setline(1, ['one one', 'two']) call listener_flush() + let s:list = [] call setline(2, 'something') call append(1, 'two two') + call assert_equal([], s:list) call listener_flush() call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 1}], s:list) @@ -77,8 +81,32 @@ func Test_listening() call setline(2, 'something') call append(0, 'two two') call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 0}], s:list) + call assert_equal('something', s:text) call listener_flush() call assert_equal([{'lnum': 1, 'end': 1, 'col': 1, 'added': 1}], s:list) + call assert_equal('two two', s:text) + + " a delete at a previous change that was the last one gets merged + call setline(1, ['one one', 'two']) + call listener_flush() + let s:list = [] + call setline(2, 'something') + 2del + call assert_equal([], s:list) + call listener_flush() + call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': -1}], s:list) + + " a delete above a previous change causes a flush + call setline(1, ['one one', 'two']) + call listener_flush() + call setline(2, 'another') + 1del + call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 0}], s:list) + call assert_equal(2, s:start) + call assert_equal('another', s:text) + call listener_flush() + call assert_equal([{'lnum': 1, 'end': 2, 'col': 1, 'added': -1}], s:list) + call assert_equal('another', s:text) " the "o" command first adds an empty line and then changes it %del diff --git a/src/version.c b/src/version.c index ad16cd5706..b085052baa 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1335, /**/ 1334, /**/ From 17aca707f92235b6f962e637e8073162d18e6de2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 16 May 2019 22:24:55 +0200 Subject: [PATCH 68/97] patch 8.1.1336: some eval functionality is not covered by tests Problem: Some eval functionality is not covered by tests. Solution: Add a few more test cases. (Masato Nishihata, closes #4374) --- src/testdir/test_bufline.vim | 6 +++++- src/testdir/test_cindent.vim | 10 ++++++++++ src/testdir/test_cursor_func.vim | 6 ++++++ src/testdir/test_delete.vim | 5 +++++ src/testdir/test_expand_func.vim | 9 +++++++++ src/testdir/test_float_func.vim | 1 + src/testdir/test_fnamemodify.vim | 6 ------ src/testdir/test_functions.vim | 24 ++++++++++++++++++++++++ src/version.c | 2 ++ 9 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/testdir/test_bufline.vim b/src/testdir/test_bufline.vim index d2d692922c..9c29a05e70 100644 --- a/src/testdir/test_bufline.vim +++ b/src/testdir/test_bufline.vim @@ -8,7 +8,7 @@ func Test_setbufline_getbufline() hide call assert_equal(0, setbufline(b, 1, ['foo', 'bar'])) call assert_equal(['foo'], getbufline(b, 1)) - call assert_equal(['bar'], getbufline(b, 2)) + call assert_equal(['bar'], getbufline(b, '$')) call assert_equal(['foo', 'bar'], getbufline(b, 1, 2)) exe "bd!" b call assert_equal([], getbufline(b, 1, 2)) @@ -81,6 +81,7 @@ func Test_appendbufline() call setline(1, ['a', 'b', 'c']) let b = bufnr('%') wincmd w + call assert_equal(1, appendbufline(b, -1, ['x'])) call assert_equal(1, appendbufline(b, 4, ['x'])) call assert_equal(1, appendbufline(1234, 1, ['x'])) call assert_equal(0, appendbufline(b, 3, ['d', 'e'])) @@ -130,8 +131,11 @@ func Test_deletebufline() exe "bd!" b call assert_equal(1, deletebufline(b, 1)) + call assert_equal(1, deletebufline(-1, 1)) + split Xtest call setline(1, ['a', 'b', 'c']) + call cursor(line('$'), 1) let b = bufnr('%') wincmd w call assert_equal(1, deletebufline(b, 4)) diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim index 7c2c5e341c..3b57360ace 100644 --- a/src/testdir/test_cindent.vim +++ b/src/testdir/test_cindent.vim @@ -102,4 +102,14 @@ func Test_cindent_expr() bw! endfunc +func Test_cindent_func() + new + setlocal cindent + call setline(1, ['int main(void)', '{', 'return 0;', '}']) + call assert_equal(cindent(0), -1) + call assert_equal(cindent(3), &sw) + call assert_equal(cindent(line('$')+1), -1) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim index a41cc7d005..12319577c6 100644 --- a/src/testdir/test_cursor_func.vim +++ b/src/testdir/test_cursor_func.vim @@ -25,6 +25,12 @@ func Test_move_cursor() call cursor(9, 1) call assert_equal([4, 1, 0, 1], getcurpos()[1:]) + call setline(1, ["\"]) + call cursor(1, 1, 1) + call assert_equal([1, 1, 1], getcurpos()[1:3]) + + call assert_equal(-1, cursor(-1, -1)) + quit! endfunc diff --git a/src/testdir/test_delete.vim b/src/testdir/test_delete.vim index 4686a0dc97..b3e153e5b7 100644 --- a/src/testdir/test_delete.vim +++ b/src/testdir/test_delete.vim @@ -105,3 +105,8 @@ func Test_symlink_recursive_delete() bwipe Xdir3/subdir/Xfile bwipe Xdir4/Xfile endfunc + +func Test_delete_errors() + call assert_fails('call delete('''')', 'E474:') + call assert_fails('call delete(''foo'', 0)', 'E15:') +endfunc diff --git a/src/testdir/test_expand_func.vim b/src/testdir/test_expand_func.vim index fb29c3eb7a..f6e5293635 100644 --- a/src/testdir/test_expand_func.vim +++ b/src/testdir/test_expand_func.vim @@ -64,3 +64,12 @@ func Test_expand_sflnum() call assert_equal(64, str2nr(trim(execute('Flnum')))) delcommand Flnum endfunc + +func Test_expand() + new + call assert_equal("", expand('%:S')) + call assert_equal('3', expand('')) + call assert_equal(['4'], expand('', v:false, v:true)) + " Don't add any line above this, otherwise will change. + quit +endfunc diff --git a/src/testdir/test_float_func.vim b/src/testdir/test_float_func.vim index 48fae74012..29bfc9e2d0 100644 --- a/src/testdir/test_float_func.vim +++ b/src/testdir/test_float_func.vim @@ -13,6 +13,7 @@ func Test_abs() call assert_equal('inf', string(abs(1.0/0.0))) call assert_equal('inf', string(abs(-1.0/0.0))) call assert_equal('nan', string(abs(0.0/0.0))) + call assert_equal('12', string(abs('12abc'))) call assert_equal('12', string(abs('-12abc'))) call assert_fails("call abs([])", 'E745:') call assert_fails("call abs({})", 'E728:') diff --git a/src/testdir/test_fnamemodify.vim b/src/testdir/test_fnamemodify.vim index 768d31192a..63f273677d 100644 --- a/src/testdir/test_fnamemodify.vim +++ b/src/testdir/test_fnamemodify.vim @@ -45,9 +45,3 @@ func Test_fnamemodify() let $HOME = save_home let &shell = save_shell endfunc - -func Test_expand() - new - call assert_equal("", expand('%:S')) - quit -endfunc diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 7bd3ef488e..b9520c7ee6 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -52,6 +52,7 @@ func Test_empty() endif call assert_equal(0, empty(function('Test_empty'))) + call assert_equal(0, empty(function('Test_empty', [0]))) endfunc func Test_len() @@ -869,6 +870,7 @@ func Test_count() call assert_equal(1, count(l, 'a', 0, 1)) call assert_equal(2, count(l, 'a', 1, 1)) call assert_fails('call count(l, "a", 0, 10)', 'E684:') + call assert_fails('call count(l, "a", [])', 'E745:') let d = {1: 'a', 2: 'a', 3: 'A', 4: 'b'} call assert_equal(2, count(d, 'a')) @@ -896,6 +898,8 @@ func Test_count() call assert_equal(2, count("foo", "O", 1)) call assert_equal(2, count("fooooo", "oo")) call assert_equal(0, count("foo", "")) + + call assert_fails('call count(0, 0)', 'E712:') endfunc func Test_changenr() @@ -1431,3 +1435,23 @@ func Test_readdir() call delete('Xdir', 'rf') endfunc + +func Test_call() + call assert_equal(3, call('len', [123])) + call assert_fails("call call('len', 123)", 'E714:') + call assert_equal(0, call('', [])) + + function Mylen() dict + return len(self.data) + endfunction + let mydict = {'data': [0, 1, 2, 3], 'len': function("Mylen")} + call assert_fails("call call('Mylen', [], 0)", 'E715:') +endfunc + +func Test_char2nr() + call assert_equal(12354, char2nr('あ', 1)) +endfunc + +func Test_eventhandler() + call assert_equal(0, eventhandler()) +endfunc diff --git a/src/version.c b/src/version.c index b085052baa..01c4394960 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1336, /**/ 1335, /**/ From 5c65e6a062dfc7d20931fa1f73d03b1714a4d5e1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 17 May 2019 11:08:56 +0200 Subject: [PATCH 69/97] patch 8.1.1337: get empty text prop when splitting line just after text prop Problem: Get empty text prop when splitting line just after text prop. Solution: Do not create an empty text prop at the start of the line. --- src/testdir/test_textprop.vim | 7 +++---- src/textprop.c | 4 +++- src/version.c | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 6cc38d5663..237eda95fb 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -316,16 +316,15 @@ func Test_prop_open_line() call assert_equal(expected, prop_list(2)) call DeletePropTypes() - " split just after first prop, empty prop and second prop move to next line + " split just after first prop, second prop move to next line let expected = SetupOneLine() " 'xonex xtwoxx' exe "normal 0fea\\" call assert_equal('xone', getline(1)) call assert_equal('x xtwoxx', getline(2)) let exp_first = expected[0:0] call assert_equal(exp_first, prop_list(1)) - let expected[0].col = 1 - let expected[0].length = 0 - let expected[1].col -= 4 + let expected = expected[1:1] + let expected[0].col -= 4 call assert_equal(expected, prop_list(2)) call DeletePropTypes() diff --git a/src/textprop.c b/src/textprop.c index 8c1e46ca68..361ecb1269 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1075,7 +1075,9 @@ adjust_props_for_split( ++prevprop.ga_len; } - if (prop.tp_col + prop.tp_len >= skipped && ga_grow(&nextprop, 1) == OK) + // Only add the property to the next line if the length is bigger than + // zero. + if (prop.tp_col + prop.tp_len > skipped && ga_grow(&nextprop, 1) == OK) { p = ((textprop_T *)nextprop.ga_data) + nextprop.ga_len; *p = prop; diff --git a/src/version.c b/src/version.c index 01c4394960..c34eed04f6 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1337, /**/ 1336, /**/ From 0ebe12be86d9f79bfa833306a0302a68a0f4fc30 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 17 May 2019 12:31:44 +0200 Subject: [PATCH 70/97] patch 8.1.1338: hang when concealing the '>' shown for half of wide char Problem: Hang when concealing the '>' shown for a wide char that doesn't fit in the last cell. Solution: Put back the pointer when the '>' is not going to be displayed. (closes #4377) --- src/screen.c | 18 +++++++++++++----- src/version.c | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/screen.c b/src/screen.c index cbb0fa4c7d..cab697fd2a 100644 --- a/src/screen.c +++ b/src/screen.c @@ -3176,7 +3176,6 @@ win_line( int vcol_off = 0; /* offset for concealed characters */ int did_wcol = FALSE; int match_conc = 0; /* cchar for match functions */ - int has_match_conc = 0; /* match wants to conceal */ int old_boguscols = 0; # define VCOL_HLC (vcol - vcol_off) # define FIX_FOR_BOGUSCOLS \ @@ -3747,7 +3746,8 @@ win_line( for (;;) { #ifdef FEAT_CONCEAL - has_match_conc = 0; + int has_match_conc = 0; // match wants to conceal + int did_decrement_ptr = FALSE; #endif /* Skip this quickly when working on the text. */ if (draw_state != WL_LINE) @@ -4596,9 +4596,12 @@ win_line( mb_utf8 = FALSE; mb_l = 1; multi_attr = HL_ATTR(HLF_AT); - /* Put pointer back so that the character will be - * displayed at the start of the next line. */ + // Put pointer back so that the character will be + // displayed at the start of the next line. --ptr; +#ifdef FEAT_CONCEAL + did_decrement_ptr = TRUE; +#endif } else if (*ptr != NUL) ptr += mb_l - 1; @@ -5261,7 +5264,12 @@ win_line( prev_syntax_id = 0; is_concealing = FALSE; } -#endif /* FEAT_CONCEAL */ + + if (n_skip > 0 && did_decrement_ptr) + // not showing the '>', put pointer back to avoid getting stuck + ++ptr; + +#endif // FEAT_CONCEAL } #ifdef FEAT_CONCEAL diff --git a/src/version.c b/src/version.c index c34eed04f6..91ea914243 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1338, /**/ 1337, /**/ From dabfde04fe974b444d08715178c619c99c2cdcd8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 17 May 2019 12:37:27 +0200 Subject: [PATCH 71/97] patch 8.1.1339: installer needs to product name et al. Problem: Installer needs to product name et al. Solution: Add a few lines to the NSIS installer script. (Christian Brabandt) --- nsis/gvim.nsi | 10 ++++++++++ src/version.c | 2 ++ 2 files changed, 12 insertions(+) diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi index 5416a0f886..cb2664c093 100644 --- a/nsis/gvim.nsi +++ b/nsis/gvim.nsi @@ -173,6 +173,16 @@ Page custom SetCustom ValidateCustom !include "lang\tradchinese.nsi" !endif +########################################################## +# Version resources + +VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Vim" +VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Vim Developers" +VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Vim" +VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (C) 1996" +VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Vi Improved - A Text Editor" +VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER_MAJOR}.${VER_MINOR}.0.0" +VIProductVersion "${VER_MAJOR}.${VER_MINOR}.0.0" # Global variables Var vim_dialog diff --git a/src/version.c b/src/version.c index 91ea914243..849676720b 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1339, /**/ 1338, /**/ From bfd451283f8c37926f4b0aa22b74b534bd84e482 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 17 May 2019 13:05:07 +0200 Subject: [PATCH 72/97] patch 8.1.1340: attributes from 'cursorline' overwrite textprop Problem: Attributes from 'cursorline' overwrite textprop. Solution: Combine the attributes. (closes #3912) --- src/screen.c | 8 ++++++-- src/testdir/dumps/Test_textprop_01.dump | 2 +- src/testdir/test_textprop.vim | 2 +- src/textprop.c | 3 --- src/version.c | 2 ++ 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/screen.c b/src/screen.c index cab697fd2a..e6c0b2b3d2 100644 --- a/src/screen.c +++ b/src/screen.c @@ -4306,11 +4306,15 @@ win_line( char_attr = hl_combine_attr(line_attr, area_attr); else if (search_attr != 0) char_attr = hl_combine_attr(line_attr, search_attr); - /* Use line_attr when not in the Visual or 'incsearch' area - * (area_attr may be 0 when "noinvcur" is set). */ +# ifdef FEAT_TEXT_PROP + else if (text_prop_type != NULL) + char_attr = hl_combine_attr(line_attr, text_prop_attr); +# endif else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL) || vcol < fromcol || vcol_prev < fromcol_prev || vcol >= tocol)) + // Use line_attr when not in the Visual or 'incsearch' area + // (area_attr may be 0 when "noinvcur" is set). char_attr = line_attr; #else if (area_attr != 0) diff --git a/src/testdir/dumps/Test_textprop_01.dump b/src/testdir/dumps/Test_textprop_01.dump index 002062e2c8..bda2a56f00 100644 --- a/src/testdir/dumps/Test_textprop_01.dump +++ b/src/testdir/dumps/Test_textprop_01.dump @@ -1,6 +1,6 @@ | +0#af5f00255#ffffff0@1|1| |O+0#0000000&|n|e| +0&#ffff4012|t|w|o| +0&#ffffff0@63 | +0#af5f00255&@1|2| |N+0#0000000#ffff4012|u|m|b|é|r| |1+0#4040ff13&|2|3| +0#0000000&|ä|n|d| |t|h|œ|n| |4+0#4040ff13&|¾|7|.+0#0000000&| +0&#ffffff0@46 -| +0#af5f00255&@1|3| >-+0#0000000#ffff4012|x+0&#ffffff0|a+0#4040ff13&@1|x+0#0000000&|-@1|x+0#4040ff13&|b@1|x+0#0000000&|-@1|x|c+0#4040ff13&@1|x|-+0#0000000&@1|x+0#4040ff13&|d@1|x|-+0#0000000&@1| @45 +| +0#af5f00255&@1|3| >-+8#0000000#ffff4012|x+8&#ffffff0|a+8#4040ff13&@1|x+8#0000000&|-@1|x+8#4040ff13&|b@1|x+8#0000000&|-@1|x|c+8#4040ff13&@1|x|-+8#0000000&@1|x+8#4040ff13&|d@1|x|-+8#0000000&@1| @45 | +0#af5f00255&@1|4| |/+0#40ff4011&@1| |c|o|m@1|e|n|t| |w+0&#e0e0e08|i|t|h| |e+8&&|r@1|o|r| +0&#ffffff0|i|n| |i|t| +0#0000000&@43 |~+0#4040ff13&| @73 |~| @73 diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 237eda95fb..dc229c0197 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -645,7 +645,7 @@ funct Test_textprop_screenshots() \ "call prop_add(3, 15, {'length': 2, 'type': 'both'})", \ "call prop_add(4, 12, {'length': 10, 'type': 'background'})", \ "call prop_add(4, 17, {'length': 5, 'type': 'error'})", - \ "set number", + \ "set number cursorline", \ "hi clear SpellBad", \ "set spell", \ "syn match Comment '//.*'", diff --git a/src/textprop.c b/src/textprop.c index 361ecb1269..4c78ff11c6 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -11,10 +11,7 @@ * Text properties implementation. See ":help text-properties". * * TODO: - * - When using 'cursorline' attributes should be merged. (#3912) * - Adjust text property column and length when text is inserted/deleted. - * -> splitting a line can create a zero-length property. Don't highlight it - * and extend it when inserting text. * -> a :substitute with a multi-line match * -> join two lines, also with BS in Insert mode * -> search for changed_bytes() from misc1.c diff --git a/src/version.c b/src/version.c index 849676720b..309ed3c09d 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1340, /**/ 1339, /**/ From 80e737cc6ab6b68948f6765348b6881be861b200 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 17 May 2019 19:56:34 +0200 Subject: [PATCH 73/97] patch 8.1.1341: text properties are lost when joining lines Problem: Text properties are lost when joining lines. Solution: Move the text properties to the joined line. --- src/ops.c | 54 ++++++++++-- src/proto/textprop.pro | 2 + src/testdir/dumps/Test_textprop_01.dump | 1 + src/testdir/test_textprop.vim | 13 ++- src/textprop.c | 107 +++++++++++++++++++++++- src/version.c | 2 + 6 files changed, 168 insertions(+), 11 deletions(-) diff --git a/src/ops.c b/src/ops.c index 2aa18c437c..d77aa2ef5f 100644 --- a/src/ops.c +++ b/src/ops.c @@ -1211,7 +1211,8 @@ do_execreg( int retval = OK; int remap; - if (regname == '@') /* repeat previous one */ + // repeat previous one + if (regname == '@') { if (execreg_lastc == NUL) { @@ -1220,7 +1221,7 @@ do_execreg( } regname = execreg_lastc; } - /* check for valid regname */ + // check for valid regname if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE)) { emsg_invreg(regname); @@ -1232,11 +1233,13 @@ do_execreg( regname = may_get_selection(regname); #endif - if (regname == '_') /* black hole: don't stuff anything */ + // black hole: don't stuff anything + if (regname == '_') return OK; #ifdef FEAT_CMDHIST - if (regname == ':') /* use last command line */ + // use last command line + if (regname == ':') { if (last_cmdline == NULL) { @@ -4438,7 +4441,10 @@ do_join( && has_format_option(FO_REMOVE_COMS); int prev_was_comment; #endif - +#ifdef FEAT_TEXT_PROP + textprop_T **prop_lines = NULL; + int *prop_lengths = NULL; +#endif if (save_undo && u_save((linenr_T)(curwin->w_cursor.lnum - 1), (linenr_T)(curwin->w_cursor.lnum + count)) == FAIL) @@ -4463,8 +4469,9 @@ do_join( #endif /* - * Don't move anything, just compute the final line length + * Don't move anything yet, just compute the final line length * and setup the array of space strings lengths + * This loops forward over the joined lines. */ for (t = 0; t < count; ++t) { @@ -4556,8 +4563,24 @@ do_join( cend = newp + sumsize; *cend = 0; +#ifdef FEAT_TEXT_PROP + // We need to move properties of the lines that are going to be deleted to + // the new long one. + if (curbuf->b_has_textprop && !text_prop_frozen) + { + // Allocate an array to copy the text properties of joined lines into. + // And another array to store the number of properties in each line. + prop_lines = (textprop_T **)alloc_clear( + (int)(count - 1) * sizeof(textprop_T *)); + prop_lengths = (int *)alloc_clear((int)(count - 1) * sizeof(int)); + if (prop_lengths == NULL) + VIM_CLEAR(prop_lines); + } +#endif + /* * Move affected lines to the new long one. + * This loops backwards over the joined lines, including the original line. * * Move marks from each deleted line to the joined line, adjusting the * column. This is not Vi compatible, but Vi deletes the marks, thus that @@ -4583,8 +4606,15 @@ do_join( (long)(cend - newp - spaces_removed), spaces_removed); if (t == 0) break; +#ifdef FEAT_TEXT_PROP + if (prop_lines != NULL) + adjust_props_for_join(curwin->w_cursor.lnum + t, + prop_lines + t - 1, prop_lengths + t - 1, + (long)(cend - newp - spaces_removed), spaces_removed); +#endif + curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1)); -#if defined(FEAT_COMMENTS) || defined(PROTO) +#if defined(FEAT_COMMENTS) if (remove_comments) curr += comments[t - 1]; #endif @@ -4592,7 +4622,14 @@ do_join( curr = skipwhite(curr); currsize = (int)STRLEN(curr); } - ml_replace(curwin->w_cursor.lnum, newp, FALSE); + +#ifdef FEAT_TEXT_PROP + if (prop_lines != NULL) + join_prop_lines(curwin->w_cursor.lnum, newp, + prop_lines, prop_lengths, count); + else +#endif + ml_replace(curwin->w_cursor.lnum, newp, FALSE); if (setmark) { @@ -4605,7 +4642,6 @@ do_join( * the deleted line. */ changed_lines(curwin->w_cursor.lnum, currsize, curwin->w_cursor.lnum + 1, 0L); - /* * Delete following lines. To do this we move the cursor there * briefly, and then move it back. After del_lines() the cursor may diff --git a/src/proto/textprop.pro b/src/proto/textprop.pro index 6d9553e287..4d37174aef 100644 --- a/src/proto/textprop.pro +++ b/src/proto/textprop.pro @@ -15,4 +15,6 @@ void clear_global_prop_types(void); void clear_buf_prop_types(buf_T *buf); void adjust_prop_columns(linenr_T lnum, colnr_T col, int bytes_added); void adjust_props_for_split(linenr_T lnum_props, linenr_T lnum_top, int kept, int deleted); +void adjust_props_for_join(linenr_T lnum, textprop_T **prop_line, int *prop_length, long col, int removed); +void join_prop_lines(linenr_T lnum, char_u *newp, textprop_T **prop_lines, int *prop_lengths, int count); /* vim: set ft=c : */ diff --git a/src/testdir/dumps/Test_textprop_01.dump b/src/testdir/dumps/Test_textprop_01.dump index bda2a56f00..9d3eb5c191 100644 --- a/src/testdir/dumps/Test_textprop_01.dump +++ b/src/testdir/dumps/Test_textprop_01.dump @@ -2,6 +2,7 @@ | +0#af5f00255&@1|2| |N+0#0000000#ffff4012|u|m|b|é|r| |1+0#4040ff13&|2|3| +0#0000000&|ä|n|d| |t|h|œ|n| |4+0#4040ff13&|¾|7|.+0#0000000&| +0&#ffffff0@46 | +0#af5f00255&@1|3| >-+8#0000000#ffff4012|x+8&#ffffff0|a+8#4040ff13&@1|x+8#0000000&|-@1|x+8#4040ff13&|b@1|x+8#0000000&|-@1|x|c+8#4040ff13&@1|x|-+8#0000000&@1|x+8#4040ff13&|d@1|x|-+8#0000000&@1| @45 | +0#af5f00255&@1|4| |/+0#40ff4011&@1| |c|o|m@1|e|n|t| |w+0&#e0e0e08|i|t|h| |e+8&&|r@1|o|r| +0&#ffffff0|i|n| |i|t| +0#0000000&@43 +| +0#af5f00255&@1|5| |f+0#0000000&|i|r|s|t| |l+0&#ffff4012|i|n|e| @1|s|e|c|o|n|d| +0&#ffffff0|l|i|n|e| @1|t|h|i|r|d| |l|i|n|e| |f|o|u|r|t|h| |l+0&#ffff4012|i|n|e| +0&#ffffff0@23 |~+0#4040ff13&| @73 |~| @73 | +0#0000000&@56|3|,|1| @10|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index dc229c0197..635902c7e9 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -624,6 +624,10 @@ funct Test_textprop_screenshots() \ .. "'Numbér 123 änd thœn 4¾7.'," \ .. "'--aa--bb--cc--dd--'," \ .. "'// comment with error in it'," + \ .. "'first line'," + \ .. "' second line '," + \ .. "'third line'," + \ .. "' fourth line'," \ .. "])", \ "hi NumberProp ctermfg=blue", \ "hi LongProp ctermbg=yellow", @@ -645,6 +649,10 @@ funct Test_textprop_screenshots() \ "call prop_add(3, 15, {'length': 2, 'type': 'both'})", \ "call prop_add(4, 12, {'length': 10, 'type': 'background'})", \ "call prop_add(4, 17, {'length': 5, 'type': 'error'})", + \ "call prop_add(5, 7, {'length': 4, 'type': 'long'})", + \ "call prop_add(6, 1, {'length': 8, 'type': 'long'})", + \ "call prop_add(8, 1, {'length': 1, 'type': 'long'})", + \ "call prop_add(8, 11, {'length': 4, 'type': 'long'})", \ "set number cursorline", \ "hi clear SpellBad", \ "set spell", @@ -652,8 +660,11 @@ funct Test_textprop_screenshots() \ "hi Comment ctermfg=green", \ "normal 3G0llix\lllix\lllix\lllix\lllix\lllix\lllix\lllix\", \ "normal 3G0lli\\", + \ "normal 6G0i\\", + \ "normal 3J", + \ "normal 3G", \], 'XtestProp') - let buf = RunVimInTerminal('-S XtestProp', {'rows': 7}) + let buf = RunVimInTerminal('-S XtestProp', {'rows': 8}) call VerifyScreenDump(buf, 'Test_textprop_01', {}) " clean up diff --git a/src/textprop.c b/src/textprop.c index 4c78ff11c6..8c86d01433 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -13,8 +13,8 @@ * TODO: * - Adjust text property column and length when text is inserted/deleted. * -> a :substitute with a multi-line match - * -> join two lines, also with BS in Insert mode * -> search for changed_bytes() from misc1.c + * -> search for mark_col_adjust() * - Perhaps we only need TP_FLAG_CONT_NEXT and can drop TP_FLAG_CONT_PREV? * - Add an arrray for global_proptypes, to quickly lookup a prop type by ID * - Add an arrray for b_proptypes, to quickly lookup a prop type by ID @@ -1097,4 +1097,109 @@ adjust_props_for_split( ga_clear(&nextprop); } +/* + * Line "lnum" has been joined and will end up at column "col" in the new line. + * "removed" bytes have been removed from the start of the line, properties + * there are to be discarded. + * Move the adjusted text properties to an allocated string, store it in + * "prop_line" and adjust the columns. + */ + void +adjust_props_for_join( + linenr_T lnum, + textprop_T **prop_line, + int *prop_length, + long col, + int removed) +{ + int proplen; + char_u *props; + int ri; + int wi = 0; + + proplen = get_text_props(curbuf, lnum, &props, FALSE); + if (proplen > 0) + { + *prop_line = (textprop_T *)alloc(proplen * (int)sizeof(textprop_T)); + if (*prop_line != NULL) + { + for (ri = 0; ri < proplen; ++ri) + { + textprop_T *cp = *prop_line + wi; + + mch_memmove(cp, props + ri * sizeof(textprop_T), + sizeof(textprop_T)); + if (cp->tp_col + cp->tp_len > removed) + { + if (cp->tp_col > removed) + cp->tp_col += col; + else + { + // property was partly deleted, make it shorter + cp->tp_len -= removed - cp->tp_col; + cp->tp_col = col; + } + ++wi; + } + } + } + *prop_length = wi; + } +} + +/* + * After joining lines: concatenate the text and the properties of all joined + * lines into one line and replace the line. + */ + void +join_prop_lines( + linenr_T lnum, + char_u *newp, + textprop_T **prop_lines, + int *prop_lengths, + int count) +{ + size_t proplen = 0; + size_t oldproplen; + char_u *props; + int i; + int len; + char_u *line; + size_t l; + + for (i = 0; i < count - 1; ++i) + proplen += prop_lengths[i]; + if (proplen == 0) + { + ml_replace(lnum, newp, FALSE); + return; + } + + // get existing properties of the joined line + oldproplen = get_text_props(curbuf, lnum, &props, FALSE); + + len = (int)STRLEN(newp) + 1; + line = alloc(len + (oldproplen + proplen) * (int)sizeof(textprop_T)); + if (line == NULL) + return; + mch_memmove(line, newp, len); + l = oldproplen * sizeof(textprop_T); + mch_memmove(line + len, props, l); + len += l; + + for (i = 0; i < count - 1; ++i) + if (prop_lines[i] != NULL) + { + l = prop_lengths[i] * sizeof(textprop_T); + mch_memmove(line + len, prop_lines[i], l); + len += l; + vim_free(prop_lines[i]); + } + + ml_replace_len(lnum, line, len, TRUE, FALSE); + vim_free(newp); + vim_free(prop_lines); + vim_free(prop_lengths); +} + #endif // FEAT_TEXT_PROP diff --git a/src/version.c b/src/version.c index 309ed3c09d..f9329ba8c4 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1341, /**/ 1340, /**/ From 787880a86dbcb79cdf6e8241b1d99ac4a7acbc09 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 17 May 2019 20:17:40 +0200 Subject: [PATCH 74/97] patch 8.1.1342: using freed memory when joining line with text property Problem: Using freed memory when joining line with text property. Solution: Use already computed length. --- src/ops.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ops.c b/src/ops.c index d77aa2ef5f..489c473544 100644 --- a/src/ops.c +++ b/src/ops.c @@ -4635,7 +4635,7 @@ do_join( { /* Set the '] mark. */ curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum; - curwin->w_buffer->b_op_end.col = (colnr_T)STRLEN(newp); + curwin->w_buffer->b_op_end.col = (colnr_T)sumsize; } /* Only report the change in the first line here, del_lines() will report diff --git a/src/version.c b/src/version.c index f9329ba8c4..07db364bf3 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1342, /**/ 1341, /**/ From 8055d17388736421d875dd4933c4c93d49a2ab58 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 17 May 2019 22:57:26 +0200 Subject: [PATCH 75/97] patch 8.1.1343: text properties not adjusted for Visual block mode delete Problem: Text properties not adjusted for Visual block mode delete. Solution: Call adjust_prop_columns(). (closes #4384) --- src/misc1.c | 11 ++++- src/ops.c | 12 +++-- src/testdir/dumps/Test_textprop_vis_01.dump | 12 +++++ src/testdir/dumps/Test_textprop_vis_02.dump | 12 +++++ src/testdir/test_textprop.vim | 51 ++++++++++++++++++++- src/textprop.c | 19 ++++++-- src/version.c | 2 + 7 files changed, 109 insertions(+), 10 deletions(-) create mode 100644 src/testdir/dumps/Test_textprop_vis_01.dump create mode 100644 src/testdir/dumps/Test_textprop_vis_02.dump diff --git a/src/misc1.c b/src/misc1.c index 5dcf268481..f83e807954 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -434,8 +434,15 @@ set_indent( saved_cursor.col = (colnr_T)(s - newline); } #ifdef FEAT_TEXT_PROP - adjust_prop_columns(curwin->w_cursor.lnum, (colnr_T)(p - oldline), - ind_len - (colnr_T)(p - oldline)); + { + int added = ind_len - (colnr_T)(p - oldline); + + // When increasing indent this behaves like spaces were inserted at + // the old indent, when decreasing indent it behaves like spaces + // were deleted at the new indent. + adjust_prop_columns(curwin->w_cursor.lnum, + (colnr_T)(added > 0 ? (p - oldline) : ind_len), added); + } #endif retval = TRUE; } diff --git a/src/ops.c b/src/ops.c index 489c473544..480516b30f 100644 --- a/src/ops.c +++ b/src/ops.c @@ -1916,10 +1916,9 @@ op_delete(oparg_T *oap) curwin->w_cursor.coladd = 0; } - /* n == number of chars deleted - * If we delete a TAB, it may be replaced by several characters. - * Thus the number of characters may increase! - */ + // "n" == number of chars deleted + // If we delete a TAB, it may be replaced by several characters. + // Thus the number of characters may increase! n = bd.textlen - bd.startspaces - bd.endspaces; oldp = ml_get(lnum); newp = alloc_check((unsigned)STRLEN(oldp) + 1 - n); @@ -1935,6 +1934,11 @@ op_delete(oparg_T *oap) STRMOVE(newp + bd.textcol + bd.startspaces + bd.endspaces, oldp); /* replace the line */ ml_replace(lnum, newp, FALSE); + +#ifdef FEAT_TEXT_PROP + if (curbuf->b_has_textprop && n != 0) + adjust_prop_columns(lnum, bd.textcol, -n); +#endif } check_cursor_col(); diff --git a/src/testdir/dumps/Test_textprop_vis_01.dump b/src/testdir/dumps/Test_textprop_vis_01.dump new file mode 100644 index 0000000000..f411d304bc --- /dev/null +++ b/src/testdir/dumps/Test_textprop_vis_01.dump @@ -0,0 +1,12 @@ +|x+0&#ffffff0@4>x@1| |1+0&#ffff4012|2|3| +0&#ffffff0|x| @61 +|x@5| |1+0&#ffff4012|2|3| +0&#ffffff0|x| @62 +|x@4| |1+0&#ffff4012|2|3| +0&#ffffff0|x| @63 +|x@4|1+0&#ffff4012|2|3| +0&#ffffff0|x| @64 +|x@4|2+0&#ffff4012|3| +0&#ffffff0|x| @65 +|x@3| |3+0&#ffff4012| +0&#ffffff0|x@1| @65 +|x@2| |1+0&#ffff4012| +0&#ffffff0|x@2| @65 +|x@1| |1+0&#ffff4012|2|x+0&#ffffff0@3| @65 +|x| |1+0&#ffff4012|2|3|x+0&#ffffff0@3| @65 +@1|1+0&#ffff4012|2|3| +0&#ffffff0|x@3| @65 +|~+0#4040ff13&| @73 +| +0#0000000&@56|1|,|6| @10|A|l@1| diff --git a/src/testdir/dumps/Test_textprop_vis_02.dump b/src/testdir/dumps/Test_textprop_vis_02.dump new file mode 100644 index 0000000000..d999ae1d69 --- /dev/null +++ b/src/testdir/dumps/Test_textprop_vis_02.dump @@ -0,0 +1,12 @@ +|x+0&#ffffff0@4> |1+0&#ffff4012|2|3| +0&#ffffff0|x| @63 +|x@4|1+0&#ffff4012|2|3| +0&#ffffff0|x| @64 +|x@4|2+0&#ffff4012|3| +0&#ffffff0|x| @65 +|x@4|3+0&#ffff4012| +0&#ffffff0|x| @66 +|x@4| |x| @67 +|x@3| |x@1| @67 +|x@2| |1+0&#ffff4012|x+0&#ffffff0@1| @67 +|x@1| |1+0&#ffff4012|2|x+0&#ffffff0@1| @67 +|x| |1+0&#ffff4012|2|3|x+0&#ffffff0@1| @67 +@1|1+0&#ffff4012|2|3| +0&#ffffff0|x@1| @67 +|~+0#4040ff13&| @73 +| +0#0000000&@56|1|,|6| @10|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 635902c7e9..d1897a236e 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -613,7 +613,7 @@ func Test_prop_undo() endfunc " screenshot test with textprop highlighting -funct Test_textprop_screenshots() +func Test_textprop_screenshot_various() " The Vim running in the terminal needs to use utf-8. if !CanRunVimInTerminal() || g:orig_encoding != 'utf-8' return @@ -671,3 +671,52 @@ funct Test_textprop_screenshots() call StopVimInTerminal(buf) call delete('XtestProp') endfunc + +func RunTestVisualBlock(width, dump) + call writefile([ + \ "call setline(1, [" + \ .. "'xxxxxxxxx 123 x'," + \ .. "'xxxxxxxx 123 x'," + \ .. "'xxxxxxx 123 x'," + \ .. "'xxxxxx 123 x'," + \ .. "'xxxxx 123 x'," + \ .. "'xxxx 123 xx'," + \ .. "'xxx 123 xxx'," + \ .. "'xx 123 xxxx'," + \ .. "'x 123 xxxxx'," + \ .. "' 123 xxxxxx'," + \ .. "])", + \ "hi SearchProp ctermbg=yellow", + \ "call prop_type_add('search', {'highlight': 'SearchProp'})", + \ "call prop_add(1, 11, {'length': 3, 'type': 'search'})", + \ "call prop_add(2, 10, {'length': 3, 'type': 'search'})", + \ "call prop_add(3, 9, {'length': 3, 'type': 'search'})", + \ "call prop_add(4, 8, {'length': 3, 'type': 'search'})", + \ "call prop_add(5, 7, {'length': 3, 'type': 'search'})", + \ "call prop_add(6, 6, {'length': 3, 'type': 'search'})", + \ "call prop_add(7, 5, {'length': 3, 'type': 'search'})", + \ "call prop_add(8, 4, {'length': 3, 'type': 'search'})", + \ "call prop_add(9, 3, {'length': 3, 'type': 'search'})", + \ "call prop_add(10, 2, {'length': 3, 'type': 'search'})", + \ "normal 1G6|\" .. repeat('l', a:width - 1) .. "10jx", + \], 'XtestPropVis') + let buf = RunVimInTerminal('-S XtestPropVis', {'rows': 12}) + call VerifyScreenDump(buf, 'Test_textprop_vis_' .. a:dump, {}) + + " clean up + call StopVimInTerminal(buf) + call delete('XtestPropVis') +endfunc + +" screenshot test with Visual block mode operations +func Test_textprop_screenshot_visual() + if !CanRunVimInTerminal() + return + endif + + " Delete two columns while text props are three chars wide. + call RunTestVisualBlock(2, '01') + + " Same, but delete four columns + call RunTestVisualBlock(4, '02') +endfunc diff --git a/src/textprop.c b/src/textprop.c index 8c86d01433..94b4d6b82b 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -957,7 +957,7 @@ clear_buf_prop_types(buf_T *buf) * shift by "bytes_added" (can be negative). * Note that "col" is zero-based, while tp_col is one-based. * Only for the current buffer. - * Called is expected to check b_has_textprop and "bytes_added" being non-zero. + * Caller is expected to check b_has_textprop and "bytes_added" being non-zero. */ void adjust_prop_columns( @@ -994,15 +994,28 @@ adjust_prop_columns( ? 2 : 1)) : (tmp_prop.tp_col > col + 1)) { - tmp_prop.tp_col += bytes_added; + if (tmp_prop.tp_col + bytes_added < col + 1) + { + tmp_prop.tp_len += (tmp_prop.tp_col - 1 - col) + bytes_added; + tmp_prop.tp_col = col + 1; + } + else + tmp_prop.tp_col += bytes_added; dirty = TRUE; + if (tmp_prop.tp_len <= 0) + continue; // drop this text property } else if (tmp_prop.tp_len > 0 && tmp_prop.tp_col + tmp_prop.tp_len > col + ((pt != NULL && (pt->pt_flags & PT_FLAG_INS_END_INCL)) ? 0 : 1)) { - tmp_prop.tp_len += bytes_added; + int after = col - bytes_added + - (tmp_prop.tp_col - 1 + tmp_prop.tp_len); + if (after > 0) + tmp_prop.tp_len += bytes_added + after; + else + tmp_prop.tp_len += bytes_added; dirty = TRUE; if (tmp_prop.tp_len <= 0) continue; // drop this text property diff --git a/src/version.c b/src/version.c index 07db364bf3..f32cd286f7 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1343, /**/ 1342, /**/ From 0d3cb73012332964e7a81d7afd1c21d393f45566 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 18 May 2019 13:05:18 +0200 Subject: [PATCH 76/97] patch 8.1.1344: Coverity complains about possibly using a NULL pointer Problem: Coverity complains about possibly using a NULL pointer and copying a string into a fixed size buffer. Solution: Check for NULL, even though it should not happen. Use vim_strncpy() instead of strcpy(). --- src/change.c | 12 ++++++++---- src/memline.c | 7 ++++--- src/version.c | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/change.c b/src/change.c index f1c3cc4d02..33db0c1b80 100644 --- a/src/change.c +++ b/src/change.c @@ -193,12 +193,16 @@ check_recorded_changes( // can be merged. di = dict_find(li->li_tv.vval.v_dict, (char_u *)"end", -1); - nr = tv_get_number(&di->di_tv); - if (lnume > nr) - di->di_tv.vval.v_number = lnume; + if (di != NULL) + { + nr = tv_get_number(&di->di_tv); + if (lnume > nr) + di->di_tv.vval.v_number = lnume; + } di = dict_find(li->li_tv.vval.v_dict, (char_u *)"added", -1); - di->di_tv.vval.v_number += xtra; + if (di != NULL) + di->di_tv.vval.v_number += xtra; return TRUE; } } diff --git a/src/memline.c b/src/memline.c index 006a8b52df..8772c4a8e4 100644 --- a/src/memline.c +++ b/src/memline.c @@ -1874,7 +1874,7 @@ recover_names( } } - /* check for out-of-memory */ + // check for out-of-memory for (i = 0; i < num_names; ++i) { if (names[i] == NULL) @@ -2101,7 +2101,7 @@ get_ctime(time_t thetime, int add_newline) # endif /* MSVC returns NULL for an invalid value of seconds. */ if (curtime == NULL) - STRCPY(buf, _("(Invalid)")); + vim_strncpy((char_u *)buf, (char_u *)_("(Invalid)"), sizeof(buf) - 1); else (void)strftime(buf, sizeof(buf) - 1, "%a %b %d %H:%M:%S %Y", curtime); #else @@ -3374,7 +3374,8 @@ ml_replace_len( if (newline != NULL) { mch_memmove(newline, line, len); - mch_memmove(newline + len, curbuf->b_ml.ml_line_ptr + oldtextlen, textproplen); + mch_memmove(newline + len, curbuf->b_ml.ml_line_ptr + + oldtextlen, textproplen); vim_free(line); line = newline; len += (colnr_T)textproplen; diff --git a/src/version.c b/src/version.c index f32cd286f7..c31a98b449 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1344, /**/ 1343, /**/ From 6349e9411fd17f80c7aff9c678a8800647d34cfa Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 18 May 2019 13:41:22 +0200 Subject: [PATCH 77/97] patch 8.1.1345: stuck in sandbox with ":s/../\=Function/gn" Problem: Stuck in sandbox with ":s/../\=Function/gn". Solution: Don't skip over code to restore sandbox. (Christian Brabandt) --- src/ex_cmds.c | 15 ++++++--------- src/testdir/test_substitute.vim | 11 +++++++++++ src/version.c | 2 ++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index b99e54bce3..3c9166d424 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5555,28 +5555,25 @@ do_sub(exarg_T *eap) #ifdef FEAT_EVAL if (subflags.do_count) { - /* prevent accidentally changing the buffer by a function */ - save_ma = curbuf->b_p_ma; + // prevent accidentally changing the buffer by a function curbuf->b_p_ma = FALSE; sandbox++; } - /* Save flags for recursion. They can change for e.g. - * :s/^/\=execute("s#^##gn") */ + // Save flags for recursion. They can change for e.g. + // :s/^/\=execute("s#^##gn") subflags_save = subflags; + save_ma = curbuf->b_p_ma; #endif - /* get length of substitution part */ + // get length of substitution part sublen = vim_regsub_multi(®match, sub_firstlnum - regmatch.startpos[0].lnum, sub, sub_firstline, FALSE, p_magic, TRUE); #ifdef FEAT_EVAL // If getting the substitute string caused an error, don't do // the replacement. - if (aborting()) - goto skip; - // Don't keep flags set by a recursive call. subflags = subflags_save; - if (subflags.do_count) + if (aborting() || subflags.do_count) { curbuf->b_p_ma = save_ma; if (sandbox > 0) diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim index a58b56ec89..06bdc243db 100644 --- a/src/testdir/test_substitute.vim +++ b/src/testdir/test_substitute.vim @@ -638,6 +638,17 @@ func Test_nocatch_sub_failure_handling() call assert_equal(1, error_caught) call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3)) + " Same, but using "n" flag so that "sandbox" gets set + call setline(1, ['1 aaa', '2 aaa', '3 aaa']) + let error_caught = 0 + try + %s/aaa/\=Foo()/gn + catch + let error_caught = 1 + endtry + call assert_equal(1, error_caught) + call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3)) + bwipe! endfunc diff --git a/src/version.c b/src/version.c index c31a98b449..5194276554 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1345, /**/ 1344, /**/ From 7f3a28490abb7c495239fc438825e3d1aaafa76d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 18 May 2019 15:02:25 +0200 Subject: [PATCH 78/97] patch 8.1.1346: error for Python exception does not show useful info Problem: Error for Python exception does not show useful info. Solution: Show the last line instead of the first one. (Ben Jackson, closes #4381) --- src/if_py_both.h | 2 ++ src/testdir/test86.ok | 2 +- src/testdir/test87.ok | 2 +- src/testdir/test_python2.vim | 8 ++++++++ src/testdir/test_python3.vim | 8 ++++++++ src/testdir/test_pyx2.vim | 8 ++++++++ src/testdir/test_pyx3.vim | 8 ++++++++ src/version.c | 2 ++ 8 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index 4e1a42a3cf..cc0450c13b 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -412,6 +412,8 @@ write_output(OutputObject *self, PyObject *string) Py_BEGIN_ALLOW_THREADS Python_Lock_Vim(); + if (error) + emsg_severe = TRUE; writer((writefn)(error ? emsg : msg), (char_u *)str, len); Python_Release_Vim(); Py_END_ALLOW_THREADS diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index 24d3fd4bde..6ad02e3723 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -91,7 +91,7 @@ pyeval("None") = v:none 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: -undefined_name: Vim(let):Trace +undefined_name: Vim(let):NameE vim: Vim(let):E859: [1] [1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index a7d4f64264..7ddea8f26e 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -91,7 +91,7 @@ py3eval("None") = v:none 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: -undefined_name: Vim(let):Trace +undefined_name: Vim(let):NameE vim: Vim(let):E859: [1] [1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim index 632f7a872f..5703231ed7 100644 --- a/src/testdir/test_python2.vim +++ b/src/testdir/test_python2.vim @@ -160,3 +160,11 @@ func Test_Write_To_Current_Buffer_Fixes_Cursor_Str() bwipe! endfunction + +func Test_Catch_Exception_Message() + try + py raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry +endfunc diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim index 514661ee25..aacc5a5759 100644 --- a/src/testdir/test_python3.vim +++ b/src/testdir/test_python3.vim @@ -160,3 +160,11 @@ func Test_Write_To_Current_Buffer_Fixes_Cursor_Str() bwipe! endfunction + +func Test_Catch_Exception_Message() + try + py3 raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry +endfunc diff --git a/src/testdir/test_pyx2.vim b/src/testdir/test_pyx2.vim index 50e57c3bfb..baaf7fa300 100644 --- a/src/testdir/test_pyx2.vim +++ b/src/testdir/test_pyx2.vim @@ -72,3 +72,11 @@ func Test_pyxfile() call assert_match(s:py3pattern, split(var)[0]) endif endfunc + +func Test_Catch_Exception_Message() + try + pyx raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry +endfunc diff --git a/src/testdir/test_pyx3.vim b/src/testdir/test_pyx3.vim index 64546b4688..4b6057a8d5 100644 --- a/src/testdir/test_pyx3.vim +++ b/src/testdir/test_pyx3.vim @@ -72,3 +72,11 @@ func Test_pyxfile() call assert_match(s:py2pattern, split(var)[0]) endif endfunc + +func Test_Catch_Exception_Message() + try + pyx raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry +endfunc diff --git a/src/version.c b/src/version.c index 5194276554..fc1a5d56fb 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1346, /**/ 1345, /**/ From bd2d68c2f42c7689f681aeaf82606d17f8a0312f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 18 May 2019 15:36:11 +0200 Subject: [PATCH 79/97] patch 8.1.1347: fractional scroll position not restored after closing window Problem: Fractional scroll position not restored after closing window. Solution: Do restore fraction if topline is not one. --- src/testdir/test_window_cmd.vim | 30 +++++++++++++++--------------- src/version.c | 2 ++ src/window.c | 5 +++-- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim index c7be133b5f..b3eecd7050 100644 --- a/src/testdir/test_window_cmd.vim +++ b/src/testdir/test_window_cmd.vim @@ -745,16 +745,8 @@ endfunc func Test_split_noscroll() let so_save = &so - new - only - - " Make sure windows can hold all content after split. - for i in range(1, 20) - wincmd + - redraw! - endfor - - call setline (1, range(1, 8)) + enew + call setline(1, range(1, 8)) normal 100% split @@ -769,12 +761,20 @@ func Test_split_noscroll() call assert_equal(1, info1.topline) call assert_equal(1, info2.topline) - " Restore original state. - for i in range(1, 20) - wincmd - - redraw! - endfor + " window that fits all lines by itself, but not when split: closing other + " window should restore fraction. only! + call setline(1, range(1, &lines - 10)) + exe &lines / 4 + let winid1 = win_getid() + let info1 = getwininfo(winid1)[0] + call assert_equal(1, info1.topline) + new + redraw + close + let info1 = getwininfo(winid1)[0] + call assert_equal(1, info1.topline) + bwipe! let &so = so_save endfunc diff --git a/src/version.c b/src/version.c index fc1a5d56fb..6166c157cc 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1347, /**/ 1346, /**/ diff --git a/src/window.c b/src/window.c index f031989197..fd732f22d3 100644 --- a/src/window.c +++ b/src/window.c @@ -5830,10 +5830,11 @@ scroll_to_fraction(win_T *wp, int prev_height) // Don't change w_topline in any of these cases: // - window height is 0 // - 'scrollbind' is set and this isn't the current window - // - window height is sufficient to display the whole buffer + // - window height is sufficient to display the whole buffer and first line + // is visible. if (height > 0 && (!wp->w_p_scb || wp == curwin) - && (height < wp->w_buffer->b_ml.ml_line_count)) + && (height < wp->w_buffer->b_ml.ml_line_count || wp->w_topline > 1)) { /* * Find a value for w_topline that shows the cursor at the same From f8191c5f07c650b75b85c5a5b3d000fd5cae1643 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 18 May 2019 17:22:54 +0200 Subject: [PATCH 80/97] patch 8.1.1348: running tests may cause the window to move Problem: Running tests may cause the window to move. Solution: Correct the reported window position for the offset with the position after ":winpos". Works around an xterm bug. --- src/testdir/test_edit.vim | 19 ++++++++++++++++++- src/version.c | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim index 381e09cb48..32569b6254 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -1359,9 +1359,26 @@ func Test_edit_complete_very_long_name() return endtry - " Try to get the Vim window position before setting 'columns'. + " Try to get the Vim window position before setting 'columns', so that we can + " move the window back to where it was. let winposx = getwinposx() let winposy = getwinposy() + + if winposx >= 0 && winposy >= 0 && !has('gui_running') + " We did get the window position, but xterm may report the wrong numbers. + " Move the window to the reported position and compute any offset. + exe 'winpos ' . winposx . ' ' . winposy + sleep 100m + let x = getwinposx() + if x >= 0 + let winposx += winposx - x + endif + let y = getwinposy() + if y >= 0 + let winposy += winposy - y + endif + endif + let save_columns = &columns " Need at least about 1100 columns to reproduce the problem. set columns=2000 diff --git a/src/version.c b/src/version.c index 6166c157cc..a658c5ab0a 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1348, /**/ 1347, /**/ From cf0bfd9ade5173bcc12563bfc90c21a4db10535d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 18 May 2019 18:52:04 +0200 Subject: [PATCH 81/97] patch 8.1.1349: if writing runs into conversion error backup file is deleted Problem: If writing runs into a conversion error the backup file is deleted. (Arseny Nasokin) Solution: Don't delete the backup file is the file was overwritten and a conversion error occurred. (Christian Brabandt, closes #4387) --- src/fileio.c | 8 ++++---- src/testdir/test_writefile.vim | 25 ++++++++++++++++++++++++- src/version.c | 2 ++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 659878eb91..4d9cd05f01 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4985,10 +4985,10 @@ restore_backup: } } - /* - * Remove the backup unless 'backup' option is set - */ - if (!p_bk && backup != NULL && mch_remove(backup) != 0) + // Remove the backup unless 'backup' option is set or there was a + // conversion error. + if (!p_bk && backup != NULL && !write_info.bw_conv_error + && mch_remove(backup) != 0) emsg(_("E207: Can't delete backup file")); goto nofail; diff --git a/src/testdir/test_writefile.vim b/src/testdir/test_writefile.vim index ff3675661f..a06333d806 100644 --- a/src/testdir/test_writefile.vim +++ b/src/testdir/test_writefile.vim @@ -36,13 +36,15 @@ func Test_writefile_fails_conversion() if !has('iconv') || has('sun') return endif + " Without a backup file the write won't happen if there is a conversion + " error. set nobackup nowritebackup new let contents = ["line one", "line two"] call writefile(contents, 'Xfile') edit Xfile call setline(1, ["first line", "cannot convert \u010b", "third line"]) - call assert_fails('write ++enc=cp932') + call assert_fails('write ++enc=cp932', 'E513:') call assert_equal(contents, readfile('Xfile')) call delete('Xfile') @@ -50,6 +52,27 @@ func Test_writefile_fails_conversion() set backup& writebackup& endfunc +func Test_writefile_fails_conversion2() + if !has('iconv') || has('sun') + return + endif + " With a backup file the write happens even if there is a conversion error, + " but then the backup file must remain + set nobackup writebackup + let contents = ["line one", "line two"] + call writefile(contents, 'Xfile_conversion_err') + edit Xfile_conversion_err + call setline(1, ["first line", "cannot convert \u010b", "third line"]) + set fileencoding=latin1 + let output = execute('write') + call assert_match('CONVERSION ERROR', output) + call assert_equal(contents, readfile('Xfile_conversion_err~')) + + call delete('Xfile_conversion_err') + call delete('Xfile_conversion_err~') + bwipe! +endfunc + func SetFlag(timer) let g:flag = 1 endfunc diff --git a/src/version.c b/src/version.c index a658c5ab0a..efddd3eaf2 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1349, /**/ 1348, /**/ From dc6855af974f2ef553aceee619fadcb858e25d39 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 18 May 2019 19:26:29 +0200 Subject: [PATCH 82/97] patch 8.1.1350: "W" for wrapping not shown when more than 99 matches Problem: "W" for wrapping not shown when more than 99 matches. Solution: Adjust check for length. (Masato Nishihata, closes #4388) --- src/search.c | 2 +- src/testdir/test_search_stat.vim | 8 ++++++++ src/version.c | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/search.c b/src/search.c index d9b6a7ca85..56bd763dda 100644 --- a/src/search.c +++ b/src/search.c @@ -5012,7 +5012,7 @@ search_stat( } len = STRLEN(t); - if (show_top_bot_msg && len + 3 < SEARCH_STAT_BUF_LEN) + if (show_top_bot_msg && len + 2 < SEARCH_STAT_BUF_LEN) { STRCPY(t + len, " W"); len += 2; diff --git a/src/testdir/test_search_stat.vim b/src/testdir/test_search_stat.vim index 107cd54a0e..322d137e2e 100644 --- a/src/testdir/test_search_stat.vim +++ b/src/testdir/test_search_stat.vim @@ -40,12 +40,20 @@ func! Test_search_stat() let g:a = execute(':unsilent :norm! n') let stat = '\[>99/>99\]' call assert_match(pat .. stat, g:a) + call cursor(line('$'), 1) + let g:a = execute(':unsilent :norm! n') + let stat = '\[1/>99\] W' + call assert_match(pat .. stat, g:a) " 5) Many matches call cursor(1, 1) let g:a = execute(':unsilent :norm! n') let stat = '\[2/>99\]' call assert_match(pat .. stat, g:a) + call cursor(1, 1) + let g:a = execute(':unsilent :norm! N') + let stat = '\[>99/>99\] W' + call assert_match(pat .. stat, g:a) " 6) right-left if exists("+rightleft") diff --git a/src/version.c b/src/version.c index efddd3eaf2..ac07931988 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1350, /**/ 1349, /**/ From 338dfdad3844ebb1ce1d56c421d1f698c086eb0c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 19 May 2019 15:19:57 +0200 Subject: [PATCH 83/97] patch 8.1.1351: text property wrong after :substitute Problem: Text property wrong after :substitute. Solution: Save for undo before changing any text properties. --- src/change.c | 2 +- src/edit.c | 2 +- src/ex_cmds.c | 12 ++++++++++-- src/misc1.c | 2 +- src/ops.c | 2 +- src/proto/textprop.pro | 2 +- src/testdir/test_textprop.vim | 13 +++++++++++++ src/textprop.c | 19 +++++++++++++++---- src/version.c | 2 ++ 9 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/change.c b/src/change.c index 33db0c1b80..fa8c42538f 100644 --- a/src/change.c +++ b/src/change.c @@ -684,7 +684,7 @@ inserted_bytes(linenr_T lnum, colnr_T col, int added UNUSED) { #ifdef FEAT_TEXT_PROP if (curbuf->b_has_textprop && added != 0) - adjust_prop_columns(lnum, col, added); + adjust_prop_columns(lnum, col, added, FALSE); #endif changed_bytes(lnum, col); diff --git a/src/edit.c b/src/edit.c index 483ef4abcb..be195fc1ae 100644 --- a/src/edit.c +++ b/src/edit.c @@ -4104,7 +4104,7 @@ replace_do_bs(int limit_col) --text_prop_frozen; adjust_prop_columns(curwin->w_cursor.lnum, curwin->w_cursor.col, - (int)(len_now - len_before)); + (int)(len_now - len_before), FALSE); } #endif } diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 3c9166d424..964c4556c9 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5187,6 +5187,9 @@ do_sub(exarg_T *eap) int do_again; /* do it again after joining lines */ int skip_match = FALSE; linenr_T sub_firstlnum; /* nr of first sub line */ +#ifdef FEAT_TEXT_PROP + int save_for_undo = TRUE; +#endif /* * The new text is build up step by step, to avoid too much @@ -5603,9 +5606,14 @@ do_sub(exarg_T *eap) p1 = sub_firstline; #ifdef FEAT_TEXT_PROP if (curbuf->b_has_textprop) - adjust_prop_columns(lnum, regmatch.startpos[0].col, + { + // When text properties are changed, need to save for + // undo first, unless done already. + if (adjust_prop_columns(lnum, regmatch.startpos[0].col, sublen - 1 - (regmatch.endpos[0].col - - regmatch.startpos[0].col)); + - regmatch.startpos[0].col), save_for_undo)) + save_for_undo = FALSE; + } #endif } else diff --git a/src/misc1.c b/src/misc1.c index f83e807954..1eac5189ae 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -441,7 +441,7 @@ set_indent( // the old indent, when decreasing indent it behaves like spaces // were deleted at the new indent. adjust_prop_columns(curwin->w_cursor.lnum, - (colnr_T)(added > 0 ? (p - oldline) : ind_len), added); + (colnr_T)(added > 0 ? (p - oldline) : ind_len), added, FALSE); } #endif retval = TRUE; diff --git a/src/ops.c b/src/ops.c index 480516b30f..975a56f372 100644 --- a/src/ops.c +++ b/src/ops.c @@ -1937,7 +1937,7 @@ op_delete(oparg_T *oap) #ifdef FEAT_TEXT_PROP if (curbuf->b_has_textprop && n != 0) - adjust_prop_columns(lnum, bd.textcol, -n); + adjust_prop_columns(lnum, bd.textcol, -n, FALSE); #endif } diff --git a/src/proto/textprop.pro b/src/proto/textprop.pro index 4d37174aef..0114b4fadc 100644 --- a/src/proto/textprop.pro +++ b/src/proto/textprop.pro @@ -13,7 +13,7 @@ void f_prop_type_get(typval_T *argvars, typval_T *rettv); void f_prop_type_list(typval_T *argvars, typval_T *rettv); void clear_global_prop_types(void); void clear_buf_prop_types(buf_T *buf); -void adjust_prop_columns(linenr_T lnum, colnr_T col, int bytes_added); +int adjust_prop_columns(linenr_T lnum, colnr_T col, int bytes_added, int save_for_undo); void adjust_props_for_split(linenr_T lnum_props, linenr_T lnum_top, int kept, int deleted); void adjust_props_for_join(linenr_T lnum, textprop_T **prop_line, int *prop_length, long col, int removed); void join_prop_lines(linenr_T lnum, char_u *newp, textprop_T **prop_lines, int *prop_lengths, int count); diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index d1897a236e..eb30c04c6c 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -608,6 +608,19 @@ func Test_prop_undo() let expected[0].length = 2 call assert_equal(expected, prop_list(1)) + " substitute a word, then undo + call setline(1, 'the number 123 is highlighted.') + call prop_add(1, 12, {'length': 3, 'type': 'comment'}) + let expected = [{'col': 12, 'length': 3, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ] + call assert_equal(expected, prop_list(1)) + set ul& + 1s/number/foo + let expected[0].col = 9 + call assert_equal(expected, prop_list(1)) + undo + let expected[0].col = 12 + call assert_equal(expected, prop_list(1)) + bwipe! call prop_type_delete('comment') endfunc diff --git a/src/textprop.c b/src/textprop.c index 94b4d6b82b..aa3e83b354 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -957,13 +957,17 @@ clear_buf_prop_types(buf_T *buf) * shift by "bytes_added" (can be negative). * Note that "col" is zero-based, while tp_col is one-based. * Only for the current buffer. + * When "save_for_undo" is TRUE then call u_savesub() before making changes to + * the line. * Caller is expected to check b_has_textprop and "bytes_added" being non-zero. + * Returns TRUE when props were changed. */ - void + int adjust_prop_columns( linenr_T lnum, colnr_T col, - int bytes_added) + int bytes_added, + int save_for_undo) { int proplen; char_u *props; @@ -974,11 +978,11 @@ adjust_prop_columns( size_t textlen; if (text_prop_frozen > 0) - return; + return FALSE; proplen = get_text_props(curbuf, lnum, &props, TRUE); if (proplen == 0) - return; + return FALSE; textlen = curbuf->b_ml.ml_line_len - proplen * sizeof(textprop_T); wi = 0; // write index @@ -1001,6 +1005,9 @@ adjust_prop_columns( } else tmp_prop.tp_col += bytes_added; + // Save for undo if requested and not done yet. + if (save_for_undo && !dirty) + u_savesub(lnum); dirty = TRUE; if (tmp_prop.tp_len <= 0) continue; // drop this text property @@ -1016,6 +1023,9 @@ adjust_prop_columns( tmp_prop.tp_len += bytes_added + after; else tmp_prop.tp_len += bytes_added; + // Save for undo if requested and not done yet. + if (save_for_undo && !dirty) + u_savesub(lnum); dirty = TRUE; if (tmp_prop.tp_len <= 0) continue; // drop this text property @@ -1034,6 +1044,7 @@ adjust_prop_columns( curbuf->b_ml.ml_flags |= ML_LINE_DIRTY; curbuf->b_ml.ml_line_len = newlen; } + return dirty; } /* diff --git a/src/version.c b/src/version.c index ac07931988..8bf07e3e99 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1351, /**/ 1350, /**/ From e9ebc9a91cac357fd4888f4b71fdff7d97b41160 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 19 May 2019 15:27:14 +0200 Subject: [PATCH 84/97] patch 8.1.1352: undofile() reports wrong name Problem: Undofile() reports wrong name. (Francisco Giordano) Solution: Clean up the name before changing path separators. (closes #4392, closes #4394) --- src/evalfunc.c | 2 +- src/testdir/test_undo.vim | 5 +++++ src/version.c | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index b5a6d685c6..4c02e159b9 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -15128,7 +15128,7 @@ f_undofile(typval_T *argvars UNUSED, typval_T *rettv) } else { - char_u *ffname = FullName_save(fname, FALSE); + char_u *ffname = FullName_save(fname, TRUE); if (ffname != NULL) rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE); diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim index 7c93e23153..ba1c861f8b 100644 --- a/src/testdir/test_undo.vim +++ b/src/testdir/test_undo.vim @@ -440,5 +440,10 @@ funct Test_undofile() " Test undofile() with 'undodir' set to a non-existing directory. call assert_equal('', undofile('Xundofoo')) + if isdirectory('/tmp') + set undodir=/tmp + call assert_equal('/tmp/%tmp%file', undofile('///tmp/file')) + endif + set undodir& endfunc diff --git a/src/version.c b/src/version.c index 8bf07e3e99..f349d7b733 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1352, /**/ 1351, /**/ From 2b39d806f04c1a474b6d689a7970253850d4adb8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 19 May 2019 16:38:56 +0200 Subject: [PATCH 85/97] patch 8.1.1353: undo test fails on Mac Problem: Undo test fails on Mac. Solution: Expect "private" on the Mac. --- src/testdir/test_undo.vim | 6 +++++- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim index ba1c861f8b..1440660adf 100644 --- a/src/testdir/test_undo.vim +++ b/src/testdir/test_undo.vim @@ -442,7 +442,11 @@ funct Test_undofile() if isdirectory('/tmp') set undodir=/tmp - call assert_equal('/tmp/%tmp%file', undofile('///tmp/file')) + if has('osx') + call assert_equal('/tmp/%private%tmp%file', undofile('///tmp/file')) + else + call assert_equal('/tmp/%tmp%file', undofile('///tmp/file')) + endif endif set undodir& diff --git a/src/version.c b/src/version.c index f349d7b733..d163546831 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1353, /**/ 1352, /**/ From f5842c5a533346c4ff41ff666e465c85f1de35d5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 19 May 2019 18:41:26 +0200 Subject: [PATCH 86/97] patch 8.1.1354: getting a list of text lines is clumsy Problem: Getting a list of text lines is clumsy. Solution: Add the =<< assignment. (Yegappan Lakshmanan, closes #4386) --- runtime/doc/eval.txt | 38 +++++++++++++ src/eval.c | 112 +++++++++++++++++++++++++++++++++++++++ src/testdir/test_let.vim | 54 +++++++++++++++++++ src/version.c | 2 + 4 files changed, 206 insertions(+) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index e43f57bc0c..e82cf32352 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -11416,6 +11416,44 @@ This does NOT work: > Like above, but append/add/subtract the value for each |List| item. + *:let=<<* *:let-heredoc* *E990* *E991* +:let {var-name} =<< [trim] {marker} +text... +text... +{marker} + Set internal variable {var-name} to a List containing + the lines of text bounded by the string {marker}. + {marker} must not contain white space. + The last line should end only with the {marker} string + without any other character. Watch out for white + space after {marker}! + If {marker} is not supplied, then "." is used as the + default marker. + + Any white space characters in the lines of text are + preserved. If "trim" is specified before {marker}, + then all the leading indentation exactly matching the + leading indentation before `let` is stripped from the + input lines and the line containing {marker}. Note + that the difference between space and tab matters + here. + + If {var-name} didn't exist yet, it is created. + Cannot be followed by another command, but can be + followed by a comment. + + Examples: > + let var1 =<< END + Sample text 1 + Sample text 2 + Sample text 3 + END + + let data =<< trim DATA + 1 2 3 4 + 5 6 7 8 + DATA +< *E121* :let {var-name} .. List the value of variable {var-name}. Multiple variable names may be given. Special names recognized diff --git a/src/eval.c b/src/eval.c index 7df5455849..c0c6aa7ad5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1224,6 +1224,102 @@ eval_foldexpr(char_u *arg, int *cp) } #endif +/* + * Get a list of lines from a HERE document. The here document is a list of + * lines surrounded by a marker. + * cmd << {marker} + * {line1} + * {line2} + * .... + * {marker} + * + * The {marker} is a string. If the optional 'trim' word is supplied before the + * marker, then the leading indentation before the lines (matching the + * indentation in the 'cmd' line) is stripped. + * Returns a List with {lines} or NULL. + */ + static list_T * +heredoc_get(exarg_T *eap, char_u *cmd) +{ + char_u *theline; + char_u *marker; + list_T *l; + char_u *p; + int indent_len = 0; + + if (eap->getline == NULL) + { + emsg(_("E991: cannot use =<< here")); + return NULL; + } + + // Check for the optional 'trim' word before the marker + cmd = skipwhite(cmd); + if (STRNCMP(cmd, "trim", 4) == 0 && (cmd[4] == NUL || VIM_ISWHITE(cmd[4]))) + { + cmd = skipwhite(cmd + 4); + + // Trim the indentation from all the lines in the here document + // The amount of indentation trimmed is the same as the indentation of + // the :let command line. + p = *eap->cmdlinep; + while (VIM_ISWHITE(*p)) + { + p++; + indent_len++; + } + } + + // The marker is the next word. Default marker is "." + if (*cmd != NUL && *cmd != '"') + { + marker = skipwhite(cmd); + p = skiptowhite(marker); + if (*skipwhite(p) != NUL && *skipwhite(p) != '"') + { + emsg(_(e_trailing)); + return NULL; + } + *p = NUL; + } + else + marker = (char_u *)"."; + + l = list_alloc(); + if (l == NULL) + return NULL; + + for (;;) + { + int i = 0; + + theline = eap->getline(NUL, eap->cookie, 0); + if (theline != NULL && indent_len > 0) + { + // trim the indent matching the first line + if (STRNCMP(theline, *eap->cmdlinep, indent_len) == 0) + i = indent_len; + } + + if (theline == NULL) + { + semsg(_("E990: Missing end marker '%s'"), marker); + break; + } + if (STRCMP(marker, theline + i) == 0) + { + vim_free(theline); + break; + } + + if (list_append_string(l, theline + i, -1) == FAIL) + break; + vim_free(theline); + } + + return l; +} + /* * ":let" list all variable values * ":let var1 var2" list variable values @@ -1286,6 +1382,22 @@ ex_let(exarg_T *eap) } eap->nextcmd = check_nextcmd(arg); } + else if (expr[0] == '=' && expr[1] == '<' && expr[2] == '<') + { + list_T *l; + + // HERE document + l = heredoc_get(eap, expr + 3); + if (l != NULL) + { + rettv_list_set(&rettv, l); + op[0] = '='; + op[1] = NUL; + (void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count, + op); + clear_tv(&rettv); + } + } else { op[0] = '='; diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim index 0ff281fe50..10670b002a 100644 --- a/src/testdir/test_let.vim +++ b/src/testdir/test_let.vim @@ -151,3 +151,57 @@ func Test_let_utf8_environment() let $a = 'ĀĒĪŌŪあいうえお' call assert_equal('ĀĒĪŌŪあいうえお', $a) endfunc + +" Test for the setting a variable using the heredoc syntax +func Test_let_heredoc() + let var1 =<< END +Some sample text + Text with indent + !@#$%^&*()-+_={}|[]\~`:";'<>?,./ +END + + call assert_equal(["Some sample text", "\tText with indent", " !@#$%^&*()-+_={}|[]\\~`:\";'<>?,./"], var1) + + let var2 =<< +Editor +. + call assert_equal(['Editor'], var2) + + let var3 =< Date: Sun, 19 May 2019 19:59:35 +0200 Subject: [PATCH 87/97] patch 8.1.1355: obvious mistakes are accepted as valid expressions Problem: Obvious mistakes are accepted as valid expressions. Solution: Be more strict about parsing numbers. (Yasuhiro Matsumoto, closes #3981) --- src/charset.c | 31 +++++++++++++++++++------------ src/eval.c | 10 ++++++++-- src/evalfunc.c | 3 ++- src/ex_cmds.c | 3 ++- src/ex_getln.c | 4 ++-- src/json.c | 22 +++++++++++++++++++--- src/misc2.c | 14 ++++++++++++-- src/ops.c | 2 +- src/option.c | 6 +++--- src/proto/charset.pro | 2 +- src/testdir/test_expr.vim | 11 +++++++++++ src/testdir/test_json.vim | 4 ++++ src/version.c | 2 ++ 13 files changed, 86 insertions(+), 28 deletions(-) diff --git a/src/charset.c b/src/charset.c index 3eb5b58055..cff62e1857 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1776,25 +1776,30 @@ vim_isblankline(char_u *lbuf) * If "what" contains STR2NR_HEX recognize hex numbers * If "what" contains STR2NR_FORCE always assume bin/oct/hex. * If maxlen > 0, check at a maximum maxlen chars. + * If strict is TRUE, check the number strictly. return *len = 0 if fail. */ void vim_str2nr( char_u *start, - int *prep, /* return: type of number 0 = decimal, 'x' - or 'X' is hex, '0' = octal, 'b' or 'B' - is bin */ - int *len, /* return: detected length of number */ - int what, /* what numbers to recognize */ - varnumber_T *nptr, /* return: signed result */ - uvarnumber_T *unptr, /* return: unsigned result */ - int maxlen) /* max length of string to check */ + int *prep, // return: type of number 0 = decimal, 'x' + // or 'X' is hex, '0' = octal, 'b' or 'B' + // is bin + int *len, // return: detected length of number + int what, // what numbers to recognize + varnumber_T *nptr, // return: signed result + uvarnumber_T *unptr, // return: unsigned result + int maxlen, // max length of string to check + int strict) // check strictly { char_u *ptr = start; - int pre = 0; /* default is decimal */ + int pre = 0; // default is decimal int negative = FALSE; uvarnumber_T un = 0; int n; + if (len != NULL) + *len = 0; + if (ptr[0] == '-') { negative = TRUE; @@ -1836,9 +1841,7 @@ vim_str2nr( } } - /* - * Do the string-to-numeric conversion "manually" to avoid sscanf quirks. - */ + // Do the conversion manually to avoid sscanf() quirks. n = 1; if (pre == 'B' || pre == 'b' || what == STR2NR_BIN + STR2NR_FORCE) { @@ -1907,6 +1910,10 @@ vim_str2nr( break; } } + // Check for an alpha-numeric character immediately following, that is + // most likely a typo. + if (strict && n - 1 != maxlen && ASCII_ISALNUM(*ptr)) + return; if (prep != NULL) *prep = pre; diff --git a/src/eval.c b/src/eval.c index c0c6aa7ad5..6950348999 100644 --- a/src/eval.c +++ b/src/eval.c @@ -4453,7 +4453,13 @@ eval7( else { // decimal, hex or octal number - vim_str2nr(*arg, NULL, &len, STR2NR_ALL, &n, NULL, 0); + vim_str2nr(*arg, NULL, &len, STR2NR_ALL, &n, NULL, 0, TRUE); + if (len == 0) + { + semsg(_(e_invexpr2), *arg); + ret = FAIL; + break; + } *arg += len; if (evaluate) { @@ -7460,7 +7466,7 @@ tv_get_number_chk(typval_T *varp, int *denote) case VAR_STRING: if (varp->vval.v_string != NULL) vim_str2nr(varp->vval.v_string, NULL, NULL, - STR2NR_ALL, &n, NULL, 0); + STR2NR_ALL, &n, NULL, 0, FALSE); return n; case VAR_LIST: emsg(_("E745: Using a List as a Number")); diff --git a/src/evalfunc.c b/src/evalfunc.c index 4c02e159b9..5631795e35 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -13199,7 +13199,8 @@ f_str2nr(typval_T *argvars, typval_T *rettv) case 16: what = STR2NR_HEX + STR2NR_FORCE; break; default: what = 0; } - vim_str2nr(p, NULL, NULL, what, &n, NULL, 0); + vim_str2nr(p, NULL, NULL, what, &n, NULL, 0, FALSE); + // Text after the number is silently ignored. if (isneg) rettv->vval.v_number = -n; else diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 964c4556c9..ff86d1cd47 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -558,7 +558,8 @@ ex_sort(exarg_T *eap) { nrs[lnum - eap->line1].st_u.num.is_number = TRUE; vim_str2nr(s, NULL, NULL, sort_what, - &nrs[lnum - eap->line1].st_u.num.value, NULL, 0); + &nrs[lnum - eap->line1].st_u.num.value, + NULL, 0, FALSE); } } #ifdef FEAT_FLOAT diff --git a/src/ex_getln.c b/src/ex_getln.c index f1c30a2d9d..ba3dc7358a 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -6470,7 +6470,7 @@ get_list_range(char_u **str, int *num1, int *num2) *str = skipwhite(*str); if (**str == '-' || vim_isdigit(**str)) /* parse "from" part of range */ { - vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0); + vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE); *str += len; *num1 = (int)num; first = TRUE; @@ -6479,7 +6479,7 @@ get_list_range(char_u **str, int *num1, int *num2) if (**str == ',') /* parse "to" part of range */ { *str = skipwhite(*str + 1); - vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0); + vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE); if (len > 0) { *num2 = (int)num; diff --git a/src/json.c b/src/json.c index 9fb6af0def..8674bf2659 100644 --- a/src/json.c +++ b/src/json.c @@ -452,7 +452,12 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote) nr = 0; len = 0; vim_str2nr(p + 2, NULL, &len, - STR2NR_HEX + STR2NR_FORCE, &nr, NULL, 4); + STR2NR_HEX + STR2NR_FORCE, &nr, NULL, 4, TRUE); + if (len == 0) + { + ga_clear(&ga); + return FAIL; + } p += len + 2; if (0xd800 <= nr && nr <= 0xdfff && (int)(reader->js_end - p) >= 6 @@ -463,7 +468,12 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote) /* decode surrogate pair: \ud812\u3456 */ len = 0; vim_str2nr(p + 2, NULL, &len, - STR2NR_HEX + STR2NR_FORCE, &nr2, NULL, 4); + STR2NR_HEX + STR2NR_FORCE, &nr2, NULL, 4, TRUE); + if (len == 0) + { + ga_clear(&ga); + return FAIL; + } if (0xdc00 <= nr2 && nr2 <= 0xdfff) { p += len + 2; @@ -783,7 +793,13 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) vim_str2nr(reader->js_buf + reader->js_used, NULL, &len, 0, /* what */ - &nr, NULL, 0); + &nr, NULL, 0, TRUE); + if (len == 0) + { + emsg(_(e_invarg)); + retval = FAIL; + goto theend; + } if (cur_item != NULL) { cur_item->v_type = VAR_NUMBER; diff --git a/src/misc2.c b/src/misc2.c index f9f6bf58e8..dac66ffb28 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -2832,7 +2832,12 @@ find_special_key( bp += 3; /* skip t_xx, xx may be '-' or '>' */ else if (STRNICMP(bp, "char-", 5) == 0) { - vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0); + vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, TRUE); + if (l == 0) + { + emsg(_(e_invarg)); + return 0; + } bp += l + 5; break; } @@ -2864,7 +2869,12 @@ find_special_key( && VIM_ISDIGIT(last_dash[6])) { /* or or */ - vim_str2nr(last_dash + 6, NULL, NULL, STR2NR_ALL, NULL, &n, 0); + vim_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL, &n, 0, TRUE); + if (l == 0) + { + emsg(_(e_invarg)); + return 0; + } key = (int)n; } else diff --git a/src/ops.c b/src/ops.c index 975a56f372..a989ce2115 100644 --- a/src/ops.c +++ b/src/ops.c @@ -5794,7 +5794,7 @@ do_addsub( 0 + (dobin ? STR2NR_BIN : 0) + (dooct ? STR2NR_OCT : 0) + (dohex ? STR2NR_HEX : 0), - NULL, &n, maxlen); + NULL, &n, maxlen, FALSE); /* ignore leading '-' for hex and octal and bin numbers */ if (pre && negative) diff --git a/src/option.c b/src/option.c index a9b9780792..bfdf71799d 100644 --- a/src/option.c +++ b/src/option.c @@ -4762,10 +4762,10 @@ do_set( /* Allow negative (for 'undolevels'), octal and * hex numbers. */ vim_str2nr(arg, NULL, &i, STR2NR_ALL, - &value, NULL, 0); - if (arg[i] != NUL && !VIM_ISWHITE(arg[i])) + &value, NULL, 0, TRUE); + if (i == 0 || (arg[i] != NUL && !VIM_ISWHITE(arg[i]))) { - errmsg = e_invarg; + errmsg = N_("E521: Number required after ="); goto skip; } } diff --git a/src/proto/charset.pro b/src/proto/charset.pro index bb4132fe79..f60822ef00 100644 --- a/src/proto/charset.pro +++ b/src/proto/charset.pro @@ -54,7 +54,7 @@ char_u *skiptowhite(char_u *p); char_u *skiptowhite_esc(char_u *p); long getdigits(char_u **pp); int vim_isblankline(char_u *lbuf); -void vim_str2nr(char_u *start, int *prep, int *len, int what, varnumber_T *nptr, uvarnumber_T *unptr, int maxlen); +void vim_str2nr(char_u *start, int *prep, int *len, int what, varnumber_T *nptr, uvarnumber_T *unptr, int maxlen, int strict); int hex2nr(int c); int hexhex2nr(char_u *p); int rem_backslash(char_u *str); diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim index 216a00f7db..ccca79270c 100644 --- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -512,3 +512,14 @@ func Test_empty_concatenate() call assert_equal('b', 'a'[4:0] . 'b') call assert_equal('b', 'b' . 'a'[4:0]) endfunc + +func Test_broken_number() + let X = 'bad' + call assert_fails('echo 1X', 'E15:') + call assert_fails('echo 0b1X', 'E15:') + call assert_fails('echo 0b12', 'E15:') + call assert_fails('echo 0x1X', 'E15:') + call assert_fails('echo 011X', 'E15:') + call assert_equal(2, str2nr('2a')) + call assert_fails('inoremap b', 'E474:') +endfunc diff --git a/src/testdir/test_json.vim b/src/testdir/test_json.vim index e16a7f0307..8f85a58cf0 100644 --- a/src/testdir/test_json.vim +++ b/src/testdir/test_json.vim @@ -176,6 +176,10 @@ func Test_json_decode() call assert_fails('call json_decode("{{}:42}")', "E474:") call assert_fails('call json_decode("{[]:42}")', "E474:") + + call assert_fails('call json_decode("\"\\u111Z\"")', 'E474:') + call assert_equal('[😂]', json_decode('"[\uD83D\uDE02]"')) + call assert_equal('a😂b', json_decode('"a\uD83D\uDE02b"')) endfunc let s:jsl5 = '[7,,,]' diff --git a/src/version.c b/src/version.c index 6d2416d135..042a8bcd99 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1355, /**/ 1354, /**/ From 8471e57026714c5a0faf89288ceef5231fb88d4f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 19 May 2019 21:37:18 +0200 Subject: [PATCH 88/97] patch 8.1.1356: some text in heredoc assignment ends the text Problem: Some text in heredoc assignment ends the text. (Ozaki Kiichi) Solution: Recognize "let v =<<" and skip until the end. --- src/testdir/test_let.vim | 68 +++++++++++++++++++++++++++++++++++----- src/userfunc.c | 41 +++++++++++++++++++++--- src/version.c | 2 ++ 3 files changed, 99 insertions(+), 12 deletions(-) diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim index 10670b002a..4fa010bab6 100644 --- a/src/testdir/test_let.vim +++ b/src/testdir/test_let.vim @@ -152,6 +152,28 @@ func Test_let_utf8_environment() call assert_equal('ĀĒĪŌŪあいうえお', $a) endfunc +func Test_let_heredoc_fails() + call assert_fails('let v =<< marker', 'E991:') + + let text =<< trim END + func WrongSyntax() + let v =<< that there + endfunc + END + call writefile(text, 'XheredocFail') + call assert_fails('source XheredocFail', 'E126:') + call delete('XheredocFail') + + let text =<< trim END + func MissingEnd() + let v =<< END + endfunc + END + call writefile(text, 'XheredocWrong') + call assert_fails('source XheredocWrong', 'E126:') + call delete('XheredocWrong') +endfunc + " Test for the setting a variable using the heredoc syntax func Test_let_heredoc() let var1 =<< END @@ -193,15 +215,45 @@ END . call assert_equal([' Line1'], var1) - call assert_fails('let v =<< marker', 'E991:') - call assert_fails('call WrongSyntax()', 'E488:') - call assert_fails('call MissingEnd()', 'E990:') + " ignore "endfunc" + let var1 =<< END +something endfunc +END + call assert_equal(['something', 'endfunc'], var1) -func WrongSyntax() - let fail =<< that there -endfunc + " ignore "endfunc" with trim + let var1 =<< trim END + something + endfunc + END + call assert_equal(['something', 'endfunc'], var1) -func MissingEnd() - let fail =<< END + " ignore "python << xx" + let var1 =< Date: Sun, 19 May 2019 21:44:08 +0200 Subject: [PATCH 89/97] patch 8.1.1357: test 37 is old style Problem: Test 37 is old style. Solution: Turn it into a new style test. (Yegappan Lakshmanan, closes #4398) --- src/Makefile | 2 +- src/testdir/Make_all.mak | 1 - src/testdir/Make_vms.mms | 2 +- src/testdir/test37.in | 116 --------------- src/testdir/test37.ok | 33 ----- src/testdir/test_scrollbind.vim | 240 ++++++++++++++++++++++++++++++++ src/version.c | 2 + 7 files changed, 244 insertions(+), 152 deletions(-) delete mode 100644 src/testdir/test37.in delete mode 100644 src/testdir/test37.ok diff --git a/src/Makefile b/src/Makefile index b6dfe75483..ff5ae10160 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2179,7 +2179,7 @@ test_libvterm: test1 \ test_eval \ test3 \ - test30 test37 test39 \ + test30 test39 \ test42 test44 test48 test49 \ test52 test59 \ test64 test69 \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index f9f2b65043..6442236dce 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -14,7 +14,6 @@ SCRIPTS_FIRST = \ # Tests that run on all systems. SCRIPTS_ALL = \ test3.out \ - test37.out \ test39.out \ test42.out \ test44.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 8217cc3303..9a6d2d7e72 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -74,7 +74,7 @@ VIMPROG = <->vim.exe .SUFFIXES : .out .in SCRIPT = test1.out test3.out \ - test30.out test37.out test39.out \ + test30.out test39.out \ test42.out test44.out test48.out test49.out \ test64.out test69.out \ test72.out test77a.out test88.out \ diff --git a/src/testdir/test37.in b/src/testdir/test37.in deleted file mode 100644 index 8ca1125793..0000000000 --- a/src/testdir/test37.in +++ /dev/null @@ -1,116 +0,0 @@ -Test for 'scrollbind'. Do not add a line below! -STARTTEST -:so small.vim -:set noscrollbind -:set scrollopt=ver,jump -:set scrolloff=2 -:set nowrap -:set noequalalways -:set splitbelow -:" TEST using two windows open to one buffer, one extra empty window -:split -:new -t: -:resize 8 -/^start of window 1$/ -zt: -:set scrollbind -j: -:resize 7 -/^start of window 2$/ -zt: -:set scrollbind -:" -- start of tests -- -:" TEST scrolling down -L5jHyybpr0tHyybpr1tL6jHyybpr2kHyybpr3: -:" TEST scrolling up -tH4kjHtHyybpr4kHyybpr5k3ktHjHyybpr6tHyybpr7: -:" TEST horizontal scrolling -:set scrollopt+=hor -gg"zyyG"zpGt015zly$bp"zpGky$bp"zpG: -k10jH7zhg0y$bp"zpGtHg0y$bp"zpG: -:set scrollopt-=hor -:" ****** tests using two different buffers ***** -tj: -:close -t: -:set noscrollbind -:/^start of window 2$/,/^end of window 2$/y -:new -tj4"zpGp: -t/^start of window 1$/ -zt: -:set scrollbind -j: -/^start of window 2$/ -zt: -:set scrollbind -:" -- start of tests -- -:" TEST scrolling down -L5jHyybpr0tHyybpr1tL6jHyybpr2kHyybpr3: -:" TEST scrolling up -tH4kjHtHyybpr4kHyybpr5k3ktHjHyybpr6tHyybpr7: -:" TEST horizontal scrolling -:set scrollopt+=hor -gg"zyyG"zpGt015zly$bp"zpGky$bp"zpG: -k10jH7zhg0y$bp"zpGtHg0y$bp"zpG: -:set scrollopt-=hor -:" TEST syncbind -t:set noscb -ggLj:set noscb -ggL:set scb -t:set scb -GjG:syncbind -HktHjHyybptyybp: -t:set noscb -ggLj:set noscb -ggL:set scb -t:set scb -tGjGt:syncbind -HkjHtHyybptjyybp: -tH3kjHtHyybptjyybp: -:" ***** done with tests ***** -:w! test.out " Write contents of this file -:qa! -ENDTEST - - -start of window 1 -. line 01 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 01 -. line 02 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02 -. line 03 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 03 -. line 04 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 04 -. line 05 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 05 -. line 06 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 06 -. line 07 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 07 -. line 08 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 08 -. line 09 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 09 -. line 10 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 10 -. line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11 -. line 12 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 12 -. line 13 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 13 -. line 14 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 14 -. line 15 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 15 -end of window 1 - - -start of window 2 -. line 01 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 01 -. line 02 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 02 -. line 03 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 03 -. line 04 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 04 -. line 05 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 05 -. line 06 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 06 -. line 07 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 07 -. line 08 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 08 -. line 09 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 09 -. line 10 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 10 -. line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11 -. line 12 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 12 -. line 13 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 13 -. line 14 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 14 -. line 15 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 15 -. line 16 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 16 -end of window 2 - -end of test37.in (please don't delete this line) diff --git a/src/testdir/test37.ok b/src/testdir/test37.ok deleted file mode 100644 index d0b74853b3..0000000000 --- a/src/testdir/test37.ok +++ /dev/null @@ -1,33 +0,0 @@ - -0 line 05 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 05 -1 line 05 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 05 -2 line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11 -3 line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11 -4 line 06 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 06 -5 line 06 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 06 -6 line 02 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 02 -7 line 02 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02 -56789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02 -UTSRQPONMLKJIHGREDCBA9876543210 02 -. line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11 -. line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11 - -0 line 05 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 05 -1 line 05 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 05 -2 line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11 -3 line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11 -4 line 06 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 06 -5 line 06 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 06 -6 line 02 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 02 -7 line 02 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02 -56789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02 -UTSRQPONMLKJIHGREDCBA9876543210 02 -. line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11 -. line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11 - -. line 16 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 16 -:set scrollbind -:set scrollbind -. line 16 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 16 -j: -. line 12 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 12 diff --git a/src/testdir/test_scrollbind.vim b/src/testdir/test_scrollbind.vim index baa24f1979..6c5488be05 100644 --- a/src/testdir/test_scrollbind.vim +++ b/src/testdir/test_scrollbind.vim @@ -30,3 +30,243 @@ func Test_scrollbind() setl noscrollbind call assert_equal(0, topLineLeft - topLineRight) endfunc + +" Test for 'scrollbind' +func Test_scrollbind_opt() + new | only + set noscrollbind + set scrollopt=ver,jump scrolloff=2 nowrap noequalalways splitbelow + + " Insert the text used for the test + append + + +start of window 1 +. line 01 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 01 +. line 02 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02 +. line 03 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 03 +. line 04 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 04 +. line 05 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 05 +. line 06 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 06 +. line 07 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 07 +. line 08 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 08 +. line 09 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 09 +. line 10 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 10 +. line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11 +. line 12 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 12 +. line 13 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 13 +. line 14 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 14 +. line 15 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 15 +end of window 1 + + +start of window 2 +. line 01 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 01 +. line 02 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 02 +. line 03 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 03 +. line 04 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 04 +. line 05 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 05 +. line 06 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 06 +. line 07 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 07 +. line 08 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 08 +. line 09 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 09 +. line 10 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 10 +. line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11 +. line 12 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 12 +. line 13 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 13 +. line 14 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 14 +. line 15 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 15 +. line 16 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 16 +end of window 2 + +. + + " Test using two windows open to one buffer, one extra empty window + split + new + wincmd t + resize 8 + call search('^start of window 1$') + normal zt + set scrollbind + wincmd j + resize 7 + call search('^start of window 2$') + normal zt + set scrollbind + + " -- start of tests -- + " Test scrolling down + normal L5jHyy + wincmd b | normal pr0 + wincmd t | normal Hyy + wincmd b | normal pr1 + wincmd t | normal L6jHyy + wincmd b | normal pr2 + wincmd k | normal Hyy + wincmd b | normal pr3 + + " Test scrolling up + wincmd t | normal H4k + wincmd j | normal H + wincmd t | normal Hyy + wincmd b | normal pr4 + wincmd k | normal Hyy + wincmd b | normal pr5 + wincmd k | normal 3k + wincmd t | normal H + wincmd j | normal Hyy + wincmd b | normal pr6 + wincmd t | normal Hyy + wincmd b | normal pr7 + + " Test horizontal scrolling + set scrollopt+=hor + normal gg"zyyG"zpG + wincmd t | normal 015zly$ + wincmd b | normal p"zpG + wincmd k | normal y$ + wincmd b | normal p"zpG + wincmd k | normal 10jH7zhg0y$ + wincmd b | normal p"zpG + wincmd t | normal Hg0y$ + wincmd b | normal p"zpG + set scrollopt-=hor + + wincmd b + call assert_equal([ + \ '', + \ '0 line 05 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 05', + \ '1 line 05 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 05', + \ '2 line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11', + \ '3 line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11', + \ '4 line 06 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 06', + \ '5 line 06 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 06', + \ '6 line 02 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 02', + \ '7 line 02 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02', + \ '56789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02', + \ 'UTSRQPONMLKJIHGREDCBA9876543210 02', + \ '. line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11', + \ '. line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11', + \ ''], getline(1, '$')) + enew! + + " ****** tests using two different buffers ***** + wincmd t | wincmd j | close + wincmd t | set noscrollbind + /start of window 2$/,/^end of window 2$/y + new + wincmd t | wincmd j | normal 4"zpGp + wincmd t + call search('^start of window 1$') + normal zt + set scrollbind + wincmd j + call search('^start of window 2$') + normal zt + set scrollbind + + " -- start of tests -- + " Test scrolling down + normal L5jHyy + wincmd b | normal pr0 + wincmd t | normal Hyy + wincmd b | normal pr1 + wincmd t | normal L6jHyy + wincmd b | normal pr2 + wincmd k | normal Hyy + wincmd b | normal pr3 + + " Test scrolling up + wincmd t | normal H4k + wincmd j | normal H + wincmd t | normal Hyy + wincmd b | normal pr4 + wincmd k | normal Hyy + wincmd b | normal pr5 + wincmd k | normal 3k + wincmd t | normal H + wincmd j | normal Hyy + wincmd b | normal pr6 + wincmd t | normal Hyy + wincmd b | normal pr7 + + " Test horizontal scrolling + set scrollopt+=hor + normal gg"zyyG"zpG + wincmd t | normal 015zly$ + wincmd b | normal p"zpG + wincmd k | normal y$ + wincmd b | normal p"zpG + wincmd k | normal 10jH7zhg0y$ + wincmd b | normal p"zpG + wincmd t | normal Hg0y$ + wincmd b | normal p"zpG + set scrollopt-=hor + + wincmd b + call assert_equal([ + \ '', + \ '0 line 05 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 05', + \ '1 line 05 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 05', + \ '2 line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11', + \ '3 line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11', + \ '4 line 06 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 06', + \ '5 line 06 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 06', + \ '6 line 02 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 02', + \ '7 line 02 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02', + \ '56789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02', + \ 'UTSRQPONMLKJIHGREDCBA9876543210 02', + \ '. line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11', + \ '. line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11', + \ ''], getline(1, '$')) + enew! + + " Test 'syncbind' + wincmd t | set noscrollbind | normal ggL + wincmd j | set noscrollbind | normal ggL + set scrollbind + wincmd t | set scrollbind | normal G + wincmd j | normal G + syncbind + normal Hk + wincmd t | normal H + wincmd j | normal Hyy + wincmd b | normal p + wincmd t | normal yy + wincmd b | normal p + wincmd t | set noscrollbind | normal ggL + wincmd j | set noscrollbind + normal ggL + set scrollbind + wincmd t | set scrollbind + wincmd t | normal G + wincmd j | normal G + wincmd t | syncbind | normal Hk + wincmd j | normal H + wincmd t | normal Hyy + wincmd b | normal p + wincmd t | wincmd j | normal yy + wincmd b | normal p + wincmd t | normal H3k + wincmd j | normal H + wincmd t | normal Hyy + wincmd b | normal p + wincmd t | wincmd j | normal yy + wincmd b | normal p + + wincmd b + call assert_equal([ + \ '', + \ '. line 16 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 16', + \ 'start of window 2', + \ 'start of window 2', + \ '. line 16 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 16', + \ '. line 15 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 15', + \ '. line 12 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 12', + \ ], getline(1, '$')) + enew! + + new | only! + set scrollbind& scrollopt& scrolloff& wrap& equalalways& splitbelow& +endfunc diff --git a/src/version.c b/src/version.c index 2dd024f0f9..edc72ecfc3 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1357, /**/ 1356, /**/ From 386b43e59498cc7b52a60f09f74bdb44df99386c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 19 May 2019 21:57:11 +0200 Subject: [PATCH 90/97] patch 8.1.1358: cannot enter character with a CSI byte Problem: Cannot enter character with a CSI byte. Solution: Only check "gui.in_use" when VIMDLL is defined. (Ken Takata, closes #4396) --- src/getchar.c | 12 ++++++++---- src/version.c | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/getchar.c b/src/getchar.c index 6a4c60f067..9379a6a8d4 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1453,9 +1453,9 @@ openscript( oldcurscript = curscript; do { - update_topline_cursor(); /* update cursor position and topline */ - normal_cmd(&oa, FALSE); /* execute one command */ - vpeekc(); /* check for end of file */ + update_topline_cursor(); // update cursor position and topline + normal_cmd(&oa, FALSE); // execute one command + vpeekc(); // check for end of file } while (scriptin[oldcurscript] != NULL); @@ -1753,7 +1753,11 @@ vgetc(void) buf[i] = vgetorpeek(TRUE); if (buf[i] == K_SPECIAL #ifdef FEAT_GUI - || (gui.in_use && buf[i] == CSI) + || ( +# ifdef VIMDLL + gui.in_use && +# endif + buf[i] == CSI) #endif ) { diff --git a/src/version.c b/src/version.c index edc72ecfc3..0cd0d7caf3 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1358, /**/ 1357, /**/ From f3333b02f34526da46cdae608f7e2d869bb8c654 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 19 May 2019 22:53:40 +0200 Subject: [PATCH 91/97] patch 8.1.1359: text property wrong after :substitute with backslash Problem: Text property wrong after :substitute with backslash. Solution: Adjust text property columns when removing backslashes. (closes #4397) --- src/change.c | 2 +- src/edit.c | 2 +- src/ex_cmds.c | 20 +++++++++++++++++--- src/misc1.c | 2 +- src/ops.c | 2 +- src/proto/textprop.pro | 2 +- src/testdir/test_textprop.vim | 19 +++++++++++++++++++ src/textprop.c | 34 +++++++++++++++++++++++++--------- src/version.c | 2 ++ src/vim.h | 4 ++++ 10 files changed, 72 insertions(+), 17 deletions(-) diff --git a/src/change.c b/src/change.c index fa8c42538f..b43ba35745 100644 --- a/src/change.c +++ b/src/change.c @@ -684,7 +684,7 @@ inserted_bytes(linenr_T lnum, colnr_T col, int added UNUSED) { #ifdef FEAT_TEXT_PROP if (curbuf->b_has_textprop && added != 0) - adjust_prop_columns(lnum, col, added, FALSE); + adjust_prop_columns(lnum, col, added, 0); #endif changed_bytes(lnum, col); diff --git a/src/edit.c b/src/edit.c index be195fc1ae..8a008cbfd4 100644 --- a/src/edit.c +++ b/src/edit.c @@ -4104,7 +4104,7 @@ replace_do_bs(int limit_col) --text_prop_frozen; adjust_prop_columns(curwin->w_cursor.lnum, curwin->w_cursor.col, - (int)(len_now - len_before), FALSE); + (int)(len_now - len_before), 0); } #endif } diff --git a/src/ex_cmds.c b/src/ex_cmds.c index ff86d1cd47..df5dcd01ff 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5189,7 +5189,7 @@ do_sub(exarg_T *eap) int skip_match = FALSE; linenr_T sub_firstlnum; /* nr of first sub line */ #ifdef FEAT_TEXT_PROP - int save_for_undo = TRUE; + int apc_flags = APC_SAVE_FOR_UNDO | APC_SUBSTITUTE; #endif /* @@ -5612,8 +5612,9 @@ do_sub(exarg_T *eap) // undo first, unless done already. if (adjust_prop_columns(lnum, regmatch.startpos[0].col, sublen - 1 - (regmatch.endpos[0].col - - regmatch.startpos[0].col), save_for_undo)) - save_for_undo = FALSE; + - regmatch.startpos[0].col), + apc_flags)) + apc_flags &= ~APC_SAVE_FOR_UNDO; } #endif } @@ -5715,7 +5716,20 @@ do_sub(exarg_T *eap) for (p1 = new_end; *p1; ++p1) { if (p1[0] == '\\' && p1[1] != NUL) /* remove backslash */ + { STRMOVE(p1, p1 + 1); +#ifdef FEAT_TEXT_PROP + if (curbuf->b_has_textprop) + { + // When text properties are changed, need to save + // for undo first, unless done already. + if (adjust_prop_columns(lnum, + (colnr_T)(p1 - new_start), -1, + apc_flags)) + apc_flags &= ~APC_SAVE_FOR_UNDO; + } +#endif + } else if (*p1 == CAR) { if (u_inssub(lnum) == OK) // prepare for undo diff --git a/src/misc1.c b/src/misc1.c index 1eac5189ae..e76e4a4a37 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -441,7 +441,7 @@ set_indent( // the old indent, when decreasing indent it behaves like spaces // were deleted at the new indent. adjust_prop_columns(curwin->w_cursor.lnum, - (colnr_T)(added > 0 ? (p - oldline) : ind_len), added, FALSE); + (colnr_T)(added > 0 ? (p - oldline) : ind_len), added, 0); } #endif retval = TRUE; diff --git a/src/ops.c b/src/ops.c index a989ce2115..4d2692483b 100644 --- a/src/ops.c +++ b/src/ops.c @@ -1937,7 +1937,7 @@ op_delete(oparg_T *oap) #ifdef FEAT_TEXT_PROP if (curbuf->b_has_textprop && n != 0) - adjust_prop_columns(lnum, bd.textcol, -n, FALSE); + adjust_prop_columns(lnum, bd.textcol, -n, 0); #endif } diff --git a/src/proto/textprop.pro b/src/proto/textprop.pro index 0114b4fadc..1301f31a51 100644 --- a/src/proto/textprop.pro +++ b/src/proto/textprop.pro @@ -13,7 +13,7 @@ void f_prop_type_get(typval_T *argvars, typval_T *rettv); void f_prop_type_list(typval_T *argvars, typval_T *rettv); void clear_global_prop_types(void); void clear_buf_prop_types(buf_T *buf); -int adjust_prop_columns(linenr_T lnum, colnr_T col, int bytes_added, int save_for_undo); +int adjust_prop_columns(linenr_T lnum, colnr_T col, int bytes_added, int flags); void adjust_props_for_split(linenr_T lnum_props, linenr_T lnum_top, int kept, int deleted); void adjust_props_for_join(linenr_T lnum, textprop_T **prop_line, int *prop_length, long col, int removed); void join_prop_lines(linenr_T lnum, char_u *newp, textprop_T **prop_lines, int *prop_lengths, int count); diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index eb30c04c6c..08b93dfc94 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -620,6 +620,25 @@ func Test_prop_undo() undo let expected[0].col = 12 call assert_equal(expected, prop_list(1)) + call prop_clear(1) + + " substitute with backslash + call setline(1, 'the number 123 is highlighted.') + call prop_add(1, 12, {'length': 3, 'type': 'comment'}) + let expected = [{'col': 12, 'length': 3, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ] + call assert_equal(expected, prop_list(1)) + 1s/the/\The + call assert_equal(expected, prop_list(1)) + 1s/^/\\ + let expected[0].col += 1 + call assert_equal(expected, prop_list(1)) + 1s/^/\~ + let expected[0].col += 1 + call assert_equal(expected, prop_list(1)) + 1s/123/12\\3 + let expected[0].length += 1 + call assert_equal(expected, prop_list(1)) + call prop_clear(1) bwipe! call prop_type_delete('comment') diff --git a/src/textprop.c b/src/textprop.c index aa3e83b354..15ae4945b9 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -957,8 +957,9 @@ clear_buf_prop_types(buf_T *buf) * shift by "bytes_added" (can be negative). * Note that "col" is zero-based, while tp_col is one-based. * Only for the current buffer. - * When "save_for_undo" is TRUE then call u_savesub() before making changes to - * the line. + * "flags" can have: + * APC_SAVE_FOR_UNDO: Call u_savesub() before making changes to the line. + * APC_SUBSTITUTE: Text is replaced, not inserted. * Caller is expected to check b_has_textprop and "bytes_added" being non-zero. * Returns TRUE when props were changed. */ @@ -967,7 +968,7 @@ adjust_prop_columns( linenr_T lnum, colnr_T col, int bytes_added, - int save_for_undo) + int flags) { int proplen; char_u *props; @@ -988,15 +989,30 @@ adjust_prop_columns( wi = 0; // write index for (ri = 0; ri < proplen; ++ri) { + int start_incl; + mch_memmove(&tmp_prop, props + ri * sizeof(textprop_T), sizeof(textprop_T)); pt = text_prop_type_by_id(curbuf, tmp_prop.tp_type); + start_incl = (flags & APC_SUBSTITUTE) || + (pt != NULL && (pt->pt_flags & PT_FLAG_INS_START_INCL)); if (bytes_added > 0 - ? (tmp_prop.tp_col >= col - + (pt != NULL && (pt->pt_flags & PT_FLAG_INS_START_INCL) - ? 2 : 1)) - : (tmp_prop.tp_col > col + 1)) + && (tmp_prop.tp_col >= col + (start_incl ? 2 : 1))) + { + if (tmp_prop.tp_col < col + (start_incl ? 2 : 1)) + { + tmp_prop.tp_len += (tmp_prop.tp_col - 1 - col) + bytes_added; + tmp_prop.tp_col = col + 1; + } + else + tmp_prop.tp_col += bytes_added; + // Save for undo if requested and not done yet. + if ((flags & APC_SAVE_FOR_UNDO) && !dirty) + u_savesub(lnum); + dirty = TRUE; + } + else if (bytes_added <= 0 && (tmp_prop.tp_col > col + 1)) { if (tmp_prop.tp_col + bytes_added < col + 1) { @@ -1006,7 +1022,7 @@ adjust_prop_columns( else tmp_prop.tp_col += bytes_added; // Save for undo if requested and not done yet. - if (save_for_undo && !dirty) + if ((flags & APC_SAVE_FOR_UNDO) && !dirty) u_savesub(lnum); dirty = TRUE; if (tmp_prop.tp_len <= 0) @@ -1024,7 +1040,7 @@ adjust_prop_columns( else tmp_prop.tp_len += bytes_added; // Save for undo if requested and not done yet. - if (save_for_undo && !dirty) + if ((flags & APC_SAVE_FOR_UNDO) && !dirty) u_savesub(lnum); dirty = TRUE; if (tmp_prop.tp_len <= 0) diff --git a/src/version.c b/src/version.c index 0cd0d7caf3..f9962a0cfd 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1359, /**/ 1358, /**/ diff --git a/src/vim.h b/src/vim.h index 05ad07ff6b..153a8c6ed9 100644 --- a/src/vim.h +++ b/src/vim.h @@ -2571,4 +2571,8 @@ long elapsed(DWORD start_tick); #define SAVE_RESTORE_ICON 2 #define SAVE_RESTORE_BOTH (SAVE_RESTORE_TITLE | SAVE_RESTORE_ICON) +// Flags for adjust_prop_columns() +#define APC_SAVE_FOR_UNDO 1 // call u_savesub() before making changes +#define APC_SUBSTITUTE 2 // text is replaced, not inserted + #endif /* VIM__H */ From 80341bcd89764d96f87859a3aac8bc00aad1d762 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 20 May 2019 20:34:51 +0200 Subject: [PATCH 92/97] patch 8.1.1360: buffer left 'nomodifiable' after :substitute Problem: Buffer left 'nomodifiable' after :substitute. (Ingo Karkat) Solution: Save the value of 'modifiable' earlier' (Christian Brabandt, closes #4403) --- src/ex_cmds.c | 2 +- src/testdir/test_substitute.vim | 18 +++++++++++++++++- src/version.c | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index df5dcd01ff..0174fd6b01 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5557,6 +5557,7 @@ do_sub(exarg_T *eap) * 3. substitute the string. */ #ifdef FEAT_EVAL + save_ma = curbuf->b_p_ma; if (subflags.do_count) { // prevent accidentally changing the buffer by a function @@ -5566,7 +5567,6 @@ do_sub(exarg_T *eap) // Save flags for recursion. They can change for e.g. // :s/^/\=execute("s#^##gn") subflags_save = subflags; - save_ma = curbuf->b_p_ma; #endif // get length of substitution part sublen = vim_regsub_multi(®match, diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim index 06bdc243db..344bb68da7 100644 --- a/src/testdir/test_substitute.vim +++ b/src/testdir/test_substitute.vim @@ -611,9 +611,24 @@ func Test_sub_cmd_8() set titlestring& endfunc +func Test_sub_cmd_9() + new + let input = ['1 aaa', '2 aaa', '3 aaa'] + call setline(1, input) + func Foo() + return submatch(0) + endfunc + %s/aaa/\=Foo()/gn + call assert_equal(input, getline(1, '$')) + call assert_equal(1, &modifiable) + + delfunc Foo + bw! +endfunc + func Test_nocatch_sub_failure_handling() " normal error results in all replacements - func! Foo() + func Foo() foobar endfunc new @@ -649,6 +664,7 @@ func Test_nocatch_sub_failure_handling() call assert_equal(1, error_caught) call assert_equal(['1 aaa', '2 aaa', '3 aaa'], getline(1, 3)) + delfunc Foo bwipe! endfunc diff --git a/src/version.c b/src/version.c index f9962a0cfd..01a0b0d622 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1360, /**/ 1359, /**/ From 0b0ad35c339b8ad156df493bebeb77e02b32b120 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 20 May 2019 21:52:45 +0200 Subject: [PATCH 93/97] patch 8.1.1361: Python setuptools don't work with Python 3 Problem: Python setuptools don't work with Python 3. Solution: Add dummy implementation for find_module. (Joel Frederico, closes #4402, closes #3984 --- src/if_py_both.h | 11 +++++++++-- src/version.c | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index cc0450c13b..e36f4fdee3 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -1222,6 +1222,14 @@ FinderFindSpec(PyObject *self, PyObject *args) return spec; } + + static PyObject * +FinderFindModule(PyObject* self UNUSED, PyObject* args UNUSED) +{ + // Apparently returning None works. + Py_INCREF(Py_None); + return Py_None; +} #else static PyObject * call_load_module(char *name, int len, PyObject *find_module_result) @@ -1400,9 +1408,8 @@ static struct PyMethodDef VimMethods[] = { {"foreach_rtp", VimForeachRTP, METH_O, "Call given callable for each path in &rtp"}, #if PY_VERSION_HEX >= 0x030700f0 {"find_spec", FinderFindSpec, METH_VARARGS, "Internal use only, returns spec object for any input it receives"}, -#else - {"find_module", FinderFindModule, METH_VARARGS, "Internal use only, returns loader object for any input it receives"}, #endif + {"find_module", FinderFindModule, METH_VARARGS, "Internal use only, returns loader object for any input it receives"}, {"path_hook", VimPathHook, METH_VARARGS, "Hook function to install in sys.path_hooks"}, {"_get_paths", (PyCFunction)Vim_GetPaths, METH_NOARGS, "Get &rtp-based additions to sys.path"}, { NULL, NULL, 0, NULL} diff --git a/src/version.c b/src/version.c index 01a0b0d622..de5ffc6e64 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1361, /**/ 1360, /**/ From c79745a82faeb5a6058e915ca49a4c69fa60ea01 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 20 May 2019 22:12:34 +0200 Subject: [PATCH 94/97] patch 8.1.1362: code and data in tests can be hard to read Problem: Code and data in tests can be hard to read. Solution: Use the new heredoc style. (Yegappan Lakshmanan, closes #4400) --- src/testdir/test_autocmd.vim | 102 +++---- src/testdir/test_balloon.vim | 16 +- src/testdir/test_bufline.vim | 35 +-- src/testdir/test_cindent.vim | 60 +++-- src/testdir/test_conceal.vim | 50 ++-- src/testdir/test_exit.vim | 66 ++--- src/testdir/test_fold.vim | 23 +- src/testdir/test_goto.vim | 405 +++++++++++++++------------- src/testdir/test_join.vim | 139 +++++----- src/testdir/test_mksession_utf8.vim | 57 ++-- src/testdir/test_normal.vim | 183 +++++++++---- src/testdir/test_profile.vim | 266 +++++++++--------- src/testdir/test_quickfix.vim | 199 +++++++------- src/testdir/test_startup.vim | 171 ++++++------ src/testdir/test_terminal.vim | 25 +- src/testdir/test_xxd.vim | 19 +- src/version.c | 2 + 17 files changed, 987 insertions(+), 831 deletions(-) diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index b22718aee6..0a4177cd77 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -423,18 +423,20 @@ func Test_autocmd_bufwipe_in_SessLoadPost() set noswapfile mksession! - let content = ['set nocp noswapfile', - \ 'let v:swapchoice="e"', - \ 'augroup test_autocmd_sessionload', - \ 'autocmd!', - \ 'autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!"', - \ 'augroup END', - \ '', - \ 'func WriteErrors()', - \ ' call writefile([execute("messages")], "Xerrors")', - \ 'endfunc', - \ 'au VimLeave * call WriteErrors()', - \ ] + let content =<< trim [CODE] + set nocp noswapfile + let v:swapchoice="e" + augroup test_autocmd_sessionload + autocmd! + autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!" + augroup END + + func WriteErrors() + call writefile([execute("messages")], "Xerrors") + endfunc + au VimLeave * call WriteErrors() + [CODE] + call writefile(content, 'Xvimrc') call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') let errors = join(readfile('Xerrors')) @@ -452,27 +454,29 @@ func Test_autocmd_bufwipe_in_SessLoadPost2() set noswapfile mksession! - let content = ['set nocp noswapfile', - \ 'function! DeleteInactiveBufs()', - \ ' tabfirst', - \ ' let tabblist = []', - \ ' for i in range(1, tabpagenr(''$''))', - \ ' call extend(tabblist, tabpagebuflist(i))', - \ ' endfor', - \ ' for b in range(1, bufnr(''$''))', - \ ' if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')', - \ ' exec ''bwipeout '' . b', - \ ' endif', - \ ' endfor', - \ ' echomsg "SessionLoadPost DONE"', - \ 'endfunction', - \ 'au SessionLoadPost * call DeleteInactiveBufs()', - \ '', - \ 'func WriteErrors()', - \ ' call writefile([execute("messages")], "Xerrors")', - \ 'endfunc', - \ 'au VimLeave * call WriteErrors()', - \ ] + let content =<< trim [CODE] + set nocp noswapfile + function! DeleteInactiveBufs() + tabfirst + let tabblist = [] + for i in range(1, tabpagenr(''$'')) + call extend(tabblist, tabpagebuflist(i)) + endfor + for b in range(1, bufnr(''$'')) + if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'') + exec ''bwipeout '' . b + endif + endfor + echomsg "SessionLoadPost DONE" + endfunction + au SessionLoadPost * call DeleteInactiveBufs() + + func WriteErrors() + call writefile([execute("messages")], "Xerrors") + endfunc + au VimLeave * call WriteErrors() + [CODE] + call writefile(content, 'Xvimrc') call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') let errors = join(readfile('Xerrors')) @@ -933,21 +937,23 @@ func Test_bufunload_all() call writefile(['Test file Xxx1'], 'Xxx1')" call writefile(['Test file Xxx2'], 'Xxx2')" - let content = [ - \ "func UnloadAllBufs()", - \ " let i = 1", - \ " while i <= bufnr('$')", - \ " if i != bufnr('%') && bufloaded(i)", - \ " exe i . 'bunload'", - \ " endif", - \ " let i += 1", - \ " endwhile", - \ "endfunc", - \ "au BufUnload * call UnloadAllBufs()", - \ "au VimLeave * call writefile(['Test Finished'], 'Xout')", - \ "edit Xxx1", - \ "split Xxx2", - \ "q"] + let content =<< trim [CODE] + func UnloadAllBufs() + let i = 1 + while i <= bufnr('$') + if i != bufnr('%') && bufloaded(i) + exe i . 'bunload' + endif + let i += 1 + endwhile + endfunc + au BufUnload * call UnloadAllBufs() + au VimLeave * call writefile(['Test Finished'], 'Xout') + edit Xxx1 + split Xxx2 + q + [CODE] + call writefile(content, 'Xtest') call delete('Xout') diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim index 57d8dcce30..39c2602be6 100644 --- a/src/testdir/test_balloon.vim +++ b/src/testdir/test_balloon.vim @@ -8,14 +8,14 @@ if !CanRunVimInTerminal() finish endif -let s:common_script = [ - \ 'call setline(1, ["one one one", "two tXo two", "three three three"])', - \ 'set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100', - \ 'func MyBalloonExpr()', - \ ' return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text', - \ 'endfun', - \ 'redraw', - \ ] +let s:common_script =<< [CODE] + call setline(1, ["one one one", "two tXo two", "three three three"]) + set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100 + func MyBalloonExpr() + return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text + endfun + redraw +[CODE] func Test_balloon_eval_term() " Use after to return from vgetc() without removing diff --git a/src/testdir/test_bufline.vim b/src/testdir/test_bufline.vim index 9c29a05e70..dbcd2e0fd6 100644 --- a/src/testdir/test_bufline.vim +++ b/src/testdir/test_bufline.vim @@ -93,23 +93,24 @@ func Test_appendbufline() endfunc func Test_appendbufline_no_E315() - let after = [ - \ 'set stl=%f ls=2', - \ 'new', - \ 'let buf = bufnr("%")', - \ 'quit', - \ 'vsp', - \ 'exec "buffer" buf', - \ 'wincmd w', - \ 'call appendbufline(buf, 0, "abc")', - \ 'redraw', - \ 'while getbufline(buf, 1)[0] =~ "^\\s*$"', - \ ' sleep 10m', - \ 'endwhile', - \ 'au VimLeavePre * call writefile([v:errmsg], "Xerror")', - \ 'au VimLeavePre * call writefile(["done"], "Xdone")', - \ 'qall!', - \ ] + let after =<< trim [CODE] + set stl=%f ls=2 + new + let buf = bufnr("%") + quit + vsp + exec "buffer" buf + wincmd w + call appendbufline(buf, 0, "abc") + redraw + while getbufline(buf, 1)[0] =~ "^\\s*$" + sleep 10m + endwhile + au VimLeavePre * call writefile([v:errmsg], "Xerror") + au VimLeavePre * call writefile(["done"], "Xdone") + qall! + [CODE] + if !RunVim([], after, '--clean') return endif diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim index 3b57360ace..4b1198a206 100644 --- a/src/testdir/test_cindent.vim +++ b/src/testdir/test_cindent.vim @@ -18,25 +18,25 @@ endfunc func Test_cino_extern_c() " Test for cino-E - let without_ind = [ - \ '#ifdef __cplusplus', - \ 'extern "C" {', - \ '#endif', - \ 'int func_a(void);', - \ '#ifdef __cplusplus', - \ '}', - \ '#endif' - \ ] + let without_ind =<< trim [CODE] + #ifdef __cplusplus + extern "C" { + #endif + int func_a(void); + #ifdef __cplusplus + } + #endif + [CODE] - let with_ind = [ - \ '#ifdef __cplusplus', - \ 'extern "C" {', - \ '#endif', - \ "\tint func_a(void);", - \ '#ifdef __cplusplus', - \ '}', - \ '#endif' - \ ] + let with_ind =<< trim [CODE] + #ifdef __cplusplus + extern "C" { + #endif + int func_a(void); + #ifdef __cplusplus + } + #endif + [CODE] new setlocal cindent cinoptions=E0 call setline(1, without_ind) @@ -89,16 +89,32 @@ func Test_cindent_expr() return v:lnum == 1 ? shiftwidth() : 0 endfunc setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction() - call setline(1, ['var_a = something()', 'b = something()']) + let testinput =<< trim [CODE] + var_a = something() + b = something() + [CODE] + call setline(1, testinput) call cursor(1, 1) call feedkeys("^\j$A;\", 'tnix') - call assert_equal([' var_a = something();', 'b = something();'], getline(1, '$')) + let expected =<< trim [CODE] + var_a = something(); + b = something(); + [CODE] + call assert_equal(expected, getline(1, '$')) %d - call setline(1, [' var_a = something()', ' b = something()']) + let testinput =<< trim [CODE] + var_a = something() + b = something() + [CODE] + call setline(1, testinput) call cursor(1, 1) call feedkeys("^\j$A;\", 'tnix') - call assert_equal([' var_a = something();', ' b = something()'], getline(1, '$')) + let expected =<< trim [CODE] + var_a = something(); + b = something() + [CODE] + call assert_equal(expected, getline(1, '$')) bw! endfunc diff --git a/src/testdir/test_conceal.vim b/src/testdir/test_conceal.vim index 685c891759..66384e1c15 100644 --- a/src/testdir/test_conceal.vim +++ b/src/testdir/test_conceal.vim @@ -11,21 +11,23 @@ if !CanRunVimInTerminal() endif func Test_conceal_two_windows() - call writefile([ - \ 'let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]', - \ 'call setline(1, lines)', - \ 'syntax match test /|hidden|/ conceal', - \ 'set conceallevel=2', - \ 'set concealcursor=', - \ 'exe "normal /here\r"', - \ 'new', - \ 'call setline(1, lines)', - \ 'call setline(4, "Second window")', - \ 'syntax match test /|hidden|/ conceal', - \ 'set conceallevel=2', - \ 'set concealcursor=nc', - \ 'exe "normal /here\r"', - \ ], 'XTest_conceal') + let code =<< trim [CODE] + let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"] + call setline(1, lines) + syntax match test /|hidden|/ conceal + set conceallevel=2 + set concealcursor= + exe "normal /here\r" + new + call setline(1, lines) + call setline(4, "Second window") + syntax match test /|hidden|/ conceal + set conceallevel=2 + set concealcursor=nc + exe "normal /here\r" + [CODE] + + call writefile(code, 'XTest_conceal') " Check that cursor line is concealed let buf = RunVimInTerminal('-S XTest_conceal', {}) call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {}) @@ -113,14 +115,16 @@ endfunc func Test_conceal_with_cursorline() " Opens a help window, where 'conceal' is set, switches to the other window " where 'cursorline' needs to be updated when the cursor moves. - call writefile([ - \ 'set cursorline', - \ 'normal othis is a test', - \ 'new', - \ 'call setline(1, ["one", "two", "three", "four", "five"])', - \ 'set ft=help', - \ 'normal M', - \ ], 'XTest_conceal_cul') + let code =<< trim [CODE] + set cursorline + normal othis is a test + new + call setline(1, ["one", "two", "three", "four", "five"]) + set ft=help + normal M + [CODE] + + call writefile(code, 'XTest_conceal_cul') let buf = RunVimInTerminal('-S XTest_conceal_cul', {}) call VerifyScreenDump(buf, 'Test_conceal_cul_01', {}) diff --git a/src/testdir/test_exit.vim b/src/testdir/test_exit.vim index 8f02fd29e3..3797626abf 100644 --- a/src/testdir/test_exit.vim +++ b/src/testdir/test_exit.vim @@ -3,52 +3,56 @@ source shared.vim func Test_exiting() - let after = [ - \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', - \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', - \ 'quit', - \ ] + let after =<< trim [CODE] + au QuitPre * call writefile(["QuitPre"], "Xtestout") + au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") + quit + [CODE] + if RunVim([], after, '') call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) endif call delete('Xtestout') - let after = [ - \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', - \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', - \ 'help', - \ 'wincmd w', - \ 'quit', - \ ] + let after =<< trim [CODE] + au QuitPre * call writefile(["QuitPre"], "Xtestout") + au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") + help + wincmd w + quit + [CODE] + if RunVim([], after, '') call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) endif call delete('Xtestout') - let after = [ - \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', - \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', - \ 'split', - \ 'new', - \ 'qall', - \ ] + let after =<< trim [CODE] + au QuitPre * call writefile(["QuitPre"], "Xtestout") + au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") + split + new + qall + [CODE] + if RunVim([], after, '') call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) endif call delete('Xtestout') - let after = [ - \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")', - \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', - \ 'augroup nasty', - \ ' au ExitPre * split', - \ 'augroup END', - \ 'quit', - \ 'augroup nasty', - \ ' au! ExitPre', - \ 'augroup END', - \ 'quit', - \ ] + let after =<< trim [CODE] + au QuitPre * call writefile(["QuitPre"], "Xtestout", "a") + au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") + augroup nasty + au ExitPre * split + augroup END + quit + augroup nasty + au! ExitPre + augroup END + quit + [CODE] + if RunVim([], after, '') call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'], \ readfile('Xtestout')) diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim index 67e5a48fe6..9ad82181c3 100644 --- a/src/testdir/test_fold.vim +++ b/src/testdir/test_fold.vim @@ -513,17 +513,18 @@ func Test_fold_create_marker_in_C() set fdm=marker fdl=9 set filetype=c - let content = [ - \ '/*', - \ ' * comment', - \ ' * ', - \ ' *', - \ ' */', - \ 'int f(int* p) {', - \ ' *p = 3;', - \ ' return 0;', - \ '}' - \] + let content =<< trim [CODE] + /* + * comment + * + * + */ + int f(int* p) { + *p = 3; + return 0; + } + [CODE] + for c in range(len(content) - 1) bw! call append(0, content) diff --git a/src/testdir/test_goto.vim b/src/testdir/test_goto.vim index c0235b1707..c00e4e4376 100644 --- a/src/testdir/test_goto.vim +++ b/src/testdir/test_goto.vim @@ -15,262 +15,282 @@ func XTest_goto_decl(cmd, lines, line, col) endfunc func Test_gD() - let lines = [ - \ 'int x;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int x; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 1, 5) endfunc func Test_gD_too() - let lines = [ - \ 'Filename x;', - \ '', - \ 'int Filename', - \ 'int func() {', - \ ' Filename x;', - \ ' return x;', - \ ] + let lines =<< trim [CODE] + Filename x; + + int Filename + int func() { + Filename x; + return x; + [CODE] + call XTest_goto_decl('gD', lines, 1, 10) endfunc func Test_gD_comment() - let lines = [ - \ '/* int x; */', - \ 'int x;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + /* int x; */ + int x; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 2, 5) endfunc func Test_gD_inline_comment() - let lines = [ - \ 'int y /* , x */;', - \ 'int x;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int y /* , x */; + int x; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 2, 5) endfunc func Test_gD_string() - let lines = [ - \ 'char *s[] = "x";', - \ 'int x = 1;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + char *s[] = "x"; + int x = 1; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 2, 5) endfunc func Test_gD_string_same_line() - let lines = [ - \ 'char *s[] = "x", int x = 1;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + char *s[] = "x", int x = 1; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 1, 22) endfunc func Test_gD_char() - let lines = [ - \ "char c = 'x';", - \ 'int x = 1;', - \ '', - \ 'int func(void)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + char c = 'x'; + int x = 1; + + int func(void) + { + return x; + } + [CODE] + call XTest_goto_decl('gD', lines, 2, 5) endfunc func Test_gd() - let lines = [ - \ 'int x;', - \ '', - \ 'int func(int x)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int x; + + int func(int x) + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 14) endfunc func Test_gd_not_local() - let lines = [ - \ 'int func1(void)', - \ '{', - \ ' return x;', - \ '}', - \ '', - \ 'int func2(int x)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func1(void) + { + return x; + } + + int func2(int x) + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 10) endfunc func Test_gd_kr_style() - let lines = [ - \ 'int func(x)', - \ ' int x;', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(x) + int x; + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 2, 7) endfunc func Test_gd_missing_braces() - let lines = [ - \ 'def func1(a)', - \ ' a + 1', - \ 'end', - \ '', - \ 'a = 1', - \ '', - \ 'def func2()', - \ ' return a', - \ 'end', - \ ] + let lines =<< trim [CODE] + def func1(a) + a + 1 + end + + a = 1 + + def func2() + return a + end + [CODE] + call XTest_goto_decl('gd', lines, 1, 11) endfunc func Test_gd_comment() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' /* int x; */', - \ ' int x;', - \ ' return x;', - \ '}', - \] + let lines =<< trim [CODE] + int func(void) + { + /* int x; */ + int x; + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 4, 7) endfunc func Test_gd_comment_in_string() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' char *s ="//"; int x;', - \ ' int x;', - \ ' return x;', - \ '}', - \] + let lines =<< trim [CODE] + int func(void) + { + char *s ="//"; int x; + int x; + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 22) endfunc func Test_gd_string_in_comment() set comments= - let lines = [ - \ 'int func(void)', - \ '{', - \ ' /* " */ int x;', - \ ' int x;', - \ ' return x;', - \ '}', - \] + let lines =<< trim [CODE] + int func(void) + { + /* " */ int x; + int x; + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 15) set comments& endfunc func Test_gd_inline_comment() - let lines = [ - \ 'int func(/* x is an int */ int x)', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(/* x is an int */ int x) + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 1, 32) endfunc func Test_gd_inline_comment_only() - let lines = [ - \ 'int func(void) /* one lonely x */', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(void) /* one lonely x */ + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 3, 10) endfunc func Test_gd_inline_comment_body() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' int y /* , x */;', - \ '', - \ ' for (/* int x = 0 */; y < 2; y++);', - \ '', - \ ' int x = 0;', - \ '', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(void) + { + int y /* , x */; + + for (/* int x = 0 */; y < 2; y++); + + int x = 0; + + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 7, 7) endfunc func Test_gd_trailing_multiline_comment() - let lines = [ - \ 'int func(int x) /* x is an int */', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(int x) /* x is an int */ + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 1, 14) endfunc func Test_gd_trailing_comment() - let lines = [ - \ 'int func(int x) // x is an int', - \ '{', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(int x) // x is an int + { + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 1, 14) endfunc func Test_gd_string() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' char *s = "x";', - \ ' int x = 1;', - \ '', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(void) + { + char *s = "x"; + int x = 1; + + return x; + } + [CODE] call XTest_goto_decl('gd', lines, 4, 7) endfunc func Test_gd_string_only() - let lines = [ - \ 'int func(void)', - \ '{', - \ ' char *s = "x";', - \ '', - \ ' return x;', - \ '}', - \ ] + let lines =<< trim [CODE] + int func(void) + { + char *s = "x"; + + return x; + } + [CODE] + call XTest_goto_decl('gd', lines, 5, 10) endfunc @@ -289,24 +309,25 @@ func Test_cursorline_keep_col() endfunc func Test_gd_local_block() - let lines = [ - \ ' int main()', - \ '{', - \ ' char *a = "NOT NULL";', - \ ' if(a)', - \ ' {', - \ ' char *b = a;', - \ ' printf("%s\n", b);', - \ ' }', - \ ' else', - \ ' {', - \ ' char *b = "NULL";', - \ ' return b;', - \ ' }', - \ '', - \ ' return 0;', - \ '}', - \ ] + let lines =<< trim [CODE] + int main() + { + char *a = "NOT NULL"; + if(a) + { + char *b = a; + printf("%s\n", b); + } + else + { + char *b = "NULL"; + return b; + } + + return 0; + } + [CODE] + call XTest_goto_decl('1gd', lines, 11, 11) endfunc diff --git a/src/testdir/test_join.vim b/src/testdir/test_join.vim index e5ef41ee0a..1b4da6f41a 100644 --- a/src/testdir/test_join.vim +++ b/src/testdir/test_join.vim @@ -98,30 +98,27 @@ ert normal `xyl$p normal `yy2l$p - normal G - let last_line = line('$') - " Expected output - append -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -zx cvn. as dfg? hjkl iop! ert ernop -zx cvn. as dfg? hjkl iop! ert ernop -. + let expected =<< trim [DATA] + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + zx cvn. as dfg? hjkl iop! ert ernop + zx cvn. as dfg? hjkl iop! ert ernop + [DATA] - call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + call assert_equal(expected, getline(1, '$')) enew! call append(0, text) @@ -143,31 +140,28 @@ zx cvn. as dfg? hjkl iop! ert ernop normal `xyl$p normal `yy2l$p - normal G - let last_line = line('$') - " Expected output - append -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -zx cvn. as dfg? hjkl iop! ert enop -zx cvn. as dfg? hjkl iop! ert ernop + let expected =<< trim [DATA] + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + zx cvn. as dfg? hjkl iop! ert enop + zx cvn. as dfg? hjkl iop! ert ernop -. + [DATA] - call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + call assert_equal(expected, getline(1, '$')) enew! call append(0, text) @@ -180,29 +174,26 @@ zx cvn. as dfg? hjkl iop! ert ernop normal JjJjJjJjJjJjJjJjJjJjJjJjJjJ normal j4Jy3l$pjdG - normal G - let last_line = line('$') - " Expected output - append -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf. asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -asdfasdf asdf -zx cvn. as dfg? hjkl iop! ert a -. + let expected =<< trim [DATA] + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + zx cvn. as dfg? hjkl iop! ert a + [DATA] - call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + call assert_equal(expected, getline(1, '$')) set nocompatible set cpoptions&vim @@ -262,11 +253,8 @@ action(); .,+2join exe "normal jj3J\" - normal G - let last_line = line('$') - " Expected output - append + let expected =<< trim [CODE] { /* Make sure the previous comment leader is not removed. */ /* Make sure the previous comment leader is not removed. */ @@ -279,9 +267,9 @@ action(); if (condition) // Remove the next comment leader! OK, I will. action(); } -. + [CODE] - call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + call assert_equal(expected, getline(1, '$')) set comments&vim set joinspaces&vim @@ -389,11 +377,8 @@ int i = 7 /* foo *// 3 exe "normal j6J\" exe "normal oSome code!\// Make sure backspacing does not remove this comment leader.\0i\\" - normal G - let last_line = line('$') - " Expected output - append + let expected =<< [CODE] { /* Make sure the previous comment leader is not removed. */ /* Make sure the previous comment leader is not removed. */ @@ -416,8 +401,8 @@ int i = 7 /* foo *// 3 // comment Some code!// Make sure backspacing does not remove this comment leader. } -. +[CODE] - call assert_equal(getline(last_line + 1, '$'), getline(1, last_line)) + call assert_equal(expected, getline(1, '$')) close! endfunc diff --git a/src/testdir/test_mksession_utf8.vim b/src/testdir/test_mksession_utf8.vim index 67af3a9ca2..36f07512a8 100644 --- a/src/testdir/test_mksession_utf8.vim +++ b/src/testdir/test_mksession_utf8.vim @@ -65,34 +65,35 @@ func Test_mksession_utf8() call wincol() mksession! test_mks.out let li = filter(readfile('test_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"') - let expected = [ - \ 'normal! 016|', - \ 'normal! 016|', - \ 'normal! 016|', - \ 'normal! 08|', - \ 'normal! 08|', - \ 'normal! 016|', - \ 'normal! 016|', - \ 'normal! 016|', - \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", - \ " normal! 016|", - \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", - \ " normal! 016|", - \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", - \ " normal! 016|", - \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'", - \ " normal! 08|", - \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'", - \ " normal! 08|", - \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", - \ " normal! 016|", - \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", - \ " normal! 016|", - \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", - \ " normal! 016|", - \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'", - \ " normal! 016|" - \ ] + let expected =<< trim [DATA] + normal! 016| + normal! 016| + normal! 016| + normal! 08| + normal! 08| + normal! 016| + normal! 016| + normal! 016| + exe 'normal! ' . s:c . '|zs' . 16 . '|' + normal! 016| + exe 'normal! ' . s:c . '|zs' . 16 . '|' + normal! 016| + exe 'normal! ' . s:c . '|zs' . 16 . '|' + normal! 016| + exe 'normal! ' . s:c . '|zs' . 8 . '|' + normal! 08| + exe 'normal! ' . s:c . '|zs' . 8 . '|' + normal! 08| + exe 'normal! ' . s:c . '|zs' . 16 . '|' + normal! 016| + exe 'normal! ' . s:c . '|zs' . 16 . '|' + normal! 016| + exe 'normal! ' . s:c . '|zs' . 16 . '|' + normal! 016| + exe 'normal! ' . s:c . '|zs' . 16 . '|' + normal! 016| + [DATA] + call assert_equal(expected, li) tabclose! diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim index 39c66f8fec..48857927c8 100644 --- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -1555,73 +1555,158 @@ endfunc fun! Test_normal29_brace() " basic test for { and } movements - let text= ['A paragraph begins after each empty line, and also at each of a set of', - \ 'paragraph macros, specified by the pairs of characters in the ''paragraphs''', - \ 'option. The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds to', - \ 'the macros ".IP", ".LP", etc. (These are nroff macros, so the dot must be in', - \ 'the first column). A section boundary is also a paragraph boundary.', - \ 'Note that a blank line (only containing white space) is NOT a paragraph', - \ 'boundary.', - \ '', - \ '', - \ 'Also note that this does not include a ''{'' or ''}'' in the first column. When', - \ 'the ''{'' flag is in ''cpoptions'' then ''{'' in the first column is used as a', - \ 'paragraph boundary |posix|.', - \ '{', - \ 'This is no paragraph', - \ 'unless the ''{'' is set', - \ 'in ''cpoptions''', - \ '}', - \ '.IP', - \ 'The nroff macros IP separates a paragraph', - \ 'That means, it must be a ''.''', - \ 'followed by IP', - \ '.LPIt does not matter, if afterwards some', - \ 'more characters follow.', - \ '.SHAlso section boundaries from the nroff', - \ 'macros terminate a paragraph. That means', - \ 'a character like this:', - \ '.NH', - \ 'End of text here'] + let text =<< trim [DATA] + A paragraph begins after each empty line, and also at each of a set of + paragraph macros, specified by the pairs of characters in the 'paragraphs' + option. The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds to + the macros ".IP", ".LP", etc. (These are nroff macros, so the dot must be in + the first column). A section boundary is also a paragraph boundary. + Note that a blank line (only containing white space) is NOT a paragraph + boundary. + + + Also note that this does not include a '{' or '}' in the first column. When + the '{' flag is in 'cpoptions' then '{' in the first column is used as a + paragraph boundary |posix|. + { + This is no paragraph + unless the '{' is set + in 'cpoptions' + } + .IP + The nroff macros IP separates a paragraph + That means, it must be a '.' + followed by IP + .LPIt does not matter, if afterwards some + more characters follow. + .SHAlso section boundaries from the nroff + macros terminate a paragraph. That means + a character like this: + .NH + End of text here + [DATA] + new call append(0, text) 1 norm! 0d2} - call assert_equal(['.IP', - \ 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', 'followed by IP', - \ '.LPIt does not matter, if afterwards some', 'more characters follow.', '.SHAlso section boundaries from the nroff', - \ 'macros terminate a paragraph. That means', 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) + + let expected =<< trim [DATA] + .IP + The nroff macros IP separates a paragraph + That means, it must be a '.' + followed by IP + .LPIt does not matter, if afterwards some + more characters follow. + .SHAlso section boundaries from the nroff + macros terminate a paragraph. That means + a character like this: + .NH + End of text here + + [DATA] + call assert_equal(expected, getline(1, '$')) + norm! 0d} - call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', - \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', - \ 'a character like this:', '.NH', 'End of text here', ''], getline(1, '$')) + + let expected =<< trim [DATA] + .LPIt does not matter, if afterwards some + more characters follow. + .SHAlso section boundaries from the nroff + macros terminate a paragraph. That means + a character like this: + .NH + End of text here + + [DATA] + call assert_equal(expected, getline(1, '$')) + $ norm! d{ - call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', - \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', 'a character like this:', ''], getline(1, '$')) + + let expected =<< trim [DATA] + .LPIt does not matter, if afterwards some + more characters follow. + .SHAlso section boundaries from the nroff + macros terminate a paragraph. That means + a character like this: + + [DATA] + call assert_equal(expected, getline(1, '$')) + norm! d{ - call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', ''], getline(1,'$')) + + let expected =<< trim [DATA] + .LPIt does not matter, if afterwards some + more characters follow. + + [DATA] + call assert_equal(expected, getline(1, '$')) + " Test with { in cpooptions %d call append(0, text) set cpo+={ 1 norm! 0d2} - call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', - \ '.IP', 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', - \ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.', - \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', - \ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) + + let expected =<< trim [DATA] + { + This is no paragraph + unless the '{' is set + in 'cpoptions' + } + .IP + The nroff macros IP separates a paragraph + That means, it must be a '.' + followed by IP + .LPIt does not matter, if afterwards some + more characters follow. + .SHAlso section boundaries from the nroff + macros terminate a paragraph. That means + a character like this: + .NH + End of text here + + [DATA] + call assert_equal(expected, getline(1, '$')) + $ norm! d} - call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', - \ '.IP', 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', - \ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.', - \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', - \ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) + + let expected =<< trim [DATA] + { + This is no paragraph + unless the '{' is set + in 'cpoptions' + } + .IP + The nroff macros IP separates a paragraph + That means, it must be a '.' + followed by IP + .LPIt does not matter, if afterwards some + more characters follow. + .SHAlso section boundaries from the nroff + macros terminate a paragraph. That means + a character like this: + .NH + End of text here + + [DATA] + call assert_equal(expected, getline(1, '$')) + norm! gg} norm! d5} - call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', ''], getline(1,'$')) + + let expected =<< trim [DATA] + { + This is no paragraph + unless the '{' is set + in 'cpoptions' + } + + [DATA] + call assert_equal(expected, getline(1, '$')) " clean up set cpo-={ diff --git a/src/testdir/test_profile.vim b/src/testdir/test_profile.vim index d6e9c03bd5..ae47a6d8c3 100644 --- a/src/testdir/test_profile.vim +++ b/src/testdir/test_profile.vim @@ -4,34 +4,34 @@ if !has('profile') endif func Test_profile_func() - let lines = [ - \ 'profile start Xprofile_func.log', - \ 'profile func Foo*"', - \ "func! Foo1()", - \ "endfunc", - \ "func! Foo2()", - \ " let l:count = 100", - \ " while l:count > 0", - \ " let l:count = l:count - 1", - \ " endwhile", - \ "endfunc", - \ "func! Foo3()", - \ "endfunc", - \ "func! Bar()", - \ "endfunc", - \ "call Foo1()", - \ "call Foo1()", - \ "profile pause", - \ "call Foo1()", - \ "profile continue", - \ "call Foo2()", - \ "call Foo3()", - \ "call Bar()", - \ "if !v:profiling", - \ " delfunc Foo2", - \ "endif", - \ "delfunc Foo3", - \ ] + let lines =<< trim [CODE] + profile start Xprofile_func.log + profile func Foo* + func! Foo1() + endfunc + func! Foo2() + let l:count = 100 + while l:count > 0 + let l:count = l:count - 1 + endwhile + endfunc + func! Foo3() + endfunc + func! Bar() + endfunc + call Foo1() + call Foo1() + profile pause + call Foo1() + profile continue + call Foo2() + call Foo3() + call Bar() + if !v:profiling + delfunc Foo2 + endif + delfunc Foo3 + [CODE] call writefile(lines, 'Xprofile_func.vim') call system(v:progpath @@ -86,38 +86,38 @@ func Test_profile_func() endfunc func Test_profile_func_with_ifelse() - let lines = [ - \ "func! Foo1()", - \ " if 1", - \ " let x = 0", - \ " elseif 1", - \ " let x = 1", - \ " else", - \ " let x = 2", - \ " endif", - \ "endfunc", - \ "func! Foo2()", - \ " if 0", - \ " let x = 0", - \ " elseif 1", - \ " let x = 1", - \ " else", - \ " let x = 2", - \ " endif", - \ "endfunc", - \ "func! Foo3()", - \ " if 0", - \ " let x = 0", - \ " elseif 0", - \ " let x = 1", - \ " else", - \ " let x = 2", - \ " endif", - \ "endfunc", - \ "call Foo1()", - \ "call Foo2()", - \ "call Foo3()", - \ ] + let lines =<< trim [CODE] + func! Foo1() + if 1 + let x = 0 + elseif 1 + let x = 1 + else + let x = 2 + endif + endfunc + func! Foo2() + if 0 + let x = 0 + elseif 1 + let x = 1 + else + let x = 2 + endif + endfunc + func! Foo3() + if 0 + let x = 0 + elseif 0 + let x = 1 + else + let x = 2 + endif + endfunc + call Foo1() + call Foo2() + call Foo3() + [CODE] call writefile(lines, 'Xprofile_func.vim') call system(v:progpath @@ -196,41 +196,41 @@ func Test_profile_func_with_ifelse() endfunc func Test_profile_func_with_trycatch() - let lines = [ - \ "func! Foo1()", - \ " try", - \ " let x = 0", - \ " catch", - \ " let x = 1", - \ " finally", - \ " let x = 2", - \ " endtry", - \ "endfunc", - \ "func! Foo2()", - \ " try", - \ " throw 0", - \ " catch", - \ " let x = 1", - \ " finally", - \ " let x = 2", - \ " endtry", - \ "endfunc", - \ "func! Foo3()", - \ " try", - \ " throw 0", - \ " catch", - \ " throw 1", - \ " finally", - \ " let x = 2", - \ " endtry", - \ "endfunc", - \ "call Foo1()", - \ "call Foo2()", - \ "try", - \ " call Foo3()", - \ "catch", - \ "endtry", - \ ] + let lines =<< trim [CODE] + func! Foo1() + try + let x = 0 + catch + let x = 1 + finally + let x = 2 + endtry + endfunc + func! Foo2() + try + throw 0 + catch + let x = 1 + finally + let x = 2 + endtry + endfunc + func! Foo3() + try + throw 0 + catch + throw 1 + finally + let x = 2 + endtry + endfunc + call Foo1() + call Foo2() + try + call Foo3() + catch + endtry + [CODE] call writefile(lines, 'Xprofile_func.vim') call system(v:progpath @@ -309,15 +309,15 @@ func Test_profile_func_with_trycatch() endfunc func Test_profile_file() - let lines = [ - \ 'func! Foo()', - \ 'endfunc', - \ 'for i in range(10)', - \ ' " a comment', - \ ' call Foo()', - \ 'endfor', - \ 'call Foo()', - \ ] + let lines =<< trim [CODE] + func! Foo() + endfunc + for i in range(10) + " a comment + call Foo() + endfor + call Foo() + [CODE] call writefile(lines, 'Xprofile_file.vim') call system(v:progpath @@ -448,26 +448,27 @@ func Test_profile_truncate_mbyte() endfunc func Test_profdel_func() - let lines = [ - \ 'profile start Xprofile_file.log', - \ 'func! Foo1()', - \ 'endfunc', - \ 'func! Foo2()', - \ 'endfunc', - \ 'func! Foo3()', - \ 'endfunc', - \ '', - \ 'profile func Foo1', - \ 'profile func Foo2', - \ 'call Foo1()', - \ 'call Foo2()', - \ '', - \ 'profile func Foo3', - \ 'profdel func Foo2', - \ 'profdel func Foo3', - \ 'call Foo1()', - \ 'call Foo2()', - \ 'call Foo3()' ] + let lines =<< trim [CODE] + profile start Xprofile_file.log + func! Foo1() + endfunc + func! Foo2() + endfunc + func! Foo3() + endfunc + + profile func Foo1 + profile func Foo2 + call Foo1() + call Foo2() + + profile func Foo3 + profdel func Foo2 + profdel func Foo3 + call Foo1() + call Foo2() + call Foo3() + [CODE] call writefile(lines, 'Xprofile_file.vim') call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q') call assert_equal(0, v:shell_error) @@ -494,14 +495,15 @@ endfunc func Test_profdel_star() " Foo() is invoked once before and once after 'profdel *'. " So profiling should report it only once. - let lines = [ - \ 'profile start Xprofile_file.log', - \ 'func! Foo()', - \ 'endfunc', - \ 'profile func Foo', - \ 'call Foo()', - \ 'profdel *', - \ 'call Foo()' ] + let lines =<< trim [CODE] + profile start Xprofile_file.log + func! Foo() + endfunc + profile func Foo + call Foo() + profdel * + call Foo() + [CODE] call writefile(lines, 'Xprofile_file.vim') call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q') call assert_equal(0, v:shell_error) diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 54c10ad6a2..ef0a512028 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -818,68 +818,68 @@ func Test_efm1() return endif - let l = [ - \ '"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.', - \ '"Xtestfile", line 6 col 19; this is an error', - \ 'gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c', - \ 'Xtestfile:9: parse error before `asd''', - \ 'make: *** [vim] Error 1', - \ 'in file "Xtestfile" linenr 10: there is an error', - \ '', - \ '2 returned', - \ '"Xtestfile", line 11 col 1; this is an error', - \ '"Xtestfile", line 12 col 2; this is another error', - \ '"Xtestfile", line 14:10; this is an error in column 10', - \ '=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time', - \ '"Xtestfile", linenr 16: yet another problem', - \ 'Error in "Xtestfile" at line 17:', - \ 'x should be a dot', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17', - \ ' ^', - \ 'Error in "Xtestfile" at line 18:', - \ 'x should be a dot', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18', - \ '.............^', - \ 'Error in "Xtestfile" at line 19:', - \ 'x should be a dot', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19', - \ '--------------^', - \ 'Error in "Xtestfile" at line 20:', - \ 'x should be a dot', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20', - \ ' ^', - \ '', - \ 'Does anyone know what is the problem and how to correction it?', - \ '"Xtestfile", line 21 col 9: What is the title of the quickfix window?', - \ '"Xtestfile", line 22 col 9: What is the title of the quickfix window?' - \ ] + let l =<< trim [DATA] + "Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set. + "Xtestfile", line 6 col 19; this is an error + gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c + Xtestfile:9: parse error before `asd' + make: *** [vim] Error 1 + in file "Xtestfile" linenr 10: there is an error + + 2 returned + "Xtestfile", line 11 col 1; this is an error + "Xtestfile", line 12 col 2; this is another error + "Xtestfile", line 14:10; this is an error in column 10 + =Xtestfile=, line 15:10; this is another error, but in vcol 10 this time + "Xtestfile", linenr 16: yet another problem + Error in "Xtestfile" at line 17: + x should be a dot + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17 + ^ + Error in "Xtestfile" at line 18: + x should be a dot + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18 + .............^ + Error in "Xtestfile" at line 19: + x should be a dot + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19 + --------------^ + Error in "Xtestfile" at line 20: + x should be a dot + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20 + ^ + + Does anyone know what is the problem and how to correction it? + "Xtestfile", line 21 col 9: What is the title of the quickfix window? + "Xtestfile", line 22 col 9: What is the title of the quickfix window? + [DATA] call writefile(l, 'Xerrorfile1') call writefile(l[:-2], 'Xerrorfile2') - let m = [ - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21', - \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22' - \ ] + let m =<< trim [DATA] + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21 + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22 + [DATA] call writefile(m, 'Xtestfile') let save_efm = &efm @@ -1092,21 +1092,23 @@ func Test_efm2() call assert_equal([' 1 Xtestfile:^\VLine search text\$: '], l) " Test for %P, %Q and %t format specifiers - let lines=["[Xtestfile1]", - \ "(1,17) error: ';' missing", - \ "(21,2) warning: variable 'z' not defined", - \ "(67,3) error: end of file found before string ended", - \ "--", - \ "", - \ "[Xtestfile2]", - \ "--", - \ "", - \ "[Xtestfile3]", - \ "NEW compiler v1.1", - \ "(2,2) warning: variable 'x' not defined", - \ "(67,3) warning: 's' already defined", - \ "--" - \] + let lines =<< trim [DATA] + [Xtestfile1] + (1,17) error: ';' missing + (21,2) warning: variable 'z' not defined + (67,3) error: end of file found before string ended + -- + + [Xtestfile2] + -- + + [Xtestfile3] + NEW compiler v1.1 + (2,2) warning: variable 'x' not defined + (67,3) warning: 's' already defined + -- + [DATA] + set efm=%+P[%f]%r,(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%+Q--%r " To exercise the push/pop file functionality in quickfix, the test files " need to be created. @@ -1128,11 +1130,13 @@ func Test_efm2() call delete('Xtestfile3') " Tests for %E, %C and %Z format specifiers - let lines = ["Error 275", - \ "line 42", - \ "column 3", - \ "' ' expected after '--'" - \] + let lines =<< trim [DATA] + Error 275 + line 42 + column 3 + ' ' expected after '--' + [DATA] + set efm=%EError\ %n,%Cline\ %l,%Ccolumn\ %c,%Z%m cgetexpr lines let l = getqflist() @@ -1143,9 +1147,11 @@ func Test_efm2() call assert_equal("\n' ' expected after '--'", l[0].text) " Test for %> - let lines = ["Error in line 147 of foo.c:", - \"unknown variable 'i'" - \] + let lines =<< trim [DATA] + Error in line 147 of foo.c: + unknown variable 'i' + [DATA] + set efm=unknown\ variable\ %m,%E%>Error\ in\ line\ %l\ of\ %f:,%Z%m cgetexpr lines let l = getqflist() @@ -1154,21 +1160,22 @@ func Test_efm2() call assert_equal("\nunknown variable 'i'", l[0].text) " Test for %A, %C and other formats - let lines = [ - \"==============================================================", - \"FAIL: testGetTypeIdCachesResult (dbfacadeTest.DjsDBFacadeTest)", - \"--------------------------------------------------------------", - \"Traceback (most recent call last):", - \' File "unittests/dbfacadeTest.py", line 89, in testFoo', - \" self.assertEquals(34, dtid)", - \' File "/usr/lib/python2.2/unittest.py", line 286, in', - \" failUnlessEqual", - \" raise self.failureException, \\", - \"AssertionError: 34 != 33", - \"", - \"--------------------------------------------------------------", - \"Ran 27 tests in 0.063s" - \] + let lines =<< trim [DATA] + ============================================================== + FAIL: testGetTypeIdCachesResult (dbfacadeTest.DjsDBFacadeTest) + -------------------------------------------------------------- + Traceback (most recent call last): + File "unittests/dbfacadeTest.py", line 89, in testFoo + self.assertEquals(34, dtid) + File "/usr/lib/python2.2/unittest.py", line 286, in + failUnlessEqual + raise self.failureException, \\ + AssertionError: 34 != 33 + + -------------------------------------------------------------- + Ran 27 tests in 0.063s + [DATA] + set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m cgetexpr lines let l = getqflist() diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim index 8f494a8507..33257f79f4 100644 --- a/src/testdir/test_startup.vim +++ b/src/testdir/test_startup.vim @@ -19,25 +19,27 @@ func Test_after_comes_later() if !has('packages') return endif - let before = [ - \ 'set nocp viminfo+=nviminfo', - \ 'set guioptions+=M', - \ 'let $HOME = "/does/not/exist"', - \ 'set loadplugins', - \ 'set rtp=Xhere,Xafter,Xanother', - \ 'set packpath=Xhere,Xafter', - \ 'set nomore', - \ 'let g:sequence = ""', - \ ] - let after = [ - \ 'redir! > Xtestout', - \ 'scriptnames', - \ 'redir END', - \ 'redir! > Xsequence', - \ 'echo g:sequence', - \ 'redir END', - \ 'quit', - \ ] + let before =<< trim [CODE] + set nocp viminfo+=nviminfo + set guioptions+=M + let $HOME = "/does/not/exist" + set loadplugins + set rtp=Xhere,Xafter,Xanother + set packpath=Xhere,Xafter + set nomore + let g:sequence = "" + [CODE] + + let after =<< trim [CODE] + redir! > Xtestout + scriptnames + redir END + redir! > Xsequence + echo g:sequence + redir END + quit + [CODE] + call mkdir('Xhere/plugin', 'p') call writefile(['let g:sequence .= "here "'], 'Xhere/plugin/here.vim') call mkdir('Xanother/plugin', 'p') @@ -76,15 +78,16 @@ func Test_pack_in_rtp_when_plugins_run() if !has('packages') return endif - let before = [ - \ 'set nocp viminfo+=nviminfo', - \ 'set guioptions+=M', - \ 'let $HOME = "/does/not/exist"', - \ 'set loadplugins', - \ 'set rtp=Xhere', - \ 'set packpath=Xhere', - \ 'set nomore', - \ ] + let before =<< trim [CODE] + set nocp viminfo+=nviminfo + set guioptions+=M + let $HOME = "/does/not/exist" + set loadplugins + set rtp=Xhere + set packpath=Xhere + set nomore + [CODE] + let after = [ \ 'quit', \ ] @@ -131,11 +134,12 @@ func Test_help_arg() endfunc func Test_compatible_args() - let after = [ - \ 'call writefile([string(&compatible)], "Xtestout")', - \ 'set viminfo+=nviminfo', - \ 'quit', - \ ] + let after =<< trim [CODE] + call writefile([string(&compatible)], "Xtestout") + set viminfo+=nviminfo + quit + [CODE] + if RunVim([], after, '-C') let lines = readfile('Xtestout') call assert_equal('1', lines[0]) @@ -152,14 +156,15 @@ endfunc " Test the -o[N] and -O[N] arguments to open N windows split " horizontally or vertically. func Test_o_arg() - let after = [ - \ 'call writefile([winnr("$"), - \ winheight(1), winheight(2), &lines, - \ winwidth(1), winwidth(2), &columns, - \ bufname(winbufnr(1)), bufname(winbufnr(2))], - \ "Xtestout")', - \ 'qall', - \ ] + let after =<< trim [CODE] + call writefile([winnr("$"), + \ winheight(1), winheight(2), &lines, + \ winwidth(1), winwidth(2), &columns, + \ bufname(winbufnr(1)), bufname(winbufnr(2))], + \ "Xtestout") + qall + [CODE] + if RunVim([], after, '-o2') " Open 2 windows split horizontally. Expect: " - 2 windows @@ -228,10 +233,11 @@ endfunc " Test the -p[N] argument to open N tabpages. func Test_p_arg() - let after = [ - \ 'call writefile(split(execute("tabs"), "\n"), "Xtestout")', - \ 'qall', - \ ] + let after =<< trim [CODE] + call writefile(split(execute("tabs"), "\n"), "Xtestout") + qall + [CODE] + if RunVim([], after, '-p2') let lines = readfile('Xtestout') call assert_equal(4, len(lines)) @@ -273,12 +279,12 @@ endfunc " Test the '-q [errorfile]' argument. func Test_q_arg() let source_file = has('win32') ? '..\memfile.c' : '../memfile.c' - let after = [ - \ 'call writefile([&errorfile, string(getpos("."))], "Xtestout")', - \ 'copen', - \ 'w >> Xtestout', - \ 'qall' - \ ] + let after =<< trim [CODE] + call writefile([&errorfile, string(getpos("."))], "Xtestout") + copen + w >> Xtestout + qall + [CODE] " Test with default argument '-q'. call assert_equal('errors.err', &errorfile) @@ -335,10 +341,11 @@ endfunc " -M resets 'modifiable' and 'write' " -R sets 'readonly' func Test_m_M_R() - let after = [ - \ 'call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout")', - \ 'qall', - \ ] + let after =<< trim [CODE] + call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout") + qall + [CODE] + if RunVim([], after, '') let lines = readfile('Xtestout') call assert_equal(['1', '1', '0', '200'], lines) @@ -361,10 +368,11 @@ endfunc " Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes). func Test_A_F_H_arg() - let after = [ - \ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")', - \ 'qall', - \ ] + let after =<< trim [CODE] + call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout") + qall + [CODE] + " Use silent Ex mode to avoid the hit-Enter prompt for the warning that " 'encoding' is not utf-8. if has('arabic') && &encoding == 'utf-8' && RunVim([], after, '-e -s -A') @@ -481,10 +489,11 @@ func Test_invalid_args() endfunc func Test_file_args() - let after = [ - \ 'call writefile(argv(), "Xtestout")', - \ 'qall', - \ ] + let after =<< trim [CODE] + call writefile(argv(), "Xtestout") + qall + [CODE] + if RunVim([], after, '') let lines = readfile('Xtestout') call assert_equal(0, len(lines)) @@ -546,10 +555,11 @@ func Test_startuptime() endfunc func Test_read_stdin() - let after = [ - \ 'write Xtestout', - \ 'quit!', - \ ] + let after =<< trim [CODE] + write Xtestout + quit! + [CODE] + if RunVimPiped([], after, '-', 'echo something | ') let lines = readfile('Xtestout') " MS-Windows adds a space after the word @@ -559,10 +569,11 @@ func Test_read_stdin() endfunc func Test_set_shell() - let after = [ - \ 'call writefile([&shell], "Xtestout")', - \ 'quit!', - \ ] + let after =<< trim [CODE] + call writefile([&shell], "Xtestout") + quit! + [CODE] + let $SHELL = '/bin/with space/sh' if RunVimPiped([], after, '', '') let lines = readfile('Xtestout') @@ -613,20 +624,22 @@ endfunc func Test_zzz_startinsert() " Test :startinsert call writefile(['123456'], 'Xtestout') - let after = [ - \ ':startinsert', - \ 'call feedkeys("foobar\:wq\","t")' - \ ] + let after =<< trim [CODE] + :startinsert + call feedkeys("foobar\:wq\","t") + [CODE] + if RunVim([], after, 'Xtestout') let lines = readfile('Xtestout') call assert_equal(['foobar123456'], lines) endif " Test :startinsert! call writefile(['123456'], 'Xtestout') - let after = [ - \ ':startinsert!', - \ 'call feedkeys("foobar\:wq\","t")' - \ ] + let after =<< trim [CODE] + :startinsert! + call feedkeys("foobar\:wq\","t") + [CODE] + if RunVim([], after, 'Xtestout') let lines = readfile('Xtestout') call assert_equal(['123456foobar'], lines) diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index fcad972b1a..8139453563 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -1012,18 +1012,19 @@ endfunc " Run Vim, start a terminal in that Vim without the kill argument, " check that :qall does not exit, :qall! does. func Test_terminal_qall_exit() - let after = [ - \ 'term', - \ 'let buf = bufnr("%")', - \ 'while term_getline(buf, 1) =~ "^\\s*$"', - \ ' sleep 10m', - \ 'endwhile', - \ 'set nomore', - \ 'au VimLeavePre * call writefile(["too early"], "Xdone")', - \ 'qall', - \ 'au! VimLeavePre * exe buf . "bwipe!" | call writefile(["done"], "Xdone")', - \ 'cquit', - \ ] + let after =<< trim [CODE] + term + let buf = bufnr("%") + while term_getline(buf, 1) =~ "^\\s*$" + sleep 10m + endwhile + set nomore + au VimLeavePre * call writefile(["too early"], "Xdone") + qall + au! VimLeavePre * exe buf . "bwipe!" | call writefile(["done"], "Xdone") + cquit + [CODE] + if !RunVim([], after, '') return endif diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim index e4e7755234..6b9dd547bd 100644 --- a/src/testdir/test_xxd.vim +++ b/src/testdir/test_xxd.vim @@ -95,9 +95,13 @@ func Test_xxd() %d exe '0r! ' . s:xxd_cmd . ' -i XXDfile' $d - let expected = ['unsigned char XXDfile[] = {', - \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', - \ 'unsigned int XXDfile_len = 11;'] + let expected =<< trim [CODE] + unsigned char XXDfile[] = { + 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a + }; + unsigned int XXDfile_len = 11; + [CODE] + call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) " Test 8: Print C include capitalized @@ -107,9 +111,12 @@ func Test_xxd() %d exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' XXDfile' $d - let expected = ['unsigned char XXDFILE[] = {', - \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', - \ 'unsigned int XXDFILE_LEN = 11;'] + let expected =<< trim [CODE] + unsigned char XXDFILE[] = { + 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a + }; + unsigned int XXDFILE_LEN = 11; + [CODE] call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) endfor diff --git a/src/version.c b/src/version.c index de5ffc6e64..cdcd132e43 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1362, /**/ 1361, /**/ From e0b5949a3b28be9940bb8a46b2579e960100b83b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 May 2019 20:54:45 +0200 Subject: [PATCH 95/97] patch 8.1.1363: ":vert options" does not make a vertical split Problem: ":vert options" does not make a vertical split. Solution: Pass the right modifiers in $OPTWIN_CMD. (Ken Takata, closes #4401) --- src/ex_cmds2.c | 4 +++- src/testdir/test_options.vim | 26 ++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 18c438ce0c..bf6e551209 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -3016,7 +3016,9 @@ ex_packadd(exarg_T *eap) ex_options( exarg_T *eap UNUSED) { - vim_setenv((char_u *)"OPTWIN_CMD", (char_u *)(cmdmod.tab ? "tab" : "")); + vim_setenv((char_u *)"OPTWIN_CMD", + (char_u *)(cmdmod.tab ? "tab" + : (cmdmod.split & WSP_VERT) ? "vert" : "")); cmd_source((char_u *)SYS_OPTWIN_FILE, NULL); } #endif diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim index c5dbb9f4c4..13de719342 100644 --- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -51,6 +51,32 @@ func Test_options() endtry call assert_equal('ok', caught) + " Check if the option-window is opened horizontally. + wincmd j + call assert_notequal('option-window', bufname('')) + wincmd k + call assert_equal('option-window', bufname('')) + " close option-window + close + + " Open the option-window vertically. + vert options + " Check if the option-window is opened vertically. + wincmd l + call assert_notequal('option-window', bufname('')) + wincmd h + call assert_equal('option-window', bufname('')) + " close option-window + close + + " Open the option-window in a new tab. + tab options + " Check if the option-window is opened in a tab. + normal gT + call assert_notequal('option-window', bufname('')) + normal gt + call assert_equal('option-window', bufname('')) + " close option-window close endfunc diff --git a/src/version.c b/src/version.c index cdcd132e43..fb7dad390e 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1363, /**/ 1362, /**/ From 5c017b2de28d19dfa4af58b8973e32f31bb1477e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 May 2019 23:09:01 +0200 Subject: [PATCH 96/97] patch 8.1.1364: design for popup window support needs more details Problem: Design for popup window support needs more details. Solution: Add details about using a window and buffer. Rename popup_show() to popup_create() and add popup_show() and popup_hide(). --- runtime/doc/popup.txt | 207 ++++++++++++++++++++++++++++++------------ src/version.c | 2 + 2 files changed, 153 insertions(+), 56 deletions(-) diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt index 1ffaf87669..4813308903 100644 --- a/runtime/doc/popup.txt +++ b/runtime/doc/popup.txt @@ -1,10 +1,10 @@ -*popup.txt* For Vim version 8.1. Last change: 2019 May 12 +*popup.txt* For Vim version 8.1. Last change: 2019 May 21 VIM REFERENCE MANUAL by Bram Moolenaar -Displaying text with properties attached. *popup* *popup-window* +Displaying text in floating window. *popup* *popup-window* THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE @@ -13,18 +13,67 @@ THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE 3. Examples |popup-examples| -{not able to use text properties when the |+textprop| feature was -disabled at compile time} +{not available if the |+eval| feature was disabled at compile time} +{not able to use text properties if the |+textprop| feature was disabled at +compile time} ============================================================================== 1. Introduction *popup-intro* -We are talking about popup windows here, text that goes on top of the buffer -text and is under control of a plugin. Other popup functionality: +We are talking about popup windows here, text that goes on top of the regular +windows and is under control of a plugin. You cannot edit the text in the +popup window like with regular windows. + +A popup window can be used for such things as: +- briefly show a message without changing the command line +- prompt the user with a dialog +- display information while typing +- give extra information for auto-completion + +The text in the popup window can be colored with |text-properties|. It is +also possible to use syntax highlighting. + +A popup window has a window-ID like other windows, but behaves differently. +The size can be up to the whole Vim window and it overlaps other windows. +It contains a buffer, and that buffer is always associated with the popup +window. The window cannot be used in Normal, Visual or Insert mode, it does +not get keyboard focus. You can use functions like `setbufline()` to change +the text in the buffer. There are more differences from how this window and +buffer behave compared to regular windows and buffers, see |popup-buffer|. + +If this is not what you are looking for, check out other popup functionality: - popup menu, see |popup-menu| - balloon, see |balloon-eval| -TODO + +TODO: + +Example how to use syntax highlighting of a code snippet. + +Scrolling: When the screen scrolls up for output of an Ex command, what +happens with popups? +1. Stay where they are. Problem: listed text may go behind and can't be read. +2. Scroll with the page. What if they get updated? Either postpone, or take + the scroll offset into account. +Probably 2. is the best choice. + +Positioning relative to the popup-menu to avoid overlapping with it; add a +function to get the position and size of the popup-menu. + + +IMPLEMENTATION: +- Put code in popupwin.c +- Use win_update() for displaying +- At first redraw all windows NOT_VALID when the popup moves or hides. +- At first always display the popup windows at the end of update_screen(), + lowest zindex first. +- Later make it more efficient and avoid flicker +- Use a separate list of windows, one for each tab and one global. Also put + "aucmd_win" in there. +- add optional {buf} command to execute(). Only works for a buffer that is + visible in a window in the current tab or in a popup window. + E.g. for execute('syntax enable', 'silent', bufnr) + ============================================================================== 2. Functions *popup-functions* @@ -33,56 +82,66 @@ THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE Proposal and discussion on issue #4063: https://github.com/vim/vim/issues/4063 -[to be moved to eval.txt later] - -popup_show({lines}, {options}) *popup_show()* - Open a popup window showing {lines}, which is a list of lines, - where each line has text and text properties. +[functions to be moved to eval.txt later, keep list of functions here] +popup_create({text}, {options}) *popup_create()* + Open a popup window showing {text}, which is either: + - a string + - a list of strings + - a list of text lines with text properties {options} is a dictionary with many possible entries. + See |popup_create-usage| for details. - Returns a unique ID to be used with |popup_close()|. - - See |popup_show-usage| for details. + Returns a window-ID, which can be used with other popup + functions. Use `winbufnr()` to get the number of the buffer + in the window: > + let winid = popup_create('hello', {}) + let bufnr = winbufnr(winid) + call setbufline(bufnr, 2, 'second line') -popup_dialog({lines}, {options}) *popup_dialog()* - Just like |popup_show()| but with different default options: - pos "center" - zindex 200 - border [] +popup_dialog({text}, {options}) *popup_dialog()* + Just like |popup_create()| but with these default options: > + call popup_create({text}, { + \ 'pos': 'center', + \ 'zindex': 200, + \ 'border': [], + \}) +< Use {options} to change the properties. popup_notification({text}, {options}) *popup_notification()* - Show the string {text} for 3 seconds at the top of the Vim - window. This works like: > - call popup_show([{'text': {text}}], { + Show the {text} for 3 seconds at the top of the Vim window. + This works like: > + call popup_create({text}, { \ 'line': 1, \ 'col': 10, \ 'time': 3000, + \ 'tab': -1, \ 'zindex': 200, \ 'highlight': 'WarningMsg', \ 'border: [], \ }) < Use {options} to change the properties. + popup_atcursor({text}, {options}) *popup_atcursor()* - Show the string {text} above the cursor, and close it when the - cursor moves. This works like: > - call popup_show([{'text': {text}}], { + Show the {text} above the cursor, and close it when the cursor + moves. This works like: > + call popup_create({text}, { \ 'line': 'cursor-1', \ 'col': 'cursor', - \ 'zindex': 50, \ 'moved': 'WORD', \ }) < Use {options} to change the properties. -popup_menu({lines}, {options}) *popup_atcursor()* - Show the {lines} near the cursor, handle selecting one of the +popup_menu({text}, {options}) *popup_menu()* + Show the {text} near the cursor, handle selecting one of the items with cursorkeys, and close it an item is selected with - Space or Enter. This works like: > - call popup_show({lines}, { + Space or Enter. {text} should have multiple lines to make this + useful. This works like: > + call popup_create({text}, { \ 'pos': 'center', \ 'zindex': 200, \ 'wrap': 0, @@ -93,9 +152,17 @@ popup_menu({lines}, {options}) *popup_atcursor()* "callback" to a function that handles the selected item. +popup_show({id}) *popup_show()* + If {id} is a hidden popup, show it now. + +popup_hide({id}) *popup_hide()* + If {id} is a displayed popup, hide it now. If the popup has a + filter it will not be invoked for so long as the popup is + hidden. + popup_move({id}, {options}) *popup_move()* Move popup {id} to the position speficied with {options}. - {options} may contain the items from |popup_show()| that + {options} may contain the items from |popup_create()| that specify the popup position: "line", "col", "pos", "maxheight", "minheight", "maxwidth" and "minwidth". @@ -116,21 +183,6 @@ popup_filter_yesno({id}, {key}) *popup_filter_yesno()* pressing 'n'. -popup_setlines({id}, {lnum}, {lines}) *popup_setlines()* - In popup {id} set line {lnum} and following to {lines}. - - {lnum} is one-based and must be either an existing line or - just one below the last line, in which case the line gets - appended. - - {lines} has the same format as one item in {lines} of - |popup_show()|. Existing lines are replaced. When {lines} - extends below the last line of the popup lines are appended. - -popup_getlines({id}) *popup_getlines()* - Return the {lines} for popup {id}. - - popup_setoptions({id}, {options}) *popup_setoptions()* Override options in popup {id} with entries in {options}. @@ -142,19 +194,46 @@ popup_getoptions({id}) *popup_getoptions()* popup_close({id}) *popup_close()* Close popup {id}. + *:popupclear* *:popupc* +:popupc[lear] Emergency solution to a misbehaving plugin: close all popup + windows. -POPUP_SHOW() ARGUMENTS *popup_show-usage* -The first argument of |popup_show()| is a list of text lines. Each item in -the list is a dictionary with these entries: - text The text to display. +POPUP BUFFER AND WINDOW *popup-buffer* + +A new buffer is created to hold the text and text properties of the popup +window. The buffer is always associated with the popup window and +manipulation is restricted: +- the buffer has no name +- 'buftype' is "popup" +- 'swapfile' is off +- 'bufhidden' is "hide" +- 'buflisted' is off +TODO: more + +The window does have a cursor position, but the cursor is not displayed. + +Options can be set on the window with `setwinvar()`, e.g.: > + call setwinvar(winid, '&wrap', 0) +And options can be set on the buffer with `setbufvar()`, e.g.: > + call setbufvar(winbufnr(winid), '&filetype', 'java') + + +POPUP_CREATE() ARGUMENTS *popup_create-usage* + +The first argument of |popup_create()| specifies the text to be displayed, and +optionally text properties. It is in one of three forms: +- a string +- a list of strings +- a list of dictionaries, where each dictionary has these entries: + text String with the text to display. props A list of text properties. Optional. Each entry is a dictionary, like the third argument of |prop_add()|, but specifying the column in the dictionary with a "col" entry, see below: |popup-props|. -The second argument of |popup_show()| is a dictionary with options: +The second argument of |popup_create()| is a dictionary with options: line screen line where to position the popup; can use "cursor", "cursor+1" or "cursor-1" to use the line of the cursor and add or subtract a number of lines; @@ -168,10 +247,20 @@ The second argument of |popup_show()| is a dictionary with options: used for. Default is "botleft". Alternatively "center" can be used to position the popup somewhere near the cursor. + flip when TRUE (the default) and the position is relative + to the cursor, flip to below or above the cursor to + avoid overlap with the |popupmenu-completion| or + another popup with a higher "zindex" maxheight maximum height minheight minimum height maxwidth maximum width minwidth minimum width + hidden when TRUE the popup exists but is not displayed; use + `popup_show()` to unhide it. + tab when -1: display the popup on all tabs; when 0 (the + default): display the popup on the current tab; + otherwise the number of the tab page the popup is + displayed on; when invalid the current tab is used title text to be displayed above the first item in the popup, on top of any border wrap TRUE to make the lines wrap (default TRUE) @@ -229,9 +318,11 @@ same, since they only apply to one line. POPUP FILTER *popup-filter* -A callback that gets any typed keys while a popup is displayed. It can return -TRUE to indicate the key has been handled and is to be discarded, or FALSE to -let Vim handle the key as usual in the current state. +A callback that gets any typed keys while a popup is displayed. The filter is +not invoked for as long as the popup is hidden. + +The filter can return TRUE to indicate the key has been handled and is to be +discarded, or FALSE to let Vim handle the key as usual in the current state. The filter function is called with two arguments: the ID of the popup and the key. @@ -241,6 +332,10 @@ Some common key actions: cursor keys select another entry Tab accept current suggestion +A mouse click arrives as . The coordinates are in +v:mouse_popup_col and v:mouse_popup_row. The top-left screen cell of the +popup is col 1, row 1 (not counting the border). + Vim provides standard filters |popup_filter_menu()| and |popup_filter_yesno()|. @@ -265,7 +360,7 @@ Prompt the user to press y/Y or n/N: > endif endfunc - call popup_show([{'text': 'Continue? y/n'}], { + call popup_create(['Continue? y/n'], { \ 'filter': 'popup_filter_yesno', \ 'callback': 'MyDialogHandler', \ }) diff --git a/src/version.c b/src/version.c index fb7dad390e..b0736df46a 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1364, /**/ 1363, /**/ From 53575521406739cf20bbe4e384d88e7dca11f040 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 22 May 2019 22:38:25 +0200 Subject: [PATCH 97/97] patch 8.1.1365: source command doesn't check for the sandbox Problem: Source command doesn't check for the sandbox. (Armin Razmjou) Solution: Check for the sandbox when sourcing a file. --- src/getchar.c | 6 ++++++ src/testdir/test_source.vim | 9 +++++++++ src/version.c | 2 ++ 3 files changed, 17 insertions(+) diff --git a/src/getchar.c b/src/getchar.c index 9379a6a8d4..debad7efd2 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1407,6 +1407,12 @@ openscript( emsg(_(e_nesting)); return; } + + // Disallow sourcing a file in the sandbox, the commands would be executed + // later, possibly outside of the sandbox. + if (check_secure()) + return; + #ifdef FEAT_EVAL if (ignore_script) /* Not reading from script, also don't open one. Warning message? */ diff --git a/src/testdir/test_source.vim b/src/testdir/test_source.vim index a33d286e75..5166bafb15 100644 --- a/src/testdir/test_source.vim +++ b/src/testdir/test_source.vim @@ -36,3 +36,12 @@ func Test_source_cmd() au! SourcePre au! SourcePost endfunc + +func Test_source_sandbox() + new + call writefile(["Ohello\"], 'Xsourcehello') + source! Xsourcehello | echo + call assert_equal('hello', getline(1)) + call assert_fails('sandbox source! Xsourcehello', 'E48:') + bwipe! +endfunc diff --git a/src/version.c b/src/version.c index b0736df46a..b2fcbfb14c 100644 --- a/src/version.c +++ b/src/version.c @@ -767,6 +767,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1365, /**/ 1364, /**/