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 / unreleased / patches / 6.0ax.011 < prev    next >
Encoding:
Internet Message Format  |  2001-09-22  |  4.3 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0ax.011
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 6.0ax.011
  8. Problem:    When 'virtualedit' is set and 'selection' is "exclusive",
  9.         Visually selecting until the start of a following line didn't
  10.         include the line break. (Joseph Edward Miele)
  11. Solution:   Remember that the end of the selection was moved to the previous
  12.         line and include the line break then.
  13. Files:        src/normal.c
  14.  
  15.  
  16. *** ../vim60ax.10/src/normal.c    Wed Sep 19 20:09:54 2001
  17. --- src/normal.c    Fri Sep 21 22:37:08 2001
  18. ***************
  19. *** 146,152 ****
  20.   static void    nv_beginline __ARGS((cmdarg_T *cap));
  21.   #ifdef FEAT_VISUAL
  22.   static void    adjust_for_sel __ARGS((cmdarg_T *cap));
  23. ! static void    unadjust_for_sel __ARGS((void));
  24.   static void    nv_select __ARGS((cmdarg_T *cap));
  25.   #endif
  26.   static void    nv_goto __ARGS((cmdarg_T *cap));
  27. --- 146,152 ----
  28.   static void    nv_beginline __ARGS((cmdarg_T *cap));
  29.   #ifdef FEAT_VISUAL
  30.   static void    adjust_for_sel __ARGS((cmdarg_T *cap));
  31. ! static int    unadjust_for_sel __ARGS((void));
  32.   static void    nv_select __ARGS((cmdarg_T *cap));
  33.   #endif
  34.   static void    nv_goto __ARGS((cmdarg_T *cap));
  35. ***************
  36. *** 1225,1230 ****
  37. --- 1225,1233 ----
  38.       static linenr_T redo_VIsual_line_count; /* number of lines */
  39.       static colnr_T  redo_VIsual_col;        /* number of cols or end column */
  40.       static long        redo_VIsual_count;        /* count for Visual operator */
  41. + # ifdef FEAT_VIRTUALEDIT
  42. +     int        include_line_break = FALSE;
  43. + # endif
  44.   #endif
  45.   
  46.   #if defined(FEAT_CLIPBOARD)
  47. ***************
  48. *** 1366,1372 ****
  49.           /* If 'selection' is "exclusive", backup one character for
  50.            * charwise selections. */
  51.           else if (VIsual_mode == 'v')
  52. !         unadjust_for_sel();
  53.   
  54.           oap->start = VIsual;
  55.           if (VIsual_mode == 'V')
  56. --- 1369,1380 ----
  57.           /* If 'selection' is "exclusive", backup one character for
  58.            * charwise selections. */
  59.           else if (VIsual_mode == 'v')
  60. !         {
  61. ! # ifdef FEAT_VIRTUALEDIT
  62. !         include_line_break =
  63. ! # endif
  64. !             unadjust_for_sel();
  65. !         }
  66.   
  67.           oap->start = VIsual;
  68.           if (VIsual_mode == 'V')
  69. ***************
  70. *** 1528,1534 ****
  71.           {
  72.           oap->motion_type = MCHAR;
  73.           if (VIsual_mode != Ctrl_V && *ml_get_pos(&(oap->end)) == NUL
  74. !             && !virtual_active())
  75.           {
  76.               oap->inclusive = FALSE;
  77.               /* Try to include the newline, unless it's an operator
  78. --- 1536,1545 ----
  79.           {
  80.           oap->motion_type = MCHAR;
  81.           if (VIsual_mode != Ctrl_V && *ml_get_pos(&(oap->end)) == NUL
  82. ! # ifdef FEAT_VIRTUALEDIT
  83. !             && (include_line_break || !virtual_active())
  84. ! # endif
  85. !             )
  86.           {
  87.               oap->inclusive = FALSE;
  88.               /* Try to include the newline, unless it's an operator
  89. ***************
  90. *** 1539,1547 ****
  91.               {
  92.               ++oap->end.lnum;
  93.               oap->end.col = 0;
  94. ! #ifdef FEAT_VIRTULEDIT
  95.               oap->end.coladd = 0;
  96. ! #endif
  97.               ++oap->line_count;
  98.               }
  99.           }
  100. --- 1550,1558 ----
  101.               {
  102.               ++oap->end.lnum;
  103.               oap->end.col = 0;
  104. ! # ifdef FEAT_VIRTUALEDIT
  105.               oap->end.coladd = 0;
  106. ! # endif
  107.               ++oap->line_count;
  108.               }
  109.           }
  110. ***************
  111. *** 7361,7368 ****
  112.   /*
  113.    * Exclude last character at end of Visual area for 'selection' == "exclusive".
  114.    * Should check VIsual_mode before calling this.
  115.    */
  116. !     static void
  117.   unadjust_for_sel()
  118.   {
  119.       pos_T    *pp;
  120. --- 7372,7380 ----
  121.   /*
  122.    * Exclude last character at end of Visual area for 'selection' == "exclusive".
  123.    * Should check VIsual_mode before calling this.
  124. +  * Returns TRUE when backed up to the previous line.
  125.    */
  126. !     static int
  127.   unadjust_for_sel()
  128.   {
  129.       pos_T    *pp;
  130. ***************
  131. *** 7379,7386 ****
  132. --- 7391,7400 ----
  133.       {
  134.           --pp->lnum;
  135.           pp->col = (colnr_T)STRLEN(ml_get(pp->lnum));
  136. +         return TRUE;
  137.       }
  138.       }
  139. +     return FALSE;
  140.   }
  141.   
  142.   /*
  143. *** ../vim60ax.10/src/version.c    Fri Sep 21 22:34:38 2001
  144. --- src/version.c    Fri Sep 21 22:30:10 2001
  145. ***************
  146. *** 608,609 ****
  147. --- 608,611 ----
  148.   {   /* Add new patch number below this line */
  149. + /**/
  150. +     11,
  151.   /**/
  152.  
  153. -- 
  154. Beer & pretzels can't be served at the same time in any bar or restaurant.
  155.         [real standing law in North Dakota, United States of America]
  156.  
  157.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  158. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  159.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  160.