Merge #8903 from janlazo/vim-8.0.0883

This commit is contained in:
Justin M. Keyes 2018-08-26 15:20:59 +02:00 committed by GitHub
commit eb663d5367
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 13 deletions

View File

@ -605,9 +605,14 @@ void getout(int exitval)
buf_T *buf = wp->w_buffer; buf_T *buf = wp->w_buffer;
if (buf_get_changedtick(buf) != -1) { if (buf_get_changedtick(buf) != -1) {
bufref_T bufref;
set_bufref(&bufref, buf);
apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
buf->b_fname, false, buf); buf->b_fname, false, buf);
buf_set_changedtick(buf, -1); // note that we did it already if (bufref_valid(&bufref)) {
buf_set_changedtick(buf, -1); // note that we did it already
}
// start all over, autocommands may mess up the lists // start all over, autocommands may mess up the lists
next_tp = first_tabpage; next_tp = first_tabpage;
break; break;

View File

@ -610,7 +610,7 @@ static bool emsgfv(const char *fmt, va_list ap)
/// detected when fuzzing vim. /// detected when fuzzing vim.
void iemsg(const char *s) void iemsg(const char *s)
{ {
msg((char_u *)s); emsg((char_u *)s);
#ifdef ABORT_ON_INTERNAL_ERROR #ifdef ABORT_ON_INTERNAL_ERROR
abort(); abort();
#endif #endif

View File

@ -1605,11 +1605,19 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
char_u *oldp = ml_get(lnum); char_u *oldp = ml_get(lnum);
colnr_T oldlen = (colnr_T)STRLEN(oldp); colnr_T oldlen = (colnr_T)STRLEN(oldp);
/* // Can't do anything when the cursor is on the NUL after the line.
* Can't do anything when the cursor is on the NUL after the line. if (col >= oldlen) {
*/
if (col >= oldlen)
return FAIL; 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) {
IEMSGN("E950: Invalid count for del_bytes(): %ld", count);
return FAIL;
}
/* If 'delcombine' is set and deleting (less than) one character, only /* If 'delcombine' is set and deleting (less than) one character, only
* delete the last combining character. */ * delete the last combining character. */

View File

@ -457,12 +457,15 @@ void expand_env_esc(char_u *restrict srcp,
} else if ((src[0] == ' ' || src[0] == ',') && !one) { } else if ((src[0] == ' ' || src[0] == ',') && !one) {
at_start = true; at_start = true;
} }
*dst++ = *src++; if (dstlen > 0) {
--dstlen; *dst++ = *src++;
dstlen--;
if (prefix != NULL && src - prefix_len >= srcp if (prefix != NULL
&& STRNCMP(src - prefix_len, prefix, prefix_len) == 0) { && src - prefix_len >= srcp
at_start = true; && STRNCMP(src - prefix_len, prefix, prefix_len) == 0) {
at_start = true;
}
} }
} }
} }

View File

@ -1448,7 +1448,11 @@ static void win_update(win_T *wp)
wp->w_lines[idx].wl_lnum = lnum; wp->w_lines[idx].wl_lnum = lnum;
wp->w_lines[idx].wl_valid = true; wp->w_lines[idx].wl_valid = true;
if (row > wp->w_height) { // past end of screen
// Past end of the window or end of the screen. Note that after
// resizing wp->w_height may be end up too big. That's a problem
// elsewhere, but prevent a crash here.
if (row > wp->w_height || row + wp->w_winrow >= Rows) {
// we may need the size of that too long line later on // we may need the size of that too long line later on
if (dollar_vcol == -1) { if (dollar_vcol == -1) {
wp->w_lines[idx].wl_size = plines_win(wp, lnum, true); wp->w_lines[idx].wl_size = plines_win(wp, lnum, true);

View File

@ -1217,6 +1217,7 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap,
str_arg_l = 3; str_arg_l = 3;
zero_padding = 0; zero_padding = 0;
} else { } else {
// Regular float number
format[0] = '%'; format[0] = '%';
size_t l = 1; size_t l = 1;
if (force_sign) { if (force_sign) {
@ -1241,7 +1242,6 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap,
format[l] = (char)(fmt_spec == 'F' ? 'f' : fmt_spec); format[l] = (char)(fmt_spec == 'F' ? 'f' : fmt_spec);
format[l + 1] = NUL; format[l + 1] = NUL;
// Regular float number
str_arg_l = (size_t)snprintf(tmp, sizeof(tmp), format, f); str_arg_l = (size_t)snprintf(tmp, sizeof(tmp), format, f);
assert(str_arg_l < sizeof(tmp)); assert(str_arg_l < sizeof(tmp));