To: vim-dev@vim.org Subject: Patch 6.0.138 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.138 Problem: GUI: When using the find or find/replace dialog from Insert mode, the text is inserted when CTRL-O is mapped. (Andre Pang) When opening the dialog again, a whole word search isn't recognized. When doing "replace all" a whole word search was never done. Solution: Don't put a search or replace command in the input buffer, execute it directly. Recognize "\<" and "\>" after removing "\V". Add "\<" and "\>" also for "replace all". Files: src/gui.c *** ../vim60.137/src/gui.c Thu Nov 1 14:56:27 2001 --- src/gui.c Wed Jan 16 11:35:01 2002 *************** *** 3952,3958 **** } #endif ! #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_GUI_MOTIF) || defined(PROTO) /* * Update the current window and the screen. */ --- 3952,3959 ---- } #endif ! #if defined(FEAT_GUI_GTK) || defined(FEAT_SUN_WORKSHOP) \ ! || defined(FEAT_GUI_MOTIF) || defined(PROTO) /* * Update the current window and the screen. */ *************** *** 3995,4001 **** --- 3996,4005 ---- /* Remove "\V" */ if (len >= 2 && STRNCMP(text, "\\V", 2) == 0) + { mch_memmove(text, text + 2, (size_t)(len - 1)); + len -= 2; + } /* Recognize "\" and remove. */ if (len >= 4 *************** *** 4024,4038 **** int exact; /* Exact word match. */ { garray_T ga; ga_init2(&ga, 1, 100); - /* start stuffing in the command text */ - if (State & INSERT) - ga_append(&ga, Ctrl_O); - else if ((State | NORMAL) == 0) - ga_append(&ga, ESC); - if (flags == FR_REPLACE) { /* Do the replacement when the text under the cursor matches. */ --- 4028,4037 ---- int exact; /* Exact word match. */ { garray_T ga; + int i; ga_init2(&ga, 1, 100); if (flags == FR_REPLACE) { /* Do the replacement when the text under the cursor matches. */ *************** *** 4044,4074 **** } } else if (flags == FR_REPLACEALL) { - ga_concat(&ga, (char_u *)":%sno/"); - ga_concat(&ga, find_text); ga_concat(&ga, (char_u *)"/"); ga_concat(&ga, repl_text); ! ga_concat(&ga, (char_u *)"/g\r"); } ! ! if (flags != FR_REPLACEALL) { /* Search for the next match. */ ! if (down) ! ga_concat(&ga, (char_u *)"/\\V"); ! else ! ga_concat(&ga, (char_u *)"?\\V"); ! if (exact) ! ga_concat(&ga, (char_u *)"\\<"); ! ga_concat(&ga, find_text); ! if (exact) ! ga_concat(&ga, (char_u *)"\\>"); ! ga_concat(&ga, (char_u *)"\r"); } ! if (ga.ga_len > 0) ! add_to_input_buf((char_u *)ga.ga_data, ga.ga_len); vim_free(ga.ga_data); return (ga.ga_len > 0); --- 4043,4079 ---- } } else if (flags == FR_REPLACEALL) + ga_concat(&ga, (char_u *)"%s/"); + + ga_concat(&ga, (char_u *)"\\V"); + if (exact) + ga_concat(&ga, (char_u *)"\\<"); + ga_concat(&ga, find_text); + if (exact) + ga_concat(&ga, (char_u *)"\\>"); + + if (flags == FR_REPLACEALL) { ga_concat(&ga, (char_u *)"/"); ga_concat(&ga, repl_text); ! ga_concat(&ga, (char_u *)"/g"); ! do_cmdline_cmd(ga.ga_data); } ! else { /* Search for the next match. */ ! i = msg_scroll; ! do_search(NULL, down ? '/' : '?', ga.ga_data, 1L, ! SEARCH_MSG + SEARCH_MARK); ! msg_scroll = i; /* don't let an error message set msg_scroll */ } ! if (State & (NORMAL | INSERT)) ! { ! gui_update_screen(); /* update the screen */ ! msg_didout = 0; /* overwrite any message */ ! need_wait_return = FALSE; /* don't wait for return */ ! } vim_free(ga.ga_data); return (ga.ga_len > 0); *** ../vim60.137/src/version.c Tue Jan 15 19:50:54 2002 --- src/version.c Wed Jan 16 11:41:01 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 138, /**/ -- hundred-and-one symptoms of being an internet addict: 1. You actually wore a blue ribbon to protest the Communications Decency Act. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///