aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-09-16 19:53:39 +0200
committerGitHub <noreply@github.com>2020-09-16 19:53:39 +0200
commitd4b4335fe330bf0558d38883cb8a2b47e8ece28a (patch)
treed7c518b675dff43ccf153a71d8c435bdef797a4f /src
parentaa98527ce7efc1b4fd38e1d17c6f455239f39f21 (diff)
parent9a7f111db67c4592ff9794e778b0ff60d0157afe (diff)
downloadrneovim-d4b4335fe330bf0558d38883cb8a2b47e8ece28a.tar.gz
rneovim-d4b4335fe330bf0558d38883cb8a2b47e8ece28a.tar.bz2
rneovim-d4b4335fe330bf0558d38883cb8a2b47e8ece28a.zip
Merge pull request #12911 from vigoux/bytetrack-formatoption-ro
treesitter: filter updates on <CR>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/change.c13
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,