comparison src/ops.c @ 5680:4d12112c5efa v7.4.186

updated for version 7.4.186 Problem: Insert in Visual mode sometimes gives incorrect results. (Dominique Pelle) Solution: Remember the original insert start position. (Christian Brabandt, Dominique Pelle)
author Bram Moolenaar <bram@vim.org>
date Sat, 22 Feb 2014 23:03:55 +0100
parents 647e6bb15aa3
children 420fd9cb86d5
comparison
equal deleted inserted replaced
5679:5fdabe005490 5680:4d12112c5efa
2641 { 2641 {
2642 struct block_def bd2; 2642 struct block_def bd2;
2643 2643
2644 /* The user may have moved the cursor before inserting something, try 2644 /* The user may have moved the cursor before inserting something, try
2645 * to adjust the block for that. */ 2645 * to adjust the block for that. */
2646 if (oap->start.lnum == curbuf->b_op_start.lnum && !bd.is_MAX) 2646 if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX)
2647 { 2647 {
2648 if (oap->op_type == OP_INSERT 2648 if (oap->op_type == OP_INSERT
2649 && oap->start.col != curbuf->b_op_start.col) 2649 && oap->start.col != curbuf->b_op_start_orig.col)
2650 { 2650 {
2651 oap->start.col = curbuf->b_op_start.col; 2651 oap->start.col = curbuf->b_op_start_orig.col;
2652 pre_textlen -= getviscol2(oap->start.col, oap->start.coladd) 2652 pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
2653 - oap->start_vcol; 2653 - oap->start_vcol;
2654 oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd); 2654 oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd);
2655 } 2655 }
2656 else if (oap->op_type == OP_APPEND 2656 else if (oap->op_type == OP_APPEND
2657 && oap->end.col >= curbuf->b_op_start.col) 2657 && oap->end.col >= curbuf->b_op_start_orig.col)
2658 { 2658 {
2659 oap->start.col = curbuf->b_op_start.col; 2659 oap->start.col = curbuf->b_op_start_orig.col;
2660 /* reset pre_textlen to the value of OP_INSERT */ 2660 /* reset pre_textlen to the value of OP_INSERT */
2661 pre_textlen += bd.textlen; 2661 pre_textlen += bd.textlen;
2662 pre_textlen -= getviscol2(oap->start.col, oap->start.coladd) 2662 pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
2663 - oap->start_vcol; 2663 - oap->start_vcol;
2664 oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd); 2664 oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd);