changeset 27724:2261ef91b850 v8.2.4388

patch 8.2.4388: dead code in op_insert() Commit: https://github.com/vim/vim/commit/7745f14ef324a7134b2f26a47451cf5032f44b89 Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Feb 15 11:48:22 2022 +0000 patch 8.2.4388: dead code in op_insert() Problem: Dead code in op_insert(). Solution: Remove condition and else block. (closes https://github.com/vim/vim/issues/9782)
author Bram Moolenaar <Bram@vim.org>
date Tue, 15 Feb 2022 13:00:04 +0100
parents 330dd16edc51
children 8c46546e1e2f
files src/ops.c src/version.c
diffstat 2 files changed, 16 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -1586,35 +1586,26 @@ op_insert(oparg_T *oap, long count1)
 	    int t = getviscol2(curbuf->b_op_start_orig.col,
 					       curbuf->b_op_start_orig.coladd);
 
-	    if (!bd.is_MAX)
-	    {
-		if (oap->op_type == OP_INSERT
-			&& oap->start.col + oap->start.coladd
-				!= curbuf->b_op_start_orig.col
+	    if (oap->op_type == OP_INSERT
+		    && oap->start.col + oap->start.coladd
+			    != curbuf->b_op_start_orig.col
 					      + curbuf->b_op_start_orig.coladd)
-		{
-		    oap->start.col = curbuf->b_op_start_orig.col;
-		    pre_textlen -= t - oap->start_vcol;
-		    oap->start_vcol = t;
-		}
-		else if (oap->op_type == OP_APPEND
-			&& oap->start.col + oap->start.coladd
-				>= curbuf->b_op_start_orig.col
+	    {
+		oap->start.col = curbuf->b_op_start_orig.col;
+		pre_textlen -= t - oap->start_vcol;
+		oap->start_vcol = t;
+	    }
+	    else if (oap->op_type == OP_APPEND
+		    && oap->start.col + oap->start.coladd
+			    >= curbuf->b_op_start_orig.col
 					      + curbuf->b_op_start_orig.coladd)
-		{
-		    oap->start.col = curbuf->b_op_start_orig.col;
-		    // reset pre_textlen to the value of OP_INSERT
-		    pre_textlen += bd.textlen;
-		    pre_textlen -= t - oap->start_vcol;
-		    oap->start_vcol = t;
-		    oap->op_type = OP_INSERT;
-		}
-	    }
-	    else if (bd.is_MAX && oap->op_type == OP_APPEND)
 	    {
+		oap->start.col = curbuf->b_op_start_orig.col;
 		// reset pre_textlen to the value of OP_INSERT
 		pre_textlen += bd.textlen;
 		pre_textlen -= t - oap->start_vcol;
+		oap->start_vcol = t;
+		oap->op_type = OP_INSERT;
 	    }
 	}
 
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4388,
+/**/
     4387,
 /**/
     4386,