mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix: also splice extmarks in preview windows
We indeed need to adjust extmarks in preview windows. Fixes #12967
This commit is contained in:
parent
82100a6bdb
commit
d0112693a3
@ -3909,17 +3909,13 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
|
|||||||
|
|
||||||
ADJUST_SUB_FIRSTLNUM();
|
ADJUST_SUB_FIRSTLNUM();
|
||||||
|
|
||||||
// TODO(bfredl): adjust also in preview, because decorations?
|
// TODO(bfredl): this has some robustness issues, look into later.
|
||||||
// this has some robustness issues, will look into later.
|
|
||||||
bool do_splice = !preview;
|
|
||||||
bcount_t replaced_bytes = 0;
|
bcount_t replaced_bytes = 0;
|
||||||
lpos_T start = regmatch.startpos[0], end = regmatch.endpos[0];
|
lpos_T start = regmatch.startpos[0], end = regmatch.endpos[0];
|
||||||
if (do_splice) {
|
for (i = 0; i < nmatch-1; i++) {
|
||||||
for (i = 0; i < nmatch-1; i++) {
|
replaced_bytes += STRLEN(ml_get(lnum_start+i)) + 1;
|
||||||
replaced_bytes += STRLEN(ml_get(lnum_start+i)) + 1;
|
|
||||||
}
|
|
||||||
replaced_bytes += end.col - start.col;
|
|
||||||
}
|
}
|
||||||
|
replaced_bytes += end.col - start.col;
|
||||||
|
|
||||||
|
|
||||||
// Now the trick is to replace CTRL-M chars with a real line
|
// 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.col = new_endcol;
|
||||||
current_match.end.lnum = lnum;
|
current_match.end.lnum = lnum;
|
||||||
|
|
||||||
if (do_splice) {
|
int matchcols = end.col - ((end.lnum == start.lnum)
|
||||||
int matchcols = end.col - ((end.lnum == start.lnum)
|
? start.col : 0);
|
||||||
? start.col : 0);
|
int subcols = new_endcol - ((lnum == lnum_start) ? start_col : 0);
|
||||||
int subcols = new_endcol - ((lnum == lnum_start) ? start_col : 0);
|
extmark_splice(curbuf, lnum_start-1, start_col,
|
||||||
extmark_splice(curbuf, lnum_start-1, start_col,
|
end.lnum-start.lnum, matchcols, replaced_bytes,
|
||||||
end.lnum-start.lnum, matchcols, replaced_bytes,
|
lnum-lnum_start, subcols, sublen-1, kExtmarkUndo);
|
||||||
lnum-lnum_start, subcols, sublen-1, kExtmarkUndo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user