buf_attach: fix buffer updates with setline()

This commit is contained in:
Björn Linse
2020-09-15 10:11:11 +02:00
committed by Thomas Vigouroux
parent f34eeba2d8
commit 34c0f7af04
3 changed files with 26 additions and 5 deletions

View File

@@ -6962,9 +6962,10 @@ void set_buffer_lines(buf_T *buf, linenr_T lnum_arg, bool append,
if (!append && lnum <= curbuf->b_ml.ml_line_count) {
// Existing line, replace it.
int old_len = (int)STRLEN(ml_get(lnum));
if (u_savesub(lnum) == OK
&& ml_replace(lnum, (char_u *)line, true) == OK) {
changed_bytes(lnum, 0);
inserted_bytes(lnum, 0, old_len, STRLEN(line));
if (is_curbuf && lnum == curwin->w_cursor.lnum) {
check_cursor_col();
}