0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.4388: dead code in op_insert()

Problem:    Dead code in op_insert().
Solution:   Remove condition and else block. (closes #9782)
This commit is contained in:
zeertzjq
2022-02-15 11:48:22 +00:00
committed by Bram Moolenaar
parent e3846cf1eb
commit 7745f14ef3
2 changed files with 16 additions and 23 deletions

View File

@@ -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
+ 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;
}
oap->start.col = curbuf->b_op_start_orig.col;
pre_textlen -= t - oap->start_vcol;
oap->start_vcol = t;
}
else if (bd.is_MAX && oap->op_type == OP_APPEND)
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;
}
}