Patch 7.4.616
Problem:    Cannot insert a tab in front of a block.
Solution:   Correctly compute aop->start. (Christian Brabandt)
Files:      src/ops.c, src/testdir/test39.in, src/testdir/test39.ok


*** ../vim-7.4.615/src/ops.c    2015-01-27 18:43:42.134535513 +0100
--- src/ops.c   2015-02-03 18:36:21.141241905 +0100
***************
*** 2544,2549 ****
--- 2544,2550 ----
      char_u            *firstline, *ins_text;
      struct block_def  bd;
      int                       i;
+     pos_T             t1;
  
      /* edit() changes this - record it for OP_APPEND */
      bd.is_MAX = (curwin->w_curswant == MAXCOL);
***************
*** 2617,2624 ****
--- 2618,2633 ----
        }
      }
  
+     t1 = oap->start;
      edit(NUL, FALSE, (linenr_T)count1);
  
+     /* When a tab was inserted, and the characters in front of the tab
+      * have been converted to a tab as well, the column of the cursor
+      * might have actually been reduced, so need to adjust here. */
+     if (t1.lnum == curbuf->b_op_start_orig.lnum
+           && lt(curbuf->b_op_start_orig, t1))
+       oap->start = curbuf->b_op_start_orig;
+ 
      /* If user has moved off this line, we don't know what to do, so do
       * nothing.
       * Also don't repeat the insert when Insert mode ended with CTRL-C. */
***************
*** 2644,2653 ****
  #endif
                        )
            {
                oap->start.col = curbuf->b_op_start_orig.col;
!               pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
!                                                           - oap->start_vcol;
!               oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd);
            }
            else if (oap->op_type == OP_APPEND
                      && oap->end.col
--- 2653,2663 ----
  #endif
                        )
            {
+               int t = getviscol2(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->end.col
***************
*** 2660,2671 ****
  #endif
                        )
            {
                oap->start.col = curbuf->b_op_start_orig.col;
                /* reset pre_textlen to the value of OP_INSERT */
                pre_textlen += bd.textlen;
!               pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
!                                                           - oap->start_vcol;
!               oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd);
                oap->op_type = OP_INSERT;
            }
        }
--- 2670,2682 ----
  #endif
                        )
            {
+               int t = getviscol2(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-7.4.615/src/testdir/test39.in        2014-12-17 18:35:37.553795955 
+0100
--- src/testdir/test39.in       2015-02-03 18:27:44.774825429 +0100
***************
*** 2,7 ****
--- 2,11 ----
  Test Visual block mode commands
  And test "U" in Visual mode, also on German sharp S.
  
+ #define BO_ALL            0x0001
+ #define BO_BS     0x0002
+ #define BO_CRSR           0x0004
+ 
  STARTTEST
  :so small.vim
  :so mbyte.vim
***************
*** 70,75 ****
--- 74,85 ----
  :exe ":norm! 2k\<C-V>$gj\<Esc>"
  :let cpos=getpos("'>")
  :$put ='col:'.cpos[2].' off:'.cpos[3]
+ :"
+ :" block_insert when replacing spaces in front of the block with tabs
+ :set ts=8 sts=4 sw=4
+ :4,7y
+ Gp
+ :exe ":norm! f0\<C-V>2jI\<tab>\<esc>"
  :/^the/,$w >> test.out
  :qa!
  ENDTEST
*** ../vim-7.4.615/src/testdir/test39.ok        2014-12-17 18:35:37.553795955 
+0100
--- src/testdir/test39.ok       2015-02-03 18:29:13.837862626 +0100
***************
*** 57,59 ****
--- 57,63 ----
  98**********
*** 743,744 ****
--- 743,746 ----
  {   /* Add new patch number below this line */
+ /**/
+     616,
  /**/

-- 
        Very funny, Scotty.  Now beam down my clothes.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui