GNOME Bugzilla – Bug 99730
RFE: Add option to search backwards
Last modified: 2004-12-22 21:47:04 UTC
During today's UI-review it was suggested to add the option to search backwards through a document. Paolo asked to file a bug report, so here it is.
Also a "Find Previous (Shift+Ctrl+G)" menu item should be added.
*** Bug 100818 has been marked as a duplicate of this bug. ***
Created attachment 16880 [details] [review] preliminary patch w/o changelog entry
The patch looks quite good. A few comments: 1. find_again should be renamed find_next 2. we need a new find_previous function 3. Do we need a function to get last_search_was_search_backwards? Is it really needed? 4. I'm not sure about the -1 in (but I could be wrong): + if (search_backwards) + gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (doc), &iter, -1); 5. Probably we need to think a more extensible signature for the gedit_document_find function 6. We should add a Find Previous menu item 7. IIRC, there are plugins using the find and find_again function (we need to update them too) Thanks again for the preliminary patch. It looks really good.
Created attachment 17100 [details] [review] larger, more tested patch w/changelog
Created attachment 17119 [details] [review] removed #ifdef's, spell plugin now working
The patch looks really good and it is quite ready for commit. I still have a few comments: 1. gedit_cmd_search_find_prev duplicates almost completely the code of gedit_cmd_search_find_next. It should be easy to reduce code duplication in this case. 2. +#define GEDIT_SEARCH_ENTIRE_WORD (1 << 0 ) +#define GEDIT_SEARCH_BACKWARDS (1 << 4 ) +#define GEDIT_SEARCH_CASE_SENSITIVE (1 << 8 ) +#define GEDIT_SEARCH_FROM_CURSOR (1 << 12) Why do you use 0, 4, 8, 12 instead of 0, 1, 2, 3 ? 3. The state of the "Search backwards" checkbutton is not restored when you re-open the find/replace dialog. 4. IMO, in the find dialog the "Search backwards" checkbutton should be above the "Wrap around" one. 5. I have found a little bug in my old code: open a new document. Search->Find Next should be insensitive. Open the Find dialog. Search for a text. Close the dialog. Search->Find Next is still insensitive. It should be sensitive.
General comment: Please work with AbiWord, Galeon, etc. to standardize on a Find/Replace dialogue.
Created attachment 17159 [details] [review] updated patch to address suggestions 1-4
Created attachment 17213 [details] [review] patch updated to *correctly* address comment #1
Fixed in CVS HEAD.