aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/change.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-06-09 23:49:02 +0200
committerGitHub <noreply@github.com>2021-06-09 23:49:02 +0200
commitfd7e77b2277d884c51bc6f0bd70c0e6e7a307bc1 (patch)
tree4dc097f548cb02be21c16d50e2cdc641ac8accb3 /src/nvim/change.c
parent93f15db5d61800a2029aa20684be31c96ebcca5b (diff)
parenta15c2cbab68821cb0ecd20636c9008bac62c9878 (diff)
downloadrneovim-fd7e77b2277d884c51bc6f0bd70c0e6e7a307bc1.tar.gz
rneovim-fd7e77b2277d884c51bc6f0bd70c0e6e7a307bc1.tar.bz2
rneovim-fd7e77b2277d884c51bc6f0bd70c0e6e7a307bc1.zip
Merge pull request #14757 from jbyuki/open_line_changed_bytes
fix: changed byte ranges for indented lines
Diffstat (limited to 'src/nvim/change.c')
-rw-r--r--src/nvim/change.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 74e27ca880..c0183d4317 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -1695,10 +1695,12 @@ int open_line(
int new_len = (int)STRLEN(saved_line);
// TODO(vigoux): maybe there is issues there with expandtabs ?
+ int cols_spliced = 0;
if (new_len < curwin->w_cursor.col) {
extmark_splice_cols(
- curbuf, (int)curwin->w_cursor.lnum,
+ curbuf, (int)curwin->w_cursor.lnum - 1,
new_len, curwin->w_cursor.col - new_len, 0, kExtmarkUndo);
+ cols_spliced = curwin->w_cursor.col - new_len;
}
saved_line = NULL;
@@ -1716,7 +1718,7 @@ int open_line(
// 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,
+ 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 {