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 / old / 5.5.073 < prev    next >
Encoding:
Internet Message Format  |  1999-12-15  |  5.7 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 5.5.073
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.5.073 (extra)
  8. Problem:    Win 32 GUI: The Find and Find/Replace dialogs didn't show the
  9.         "match case" checkbox.  The Find/Replace dialog didn't handle the
  10.         "match whole word" checkbox.
  11. Solution:   Support the "match case" and "match whole word" checkboxes.
  12. Files:        src/gui_w32.c
  13.  
  14.  
  15. *** ../vim-5.5.72/src/gui_w32.c    Sun Oct 24 19:27:14 1999
  16. --- src/gui_w32.c    Thu Dec 16 15:41:43 1999
  17. ***************
  18. *** 1473,1478 ****
  19. --- 1473,1506 ----
  20.   }
  21.   
  22.   #ifdef WIN32_FIND_REPLACE
  23. +     static void
  24. + fr_setwhat(char_u *cmd)
  25. + {
  26. +     if (s_findrep_struct.Flags & FR_WHOLEWORD)
  27. +     STRCAT(cmd, "\\<");
  28. +     STRCAT(cmd, s_findrep_struct.lpstrFindWhat);
  29. +     if (s_findrep_struct.Flags & FR_WHOLEWORD)
  30. +     STRCAT(cmd, "\\>");
  31. + }
  32. +     static void
  33. + fr_setreplcmd(char_u *cmd)
  34. + {
  35. +     STRCAT(cmd, ":%sno/");
  36. +     fr_setwhat(cmd);
  37. +     STRCAT(cmd, "/");
  38. +     STRCAT(cmd, s_findrep_struct.lpstrReplaceWith);
  39. +     if (s_findrep_struct.Flags & FR_REPLACE)
  40. +     STRCAT(cmd, "/gc");
  41. +     else
  42. +     STRCAT(cmd, "/g");
  43. +     if (s_findrep_struct.Flags & FR_MATCHCASE)
  44. +     STRCAT(cmd, "I");
  45. +     else
  46. +     STRCAT(cmd, "i");
  47. +     STRCAT(cmd, "\r");
  48. + }
  49.   /*
  50.    * Handle a Find/Replace window message.
  51.    */
  52. ***************
  53. *** 1484,1490 ****
  54.       /* Add a char before the command if needed */
  55.       if (State & INSERT)
  56.       cmd[0] = Ctrl('O');
  57. !     else if ((State | NORMAL) == 0 && State != CONFIRM)
  58.       cmd[0] = ESC;
  59.       else
  60.       cmd[0] = NUL;
  61. --- 1512,1518 ----
  62.       /* Add a char before the command if needed */
  63.       if (State & INSERT)
  64.       cmd[0] = Ctrl('O');
  65. !     else if ((State & NORMAL) == 0 && State != CONFIRM)
  66.       cmd[0] = ESC;
  67.       else
  68.       cmd[0] = NUL;
  69. ***************
  70. *** 1507,1524 ****
  71.       }
  72.       else
  73.       {
  74.           if (s_findrep_struct.Flags & FR_DOWN)
  75.           STRCAT(cmd, "/");
  76.           else
  77.           STRCAT(cmd, "?");
  78. !         if (s_findrep_struct.Flags & FR_WHOLEWORD)
  79. !         STRCAT(cmd, "\\<");
  80. !         STRCAT(cmd, s_findrep_struct.lpstrFindWhat);
  81. !         if (s_findrep_struct.Flags & FR_WHOLEWORD)
  82. !         STRCAT(cmd, "\\>");
  83.           STRCAT(cmd, "\r");
  84.       }
  85.       /*
  86.        * Give main window the focus back: this is so
  87. --- 1535,1565 ----
  88.       }
  89.       else
  90.       {
  91. +         /* Set 'ignorecase' just for this search command. */
  92. +         if (!(s_findrep_struct.Flags & FR_MATCHCASE) == !p_ic)
  93. +         {
  94. +         if (p_ic)
  95. +             STRCAT(cmd, ":set noic\r");
  96. +         else
  97. +             STRCAT(cmd, ":set ic\r");
  98. +         if (State & INSERT)
  99. +             STRCAT(cmd, "\017");    /* CTRL-O */
  100. +         }
  101.           if (s_findrep_struct.Flags & FR_DOWN)
  102.           STRCAT(cmd, "/");
  103.           else
  104.           STRCAT(cmd, "?");
  105. !         fr_setwhat(cmd);
  106.           STRCAT(cmd, "\r");
  107. +         if (!(s_findrep_struct.Flags & FR_MATCHCASE) == !p_ic)
  108. +         {
  109. +         if (State & INSERT)
  110. +             STRCAT(cmd, "\017");    /* CTRL-O */
  111. +         if (p_ic)
  112. +             STRCAT(cmd, ":set ic\r");
  113. +         else
  114. +             STRCAT(cmd, ":set noic\r");
  115. +         }
  116.       }
  117.       /*
  118.        * Give main window the focus back: this is so
  119. ***************
  120. *** 1529,1545 ****
  121.       else if (s_findrep_struct.Flags & FR_REPLACE)
  122.       {
  123.       if (State == CONFIRM)
  124. -     {
  125.           STRCAT(cmd, "y");
  126. -     }
  127.       else
  128. !     {
  129. !         STRCAT(cmd, ":%sno/");
  130. !         STRCAT(cmd, s_findrep_struct.lpstrFindWhat);
  131. !         STRCAT(cmd, "/");
  132. !         STRCAT(cmd, s_findrep_struct.lpstrReplaceWith);
  133. !         STRCAT(cmd, "/gc\r");
  134. !     }
  135.       /*
  136.        * Give main window the focus back: this is to allow
  137.        * handling of the confirmation y/n/a/q stuff.
  138. --- 1570,1578 ----
  139.       else if (s_findrep_struct.Flags & FR_REPLACE)
  140.       {
  141.       if (State == CONFIRM)
  142.           STRCAT(cmd, "y");
  143.       else
  144. !         fr_setreplcmd(cmd);
  145.       /*
  146.        * Give main window the focus back: this is to allow
  147.        * handling of the confirmation y/n/a/q stuff.
  148. ***************
  149. *** 1549,1565 ****
  150.       else if (s_findrep_struct.Flags & FR_REPLACEALL)
  151.       {
  152.       if (State == CONFIRM)
  153. -     {
  154.           STRCAT(cmd, "a");
  155. -     }
  156.       else
  157. !     {
  158. !         STRCAT(cmd, ":%sno/");
  159. !         STRCAT(cmd, s_findrep_struct.lpstrFindWhat);
  160. !         STRCAT(cmd, "/");
  161. !         STRCAT(cmd, s_findrep_struct.lpstrReplaceWith);
  162. !         STRCAT(cmd, "/g\r");
  163. !     }
  164.       }
  165.       if (*cmd)
  166.       add_to_input_buf(cmd, STRLEN(cmd));
  167. --- 1582,1590 ----
  168.       else if (s_findrep_struct.Flags & FR_REPLACEALL)
  169.       {
  170.       if (State == CONFIRM)
  171.           STRCAT(cmd, "a");
  172.       else
  173. !         fr_setreplcmd(cmd);
  174.       }
  175.       if (*cmd)
  176.       add_to_input_buf(cmd, STRLEN(cmd));
  177. ***************
  178. *** 5664,5674 ****
  179.   initialise_findrep(char_u *initial_string)
  180.   {
  181.       s_findrep_struct.hwndOwner = s_hwnd;
  182. !     s_findrep_struct.Flags = FR_HIDEMATCHCASE | FR_DOWN;
  183.       if (initial_string != NULL && *initial_string != NUL)
  184.       {
  185.       STRCPY(s_findrep_struct.lpstrFindWhat, initial_string);
  186. !     s_findrep_struct.lpstrReplaceWith[0] = NUL;
  187.       }
  188.   }
  189.   #endif
  190. --- 5689,5703 ----
  191.   initialise_findrep(char_u *initial_string)
  192.   {
  193.       s_findrep_struct.hwndOwner = s_hwnd;
  194. !     s_findrep_struct.Flags = FR_DOWN;
  195. !     if (p_ic)
  196. !     s_findrep_struct.Flags &= ~FR_MATCHCASE;
  197. !     else
  198. !     s_findrep_struct.Flags |= FR_MATCHCASE;
  199.       if (initial_string != NULL && *initial_string != NUL)
  200.       {
  201.       STRCPY(s_findrep_struct.lpstrFindWhat, initial_string);
  202. !     s_findrep_struct.lpstrReplaceWith[0] = NUL;
  203.       }
  204.   }
  205.   #endif
  206. *** ../vim-5.5.72/src/version.c    Thu Dec 16 16:06:45 1999
  207. --- src/version.c    Thu Dec 16 16:07:03 1999
  208. ***************
  209. *** 420,420 ****
  210. --- 420,421 ----
  211.   {   /* Add new patch number below this line */
  212. +     73,
  213.  
  214. -- 
  215. CRONE:  Who sent you?
  216. ARTHUR: The Knights Who Say Ni!
  217. CRONE:  Aaaagh!  (she looks around in rear) No!  We have no shrubberies here.
  218.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  219.  
  220. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  221.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  222.