aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-12-16 12:05:01 +0100
committerGitHub <noreply@github.com>2020-12-16 12:05:01 +0100
commit958ebc7337bb9ee8d39516f0a079cd518a3e3ef4 (patch)
tree2d8e74a857580adcee0bf1d9450d3fd6fd2daa37 /src/nvim/ex_cmds.c
parentc3b9c35876bf82b5bd53543bc7222ef3599eb057 (diff)
parent25e20da550b0d267013ac295756bad76f5fda7ef (diff)
downloadrneovim-958ebc7337bb9ee8d39516f0a079cd518a3e3ef4.tar.gz
rneovim-958ebc7337bb9ee8d39516f0a079cd518a3e3ef4.tar.bz2
rneovim-958ebc7337bb9ee8d39516f0a079cd518a3e3ef4.zip
Merge pull request #13539 from vigoux/ts-fix-icmnosplit
fix: also splice extmarks in preview buffers
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index b0a51eaefd..39902cf18e 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3909,17 +3909,13 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
ADJUST_SUB_FIRSTLNUM();
- // TODO(bfredl): adjust also in preview, because decorations?
- // this has some robustness issues, will look into later.
- bool do_splice = !preview;
+ // TODO(bfredl): this has some robustness issues, look into later.
bcount_t replaced_bytes = 0;
lpos_T start = regmatch.startpos[0], end = regmatch.endpos[0];
- if (do_splice) {
- for (i = 0; i < nmatch-1; i++) {
- replaced_bytes += STRLEN(ml_get(lnum_start+i)) + 1;
- }
- replaced_bytes += end.col - start.col;
+ for (i = 0; i < nmatch-1; i++) {
+ replaced_bytes += STRLEN(ml_get(lnum_start+i)) + 1;
}
+ replaced_bytes += end.col - start.col;
// Now the trick is to replace CTRL-M chars with a real line
@@ -3964,14 +3960,12 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
current_match.end.col = new_endcol;
current_match.end.lnum = lnum;
- if (do_splice) {
- int matchcols = end.col - ((end.lnum == start.lnum)
- ? start.col : 0);
- int subcols = new_endcol - ((lnum == lnum_start) ? start_col : 0);
- extmark_splice(curbuf, lnum_start-1, start_col,
- end.lnum-start.lnum, matchcols, replaced_bytes,
- lnum-lnum_start, subcols, sublen-1, kExtmarkUndo);
- }
+ int matchcols = end.col - ((end.lnum == start.lnum)
+ ? start.col : 0);
+ int subcols = new_endcol - ((lnum == lnum_start) ? start_col : 0);
+ extmark_splice(curbuf, lnum_start-1, start_col,
+ end.lnum-start.lnum, matchcols, replaced_bytes,
+ lnum-lnum_start, subcols, sublen-1, kExtmarkUndo);
}