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.044 < prev    next >
Encoding:
Internet Message Format  |  2002-11-04  |  38.7 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.044 (extra)
  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.044 (extra)
  11. Problem:    GUI: When using the find/replace dialog with text that contains a
  12.         slash, an invalid substitute command is generated.
  13.         On Win32 a find doesn't work when 'insertmode' is set.
  14. Solution:   Escape slashes with a backslash.
  15.         Make the Win32, Motif and GTK gui use common code for the
  16.         find/replace dialog.
  17.         Add the "match case" option for Motif and GTK.
  18. Files:        src/feature.h, src/proto/gui.pro, src/gui.c, src/gui.h,
  19.         src/gui_motif.c, src/gui_gtk.c, src/gui_w48.c
  20.  
  21.  
  22. *** ../vim61.043/src/feature.h    Sat Mar  9 16:17:30 2002
  23. --- src/feature.h    Wed May  1 19:58:03 2002
  24. ***************
  25. *** 980,985 ****
  26. --- 980,990 ----
  27.   # endif
  28.   #endif
  29.   
  30. + #if defined(FEAT_GUI_MSWIN) && defined(FEAT_SMALL)
  31. + # define MSWIN_FIND_REPLACE    /* include code for find/replace dialog */
  32. + # define MSWIN_FR_BUFSIZE 256
  33. + #endif
  34.   /*
  35.    * +clientserver    Remote control via the remote_send() function
  36.    *            and the --remote argument
  37. *** ../vim61.043/src/proto/gui.pro    Fri Mar 22 21:41:26 2002
  38. --- src/proto/gui.pro    Tue Apr 30 17:47:17 2002
  39. ***************
  40. *** 54,59 ****
  41.   void display_errors __ARGS((void));
  42.   int no_console_input __ARGS((void));
  43.   void gui_update_screen __ARGS((void));
  44. ! char_u *get_find_dialog_text __ARGS((char_u *arg, int *wordp));
  45. ! int gui_do_findrepl __ARGS((int flags, char_u *find_text, char_u *repl_text, int down, int exact));
  46.   /* vim: set ft=c : */
  47. --- 54,59 ----
  48.   void display_errors __ARGS((void));
  49.   int no_console_input __ARGS((void));
  50.   void gui_update_screen __ARGS((void));
  51. ! char_u *get_find_dialog_text __ARGS((char_u *arg, int *wwordp, int *mcasep));
  52. ! int gui_do_findrepl __ARGS((int flags, char_u *find_text, char_u *repl_text, int down));
  53.   /* vim: set ft=c : */
  54. *** ../vim61.043/src/gui.c    Fri Mar 22 22:08:42 2002
  55. --- src/gui.c    Wed May  1 21:11:42 2002
  56. ***************
  57. *** 4013,4020 ****
  58.   }
  59.   #endif
  60.   
  61. ! #if defined(FEAT_GUI_GTK) || defined(FEAT_SUN_WORKSHOP) \
  62. !     || defined(FEAT_GUI_MOTIF) || defined(PROTO)
  63.   /*
  64.    * Update the current window and the screen.
  65.    */
  66. --- 4013,4021 ----
  67.   }
  68.   #endif
  69.   
  70. ! #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
  71. !     || defined(MSWIN_FIND_REPLACE) || defined(FEAT_SUN_WORKSHOP) \
  72. !     || defined(PROTO)
  73.   /*
  74.    * Update the current window and the screen.
  75.    */
  76. ***************
  77. *** 4031,4046 ****
  78.   }
  79.   #endif
  80.   
  81. ! #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) || defined(PROTO)
  82.   /*
  83.    * Get the text to use in a find/replace dialog.  Uses the last search pattern
  84.    * if the argument is empty.
  85.    * Returns an allocated string.
  86.    */
  87.       char_u *
  88. ! get_find_dialog_text(arg, wordp)
  89.       char_u    *arg;
  90. !     int        *wordp;        /* return: TRUE if \< \> found */
  91.   {
  92.       char_u    *text;
  93.   
  94. --- 4032,4051 ----
  95.   }
  96.   #endif
  97.   
  98. ! #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
  99. !     || defined(MSWIN_FIND_REPLACE) || defined(PROTO)
  100. ! static void concat_esc __ARGS((garray_T *gap, char_u *text, int what));
  101.   /*
  102.    * Get the text to use in a find/replace dialog.  Uses the last search pattern
  103.    * if the argument is empty.
  104.    * Returns an allocated string.
  105.    */
  106.       char_u *
  107. ! get_find_dialog_text(arg, wwordp, mcasep)
  108.       char_u    *arg;
  109. !     int        *wwordp;    /* return: TRUE if \< \> found */
  110. !     int        *mcasep;    /* return: TRUE if \C found */
  111.   {
  112.       char_u    *text;
  113.   
  114. ***************
  115. *** 4062,4122 ****
  116.           len -= 2;
  117.           }
  118.   
  119.           /* Recognize "\<text\>" and remove. */
  120.           if (len >= 4
  121.               && STRNCMP(text, "\\<", 2) == 0
  122.               && STRNCMP(text + len - 2, "\\>", 2) == 0)
  123.           {
  124. !         *wordp = TRUE;
  125.           mch_memmove(text, text + 2, (size_t)(len - 4));
  126.           text[len - 4] = NUL;
  127.           }
  128.       }
  129.       }
  130.       return text;
  131.   }
  132.   
  133.   /*
  134.    * Handle the press of a button in the find-replace dialog.
  135.    * Return TRUE when something was added to the input buffer.
  136.    */
  137.       int
  138. ! gui_do_findrepl(flags, find_text, repl_text, down, exact)
  139. !     int        flags;        /* one of FR_REPLACE, FR_FINDNEXT, etc. */
  140.       char_u    *find_text;
  141.       char_u    *repl_text;
  142.       int        down;        /* Search downwards. */
  143. -     int        exact;        /* Exact word match. */
  144.   {
  145.       garray_T    ga;
  146.       int        i;
  147.   
  148.       ga_init2(&ga, 1, 100);
  149.   
  150. !     if (flags == FR_REPLACE)
  151.       {
  152.       /* Do the replacement when the text under the cursor matches. */
  153. !     if (STRNCMP(ml_get_cursor(), find_text, STRLEN(find_text)) == 0
  154.           && u_save_cursor() == OK)
  155.       {
  156. !         del_bytes((long)STRLEN(find_text), FALSE);
  157.           ins_str(repl_text);
  158.       }
  159.       }
  160. !     else if (flags == FR_REPLACEALL)
  161.       ga_concat(&ga, (char_u *)"%s/");
  162.   
  163.       ga_concat(&ga, (char_u *)"\\V");
  164. !     if (exact)
  165.       ga_concat(&ga, (char_u *)"\\<");
  166. !     ga_concat(&ga, find_text);
  167. !     if (exact)
  168.       ga_concat(&ga, (char_u *)"\\>");
  169.   
  170. !     if (flags == FR_REPLACEALL)
  171.       {
  172.       ga_concat(&ga, (char_u *)"/");
  173. !     ga_concat(&ga, repl_text);
  174.       ga_concat(&ga, (char_u *)"/g");
  175.       do_cmdline_cmd(ga.ga_data);
  176.       }
  177. --- 4067,4183 ----
  178.           len -= 2;
  179.           }
  180.   
  181. +         /* Recognize "\c" and "\C" and remove. */
  182. +         if (len >= 2 && *text == '\\' && (text[1] == 'c' || text[1] == 'C'))
  183. +         {
  184. +         *mcasep = (text[1] == 'C');
  185. +         mch_memmove(text, text + 2, (size_t)(len - 1));
  186. +         len -= 2;
  187. +         }
  188.           /* Recognize "\<text\>" and remove. */
  189.           if (len >= 4
  190.               && STRNCMP(text, "\\<", 2) == 0
  191.               && STRNCMP(text + len - 2, "\\>", 2) == 0)
  192.           {
  193. !         *wwordp = TRUE;
  194.           mch_memmove(text, text + 2, (size_t)(len - 4));
  195.           text[len - 4] = NUL;
  196.           }
  197.       }
  198.       }
  199.       return text;
  200.   }
  201.   
  202.   /*
  203. +  * Concatenate "text" to grow array "gap", escaping "what" with a backslash.
  204. +  */
  205. +     static void
  206. + concat_esc(gap, text, what)
  207. +     garray_T    *gap;
  208. +     char_u    *text;
  209. +     int        what;
  210. + {
  211. +     while (*text != NUL)
  212. +     {
  213. + #ifdef FEAT_MBYTE
  214. +     int l = (*mb_ptr2len_check)(text);
  215. +     if (l > 1)
  216. +     {
  217. +         while (--l >= 0)
  218. +         ga_append(gap, *text++);
  219. +         continue;
  220. +     }
  221. + #endif
  222. +     if (*text == what)
  223. +         ga_append(gap, '\\');
  224. +     ga_append(gap, *text);
  225. +     ++text;
  226. +     }
  227. + }
  228. + /*
  229.    * Handle the press of a button in the find-replace dialog.
  230.    * Return TRUE when something was added to the input buffer.
  231.    */
  232.       int
  233. ! gui_do_findrepl(flags, find_text, repl_text, down)
  234. !     int        flags;        /* one of FRD_REPLACE, FRD_FINDNEXT, etc. */
  235.       char_u    *find_text;
  236.       char_u    *repl_text;
  237.       int        down;        /* Search downwards. */
  238.   {
  239.       garray_T    ga;
  240.       int        i;
  241. +     int        type = (flags & FRD_TYPE_MASK);
  242. +     char_u    *p;
  243.   
  244.       ga_init2(&ga, 1, 100);
  245.   
  246. !     if (type == FRD_REPLACE)
  247.       {
  248.       /* Do the replacement when the text under the cursor matches. */
  249. !     i = STRLEN(find_text);
  250. !     p = ml_get_cursor();
  251. !     if (((flags & FRD_MATCH_CASE)
  252. !             ? STRNCMP(p, find_text, i) == 0
  253. !             : STRNICMP(p, find_text, i) == 0)
  254.           && u_save_cursor() == OK)
  255.       {
  256. !         /* A button was pressed thus undo should be synced. */
  257. !         if (no_u_sync == 0)
  258. !         u_sync();
  259. !         del_bytes((long)i, FALSE);
  260.           ins_str(repl_text);
  261.       }
  262.       }
  263. !     else if (type == FRD_REPLACEALL)
  264.       ga_concat(&ga, (char_u *)"%s/");
  265.   
  266.       ga_concat(&ga, (char_u *)"\\V");
  267. !     if (flags & FRD_MATCH_CASE)
  268. !     ga_concat(&ga, (char_u *)"\\C");
  269. !     else
  270. !     ga_concat(&ga, (char_u *)"\\c");
  271. !     if (flags & FRD_WHOLE_WORD)
  272.       ga_concat(&ga, (char_u *)"\\<");
  273. !     if (type == FRD_REPLACEALL || down)
  274. !     concat_esc(&ga, find_text, '/');    /* escape slashes */
  275. !     else
  276. !     concat_esc(&ga, find_text, '?');    /* escape '?' */
  277. !     if (flags & FRD_WHOLE_WORD)
  278.       ga_concat(&ga, (char_u *)"\\>");
  279.   
  280. !     if (type == FRD_REPLACEALL)
  281.       {
  282. +     /* A button was pressed, thus undo should be synced. */
  283. +     if (no_u_sync == 0)
  284. +         u_sync();
  285.       ga_concat(&ga, (char_u *)"/");
  286. !     concat_esc(&ga, repl_text, '/');    /* escape slashes */
  287.       ga_concat(&ga, (char_u *)"/g");
  288.       do_cmdline_cmd(ga.ga_data);
  289.       }
  290. *** ../vim61.043/src/gui.h    Sat Mar  9 16:17:30 2002
  291. --- src/gui.h    Wed May  1 20:36:02 2002
  292. ***************
  293. *** 482,495 ****
  294.       VW_POS_TOP_CENTER
  295.   } gui_win_pos_T;
  296.   
  297. ! #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK)
  298.   /*
  299.    * Flags used to distinguish the different contexts in which the
  300.    * find/replace callback may be called.
  301.    */
  302. ! # define FR_FINDNEXT    1    /* Find next in find dialog */
  303. ! # define FR_R_FINDNEXT    2    /* Find next in repl dialog */
  304. ! # define FR_REPLACE    3
  305. ! # define FR_REPLACEALL    4
  306. ! # define FR_UNDO    5
  307.   #endif
  308. --- 482,500 ----
  309.       VW_POS_TOP_CENTER
  310.   } gui_win_pos_T;
  311.   
  312. ! #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \
  313. !     || defined(MSWIN_FIND_REPLACE)
  314.   /*
  315.    * Flags used to distinguish the different contexts in which the
  316.    * find/replace callback may be called.
  317.    */
  318. ! # define FRD_FINDNEXT    1    /* Find next in find dialog */
  319. ! # define FRD_R_FINDNEXT    2    /* Find next in repl dialog */
  320. ! # define FRD_REPLACE    3    /* Replace once */
  321. ! # define FRD_REPLACEALL    4    /* Replace remaining matches */
  322. ! # define FRD_UNDO    5    /* Undo replaced text */
  323. ! # define FRD_TYPE_MASK   7    /* Mask for the callback type */
  324. ! /* Flags which change the way searching is done. */
  325. ! # define FRD_WHOLE_WORD    0x08    /* match whole word only */
  326. ! # define FRD_MATCH_CASE    0x10    /* match case */
  327.   #endif
  328. *** ../vim61.043/src/gui_motif.c    Thu Feb 21 21:06:59 2002
  329. --- src/gui_motif.c    Wed May  1 20:07:45 2002
  330. ***************
  331. *** 2579,2585 ****
  332.   typedef struct _SharedFindReplace
  333.   {
  334.       Widget dialog;    /* the main dialog widget */
  335. !     Widget exact;    /* 'Exact match' check button */
  336.       Widget up;        /* search direction 'Up' radio button */
  337.       Widget down;    /* search direction 'Down' radio button */
  338.       Widget what;    /* 'Find what' entry text widget */
  339. --- 2579,2586 ----
  340.   typedef struct _SharedFindReplace
  341.   {
  342.       Widget dialog;    /* the main dialog widget */
  343. !     Widget wword;    /* 'Exact match' check button */
  344. !     Widget mcase;    /* 'match case' check button */
  345.       Widget up;        /* search direction 'Up' radio button */
  346.       Widget down;    /* search direction 'Down' radio button */
  347.       Widget what;    /* 'Find what' entry text widget */
  348. ***************
  349. *** 2648,2657 ****
  350.       long_u    flags = (long_u)client_data;
  351.       char    *find_text, *repl_text;
  352.       Boolean    direction_down = TRUE;
  353. !     Boolean    exact_match = FALSE;
  354.       SharedFindReplace *sfr;
  355.   
  356. !     if (flags == FR_UNDO)
  357.       {
  358.       char_u    *save_cpo = p_cpo;
  359.   
  360. --- 2649,2659 ----
  361.       long_u    flags = (long_u)client_data;
  362.       char    *find_text, *repl_text;
  363.       Boolean    direction_down = TRUE;
  364. !     Boolean    wword;
  365. !     Boolean    mcase;
  366.       SharedFindReplace *sfr;
  367.   
  368. !     if (flags == FRD_UNDO)
  369.       {
  370.       char_u    *save_cpo = p_cpo;
  371.   
  372. ***************
  373. *** 2664,2670 ****
  374.       }
  375.   
  376.       /* Get the search/replace strings from the dialog */
  377. !     if (flags == FR_FINDNEXT)
  378.       {
  379.       repl_text = NULL;
  380.       sfr = &find_widgets;
  381. --- 2666,2672 ----
  382.       }
  383.   
  384.       /* Get the search/replace strings from the dialog */
  385. !     if (flags == FRD_FINDNEXT)
  386.       {
  387.       repl_text = NULL;
  388.       sfr = &find_widgets;
  389. ***************
  390. *** 2676,2685 ****
  391.       }
  392.       find_text = XmTextFieldGetString(sfr->what);
  393.       XtVaGetValues(sfr->down, XmNset, &direction_down, NULL);
  394. !     XtVaGetValues(sfr->exact, XmNset, &exact_match, NULL);
  395.   
  396.       (void)gui_do_findrepl((int)flags, (char_u *)find_text, (char_u *)repl_text,
  397. !                          direction_down, exact_match);
  398.   
  399.       if (find_text != NULL)
  400.       XtFree(find_text);
  401. --- 2678,2692 ----
  402.       }
  403.       find_text = XmTextFieldGetString(sfr->what);
  404.       XtVaGetValues(sfr->down, XmNset, &direction_down, NULL);
  405. !     XtVaGetValues(sfr->wword, XmNset, &wword, NULL);
  406. !     XtVaGetValues(sfr->mcase, XmNset, &mcase, NULL);
  407. !     if (wword)
  408. !     flags |= FRD_WHOLE_WORD;
  409. !     if (mcase)
  410. !     flags |= FRD_MATCH_CASE;
  411.   
  412.       (void)gui_do_findrepl((int)flags, (char_u *)find_text, (char_u *)repl_text,
  413. !                                   direction_down);
  414.   
  415.       if (find_text != NULL)
  416.       XtFree(find_text);
  417. ***************
  418. *** 2715,2725 ****
  419.       Widget        separator;
  420.       Widget        input_form;
  421.       Widget        button_form;
  422.       Widget        frame;
  423.       XmString        str;
  424.       int            n;
  425.       Arg            args[6];
  426. !     int            exact_word = FALSE;
  427.       Dimension        width;
  428.       Dimension        widest;
  429.       char_u        *entry_text;
  430. --- 2722,2734 ----
  431.       Widget        separator;
  432.       Widget        input_form;
  433.       Widget        button_form;
  434. +     Widget        toggle_form;
  435.       Widget        frame;
  436.       XmString        str;
  437.       int            n;
  438.       Arg            args[6];
  439. !     int            wword = FALSE;
  440. !     int            mcase = !p_ic;
  441.       Dimension        width;
  442.       Dimension        widest;
  443.       char_u        *entry_text;
  444. ***************
  445. *** 2727,2733 ****
  446.       frdp = do_replace ? &repl_widgets : &find_widgets;
  447.   
  448.       /* Get the search string to use. */
  449. !     entry_text = get_find_dialog_text(arg, &exact_word);
  450.   
  451.       /* If the dialog already exists, just raise it. */
  452.       if (frdp->dialog)
  453. --- 2736,2742 ----
  454.       frdp = do_replace ? &repl_widgets : &find_widgets;
  455.   
  456.       /* Get the search string to use. */
  457. !     entry_text = get_find_dialog_text(arg, &wword, &mcase);
  458.   
  459.       /* If the dialog already exists, just raise it. */
  460.       if (frdp->dialog)
  461. ***************
  462. *** 2745,2751 ****
  463.           XmTextFieldSetString(frdp->what, (char *)entry_text);
  464.       vim_free(entry_text);
  465.   
  466. !     XtVaSetValues(frdp->exact, XmNset, exact_word, NULL);
  467.       return;
  468.       }
  469.   
  470. --- 2754,2760 ----
  471.           XmTextFieldSetString(frdp->what, (char *)entry_text);
  472.       vim_free(entry_text);
  473.   
  474. !     XtVaSetValues(frdp->wword, XmNset, wword, NULL);
  475.       return;
  476.       }
  477.   
  478. ***************
  479. *** 2788,2794 ****
  480.   
  481.       XtAddCallback(frdp->find, XmNactivateCallback,
  482.           find_replace_callback,
  483. !         (XtPointer) (do_replace ? FR_R_FINDNEXT : FR_FINDNEXT));
  484.   
  485.       if (do_replace)
  486.       {
  487. --- 2797,2803 ----
  488.   
  489.       XtAddCallback(frdp->find, XmNactivateCallback,
  490.           find_replace_callback,
  491. !         (XtPointer) (do_replace ? FRD_R_FINDNEXT : FRD_FINDNEXT));
  492.   
  493.       if (do_replace)
  494.       {
  495. ***************
  496. *** 2803,2809 ****
  497.           NULL);
  498.       XmStringFree(str);
  499.       XtAddCallback(frdp->replace, XmNactivateCallback,
  500. !         find_replace_callback, (XtPointer)FR_REPLACE);
  501.   
  502.       str = XmStringCreateSimple(_("Replace All"));
  503.       frdp->all = XtVaCreateManagedWidget("replaceAllButton",
  504. --- 2812,2818 ----
  505.           NULL);
  506.       XmStringFree(str);
  507.       XtAddCallback(frdp->replace, XmNactivateCallback,
  508. !         find_replace_callback, (XtPointer)FRD_REPLACE);
  509.   
  510.       str = XmStringCreateSimple(_("Replace All"));
  511.       frdp->all = XtVaCreateManagedWidget("replaceAllButton",
  512. ***************
  513. *** 2816,2822 ****
  514.           NULL);
  515.       XmStringFree(str);
  516.       XtAddCallback(frdp->all, XmNactivateCallback,
  517. !         find_replace_callback, (XtPointer)FR_REPLACEALL);
  518.   
  519.       str = XmStringCreateSimple(_("Undo"));
  520.       frdp->undo = XtVaCreateManagedWidget("undoButton",
  521. --- 2825,2831 ----
  522.           NULL);
  523.       XmStringFree(str);
  524.       XtAddCallback(frdp->all, XmNactivateCallback,
  525. !         find_replace_callback, (XtPointer)FRD_REPLACEALL);
  526.   
  527.       str = XmStringCreateSimple(_("Undo"));
  528.       frdp->undo = XtVaCreateManagedWidget("undoButton",
  529. ***************
  530. *** 2829,2835 ****
  531.           NULL);
  532.       XmStringFree(str);
  533.       XtAddCallback(frdp->undo, XmNactivateCallback,
  534. !         find_replace_callback, (XtPointer)FR_UNDO);
  535.       }
  536.   
  537.       str = XmStringCreateSimple(_("Cancel"));
  538. --- 2838,2844 ----
  539.           NULL);
  540.       XmStringFree(str);
  541.       XtAddCallback(frdp->undo, XmNactivateCallback,
  542. !         find_replace_callback, (XtPointer)FRD_UNDO);
  543.       }
  544.   
  545.       str = XmStringCreateSimple(_("Cancel"));
  546. ***************
  547. *** 2901,2907 ****
  548.               NULL);
  549.   
  550.           XtAddCallback(frdp->with, XmNactivateCallback,
  551. !             find_replace_callback, (XtPointer) FR_R_FINDNEXT);
  552.   
  553.           str = XmStringCreateSimple(_("Replace with:"));
  554.           label_with = XtVaCreateManagedWidget("withLabel",
  555. --- 2910,2916 ----
  556.               NULL);
  557.   
  558.           XtAddCallback(frdp->with, XmNactivateCallback,
  559. !             find_replace_callback, (XtPointer) FRD_R_FINDNEXT);
  560.   
  561.           str = XmStringCreateSimple(_("Replace with:"));
  562.           label_with = XtVaCreateManagedWidget("withLabel",
  563. ***************
  564. *** 2932,2938 ****
  565.            * Make the entry activation do the search.
  566.            */
  567.           XtAddCallback(frdp->what, XmNactivateCallback,
  568. !             find_replace_callback, (XtPointer)FR_FINDNEXT);
  569.       }
  570.       XtAddEventHandler(frdp->what, KeyPressMask, False,
  571.                   (XtEventHandler)find_replace_keypress,
  572. --- 2941,2947 ----
  573.            * Make the entry activation do the search.
  574.            */
  575.           XtAddCallback(frdp->what, XmNactivateCallback,
  576. !             find_replace_callback, (XtPointer)FRD_FINDNEXT);
  577.       }
  578.       XtAddEventHandler(frdp->what, KeyPressMask, False,
  579.                   (XtEventHandler)find_replace_keypress,
  580. ***************
  581. *** 3005,3026 ****
  582.       XtManageChild(frame);
  583.       }
  584.   
  585. !     str = XmStringCreateSimple(_("Match exact word only"));
  586. !     frdp->exact = XtVaCreateManagedWidget("exactToggle",
  587. !         xmToggleButtonGadgetClass, frdp->dialog,
  588. !         XmNlabelString, str,
  589. !         XmNorientation, XmVERTICAL,
  590. !         XmNentryAlignment, XmALIGNMENT_BEGINNING,
  591.           XmNleftAttachment, XmATTACH_FORM,
  592.           XmNleftOffset, 4,
  593.           XmNrightAttachment, XmATTACH_WIDGET,
  594.           XmNrightWidget, frame,
  595.           XmNrightOffset, 4,
  596.           XmNbottomAttachment, XmATTACH_FORM,
  597.           XmNbottomOffset, 4,
  598. !         XmNset, exact_word,
  599.           NULL);
  600.       XmStringFree(str);
  601.   
  602.       if (entry_text != NULL)
  603.       XmTextFieldSetString(frdp->what, (char *)entry_text);
  604. --- 3014,3059 ----
  605.       XtManageChild(frame);
  606.       }
  607.   
  608. !     toggle_form = XtVaCreateWidget("toggleForm",
  609. !         xmFormWidgetClass,    frdp->dialog,
  610.           XmNleftAttachment, XmATTACH_FORM,
  611.           XmNleftOffset, 4,
  612.           XmNrightAttachment, XmATTACH_WIDGET,
  613.           XmNrightWidget, frame,
  614.           XmNrightOffset, 4,
  615. +         XmNtopAttachment, XmATTACH_WIDGET,
  616. +         XmNtopWidget, input_form,
  617. +         XmNtopOffset, 4,
  618.           XmNbottomAttachment, XmATTACH_FORM,
  619.           XmNbottomOffset, 4,
  620. !         NULL);
  621. !     str = XmStringCreateSimple(_("Match whole word only"));
  622. !     frdp->wword = XtVaCreateManagedWidget("wordToggle",
  623. !         xmToggleButtonGadgetClass, toggle_form,
  624. !         XmNlabelString, str,
  625. !         XmNtopAttachment, XmATTACH_FORM,
  626. !         XmNtopOffset, 4,
  627. !         XmNleftAttachment, XmATTACH_FORM,
  628. !         XmNleftOffset, 4,
  629. !         XmNset, wword,
  630.           NULL);
  631.       XmStringFree(str);
  632. +     str = XmStringCreateSimple(_("Match case"));
  633. +     frdp->mcase = XtVaCreateManagedWidget("caseToggle",
  634. +         xmToggleButtonGadgetClass, toggle_form,
  635. +         XmNlabelString, str,
  636. +         XmNleftAttachment, XmATTACH_FORM,
  637. +         XmNleftOffset, 4,
  638. +         XmNtopAttachment, XmATTACH_WIDGET,
  639. +         XmNtopWidget, frdp->wword,
  640. +         XmNtopOffset, 4,
  641. +         XmNset, mcase,
  642. +         NULL);
  643. +     XmStringFree(str);
  644. +     XtManageChild(toggle_form);
  645.   
  646.       if (entry_text != NULL)
  647.       XmTextFieldSetString(frdp->what, (char *)entry_text);
  648. *** ../vim61.043/src/gui_gtk.c    Thu Feb 28 16:27:52 2002
  649. --- src/gui_gtk.c    Wed May  1 20:07:56 2002
  650. ***************
  651. *** 119,125 ****
  652.   static void entry_changed_cb(GtkWidget *entry, GtkWidget *dialog);
  653.   static void find_direction_cb(GtkWidget *widget, gpointer data);
  654.   static void find_replace_cb(GtkWidget *widget, unsigned int flags);
  655. ! static void exact_match_cb(GtkWidget *widget, gpointer data);
  656.   static void repl_dir_cb(GtkWidget * widget, gpointer data);
  657.   
  658.   /*
  659. --- 119,126 ----
  660.   static void entry_changed_cb(GtkWidget *entry, GtkWidget *dialog);
  661.   static void find_direction_cb(GtkWidget *widget, gpointer data);
  662.   static void find_replace_cb(GtkWidget *widget, unsigned int flags);
  663. ! static void wword_match_cb(GtkWidget *widget, gpointer data);
  664. ! static void mcase_match_cb(GtkWidget *widget, gpointer data);
  665.   static void repl_dir_cb(GtkWidget * widget, gpointer data);
  666.   
  667.   /*
  668. ***************
  669. *** 1474,1480 ****
  670.   typedef struct _SharedFindReplace
  671.   {
  672.       GtkWidget *dialog;    /* the main dialog widget */
  673. !     GtkWidget *exact;    /* 'Exact match' check button */
  674.       GtkWidget *up;    /* search direction 'Up' radio button */
  675.       GtkWidget *down;    /* search direction 'Down' radio button */
  676.       GtkWidget *what;    /* 'Find what' entry text widget */
  677. --- 1475,1482 ----
  678.   typedef struct _SharedFindReplace
  679.   {
  680.       GtkWidget *dialog;    /* the main dialog widget */
  681. !     GtkWidget *wword;    /* 'Whole word only' check button */
  682. !     GtkWidget *mcase;    /* 'Match case' check button */
  683.       GtkWidget *up;    /* search direction 'Up' radio button */
  684.       GtkWidget *down;    /* search direction 'Down' radio button */
  685.       GtkWidget *what;    /* 'Find what' entry text widget */
  686. ***************
  687. *** 1533,1544 ****
  688.       gboolean    sensitive;
  689.       SharedFindReplace *frdp;
  690.       char_u    *entry_text;
  691. !     int        exact_word = FALSE;
  692.   
  693.       frdp = (do_replace) ? (&repl_widgets) : (&find_widgets);
  694.   
  695.       /* Get the search string to use. */
  696. !     entry_text = get_find_dialog_text(arg, &exact_word);
  697.   
  698.       /*
  699.        * If the dialog already exists, just raise it.
  700. --- 1535,1547 ----
  701.       gboolean    sensitive;
  702.       SharedFindReplace *frdp;
  703.       char_u    *entry_text;
  704. !     int        wword = FALSE;
  705. !     int        mcase = !p_ic;
  706.   
  707.       frdp = (do_replace) ? (&repl_widgets) : (&find_widgets);
  708.   
  709.       /* Get the search string to use. */
  710. !     entry_text = get_find_dialog_text(arg, &wword, &mcase);
  711.   
  712.       /*
  713.        * If the dialog already exists, just raise it.
  714. ***************
  715. *** 1560,1567 ****
  716.       if (entry_text != NULL)
  717.       {
  718.           gtk_entry_set_text(GTK_ENTRY(frdp->what), (char *)entry_text);
  719. !         gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->exact),
  720. !                             (gboolean)exact_word);
  721.       }
  722.       gdk_window_raise(frdp->dialog->window);
  723.   
  724. --- 1563,1572 ----
  725.       if (entry_text != NULL)
  726.       {
  727.           gtk_entry_set_text(GTK_ENTRY(frdp->what), (char *)entry_text);
  728. !         gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->wword),
  729. !                                  (gboolean)wword);
  730. !         gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->mcase),
  731. !                                  (gboolean)mcase);
  732.       }
  733.       gdk_window_raise(frdp->dialog->window);
  734.   
  735. ***************
  736. *** 1626,1632 ****
  737.       frdp->with = gtk_entry_new();
  738.       gtk_signal_connect(GTK_OBJECT(frdp->with), "activate",
  739.                  GTK_SIGNAL_FUNC(find_replace_cb),
  740. !                (gpointer) FR_R_FINDNEXT);
  741.       gtk_signal_connect_after(GTK_OBJECT(frdp->with), "key_press_event",
  742.                    GTK_SIGNAL_FUNC(find_key_press_event),
  743.                    (gpointer) frdp);
  744. --- 1631,1637 ----
  745.       frdp->with = gtk_entry_new();
  746.       gtk_signal_connect(GTK_OBJECT(frdp->with), "activate",
  747.                  GTK_SIGNAL_FUNC(find_replace_cb),
  748. !                (gpointer) FRD_R_FINDNEXT);
  749.       gtk_signal_connect_after(GTK_OBJECT(frdp->with), "key_press_event",
  750.                    GTK_SIGNAL_FUNC(find_key_press_event),
  751.                    (gpointer) frdp);
  752. ***************
  753. *** 1647,1666 ****
  754.        */
  755.       gtk_signal_connect(GTK_OBJECT(frdp->what), "activate",
  756.                  GTK_SIGNAL_FUNC(find_replace_cb),
  757. !                (gpointer) FR_FINDNEXT);
  758.       }
  759.   
  760. !     /* exact match only button */
  761. !     frdp->exact = gtk_check_button_new_with_label(_("Match exact word only"));
  762. !     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->exact),
  763. !                             (gboolean)exact_word);
  764. !     gtk_signal_connect(GTK_OBJECT(frdp->exact), "clicked",
  765. !                GTK_SIGNAL_FUNC(exact_match_cb), NULL);
  766.       if (do_replace)
  767. !     gtk_table_attach(GTK_TABLE(table), frdp->exact, 0, 1023, 3, 4,
  768.                GTK_FILL, GTK_EXPAND, 2, 2);
  769.       else
  770. !     gtk_table_attach(GTK_TABLE(table), frdp->exact, 0, 1023, 2, 3,
  771.                GTK_FILL, GTK_EXPAND, 2, 2);
  772.   
  773.       tmp = gtk_frame_new(_("Direction"));
  774. --- 1652,1684 ----
  775.        */
  776.       gtk_signal_connect(GTK_OBJECT(frdp->what), "activate",
  777.                  GTK_SIGNAL_FUNC(find_replace_cb),
  778. !                (gpointer) FRD_FINDNEXT);
  779.       }
  780.   
  781. !     /* whole word only button */
  782. !     frdp->wword = gtk_check_button_new_with_label(_("Match whole word only"));
  783. !     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->wword),
  784. !                             (gboolean)wword);
  785. !     gtk_signal_connect(GTK_OBJECT(frdp->wword), "clicked",
  786. !                GTK_SIGNAL_FUNC(wword_match_cb), NULL);
  787.       if (do_replace)
  788. !     gtk_table_attach(GTK_TABLE(table), frdp->wword, 0, 1023, 2, 3,
  789.                GTK_FILL, GTK_EXPAND, 2, 2);
  790.       else
  791. !     gtk_table_attach(GTK_TABLE(table), frdp->wword, 0, 1023, 1, 2,
  792. !              GTK_FILL, GTK_EXPAND, 2, 2);
  793. !     /* match case button */
  794. !     frdp->mcase = gtk_check_button_new_with_label(_("Match case"));
  795. !     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->mcase),
  796. !                                  (gboolean)mcase);
  797. !     gtk_signal_connect(GTK_OBJECT(frdp->mcase), "clicked",
  798. !                GTK_SIGNAL_FUNC(mcase_match_cb), NULL);
  799. !     if (do_replace)
  800. !     gtk_table_attach(GTK_TABLE(table), frdp->mcase, 0, 1023, 3, 4,
  801. !              GTK_FILL, GTK_EXPAND, 2, 2);
  802. !     else
  803. !     gtk_table_attach(GTK_TABLE(table), frdp->mcase, 0, 1023, 2, 3,
  804.                GTK_FILL, GTK_EXPAND, 2, 2);
  805.   
  806.       tmp = gtk_frame_new(_("Direction"));
  807. ***************
  808. *** 1706,1716 ****
  809.       if (do_replace)
  810.       gtk_signal_connect(GTK_OBJECT(frdp->find), "clicked",
  811.                  GTK_SIGNAL_FUNC(find_replace_cb),
  812. !                (gpointer) FR_R_FINDNEXT);
  813.       else
  814.       gtk_signal_connect(GTK_OBJECT(frdp->find), "clicked",
  815.                  GTK_SIGNAL_FUNC(find_replace_cb),
  816. !                (gpointer) FR_FINDNEXT);
  817.       GTK_WIDGET_SET_FLAGS(frdp->find, GTK_CAN_DEFAULT);
  818.       gtk_box_pack_start(GTK_BOX(actionarea), frdp->find, FALSE, FALSE, 0);
  819.       gtk_widget_grab_default(frdp->find);
  820. --- 1724,1734 ----
  821.       if (do_replace)
  822.       gtk_signal_connect(GTK_OBJECT(frdp->find), "clicked",
  823.                  GTK_SIGNAL_FUNC(find_replace_cb),
  824. !                (gpointer) FRD_R_FINDNEXT);
  825.       else
  826.       gtk_signal_connect(GTK_OBJECT(frdp->find), "clicked",
  827.                  GTK_SIGNAL_FUNC(find_replace_cb),
  828. !                (gpointer) FRD_FINDNEXT);
  829.       GTK_WIDGET_SET_FLAGS(frdp->find, GTK_CAN_DEFAULT);
  830.       gtk_box_pack_start(GTK_BOX(actionarea), frdp->find, FALSE, FALSE, 0);
  831.       gtk_widget_grab_default(frdp->find);
  832. ***************
  833. *** 1724,1730 ****
  834.       gtk_box_pack_start(GTK_BOX(actionarea), frdp->replace, FALSE, FALSE, 0);
  835.       gtk_signal_connect(GTK_OBJECT(frdp->replace), "clicked",
  836.                  GTK_SIGNAL_FUNC(find_replace_cb),
  837. !                (gpointer) FR_REPLACE);
  838.   
  839.       /* 'Replace All' button */
  840.       frdp->all = gtk_button_new_with_label(_("Replace All"));
  841. --- 1742,1748 ----
  842.       gtk_box_pack_start(GTK_BOX(actionarea), frdp->replace, FALSE, FALSE, 0);
  843.       gtk_signal_connect(GTK_OBJECT(frdp->replace), "clicked",
  844.                  GTK_SIGNAL_FUNC(find_replace_cb),
  845. !                (gpointer) FRD_REPLACE);
  846.   
  847.       /* 'Replace All' button */
  848.       frdp->all = gtk_button_new_with_label(_("Replace All"));
  849. ***************
  850. *** 1733,1739 ****
  851.       gtk_box_pack_start(GTK_BOX(actionarea), frdp->all, FALSE, FALSE, 0);
  852.       gtk_signal_connect(GTK_OBJECT(frdp->all), "clicked",
  853.                  GTK_SIGNAL_FUNC(find_replace_cb),
  854. !                (gpointer) FR_REPLACEALL);
  855.       }
  856.   
  857.       /* 'Cancel' button */
  858. --- 1751,1757 ----
  859.       gtk_box_pack_start(GTK_BOX(actionarea), frdp->all, FALSE, FALSE, 0);
  860.       gtk_signal_connect(GTK_OBJECT(frdp->all), "clicked",
  861.                  GTK_SIGNAL_FUNC(find_replace_cb),
  862. !                (gpointer) FRD_REPLACEALL);
  863.       }
  864.   
  865.       /* 'Cancel' button */
  866. ***************
  867. *** 1841,1851 ****
  868.   {
  869.       char    *find_text, *repl_text;
  870.       gboolean    direction_down = TRUE;
  871. -     gboolean    exact_match = FALSE;
  872.       SharedFindReplace *sfr;
  873.   
  874.       /* Get the search/replace strings from the dialog */
  875. !     if (flags == FR_FINDNEXT)
  876.       {
  877.       repl_text = NULL;
  878.       sfr = &find_widgets;
  879. --- 1859,1868 ----
  880.   {
  881.       char    *find_text, *repl_text;
  882.       gboolean    direction_down = TRUE;
  883.       SharedFindReplace *sfr;
  884.   
  885.       /* Get the search/replace strings from the dialog */
  886. !     if (flags == FRD_FINDNEXT)
  887.       {
  888.       repl_text = NULL;
  889.       sfr = &find_widgets;
  890. ***************
  891. *** 1857,1866 ****
  892.       }
  893.       find_text = gtk_entry_get_text(GTK_ENTRY(sfr->what));
  894.       direction_down = GTK_TOGGLE_BUTTON(sfr->down)->active;
  895. !     exact_match = GTK_TOGGLE_BUTTON(sfr->exact)->active;
  896.   
  897.       if (gui_do_findrepl((int)flags, (char_u *)find_text, (char_u *)repl_text,
  898. !                        (int)direction_down, (int)exact_match))
  899.       if (gtk_main_level() > 0)
  900.           gtk_main_quit();    /* make sure cmd will be handled immediately */
  901.   }
  902. --- 1874,1886 ----
  903.       }
  904.       find_text = gtk_entry_get_text(GTK_ENTRY(sfr->what));
  905.       direction_down = GTK_TOGGLE_BUTTON(sfr->down)->active;
  906. !     if (GTK_TOGGLE_BUTTON(sfr->wword)->active)
  907. !     flags |= FRD_WHOLE_WORD;
  908. !     if (GTK_TOGGLE_BUTTON(sfr->mcase)->active)
  909. !     flags |= FRD_MATCH_CASE;
  910.   
  911.       if (gui_do_findrepl((int)flags, (char_u *)find_text, (char_u *)repl_text,
  912. !                              (int)direction_down))
  913.       if (gtk_main_level() > 0)
  914.           gtk_main_quit();    /* make sure cmd will be handled immediately */
  915.   }
  916. ***************
  917. *** 1912,1927 ****
  918.   
  919.   /*ARGSUSED*/
  920.       static void
  921. ! exact_match_cb(GtkWidget * widget, gpointer data)
  922.   {
  923. !     gboolean exact_match = GTK_TOGGLE_BUTTON(widget)->active;
  924.   
  925.       if (find_widgets.dialog)
  926. !     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(find_widgets.exact),
  927. !                     exact_match);
  928.       if (repl_widgets.dialog)
  929. !     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(repl_widgets.exact),
  930. !                     exact_match);
  931.   }
  932.   
  933.       static void
  934. --- 1932,1961 ----
  935.   
  936.   /*ARGSUSED*/
  937.       static void
  938. ! wword_match_cb(GtkWidget * widget, gpointer data)
  939. ! {
  940. !     gboolean active = GTK_TOGGLE_BUTTON(widget)->active;
  941. !     if (find_widgets.dialog)
  942. !     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(find_widgets.wword),
  943. !                     active);
  944. !     if (repl_widgets.dialog)
  945. !     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(repl_widgets.wword),
  946. !                     active);
  947. ! }
  948. ! /*ARGSUSED*/
  949. !     static void
  950. ! mcase_match_cb(GtkWidget * widget, gpointer data)
  951.   {
  952. !     gboolean active = GTK_TOGGLE_BUTTON(widget)->active;
  953.   
  954.       if (find_widgets.dialog)
  955. !     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(find_widgets.mcase),
  956. !                     active);
  957.       if (repl_widgets.dialog)
  958. !     gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(repl_widgets.mcase),
  959. !                     active);
  960.   }
  961.   
  962.       static void
  963. *** ../vim61.043/src/gui_w48.c    Sat Mar 30 17:05:41 2002
  964. --- src/gui_w48.c    Wed May  1 21:00:30 2002
  965. ***************
  966. *** 44,53 ****
  967.   # include "glbl_ime.h"
  968.   #endif
  969.   
  970. - #ifdef FEAT_SMALL
  971. - # define MSWIN_FIND_REPLACE    /* include code for find/replace dialog */
  972. - # define MSWIN_FR_BUFSIZE 256
  973. - #endif
  974.   #ifdef FEAT_MENU
  975.   # define MENUHINTS        /* show menu hints in command line */
  976.   #endif
  977. --- 44,49 ----
  978. ***************
  979. *** 141,148 ****
  980.   static int        destroying = FALSE;    /* call DestroyWindow() ourselves */
  981.   
  982.   #ifdef MSWIN_FIND_REPLACE
  983. ! static UINT        s_findrep_msg = 0;
  984.   static FINDREPLACE    s_findrep_struct;
  985.   #endif
  986.   
  987.   static HINSTANCE    s_hinst = NULL;
  988. --- 137,147 ----
  989.   static int        destroying = FALSE;    /* call DestroyWindow() ourselves */
  990.   
  991.   #ifdef MSWIN_FIND_REPLACE
  992. ! static UINT        s_findrep_msg = 0;    /* set in gui_w[16/32].c */
  993.   static FINDREPLACE    s_findrep_struct;
  994. + static HWND        s_findrep_hwnd = NULL;
  995. + static int        s_findrep_is_find;    /* TRUE for find dialog, FALSE
  996. +                            for find/replace dialog */
  997.   #endif
  998.   
  999.   static HINSTANCE    s_hinst = NULL;
  1000. ***************
  1001. *** 267,276 ****
  1002.   static UINT        s_wait_timer = 0;   /* Timer for get char from user */
  1003.   static int        s_timed_out = FALSE;
  1004.   static int        dead_key = 0;    /* 0 - no dead key, 1 - dead key pressed */
  1005. - #ifdef MSWIN_FIND_REPLACE
  1006. - static HWND        s_findrep_hwnd = NULL;
  1007. - static int        s_findrep_is_find;
  1008. - #endif
  1009.   
  1010.   /*
  1011.    * For control IME.
  1012. --- 266,271 ----
  1013. ***************
  1014. *** 764,900 ****
  1015.   }
  1016.   #endif
  1017.   
  1018. ! #if defined(MSWIN_FIND_REPLACE)
  1019. ! /*
  1020. !  * Copy the "from" string to the end of cmd[], escaping any '/'.
  1021. !  */
  1022. !     static void
  1023. ! fr_copy_escape(char *from, char_u *to)
  1024. ! {
  1025. !     char    *s;
  1026. !     char_u    *d;
  1027. !     d = to + STRLEN(to);
  1028. !     for (s = from; *s != NUL; ++s)
  1029. !     {
  1030. !     if (*s == '/')
  1031. !         *d++ = '\\';
  1032. !     *d++ = *s;
  1033. !     }
  1034. !     *d = NUL;
  1035. ! }
  1036. !     static void
  1037. ! fr_setwhat(char_u *cmd)
  1038. ! {
  1039. !     if (s_findrep_struct.Flags & FR_WHOLEWORD)
  1040. !     STRCAT(cmd, "\\<");
  1041. !     fr_copy_escape(s_findrep_struct.lpstrFindWhat, cmd);
  1042. !     if (s_findrep_struct.Flags & FR_WHOLEWORD)
  1043. !     STRCAT(cmd, "\\>");
  1044. ! }
  1045. !     static void
  1046. ! fr_setreplcmd(char_u *cmd)
  1047. ! {
  1048. !     STRCAT(cmd, ":%sno/");
  1049. !     fr_setwhat(cmd);
  1050. !     STRCAT(cmd, "/");
  1051. !     fr_copy_escape(s_findrep_struct.lpstrReplaceWith, cmd);
  1052. !     if (s_findrep_struct.Flags & FR_REPLACE)
  1053. !     STRCAT(cmd, "/gc");
  1054. !     else
  1055. !     STRCAT(cmd, "/g");
  1056. !     if (s_findrep_struct.Flags & FR_MATCHCASE)
  1057. !     STRCAT(cmd, "I");
  1058. !     else
  1059. !     STRCAT(cmd, "i");
  1060. !     STRCAT(cmd, "\r");
  1061. ! }
  1062.   /*
  1063.    * Handle a Find/Replace window message.
  1064.    */
  1065.       static void
  1066.   _OnFindRepl(void)
  1067.   {
  1068. !     char_u cmd[MSWIN_FR_BUFSIZE * 2 + 100]; //XXX kludge
  1069. !     /* Add a char before the command if needed */
  1070. !     if (State & INSERT)
  1071. !     cmd[0] = Ctrl_O;
  1072. !     else if ((State & NORMAL) == 0 && State != CONFIRM)
  1073. !     cmd[0] = ESC;
  1074. !     else
  1075. !     cmd[0] = NUL;
  1076. !     cmd[1] = NUL;
  1077.   
  1078. !     if (s_findrep_struct.Flags & FR_DIALOGTERM)
  1079. !     {
  1080. !     if (State == CONFIRM)
  1081. !         add_to_input_buf("q", 1);
  1082. !     return;
  1083. !     }
  1084.   
  1085.       if (s_findrep_struct.Flags & FR_FINDNEXT)
  1086.       {
  1087. !     if (State == CONFIRM)
  1088. !         STRCAT(cmd, "n");
  1089. !     else
  1090. !     {
  1091. !         /* Set 'ignorecase' just for this search command. */
  1092. !         if (!(s_findrep_struct.Flags & FR_MATCHCASE) == !p_ic)
  1093. !         {
  1094. !         if (p_ic)
  1095. !             STRCAT(cmd, ":set noic\r");
  1096. !         else
  1097. !             STRCAT(cmd, ":set ic\r");
  1098. !         if (State & INSERT)
  1099. !             STRCAT(cmd, "\017");    /* CTRL-O */
  1100. !         }
  1101. !         if (s_findrep_struct.Flags & FR_DOWN)
  1102. !         STRCAT(cmd, "/");
  1103. !         else
  1104. !         STRCAT(cmd, "?");
  1105. !         fr_setwhat(cmd);
  1106. !         STRCAT(cmd, "\r");
  1107. !         if (!(s_findrep_struct.Flags & FR_MATCHCASE) == !p_ic)
  1108. !         {
  1109. !         if (State & INSERT)
  1110. !             STRCAT(cmd, "\017");    /* CTRL-O */
  1111. !         if (p_ic)
  1112. !             STRCAT(cmd, ":set ic\r");
  1113. !         else
  1114. !             STRCAT(cmd, ":set noic\r");
  1115. !         }
  1116. !     }
  1117. !     /*
  1118. !      * Give main window the focus back: this is so
  1119. !      * the cursor isn't hollow.
  1120. !      */
  1121.       (void)SetFocus(s_hwnd);
  1122.       }
  1123.       else if (s_findrep_struct.Flags & FR_REPLACE)
  1124.       {
  1125. !     if (State == CONFIRM)
  1126. !         STRCAT(cmd, "y");
  1127. !     else
  1128. !         fr_setreplcmd(cmd);
  1129. !     /*
  1130. !      * Give main window the focus back: this is to allow
  1131. !      * handling of the confirmation y/n/a/q stuff.
  1132. !      */
  1133.       (void)SetFocus(s_hwnd);
  1134.       }
  1135.       else if (s_findrep_struct.Flags & FR_REPLACEALL)
  1136.       {
  1137. !     if (State == CONFIRM)
  1138. !         STRCAT(cmd, "a");
  1139. !     else
  1140. !         fr_setreplcmd(cmd);
  1141.       }
  1142. -     if (*cmd)
  1143. -     add_to_input_buf(cmd, (int)STRLEN(cmd));
  1144.   }
  1145.   #endif
  1146.   
  1147. --- 759,808 ----
  1148.   }
  1149.   #endif
  1150.   
  1151. ! #ifdef MSWIN_FIND_REPLACE
  1152.   /*
  1153.    * Handle a Find/Replace window message.
  1154.    */
  1155.       static void
  1156.   _OnFindRepl(void)
  1157.   {
  1158. !     int        flags = 0;
  1159. !     int        down;
  1160.   
  1161. !     /* if (s_findrep_struct.Flags & FR_DIALOGTERM)  nothing to do */
  1162.   
  1163.       if (s_findrep_struct.Flags & FR_FINDNEXT)
  1164.       {
  1165. !     flags = FRD_FINDNEXT;
  1166. !     /* Give main window the focus back: this is so the cursor isn't
  1167. !      * hollow. */
  1168.       (void)SetFocus(s_hwnd);
  1169.       }
  1170.       else if (s_findrep_struct.Flags & FR_REPLACE)
  1171.       {
  1172. !     flags = FRD_REPLACE;
  1173. !     /* Give main window the focus back: this is so the cursor isn't
  1174. !      * hollow. */
  1175.       (void)SetFocus(s_hwnd);
  1176.       }
  1177.       else if (s_findrep_struct.Flags & FR_REPLACEALL)
  1178.       {
  1179. !     flags = FRD_REPLACEALL;
  1180. !     }
  1181. !     if (flags != 0)
  1182. !     {
  1183. !     /* Call the generic GUI function to do the actual work. */
  1184. !     if (s_findrep_struct.Flags & FR_WHOLEWORD)
  1185. !         flags |= FRD_WHOLE_WORD;
  1186. !     if (s_findrep_struct.Flags & FR_MATCHCASE)
  1187. !         flags |= FRD_MATCH_CASE;
  1188. !     down = (s_findrep_struct.Flags & FR_DOWN) != 0;
  1189. !     gui_do_findrepl(flags, s_findrep_struct.lpstrFindWhat,
  1190. !                      s_findrep_struct.lpstrReplaceWith, down);
  1191.       }
  1192.   }
  1193.   #endif
  1194.   
  1195. ***************
  1196. *** 1533,1539 ****
  1197.   
  1198.   #ifdef MSWIN_FIND_REPLACE
  1199.       /* Don't process messages used by the dialog */
  1200. !     if ((s_findrep_hwnd) && (IsDialogMessage(s_findrep_hwnd, &msg)))
  1201.       {
  1202.       HandleMouseHide(msg.message, msg.lParam);
  1203.       return;
  1204. --- 1441,1447 ----
  1205.   
  1206.   #ifdef MSWIN_FIND_REPLACE
  1207.       /* Don't process messages used by the dialog */
  1208. !     if (s_findrep_hwnd != NULL && IsDialogMessage(s_findrep_hwnd, &msg))
  1209.       {
  1210.       HandleMouseHide(msg.message, msg.lParam);
  1211.       return;
  1212. ***************
  1213. *** 2038,2064 ****
  1214.   }
  1215.   
  1216.   /*
  1217. !  * Create the find & replace dialogs
  1218.    * You can't have both at once: ":find" when replace is showing, destroys
  1219. !  * the replace dialog first.
  1220.    */
  1221.   #ifdef MSWIN_FIND_REPLACE
  1222.       static void
  1223.   initialise_findrep(char_u *initial_string)
  1224.   {
  1225.       s_findrep_struct.hwndOwner = s_hwnd;
  1226.       s_findrep_struct.Flags = FR_DOWN;
  1227. !     if (p_ic)
  1228. !     s_findrep_struct.Flags &= ~FR_MATCHCASE;
  1229. !     else
  1230.       s_findrep_struct.Flags |= FR_MATCHCASE;
  1231. !     if (initial_string != NULL && *initial_string != NUL)
  1232.       {
  1233. !     STRNCPY(s_findrep_struct.lpstrFindWhat, initial_string,
  1234.                              s_findrep_struct.wFindWhatLen);
  1235.       s_findrep_struct.lpstrFindWhat[s_findrep_struct.wFindWhatLen - 1] = NUL;
  1236.       s_findrep_struct.lpstrReplaceWith[0] = NUL;
  1237.       }
  1238.   }
  1239.   #endif
  1240.   
  1241. --- 1946,1980 ----
  1242.   }
  1243.   
  1244.   /*
  1245. !  * Create the find & replace dialogs.
  1246.    * You can't have both at once: ":find" when replace is showing, destroys
  1247. !  * the replace dialog first, and the other way around.
  1248.    */
  1249.   #ifdef MSWIN_FIND_REPLACE
  1250.       static void
  1251.   initialise_findrep(char_u *initial_string)
  1252.   {
  1253. +     int        wword = FALSE;
  1254. +     int        mcase = !p_ic;
  1255. +     char_u    *entry_text;
  1256. +     /* Get the search string to use. */
  1257. +     entry_text = get_find_dialog_text(initial_string, &wword, &mcase);
  1258.       s_findrep_struct.hwndOwner = s_hwnd;
  1259.       s_findrep_struct.Flags = FR_DOWN;
  1260. !     if (mcase)
  1261.       s_findrep_struct.Flags |= FR_MATCHCASE;
  1262. !     if (wword)
  1263. !     s_findrep_struct.Flags |= FR_WHOLEWORD;
  1264. !     if (entry_text != NULL && *entry_text != NUL)
  1265.       {
  1266. !     STRNCPY(s_findrep_struct.lpstrFindWhat, entry_text,
  1267.                              s_findrep_struct.wFindWhatLen);
  1268.       s_findrep_struct.lpstrFindWhat[s_findrep_struct.wFindWhatLen - 1] = NUL;
  1269.       s_findrep_struct.lpstrReplaceWith[0] = NUL;
  1270.       }
  1271. +     vim_free(entry_text);
  1272.   }
  1273.   #endif
  1274.   
  1275. ***************
  1276. *** 2068,2074 ****
  1277.   #ifdef MSWIN_FIND_REPLACE
  1278.       if (s_findrep_msg != 0)
  1279.       {
  1280. !     if (IsWindow(s_findrep_hwnd) && (s_findrep_is_find == FALSE))
  1281.           DestroyWindow(s_findrep_hwnd);
  1282.   
  1283.       if (!IsWindow(s_findrep_hwnd))
  1284. --- 1984,1990 ----
  1285.   #ifdef MSWIN_FIND_REPLACE
  1286.       if (s_findrep_msg != 0)
  1287.       {
  1288. !     if (IsWindow(s_findrep_hwnd) && !s_findrep_is_find)
  1289.           DestroyWindow(s_findrep_hwnd);
  1290.   
  1291.       if (!IsWindow(s_findrep_hwnd))
  1292. ***************
  1293. *** 2093,2099 ****
  1294.   #ifdef MSWIN_FIND_REPLACE
  1295.       if (s_findrep_msg != 0)
  1296.       {
  1297. !     if (IsWindow(s_findrep_hwnd) && (s_findrep_is_find == TRUE))
  1298.           DestroyWindow(s_findrep_hwnd);
  1299.   
  1300.       if (!IsWindow(s_findrep_hwnd))
  1301. --- 2009,2015 ----
  1302.   #ifdef MSWIN_FIND_REPLACE
  1303.       if (s_findrep_msg != 0)
  1304.       {
  1305. !     if (IsWindow(s_findrep_hwnd) && s_findrep_is_find)
  1306.           DestroyWindow(s_findrep_hwnd);
  1307.   
  1308.       if (!IsWindow(s_findrep_hwnd))
  1309. *** ../vim61.043/src/version.c    Wed May  1 19:40:35 2002
  1310. --- src/version.c    Wed May  1 20:51:21 2002
  1311. ***************
  1312. *** 608,609 ****
  1313. --- 608,611 ----
  1314.   {   /* Add new patch number below this line */
  1315. + /**/
  1316. +     44,
  1317.   /**/
  1318.  
  1319. -- 
  1320. TIM:   That is not an ordinary rabbit ... 'tis the most foul cruel and
  1321.        bad-tempered thing you ever set eyes on.
  1322. ROBIN: You tit.  I soiled my armour I was so scared!
  1323.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  1324.  
  1325.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  1326. ///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
  1327. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  1328.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  1329.