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.0.138 < prev    next >
Encoding:
Internet Message Format  |  2002-01-15  |  4.4 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.138
  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.0.138
  11. Problem:    GUI: When using the find or find/replace dialog from Insert mode,
  12.         the text is inserted when CTRL-O is mapped. (Andre Pang)
  13.         When opening the dialog again, a whole word search isn't
  14.         recognized.
  15.         When doing "replace all" a whole word search was never done.
  16. Solution:   Don't put a search or replace command in the input buffer,
  17.         execute it directly.
  18.         Recognize "\<" and "\>" after removing "\V".
  19.         Add "\<" and "\>" also for "replace all".
  20. Files:        src/gui.c
  21.  
  22.  
  23. *** ../vim60.137/src/gui.c    Thu Nov  1 14:56:27 2001
  24. --- src/gui.c    Wed Jan 16 11:35:01 2002
  25. ***************
  26. *** 3952,3958 ****
  27.   }
  28.   #endif
  29.   
  30. ! #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_GUI_MOTIF) || defined(PROTO)
  31.   /*
  32.    * Update the current window and the screen.
  33.    */
  34. --- 3952,3959 ----
  35.   }
  36.   #endif
  37.   
  38. ! #if defined(FEAT_GUI_GTK) || defined(FEAT_SUN_WORKSHOP) \
  39. !     || defined(FEAT_GUI_MOTIF) || defined(PROTO)
  40.   /*
  41.    * Update the current window and the screen.
  42.    */
  43. ***************
  44. *** 3995,4001 ****
  45. --- 3996,4005 ----
  46.   
  47.           /* Remove "\V" */
  48.           if (len >= 2 && STRNCMP(text, "\\V", 2) == 0)
  49. +         {
  50.           mch_memmove(text, text + 2, (size_t)(len - 1));
  51. +         len -= 2;
  52. +         }
  53.   
  54.           /* Recognize "\<text\>" and remove. */
  55.           if (len >= 4
  56. ***************
  57. *** 4024,4038 ****
  58.       int        exact;        /* Exact word match. */
  59.   {
  60.       garray_T    ga;
  61.   
  62.       ga_init2(&ga, 1, 100);
  63.   
  64. -     /* start stuffing in the command text */
  65. -     if (State & INSERT)
  66. -     ga_append(&ga, Ctrl_O);
  67. -     else if ((State | NORMAL) == 0)
  68. -     ga_append(&ga, ESC);
  69.       if (flags == FR_REPLACE)
  70.       {
  71.       /* Do the replacement when the text under the cursor matches. */
  72. --- 4028,4037 ----
  73.       int        exact;        /* Exact word match. */
  74.   {
  75.       garray_T    ga;
  76. +     int        i;
  77.   
  78.       ga_init2(&ga, 1, 100);
  79.   
  80.       if (flags == FR_REPLACE)
  81.       {
  82.       /* Do the replacement when the text under the cursor matches. */
  83. ***************
  84. *** 4044,4074 ****
  85.       }
  86.       }
  87.       else if (flags == FR_REPLACEALL)
  88.       {
  89. -     ga_concat(&ga, (char_u *)":%sno/");
  90. -     ga_concat(&ga, find_text);
  91.       ga_concat(&ga, (char_u *)"/");
  92.       ga_concat(&ga, repl_text);
  93. !     ga_concat(&ga, (char_u *)"/g\r");
  94.       }
  95. !     if (flags != FR_REPLACEALL)
  96.       {
  97.       /* Search for the next match. */
  98. !     if (down)
  99. !         ga_concat(&ga, (char_u *)"/\\V");
  100. !     else
  101. !         ga_concat(&ga, (char_u *)"?\\V");
  102. !     if (exact)
  103. !         ga_concat(&ga, (char_u *)"\\<");
  104. !     ga_concat(&ga, find_text);
  105. !     if (exact)
  106. !         ga_concat(&ga, (char_u *)"\\>");
  107. !     ga_concat(&ga, (char_u *)"\r");
  108.       }
  109.   
  110. !     if (ga.ga_len > 0)
  111. !     add_to_input_buf((char_u *)ga.ga_data, ga.ga_len);
  112.   
  113.       vim_free(ga.ga_data);
  114.       return (ga.ga_len > 0);
  115. --- 4043,4079 ----
  116.       }
  117.       }
  118.       else if (flags == FR_REPLACEALL)
  119. +     ga_concat(&ga, (char_u *)"%s/");
  120. +     ga_concat(&ga, (char_u *)"\\V");
  121. +     if (exact)
  122. +     ga_concat(&ga, (char_u *)"\\<");
  123. +     ga_concat(&ga, find_text);
  124. +     if (exact)
  125. +     ga_concat(&ga, (char_u *)"\\>");
  126. +     if (flags == FR_REPLACEALL)
  127.       {
  128.       ga_concat(&ga, (char_u *)"/");
  129.       ga_concat(&ga, repl_text);
  130. !     ga_concat(&ga, (char_u *)"/g");
  131. !     do_cmdline_cmd(ga.ga_data);
  132.       }
  133. !     else
  134.       {
  135.       /* Search for the next match. */
  136. !     i = msg_scroll;
  137. !     do_search(NULL, down ? '/' : '?', ga.ga_data, 1L,
  138. !                             SEARCH_MSG + SEARCH_MARK);
  139. !     msg_scroll = i;        /* don't let an error message set msg_scroll */
  140.       }
  141.   
  142. !     if (State & (NORMAL | INSERT))
  143. !     {
  144. !     gui_update_screen();        /* update the screen */
  145. !     msg_didout = 0;            /* overwrite any message */
  146. !     need_wait_return = FALSE;    /* don't wait for return */
  147. !     }
  148.   
  149.       vim_free(ga.ga_data);
  150.       return (ga.ga_len > 0);
  151. *** ../vim60.137/src/version.c    Tue Jan 15 19:50:54 2002
  152. --- src/version.c    Wed Jan 16 11:41:01 2002
  153. ***************
  154. *** 608,609 ****
  155. --- 608,611 ----
  156.   {   /* Add new patch number below this line */
  157. + /**/
  158. +     138,
  159.   /**/
  160.  
  161. -- 
  162. hundred-and-one symptoms of being an internet addict:
  163. 1. You actually wore a blue ribbon to protest the Communications Decency Act.
  164.  
  165.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  166. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  167.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  168.