diff src/normal.c @ 17787:92e0996e1cb8 v8.1.1890

patch 8.1.1890: ml_get error when deleting fold marker commit https://github.com/vim/vim/commit/9a4a8c4d5993c6371486c895a515c2ad351e9aaa Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 19 22:48:30 2019 +0200 patch 8.1.1890: ml_get error when deleting fold marker Problem: Ml_get error when deleting fold marker. Solution: Check that the line number is not below the last line. Adjust the fold when deleting the empty line. (Christian Brabandt, closes #4834)
author Bram Moolenaar <Bram@vim.org>
date Mon, 19 Aug 2019 23:00:05 +0200
parents 2fe133c7e972
children 2ea47dee7ddd
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -9346,13 +9346,15 @@ nv_put_opt(cmdarg_T *cap, int fix_indent
 		reg1 = get_register(regname, TRUE);
 	    }
 
-	    /* Now delete the selected text. */
+	    // Now delete the selected text. Avoid messages here.
 	    cap->cmdchar = 'd';
 	    cap->nchar = NUL;
 	    cap->oap->regname = NUL;
+	    ++msg_silent;
 	    nv_operator(cap);
 	    do_pending_operator(cap, 0, FALSE);
 	    empty = (curbuf->b_ml.ml_flags & ML_EMPTY);
+	    --msg_silent;
 
 	    /* delete PUT_LINE_BACKWARD; */
 	    cap->oap->regname = regname;
@@ -9407,6 +9409,7 @@ nv_put_opt(cmdarg_T *cap, int fix_indent
 	if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL)
 	{
 	    ml_delete(curbuf->b_ml.ml_line_count, TRUE);
+	    deleted_lines(curbuf->b_ml.ml_line_count + 1, 1);
 
 	    /* If the cursor was in that line, move it to the end of the last
 	     * line. */