treesitter: filter updates on <CR>

This fixes an error when fo=ro, when hitting <CR> to insert a new
comment line.
This commit is contained in:
Thomas Vigouroux
2020-09-14 18:48:58 +02:00
committed by Björn Linse
parent aa98527ce7
commit 9a7f111db6
2 changed files with 43 additions and 10 deletions

View File

@@ -1676,9 +1676,16 @@ int open_line(
truncate_spaces(saved_line);
}
ml_replace(curwin->w_cursor.lnum, saved_line, false);
extmark_splice_cols(
curbuf, (int)curwin->w_cursor.lnum,
0, curwin->w_cursor.col, (int)STRLEN(saved_line), kExtmarkUndo);
int new_len = (int)STRLEN(saved_line);
// TODO(vigoux): maybe there is issues there with expandtabs ?
if (new_len < curwin->w_cursor.col) {
extmark_splice_cols(
curbuf, (int)curwin->w_cursor.lnum,
new_len, curwin->w_cursor.col - new_len, 0, kExtmarkUndo);
}
saved_line = NULL;
if (did_append) {
changed_lines(curwin->w_cursor.lnum, curwin->w_cursor.col,