diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-03-30 08:05:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-30 08:05:36 +0800 |
commit | 19d63563e1cceabbf8603d0abb2e88fae5bd3626 (patch) | |
tree | 896e6492b9deb0d0f2ad04859829ffe0af01cdac /src/nvim/change.c | |
parent | 2424c3e6967ef953222cf48564629ffe5812d415 (diff) | |
download | rneovim-19d63563e1cceabbf8603d0abb2e88fae5bd3626.tar.gz rneovim-19d63563e1cceabbf8603d0abb2e88fae5bd3626.tar.bz2 rneovim-19d63563e1cceabbf8603d0abb2e88fae5bd3626.zip |
fix(extmarks): splice earlier when opening new line (#28108)
Related #26364 #26499 #26501
Fix #28107
Diffstat (limited to 'src/nvim/change.c')
-rw-r--r-- | src/nvim/change.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c index b6f2be547f..42884842b3 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -1838,6 +1838,13 @@ bool open_line(int dir, int flags, int second_line_indent, bool *did_do_comment) saved_line = NULL; if (did_append) { + // Always move extmarks - Here we move only the line where the + // cursor is, the later mark_adjust takes care of the lines after. + int cols_added = mincol - 1 + less_cols_off - less_cols; + extmark_splice(curbuf, (int)lnum - 1, mincol - 1 - cols_spliced, + 0, less_cols_off, less_cols_off, + 1, cols_added, 1 + cols_added, kExtmarkUndo); + changed_lines(curbuf, curwin->w_cursor.lnum, curwin->w_cursor.col, curwin->w_cursor.lnum + 1, 1, true); did_append = false; @@ -1848,12 +1855,6 @@ bool open_line(int dir, int flags, int second_line_indent, bool *did_do_comment) curwin->w_cursor.col + less_cols_off, 1, -less_cols, 0); } - // Always move extmarks - Here we move only the line where the - // cursor is, the previous mark_adjust takes care of the lines after - int cols_added = mincol - 1 + less_cols_off - less_cols; - extmark_splice(curbuf, (int)lnum - 1, mincol - 1 - cols_spliced, - 0, less_cols_off, less_cols_off, - 1, cols_added, 1 + cols_added, kExtmarkUndo); } else { changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col); } |