home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.4 / 7.4.186 < prev    next >
Encoding:
Internet Message Format  |  2014-02-21  |  5.3 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.4.186
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.4.186 (after 7.4.085)
  11. Problem:    Insert in Visual mode sometimes gives incorrect results.
  12.             (Dominique Pelle)
  13. Solution:   Remember the original insert start position. (Christian Brabandt,
  14.             Dominique Pelle)
  15. Files:      src/edit.c, src/globals.h, src/ops.c, src/structs.h
  16.  
  17.  
  18. *** ../vim-7.4.185/src/edit.c    2014-01-23 22:45:54.608127182 +0100
  19. --- src/edit.c    2014-02-22 22:43:52.820903112 +0100
  20. ***************
  21. *** 264,269 ****
  22. --- 264,270 ----
  23.   
  24.   static colnr_T    Insstart_textlen;    /* length of line when insert started */
  25.   static colnr_T    Insstart_blank_vcol;    /* vcol for first inserted blank */
  26. + static int    update_Insstart_orig = TRUE; /* set Insstart_orig to Insstart */
  27.   
  28.   static char_u    *last_insert = NULL;    /* the text of the previous insert,
  29.                          K_SPECIAL and CSI are escaped */
  30. ***************
  31. *** 340,345 ****
  32. --- 341,349 ----
  33.        * error message */
  34.       check_for_delay(TRUE);
  35.   
  36. +     /* set Insstart_orig to Insstart */
  37. +     update_Insstart_orig = TRUE;
  38.   #ifdef HAVE_SANDBOX
  39.       /* Don't allow inserting in the sandbox. */
  40.       if (sandbox != 0)
  41. ***************
  42. *** 631,636 ****
  43. --- 635,643 ----
  44.       if (arrow_used)        /* don't repeat insert when arrow key used */
  45.           count = 0;
  46.   
  47. +     if (update_Insstart_orig)
  48. +         Insstart_orig = Insstart;
  49.       if (stop_insert_mode)
  50.       {
  51.           /* ":stopinsert" used or 'insertmode' reset */
  52. ***************
  53. *** 6923,6928 ****
  54. --- 6930,6936 ----
  55.       if (end_insert_pos != NULL)
  56.       {
  57.       curbuf->b_op_start = Insstart;
  58. +     curbuf->b_op_start_orig = Insstart_orig;
  59.       curbuf->b_op_end = *end_insert_pos;
  60.       }
  61.   }
  62. ***************
  63. *** 8257,8262 ****
  64. --- 8265,8271 ----
  65.   
  66.             /* Need to reset Insstart, esp. because a BS that joins
  67.              * a line to the previous one must save for undo. */
  68. +           update_Insstart_orig = FALSE;
  69.             Insstart = curwin->w_cursor;
  70.             break;
  71.   
  72. *** ../vim-7.4.185/src/globals.h    2014-02-11 15:10:38.130111835 +0100
  73. --- src/globals.h    2014-02-22 23:02:01.644901378 +0100
  74. ***************
  75. *** 752,757 ****
  76. --- 752,763 ----
  77.    */
  78.   EXTERN pos_T    Insstart;        /* This is where the latest
  79.                        * insert/append mode started. */
  80. + /* This is where the latest insert/append mode started. In contrast to
  81. +  * Insstart, this won't be reset by certain keys and is needed for
  82. +  * op_insert(), to detect correctly where inserting by the user started. */
  83. + EXTERN pos_T    Insstart_orig;
  84.   #ifdef FEAT_VREPLACE
  85.   /*
  86.    * Stuff for VREPLACE mode.
  87. *** ../vim-7.4.185/src/ops.c    2014-02-11 19:33:03.358353098 +0100
  88. --- src/ops.c    2014-02-22 22:39:47.588903502 +0100
  89. ***************
  90. *** 2643,2662 ****
  91.   
  92.       /* The user may have moved the cursor before inserting something, try
  93.        * to adjust the block for that. */
  94. !     if (oap->start.lnum == curbuf->b_op_start.lnum && !bd.is_MAX)
  95.       {
  96.           if (oap->op_type == OP_INSERT
  97. !             && oap->start.col != curbuf->b_op_start.col)
  98.           {
  99. !         oap->start.col = curbuf->b_op_start.col;
  100.           pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
  101.                                   - oap->start_vcol;
  102.           oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd);
  103.           }
  104.           else if (oap->op_type == OP_APPEND
  105. !             && oap->end.col >= curbuf->b_op_start.col)
  106.           {
  107. !         oap->start.col = curbuf->b_op_start.col;
  108.           /* reset pre_textlen to the value of OP_INSERT */
  109.           pre_textlen += bd.textlen;
  110.           pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
  111. --- 2643,2662 ----
  112.   
  113.       /* The user may have moved the cursor before inserting something, try
  114.        * to adjust the block for that. */
  115. !     if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX)
  116.       {
  117.           if (oap->op_type == OP_INSERT
  118. !             && oap->start.col != curbuf->b_op_start_orig.col)
  119.           {
  120. !         oap->start.col = curbuf->b_op_start_orig.col;
  121.           pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
  122.                                   - oap->start_vcol;
  123.           oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd);
  124.           }
  125.           else if (oap->op_type == OP_APPEND
  126. !             && oap->end.col >= curbuf->b_op_start_orig.col)
  127.           {
  128. !         oap->start.col = curbuf->b_op_start_orig.col;
  129.           /* reset pre_textlen to the value of OP_INSERT */
  130.           pre_textlen += bd.textlen;
  131.           pre_textlen -= getviscol2(oap->start.col, oap->start.coladd)
  132. *** ../vim-7.4.185/src/structs.h    2014-02-11 15:10:38.138111836 +0100
  133. --- src/structs.h    2014-02-22 22:39:47.588903502 +0100
  134. ***************
  135. *** 1449,1454 ****
  136. --- 1449,1455 ----
  137.        * start and end of an operator, also used for '[ and ']
  138.        */
  139.       pos_T    b_op_start;
  140. +     pos_T    b_op_start_orig;  /* used for Insstart_orig */
  141.       pos_T    b_op_end;
  142.   
  143.   #ifdef FEAT_VIMINFO
  144. *** ../vim-7.4.185/src/version.c    2014-02-22 22:27:20.772904692 +0100
  145. --- src/version.c    2014-02-22 22:39:08.932903564 +0100
  146. ***************
  147. *** 740,741 ****
  148. --- 740,743 ----
  149.   {   /* Add new patch number below this line */
  150. + /**/
  151. +     186,
  152.   /**/
  153.  
  154. -- 
  155. Individualists unite!
  156.  
  157.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  158. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  159. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  160.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  161.