From ffd143be824ca96db1777c903b10696f06326a01 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 18:21:32 +0100 Subject: vim-patch:7.4.798 Problem: Repeating a change in Visual mode does not work as expected. (Urtica Dioica) Solution: Make redo in Visual mode work better. (Christian Brabandt) https://github.com/vim/vim/commit/31b259bf9571cae6408be3ef75d9485e24029be5 --- src/nvim/normal.c | 25 ++++++++++++++----------- src/nvim/testdir/test_listlbr.in | 6 ++++++ src/nvim/testdir/test_listlbr.ok | 5 +++++ src/nvim/version.c | 2 +- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 9a9cf50e48..4458c8bd5b 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -7798,20 +7798,23 @@ static void get_op_vcol( } getvvcol(curwin, &(oap->start), &oap->start_vcol, NULL, &oap->end_vcol); - getvvcol(curwin, &(oap->end), &start, NULL, &end); + if (!redo_VIsual_busy) { + getvvcol(curwin, &(oap->end), &start, NULL, &end); - if (start < oap->start_vcol) { - oap->start_vcol = start; - } - if (end > oap->end_vcol) { - if (initial && *p_sel == 'e' - && start >= 1 - && start - 1 >= oap->end_vcol) { - oap->end_vcol = start - 1; - } else { - oap->end_vcol = end; + if (start < oap->start_vcol) { + oap->start_vcol = start; + } + if (end > oap->end_vcol) { + if (initial && *p_sel == 'e' + && start >= 1 + && start - 1 >= oap->end_vcol) { + oap->end_vcol = start - 1; + } else { + oap->end_vcol = end; + } } } + // if '$' was used, get oap->end_vcol from longest line if (curwin->w_curswant == MAXCOL) { curwin->w_cursor.col = MAXCOL; diff --git a/src/nvim/testdir/test_listlbr.in b/src/nvim/testdir/test_listlbr.in index 57202b46eb..f13eee121e 100644 --- a/src/nvim/testdir/test_listlbr.in +++ b/src/nvim/testdir/test_listlbr.in @@ -75,6 +75,12 @@ Golong line: 40afoobar aTARGET at end :let g:test ="Test 8: set linebreak with visual char mode and changing block" :$put =g:test Go1111-1111-1111-11-1111-1111-11110f-lv3lc2222bgj. +:let g:test ="Test 9: using redo after block visual mode" +:$put =g:test +Go +aaa +aaa +a2k2j~e. :%w! test.out :qa! ENDTEST diff --git a/src/nvim/testdir/test_listlbr.ok b/src/nvim/testdir/test_listlbr.ok index 82881234c4..323bcdee08 100644 --- a/src/nvim/testdir/test_listlbr.ok +++ b/src/nvim/testdir/test_listlbr.ok @@ -41,3 +41,8 @@ Test 7: set linebreak with visual block mode and v_b_A long line: foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar TARGETx at end Test 8: set linebreak with visual char mode and changing block 1111-2222-1111-11-1111-2222-1111 +Test 9: using redo after block visual mode + +AaA +AaA +A diff --git a/src/nvim/version.c b/src/nvim/version.c index 33211cdf14..228bc6a6d0 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -490,7 +490,7 @@ static int included_patches[] = { // 801, // 800, 799, - // 798, + 798, // 797, // 796 NA 795, -- cgit From cdc7250cd8ca948d15c158789f621a71d5c7b35d Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 18:34:04 +0100 Subject: vim-patch:7.4.800 Problem: Using freed memory when triggering CmdUndefined autocommands. Solution: Set pointer to NULL. (Dominique Pelle) https://github.com/vim/vim/commit/829aef1eb48b17445b1f0a801948c1b826f507f8 --- src/nvim/ex_docmd.c | 6 +++--- src/nvim/version.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 1ae440c757..755e1b9f64 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1702,9 +1702,9 @@ static char_u * do_one_cmd(char_u **cmdlinep, p = vim_strnsave(ea.cmd, p - ea.cmd); int ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL); xfree(p); - if (ret && !aborting()) { - p = find_command(&ea, NULL); - } + // If the autocommands did something and didn't cause an error, try + // finding the command again. + p = (ret && !aborting()) ? find_command(&ea, NULL) : NULL; } if (p == NULL) { diff --git a/src/nvim/version.c b/src/nvim/version.c index 228bc6a6d0..7a044a2a65 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -488,7 +488,7 @@ static int included_patches[] = { 803, 802, // 801, - // 800, + 800, 799, 798, // 797, -- cgit From cfce719c66b22f26e9f8def87c2b14d339208482 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 18:40:10 +0100 Subject: vim-patch:7.4.805 Problem: The ruler shows "Bot" even when there are only filler lines missing. (Gary Johnson) Solution: Use "All" when the first line and one filler line are visible. https://github.com/vim/vim/commit/29bc9db36e41cb519dca9381cc29a3fc1ff02106 --- src/nvim/buffer.c | 5 +++++ src/nvim/version.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 34e24712cd..f56c64f109 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -3895,6 +3895,11 @@ void get_rel_pos(win_T *wp, char_u *buf, int buflen) above = wp->w_topline - 1; above += diff_check_fill(wp, wp->w_topline) - wp->w_topfill; + if (wp->w_topline == 1 && wp->w_topfill >= 1) { + // All buffer lines are displayed and there is an indication + // of filler lines, that can be considered seeing all lines. + above = 0; + } below = wp->w_buffer->b_ml.ml_line_count - wp->w_botline + 1; if (below <= 0) STRLCPY(buf, (above == 0 ? _("All") : _("Bot")), buflen); diff --git a/src/nvim/version.c b/src/nvim/version.c index 7a044a2a65..88317fa8ee 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -483,7 +483,7 @@ static int included_patches[] = { // 808 NA 807, 806, - // 805, + 805, // 804, 803, 802, -- cgit From 2b2f9ccf8c5ace922f0e2682adabea8461b54ea5 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 18:52:35 +0100 Subject: vim-patch:7.4.810 Problem: With a sequence of commands using buffers in diff mode E749 is given. (itchyny) Solution: Skip unloaded buffer. (Hirohito Higashi) https://github.com/vim/vim/commit/9dd33af4baf5fd7d3a7a779d8363834b38804946 --- src/nvim/diff.c | 4 ++-- src/nvim/version.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nvim/diff.c b/src/nvim/diff.c index ce79158050..2776e45f5d 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -763,8 +763,8 @@ void ex_diffupdate(exarg_T *eap) // Make a difference between the first buffer and every other. for (idx_new = idx_orig + 1; idx_new < DB_COUNT; ++idx_new) { buf_T *buf = curtab->tp_diffbuf[idx_new]; - if (buf == NULL) { - continue; + if (buf == NULL || buf->b_ml.ml_mfp == NULL) { + continue; // skip buffer that isn't loaded } if (diff_write(buf, tmp_new) == FAIL) { diff --git a/src/nvim/version.c b/src/nvim/version.c index 88317fa8ee..e46de678c5 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -478,7 +478,7 @@ static int included_patches[] = { 813, // 812, // 811, - // 810, + 810, 809, // 808 NA 807, -- cgit From f20818de3126b01fb6b18696db2621fa4880b632 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 18:54:52 +0100 Subject: vim-patch:7.4.811 Problem: Invalid memory access when using "exe 'sc'". Solution: Avoid going over the end of the string. (Dominique Pelle) https://github.com/vim/vim/commit/204b93f95831454e6924acf30b16fd4bdfda0d14 --- src/nvim/ex_docmd.c | 7 +++++-- src/nvim/version.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 755e1b9f64..c45be3de74 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -2348,8 +2348,11 @@ static char_u *find_command(exarg_T *eap, int *full) eap->cmdidx = CMD_k; ++p; } else if (p[0] == 's' - && ((p[1] == 'c' && p[2] != 's' && p[2] != 'r' - && p[3] != 'i' && p[4] != 'p') + && ((p[1] == 'c' + && (p[2] == NUL + || (p[2] != 's' && p[2] != 'r' + && (p[3] == NUL + || (p[3] != 'i' && p[4] != 'p'))))) || p[1] == 'g' || (p[1] == 'i' && p[2] != 'm' && p[2] != 'l' && p[2] != 'g') || p[1] == 'I' diff --git a/src/nvim/version.c b/src/nvim/version.c index e46de678c5..31a839fd05 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -477,7 +477,7 @@ static int included_patches[] = { // 814, 813, // 812, - // 811, + 811, 810, 809, // 808 NA -- cgit From ce2ff1ac0134d2b3b56eee1862d846e1fe9e4caf Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 19:56:18 +0100 Subject: vim-patch:7.4.814 Problem: Illegal memory access with "sy match a fold". Solution: Check for empty string. (Dominique Pelle) https://github.com/vim/vim/commit/382197865ca8353a3d6681a364f95bda6aed95ec --- src/nvim/syntax.c | 5 +++-- src/nvim/version.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 24422c71fb..e91ea68891 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -4843,9 +4843,10 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci) int idx; char_u *cpo_save; - /* need at least three chars */ - if (arg == NULL || arg[1] == NUL || arg[2] == NUL) + // need at least three chars + if (arg == NULL || arg[0] == NUL || arg[1] == NUL || arg[2] == NUL) { return NULL; + } end = skip_regexp(arg + 1, *arg, TRUE, NULL); if (*end != *arg) { /* end delimiter not found */ diff --git a/src/nvim/version.c b/src/nvim/version.c index 31a839fd05..d554ec0c84 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -474,7 +474,7 @@ static int included_patches[] = { // 817, // 816, // 815, - // 814, + 814, 813, // 812, 811, -- cgit From 105f98fbf87182c9551f24d1a913e1e4b8e6646a Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 20:00:11 +0100 Subject: vim-patch:7.4.815 Problem: Invalid memory access when doing ":call g:". Solution: Check for an empty name. (Dominique Pelle) https://github.com/vim/vim/commit/73627d0bd43e63a67995ab1c826f1cec4ed22560 --- src/nvim/eval.c | 4 ++++ src/nvim/version.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 6c471ab770..109504037d 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -18578,6 +18578,9 @@ static hashtab_T *find_var_ht_dict(char_u *name, uint8_t **varname, dict_T **d) hashitem_T *hi; *d = NULL; + if (name[0] == NUL) { + return NULL; + } if (name[1] != ':') { // name has implicit scope if (name[0] == ':' || name[0] == AUTOLOAD_CHAR) { @@ -18627,6 +18630,7 @@ end: } // Find the hashtab used for a variable name. +// Return NULL if the name is not valid. // Set "varname" to the start of name without ':'. static hashtab_T *find_var_ht(uint8_t *name, uint8_t **varname) { diff --git a/src/nvim/version.c b/src/nvim/version.c index d554ec0c84..b5a2d6d8f8 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -473,7 +473,7 @@ static int included_patches[] = { // 818, // 817, // 816, - // 815, + 815, 814, 813, // 812, -- cgit From 3c0a0828945084a81fac43c5ad99736caf4cc54d Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 20:07:03 +0100 Subject: vim-patch:7.4.816 Problem: Invalid memory access when doing ":fun X(". Solution: Check for missing ')'. (Dominique Pelle) https://github.com/vim/vim/commit/dd8a5286e191d23410c5970a0f17f01c7ff1211b --- src/nvim/eval.c | 5 ++++- src/nvim/version.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 109504037d..0d7e2f7b5d 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19626,7 +19626,10 @@ void ex_function(exarg_T *eap) break; } } - ++p; /* skip the ')' */ + if (*p != ')') { + goto erret; + } + ++p; // skip the ')' /* find extra arguments "range", "dict" and "abort" */ for (;; ) { diff --git a/src/nvim/version.c b/src/nvim/version.c index b5a2d6d8f8..e36eb0919b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -472,7 +472,7 @@ static int included_patches[] = { // 819, // 818, // 817, - // 816, + 816, 815, 814, 813, -- cgit From 5feff1c415eb46fb6bb4680b536dfd482dfc5a95 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 20:13:31 +0100 Subject: vim-patch:7.4.817 Problem: Invalid memory access in file_pat_to_reg_pat(). Solution: Use vim_isspace() instead of checking for a space only. (Dominique Pelle) https://github.com/vim/vim/commit/2288afed428d29ce2e464964df4c5a757281e70e --- src/nvim/fileio.c | 8 ++++---- src/nvim/version.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index badb5b85b0..355fddfdbb 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -7218,12 +7218,12 @@ char_u * file_pat_to_reg_pat( #ifdef BACKSLASH_IN_FILENAME && no_bslash #endif - ) + ) { reg_pat[i++] = '?'; - else if (*p == ',' || *p == '%' || *p == '#' - || *p == ' ' || *p == '{' || *p == '}') + } else if (*p == ',' || *p == '%' || *p == '#' + || ascii_isspace(*p) || *p == '{' || *p == '}') { reg_pat[i++] = *p; - else if (*p == '\\' && p[1] == '\\' && p[2] == '{') { + } else if (*p == '\\' && p[1] == '\\' && p[2] == '{') { reg_pat[i++] = '\\'; reg_pat[i++] = '{'; p += 2; diff --git a/src/nvim/version.c b/src/nvim/version.c index e36eb0919b..45a96c427b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -471,7 +471,7 @@ static int included_patches[] = { // 820, // 819, // 818, - // 817, + 817, 816, 815, 814, -- cgit From 8d5cfe4ffcb44a924ba370a10c98ba089f018e2e Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 20:24:30 +0100 Subject: vim-patch:7.4.820 Problem: Invalid memory access in file_pat_to_reg_pat. Solution: Avoid looking before the start of a string. (Dominique Pelle) https://github.com/vim/vim/commit/8fee878fe277ec1b1b833ba6e5db679151f7982f --- src/nvim/fileio.c | 7 ++++--- src/nvim/version.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 355fddfdbb..8fe7ad0e30 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -7160,10 +7160,11 @@ char_u * file_pat_to_reg_pat( else reg_pat[i++] = '^'; endp = pat_end - 1; - if (*endp == '*') { - while (endp - pat > 0 && *endp == '*') + if (endp >= pat && *endp == '*') { + while (endp - pat > 0 && *endp == '*') { endp--; - add_dollar = FALSE; + } + add_dollar = false; } for (p = pat; *p && nested >= 0 && p <= endp; p++) { switch (*p) { diff --git a/src/nvim/version.c b/src/nvim/version.c index 45a96c427b..fc526cc953 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -468,7 +468,7 @@ static int included_patches[] = { 823, // 822, // 821, - // 820, + 820, // 819, // 818, 817, -- cgit From 52692d3cd3e682a4116d3cec1fcf05880f0c77a1 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Tue, 2 Feb 2016 20:30:30 +0100 Subject: vim-patch:7.4.825 Problem: Invalid memory access for ":syn keyword x a[". Solution: Do not skip over the NUL. (Dominique Pelle) https://github.com/vim/vim/commit/1560d07045d416d0abf9731c43c28925f61515b6 --- src/nvim/syntax.c | 11 +++++++---- src/nvim/version.c | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index e91ea68891..f47c5eadd3 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -4183,12 +4183,14 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing) break; if (p[1] == NUL) { EMSG2(_("E789: Missing ']': %s"), kw); - kw = p + 2; /* skip over the NUL */ - break; + goto error; } if (p[1] == ']') { - kw = p + 1; /* skip over the "]" */ - break; + if (p[2] != NUL) { + EMSG3(_("E890: trailing char after ']': %s]%s"), + kw, &p[2]); + goto error; + } } if (has_mbyte) { int l = (*mb_ptr2len)(p + 1); @@ -4203,6 +4205,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing) } } +error: xfree(keyword_copy); xfree(syn_opt_arg.cont_in_list); xfree(syn_opt_arg.next_list); diff --git a/src/nvim/version.c b/src/nvim/version.c index fc526cc953..2225611779 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -463,7 +463,7 @@ static int included_patches[] = { // 828, // 827, 826, - // 825, + 825, // 824 NA 823, // 822, -- cgit