aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-02-09 01:58:54 -0500
committerJustin M. Keyes <justinkz@gmail.com>2016-02-09 01:58:54 -0500
commitb9701c2a2b7b4633e894ad62955e0a0039dc0f95 (patch)
tree970a236df8b1ab30b5866487ff00f4e49c7c71bf /src
parent17ae27190d4589b2a35f44bc6c8b552f4bf06d4e (diff)
parent52692d3cd3e682a4116d3cec1fcf05880f0c77a1 (diff)
downloadrneovim-b9701c2a2b7b4633e894ad62955e0a0039dc0f95.tar.gz
rneovim-b9701c2a2b7b4633e894ad62955e0a0039dc0f95.tar.bz2
rneovim-b9701c2a2b7b4633e894ad62955e0a0039dc0f95.zip
Merge #4152 'vim-patch:7.4.{798,800,805,810,811,814,815,816,817,820,825}'.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c5
-rw-r--r--src/nvim/diff.c4
-rw-r--r--src/nvim/eval.c9
-rw-r--r--src/nvim/ex_docmd.c13
-rw-r--r--src/nvim/fileio.c15
-rw-r--r--src/nvim/normal.c25
-rw-r--r--src/nvim/syntax.c16
-rw-r--r--src/nvim/testdir/test_listlbr.in6
-rw-r--r--src/nvim/testdir/test_listlbr.ok5
-rw-r--r--src/nvim/version.c22
10 files changed, 77 insertions, 43 deletions
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/diff.c b/src/nvim/diff.c
index 94c5712163..e06ffd0bbc 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/eval.c b/src/nvim/eval.c
index 969a03fce3..8971b6d463 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -18587,6 +18587,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) {
@@ -18636,6 +18639,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)
{
@@ -19631,7 +19635,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/ex_docmd.c b/src/nvim/ex_docmd.c
index 28ff6fded4..50513c0a6a 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) {
@@ -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/fileio.c b/src/nvim/fileio.c
index 90987d0b3d..383cd47dbe 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) {
@@ -7218,12 +7219,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/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/syntax.c b/src/nvim/syntax.c
index b46131b972..494683d254 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -4188,12 +4188,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);
@@ -4208,6 +4210,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);
@@ -4848,9 +4851,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/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 90ae2e6ce7..3fb1738f2a 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -463,34 +463,34 @@ static int included_patches[] = {
// 828,
// 827,
826,
- // 825,
+ 825,
// 824 NA
823,
// 822,
// 821,
- // 820,
+ 820,
// 819,
// 818,
- // 817,
- // 816,
- // 815,
- // 814,
+ 817,
+ 816,
+ 815,
+ 814,
813,
// 812,
- // 811,
- // 810,
+ 811,
+ 810,
809,
// 808 NA
807,
806,
- // 805,
+ 805,
// 804,
803,
802,
801,
- // 800,
+ 800,
799,
- // 798,
+ 798,
// 797,
// 796 NA
795,