From 899ec829be85b52202f0ce32c455ae4f4d60b85b Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 26 Dec 2025 04:51:47 -0500 Subject: [PATCH] vim-patch:9.0.0145: substitute that joins lines drops text properties (#37108) Problem: Substitute that joins lines drops text properties. Solution: Move text properties of the last line to the new line. https://github.com/vim/vim/commit/213bbaf15afc628e5f83d1ae6526631ca8292292 Co-authored-by: Bram Moolenaar --- src/nvim/ex_cmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 48f27ea459..d3e0092581 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4182,7 +4182,8 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const int cmdpreview_n if (nmatch == 1) { p1 = sub_firstline; } else { - p1 = ml_get(sub_firstlnum + (linenr_T)nmatch - 1); + linenr_T lastlnum = sub_firstlnum + (linenr_T)nmatch - 1; + p1 = ml_get(lastlnum); nmatch_tl += nmatch - 1; } int copy_len = regmatch.startpos[0].col - copycol;