Merge #4152 'vim-patch:7.4.{798,800,805,810,811,814,815,816,817,820,825}'.

This commit is contained in:
Justin M. Keyes 2016-02-09 01:58:54 -05:00
commit b9701c2a2b
10 changed files with 77 additions and 43 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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 (;; ) {

View File

@ -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'

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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,