To: vim_dev@googlegroups.com Subject: Patch 8.2.4388 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4388 Problem: Dead code in op_insert(). Solution: Remove condition and else block. (closes #9782) Files: src/ops.c *** ../vim-8.2.4387/src/ops.c 2022-02-03 13:05:28.809273683 +0000 --- src/ops.c 2022-02-15 11:45:00.354540430 +0000 *************** *** 1586,1620 **** 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 ! + 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 + 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) { // reset pre_textlen to the value of OP_INSERT pre_textlen += bd.textlen; pre_textlen -= t - oap->start_vcol; } } --- 1586,1611 ---- int t = getviscol2(curbuf->b_op_start_orig.col, curbuf->b_op_start_orig.coladd); ! 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 ! + 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; } } *** ../vim-8.2.4387/src/version.c 2022-02-15 11:35:51.148044050 +0000 --- src/version.c 2022-02-15 11:46:03.306367912 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4388, /**/ -- The future isn't what it used to be. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///