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 / 6.1.413 < prev    next >
Encoding:
Internet Message Format  |  2003-03-22  |  4.7 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.413
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.413
  11. Problem:    When 'clipboard' contains "unnamed", "p" in Visual mode doesn't
  12.         work correctly.
  13. Solution:   Save the register before overwriting it and put the resulting text
  14.         on the clipboard afterwards.  (Muraoka Taro)
  15. Files:        src/normal.c, src/ops.c
  16.  
  17.  
  18. *** ../vim61.412/src/normal.c    Sat Mar 15 17:55:18 2003
  19. --- src/normal.c    Thu Mar 20 21:37:09 2003
  20. ***************
  21. *** 8048,8054 ****
  22.   # ifdef FEAT_CLIPBOARD
  23.           adjust_clip_reg(®name);
  24.   # endif
  25. !         if (regname == 0 || isdigit(regname))
  26.           {
  27.           /* the delete is going to overwrite the register we want to
  28.            * put, save it first. */
  29. --- 8048,8059 ----
  30.   # ifdef FEAT_CLIPBOARD
  31.           adjust_clip_reg(®name);
  32.   # endif
  33. !         if (regname == 0 || isdigit(regname)
  34. ! # ifdef FEAT_CLIPBOARD
  35. !             || (clip_unnamed && (regname == '*' || regname == '+'))
  36. ! # endif
  37. !             )
  38.           {
  39.           /* the delete is going to overwrite the register we want to
  40.            * put, save it first. */
  41. *** ../vim61.412/src/ops.c    Sun Feb 16 20:14:02 2003
  42. --- src/ops.c    Sun Mar 23 21:05:02 2003
  43. ***************
  44. *** 104,109 ****
  45. --- 104,112 ----
  46.   static int    yank_copy_line __ARGS((struct block_def *bd, long y_idx));
  47.   #ifdef FEAT_CLIPBOARD
  48.   static void    copy_yank_reg __ARGS((struct yankreg *reg));
  49. + # if defined(FEAT_VISUAL) || defined(FEAT_EVAL)
  50. + static void    may_set_selection __ARGS((void));
  51. + # endif
  52.   #endif
  53.   static void    dis_msg __ARGS((char_u *p, int skip_esc));
  54.   #ifdef FEAT_VISUAL
  55. ***************
  56. *** 894,899 ****
  57. --- 897,907 ----
  58.       get_yank_register(name, 0);
  59.       free_yank_all();
  60.       *y_current = *(struct yankreg *)reg;
  61. + # ifdef FEAT_CLIPBOARD
  62. +     /* Send text written to clipboard register to the clipboard. */
  63. +     may_set_selection();
  64. + # endif
  65.   }
  66.   #endif
  67.   
  68. ***************
  69. *** 5225,5234 ****
  70.       return y_ptr->y_type;
  71.   }
  72.   
  73. - #endif /* FEAT_CLIPBOARD || PROTO */
  74.   
  75.   
  76. ! #ifdef FEAT_EVAL
  77.   /*
  78.    * Return the contents of a register as a single allocated string.
  79.    * Used for "@r" in expressions.
  80. --- 5233,5262 ----
  81.       return y_ptr->y_type;
  82.   }
  83.   
  84.   
  85. + # if defined(FEAT_VISUAL) || defined(FEAT_EVAL)
  86. + /*
  87. +  * If we have written to a clipboard register, send the text to the clipboard.
  88. +  */
  89. +     static void
  90. + may_set_selection()
  91. + {
  92. +     if (y_current == &(y_regs[STAR_REGISTER]) && clip_star.available)
  93. +     {
  94. +     clip_own_selection(&clip_star);
  95. +     clip_gen_set_selection(&clip_star);
  96. +     }
  97. +     else if (y_current == &(y_regs[PLUS_REGISTER]) && clip_plus.available)
  98. +     {
  99. +     clip_own_selection(&clip_plus);
  100. +     clip_gen_set_selection(&clip_plus);
  101. +     }
  102. + }
  103. + # endif
  104. + #endif /* FEAT_CLIPBOARD || PROTO */
  105.   
  106. ! #if defined(FEAT_EVAL) || defined(PROTO)
  107.   /*
  108.    * Return the contents of a register as a single allocated string.
  109.    * Used for "@r" in expressions.
  110. ***************
  111. *** 5369,5392 ****
  112.           (len > 0 && (str[len - 1] == '\n' || str[len -1] == '\r'))
  113.            ? MLINE : MCHAR, str, len);
  114.   
  115. ! #ifdef FEAT_CLIPBOARD
  116. !     /*
  117. !      * If we are writing to the selection register, send result to selection.
  118. !      */
  119. !     if (y_current == &(y_regs[STAR_REGISTER]) && clip_star.available)
  120. !     {
  121. !     clip_own_selection(&clip_star);
  122. !     clip_gen_set_selection(&clip_star);
  123. !     }
  124. !     /*
  125. !      * If we are writing to the clipboard register, send result to clipboard.
  126. !      */
  127. !     else if (y_current == &(y_regs[PLUS_REGISTER]) && clip_plus.available)
  128. !     {
  129. !     clip_own_selection(&clip_plus);
  130. !     clip_gen_set_selection(&clip_plus);
  131. !     }
  132. ! #endif
  133.   
  134.       /* ':let @" = "val"' should change the meaning of the "" register */
  135.       if (name != '"')
  136. --- 5397,5406 ----
  137.           (len > 0 && (str[len - 1] == '\n' || str[len -1] == '\r'))
  138.            ? MLINE : MCHAR, str, len);
  139.   
  140. ! # ifdef FEAT_CLIPBOARD
  141. !     /* Send text of clipboard register to the clipboard. */
  142. !     may_set_selection();
  143. ! # endif
  144.   
  145.       /* ':let @" = "val"' should change the meaning of the "" register */
  146.       if (name != '"')
  147. *** ../vim61.412/src/version.c    Sun Mar 23 20:55:21 2003
  148. --- src/version.c    Sun Mar 23 20:59:51 2003
  149. ***************
  150. *** 613,614 ****
  151. --- 613,616 ----
  152.   {   /* Add new patch number below this line */
  153. + /**/
  154. +     413,
  155.   /**/
  156.  
  157. -- 
  158. hundred-and-one symptoms of being an internet addict:
  159. 182. You may not know what is happening in the world, but you know
  160.      every bit of net-gossip there is.
  161.  
  162.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  163. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  164. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  165.  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
  166.