diff options
author | Thomas Vigouroux <tomvig38@gmail.com> | 2020-09-14 18:48:58 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2020-09-16 16:35:17 +0200 |
commit | 9a7f111db67c4592ff9794e778b0ff60d0157afe (patch) | |
tree | d7c518b675dff43ccf153a71d8c435bdef797a4f /src | |
parent | aa98527ce7efc1b4fd38e1d17c6f455239f39f21 (diff) | |
download | rneovim-9a7f111db67c4592ff9794e778b0ff60d0157afe.tar.gz rneovim-9a7f111db67c4592ff9794e778b0ff60d0157afe.tar.bz2 rneovim-9a7f111db67c4592ff9794e778b0ff60d0157afe.zip |
treesitter: filter updates on <CR>
This fixes an error when fo=ro, when hitting <CR> to insert a new
comment line.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/change.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c index 8bf02385ef..71614363d2 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -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, |