diff src/evalfunc.c @ 15365:01ee8dc12313 v8.1.0690

patch 8.1.0690: setline() and setbufline() do not clear text properties commit https://github.com/vim/vim/commit/21b5038e02306ce2fd438249055eed372befe51f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 4 18:07:24 2019 +0100 patch 8.1.0690: setline() and setbufline() do not clear text properties Problem: setline() and setbufline() do not clear text properties. Solution: Clear text properties when setting the text.
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Jan 2019 18:15:04 +0100
parents 73b153ed5af8
children 7444fffa482d
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -1357,8 +1357,10 @@ set_buffer_lines(
 
 	if (!append && lnum <= curbuf->b_ml.ml_line_count)
 	{
-	    /* existing line, replace it */
-	    if (u_savesub(lnum) == OK && ml_replace(lnum, line, TRUE) == OK)
+	    // Existing line, replace it.
+	    // Removes any existing text properties.
+	    if (u_savesub(lnum) == OK && ml_replace_len(
+		      lnum, line, (colnr_T)STRLEN(line) + 1, TRUE, TRUE) == OK)
 	    {
 		changed_bytes(lnum, 0);
 		if (is_curbuf && lnum == curwin->w_cursor.lnum)