~ubuntu-branches/ubuntu/wily/geany/wily

« back to all changes in this revision

Viewing changes to src/search.c

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-12-10 07:43:26 UTC
  • mfrom: (3.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20111210074326-s8yqbew5i20h33tf
Tags: 0.21-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  - debian/patches/20_use_evince_viewer.patch:
     + use evince as viewer for pdf and dvi files
  - debian/patches/20_use_x_terminal_emulator.patch:
     + use x-terminal-emulator as terminal
  - debian/control
     + Add breaks on geany-plugins-common << 0.20
* Also fixes bugs:
  - Filter for MATLAB/Octave files filters everythign (LP: 885505)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *      search.c - this file is part of Geany, a fast and lightweight IDE
3
3
 *
4
 
 *      Copyright 2006-2010 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5
 
 *      Copyright 2006-2010 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
 
4
 *      Copyright 2006-2011 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
 
5
 *      Copyright 2006-2011 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
6
6
 *
7
7
 *      This program is free software; you can redistribute it and/or modify
8
8
 *      it under the terms of the GNU General Public License as published by
18
18
 *      along with this program; if not, write to the Free Software
19
19
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
20
 *
21
 
 * $Id: search.c 5299 2010-10-16 12:37:20Z eht16 $
 
21
 * $Id: search.c 5840 2011-06-13 18:41:50Z colombanw $
22
22
 */
23
23
 
24
24
/*
75
75
};
76
76
 
77
77
 
 
78
enum
 
79
{
 
80
        FILES_MODE_ALL,
 
81
        FILES_MODE_PROJECT,
 
82
        FILES_MODE_CUSTOM
 
83
};
 
84
 
 
85
 
78
86
GeanySearchData search_data;
79
87
GeanySearchPrefs search_prefs;
80
88
 
88
96
        gboolean fif_recursive;
89
97
        gboolean fif_use_extra_options;
90
98
        gchar *fif_extra_options;
91
 
        gboolean fif_use_files;
 
99
        gint fif_files_mode;
92
100
        gchar *fif_files;
 
101
        gboolean find_regexp;
 
102
        gboolean find_escape_sequences;
 
103
        gboolean find_case_sensitive;
 
104
        gboolean find_match_whole_word;
 
105
        gboolean find_match_word_start;
 
106
        gboolean find_close_dialog;
 
107
        gboolean replace_regexp;
 
108
        gboolean replace_escape_sequences;
 
109
        gboolean replace_case_sensitive;
 
110
        gboolean replace_match_whole_word;
 
111
        gboolean replace_match_word_start;
 
112
        gboolean replace_search_backwards;
 
113
        gboolean replace_close_dialog;
93
114
}
94
 
settings = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL, FALSE, NULL};
 
115
settings;
95
116
 
96
117
static StashGroup *fif_prefs = NULL;
 
118
static StashGroup *find_prefs = NULL;
 
119
static StashGroup *replace_prefs = NULL;
97
120
 
98
121
 
99
122
static struct
122
145
        GtkWidget       *files_combo;
123
146
        GtkWidget       *search_combo;
124
147
        GtkWidget       *encoding_combo;
 
148
        GtkWidget       *files_mode_combo;
125
149
        gint            position[2]; /* x, y */
126
150
}
127
 
fif_dlg = {NULL, NULL, NULL, NULL, NULL, {0, 0}};
 
151
fif_dlg = {NULL, NULL, NULL, NULL, NULL, NULL, {0, 0}};
128
152
 
129
153
 
130
154
static gboolean search_read_io(GIOChannel *source, GIOCondition condition, gpointer data);
145
169
on_find_entry_activate(GtkEntry *entry, gpointer user_data);
146
170
 
147
171
static void
 
172
on_find_entry_activate_backward(GtkEntry *entry, gpointer user_data);
 
173
 
 
174
static void
148
175
on_replace_dialog_response(GtkDialog *dialog, gint response, gpointer user_data);
149
176
 
150
177
static void
176
203
        stash_group_add_integer(group, &fif_dlg.position[0], "position_fif_x", -1);
177
204
        stash_group_add_integer(group, &fif_dlg.position[1], "position_fif_y", -1);
178
205
 
 
206
        memset(&settings, '\0', sizeof(settings));
 
207
 
179
208
        group = stash_group_new("search");
180
209
        fif_prefs = group;
181
210
        configuration_add_pref_group(group, FALSE);
195
224
                "fif_use_extra_options", FALSE, "check_extra");
196
225
        stash_group_add_entry(group, &settings.fif_files,
197
226
                "fif_files", "", "entry_files");
198
 
        stash_group_add_toggle_button(group, &settings.fif_use_files,
199
 
                "fif_use_files", FALSE, "check_files");
 
227
        stash_group_add_combo_box(group, &settings.fif_files_mode,
 
228
                "fif_files_mode", FILES_MODE_ALL, "combo_files_mode");
 
229
 
 
230
        group = stash_group_new("search");
 
231
        find_prefs = group;
 
232
        configuration_add_pref_group(group, FALSE);
 
233
        stash_group_add_toggle_button(group, &settings.find_regexp,
 
234
                "find_regexp", FALSE, "check_regexp");
 
235
        stash_group_add_toggle_button(group, &settings.find_case_sensitive,
 
236
                "find_case_sensitive", FALSE, "check_case");
 
237
        stash_group_add_toggle_button(group, &settings.find_escape_sequences,
 
238
                "find_escape_sequences", FALSE, "check_escape");
 
239
        stash_group_add_toggle_button(group, &settings.find_match_whole_word,
 
240
                "find_match_whole_word", FALSE, "check_word");
 
241
        stash_group_add_toggle_button(group, &settings.find_match_word_start,
 
242
                "find_match_word_start", FALSE, "check_wordstart");
 
243
        stash_group_add_toggle_button(group, &settings.find_close_dialog,
 
244
                "find_close_dialog", TRUE, "check_close");
 
245
 
 
246
        group = stash_group_new("search");
 
247
        replace_prefs = group;
 
248
        configuration_add_pref_group(group, FALSE);
 
249
        stash_group_add_toggle_button(group, &settings.replace_regexp,
 
250
                "replace_regexp", FALSE, "check_regexp");
 
251
        stash_group_add_toggle_button(group, &settings.replace_case_sensitive,
 
252
                "replace_case_sensitive", FALSE, "check_case");
 
253
        stash_group_add_toggle_button(group, &settings.replace_escape_sequences,
 
254
                "replace_escape_sequences", FALSE, "check_escape");
 
255
        stash_group_add_toggle_button(group, &settings.replace_match_whole_word,
 
256
                "replace_match_whole_word", FALSE, "check_word");
 
257
        stash_group_add_toggle_button(group, &settings.replace_match_word_start,
 
258
                "replace_match_word_start", FALSE, "check_wordstart");
 
259
        stash_group_add_toggle_button(group, &settings.replace_search_backwards,
 
260
                "replace_search_backwards", FALSE, "check_back");
 
261
        stash_group_add_toggle_button(group, &settings.replace_close_dialog,
 
262
                "replace_close_dialog", TRUE, "check_close");
200
263
}
201
264
 
202
265
 
203
266
void search_init(void)
204
267
{
205
268
        search_data.text = NULL;
 
269
        search_data.original_text = NULL;
206
270
        init_prefs();
207
271
}
208
272
 
216
280
        FREE_WIDGET(replace_dlg.dialog);
217
281
        FREE_WIDGET(fif_dlg.dialog);
218
282
        g_free(search_data.text);
 
283
        g_free(search_data.original_text);
219
284
}
220
285
 
221
286
 
227
292
        check_regexp = gtk_check_button_new_with_mnemonic(_("_Use regular expressions"));
228
293
        ui_hookup_widget(dialog, check_regexp, "check_regexp");
229
294
        gtk_button_set_focus_on_click(GTK_BUTTON(check_regexp), FALSE);
230
 
        ui_widget_set_tooltip_text(check_regexp, _("Use POSIX-like regular expressions. "
 
295
        gtk_widget_set_tooltip_text(check_regexp, _("Use POSIX-like regular expressions. "
231
296
                "For detailed information about using regular expressions, please read the documentation."));
232
297
        g_signal_connect(check_regexp, "toggled",
233
 
                G_CALLBACK(on_find_replace_checkbutton_toggled), GTK_WIDGET(dialog));
 
298
                G_CALLBACK(on_find_replace_checkbutton_toggled), dialog);
234
299
 
235
300
        if (dialog != GTK_DIALOG(find_dlg.dialog))
236
301
        {
250
315
        checkbox7 = gtk_check_button_new_with_mnemonic(_("Use _escape sequences"));
251
316
        ui_hookup_widget(dialog, checkbox7, "check_escape");
252
317
        gtk_button_set_focus_on_click(GTK_BUTTON(checkbox7), FALSE);
253
 
        ui_widget_set_tooltip_text(checkbox7,
 
318
        gtk_widget_set_tooltip_text(checkbox7,
254
319
                _("Replace \\\\, \\t, \\n, \\r and \\uXXXX (Unicode chararacters) with the "
255
320
                  "corresponding control characters"));
256
321
 
295
360
static void setup_find_next(const gchar *text)
296
361
{
297
362
        g_free(search_data.text);
 
363
        g_free(search_data.original_text);
298
364
        search_data.text = g_strdup(text);
 
365
        search_data.original_text = g_strdup(text);
299
366
        search_data.flags = 0;
300
367
        search_data.backwards = FALSE;
301
368
        search_data.search_bar = FALSE;
342
409
        {
343
410
                setup_find_next(s);     /* allow find next/prev */
344
411
 
345
 
                if (document_find_text(doc, s, 0, search_backwards, FALSE, NULL) > -1)
 
412
                if (document_find_text(doc, s, NULL, 0, search_backwards, FALSE, NULL) > -1)
346
413
                        editor_display_current_line(doc->editor, 0.3F);
347
414
                g_free(s);
348
415
        }
424
491
 
425
492
        g_signal_connect(gtk_bin_get_child(GTK_BIN(entry)), "activate",
426
493
                        G_CALLBACK(on_find_entry_activate), NULL);
 
494
        ui_entry_add_activate_backward_signal(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry))));
 
495
        g_signal_connect(gtk_bin_get_child(GTK_BIN(entry)), "activate-backward",
 
496
                        G_CALLBACK(on_find_entry_activate_backward), NULL);
427
497
        g_signal_connect(find_dlg.dialog, "response",
428
498
                        G_CALLBACK(on_find_dialog_response), entry);
429
499
        g_signal_connect(find_dlg.dialog, "delete-event",
446
516
        bbox = gtk_hbutton_box_new();
447
517
 
448
518
        button = gtk_button_new_with_mnemonic(_("_Mark"));
449
 
        ui_widget_set_tooltip_text(button,
 
519
        gtk_widget_set_tooltip_text(button,
450
520
                        _("Mark all matches in the current document"));
451
521
        gtk_container_add(GTK_CONTAINER(bbox), button);
452
522
        g_signal_connect(button, "clicked", G_CALLBACK(send_find_dialog_response),
466
536
        check_close = gtk_check_button_new_with_mnemonic(_("Close _dialog"));
467
537
        ui_hookup_widget(find_dlg.dialog, check_close, "check_close");
468
538
        gtk_button_set_focus_on_click(GTK_BUTTON(check_close), FALSE);
469
 
        ui_widget_set_tooltip_text(check_close,
 
539
        gtk_widget_set_tooltip_text(check_close,
470
540
                        _("Disable this option to keep the dialog open"));
471
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_close), TRUE);
472
541
        gtk_container_add(GTK_CONTAINER(bbox), check_close);
473
542
        gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(bbox), check_close, TRUE);
474
543
 
499
568
        if (find_dlg.dialog == NULL)
500
569
        {
501
570
                create_find_dialog();
 
571
                stash_group_display(find_prefs, find_dlg.dialog);
502
572
                if (sel)
503
573
                        gtk_entry_set_text(GTK_ENTRY(find_dlg.entry), sel);
504
574
 
640
710
                GINT_TO_POINTER(GEANY_RESPONSE_REPLACE_IN_FILE));
641
711
 
642
712
        button = gtk_button_new_with_mnemonic(_("In Se_lection"));
643
 
        ui_widget_set_tooltip_text(button,
 
713
        gtk_widget_set_tooltip_text(button,
644
714
                _("Replace all matches found in the currently selected text"));
645
715
        gtk_container_add(GTK_CONTAINER(bbox), button);
646
716
        g_signal_connect(button, "clicked", G_CALLBACK(send_replace_dialog_response),
650
720
        check_close = gtk_check_button_new_with_mnemonic(_("Close _dialog"));
651
721
        ui_hookup_widget(replace_dlg.dialog, check_close, "check_close");
652
722
        gtk_button_set_focus_on_click(GTK_BUTTON(check_close), FALSE);
653
 
        ui_widget_set_tooltip_text(check_close,
 
723
        gtk_widget_set_tooltip_text(check_close,
654
724
                        _("Disable this option to keep the dialog open"));
655
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_close), TRUE);
656
725
        gtk_container_add(GTK_CONTAINER(bbox), check_close);
657
726
        gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(bbox), check_close, TRUE);
658
727
 
677
746
        if (replace_dlg.dialog == NULL)
678
747
        {
679
748
                create_replace_dialog();
 
749
                stash_group_display(replace_prefs, replace_dlg.dialog);
680
750
                if (sel)
681
751
                        gtk_entry_set_text(GTK_ENTRY(replace_dlg.find_entry), sel);
682
752
 
696
766
                /* bring the dialog back in the foreground in case it is already open but the focus is away */
697
767
                gtk_window_present(GTK_WINDOW(replace_dlg.dialog));
698
768
        }
 
769
 
699
770
        g_free(sel);
700
771
}
701
772
 
708
779
}
709
780
 
710
781
 
 
782
static void update_file_patterns(GtkWidget *mode_combo, GtkWidget *fcombo)
 
783
{
 
784
        gint selection;
 
785
        GtkWidget *entry;
 
786
 
 
787
        entry = gtk_bin_get_child(GTK_BIN(fcombo));
 
788
 
 
789
        selection = gtk_combo_box_get_active(GTK_COMBO_BOX(mode_combo));
 
790
 
 
791
        if (selection == FILES_MODE_ALL)
 
792
        {
 
793
                gtk_entry_set_text(GTK_ENTRY(entry), "");
 
794
                gtk_widget_set_sensitive(fcombo, FALSE);
 
795
        }
 
796
        else if (selection == FILES_MODE_CUSTOM)
 
797
        {
 
798
                gtk_widget_set_sensitive(fcombo, TRUE);
 
799
        }
 
800
        else if (selection == FILES_MODE_PROJECT)
 
801
        {
 
802
                if (app->project && NZV(app->project->file_patterns))
 
803
                {
 
804
                        gchar *patterns;
 
805
 
 
806
                        patterns = g_strjoinv(" ", app->project->file_patterns);
 
807
                        gtk_entry_set_text(GTK_ENTRY(entry), patterns);
 
808
                        g_free(patterns);
 
809
                }
 
810
                else
 
811
                {
 
812
                        gtk_entry_set_text(GTK_ENTRY(entry), "");
 
813
                }
 
814
 
 
815
                gtk_widget_set_sensitive(fcombo, FALSE);
 
816
        }
 
817
}
 
818
 
 
819
 
 
820
/* creates the combo to choose which files include in the search */
 
821
static GtkWidget *create_fif_file_mode_combo(void)
 
822
{
 
823
        GtkWidget *combo;
 
824
        GtkCellRenderer *renderer;
 
825
        GtkListStore *store;
 
826
        GtkTreeIter iter;
 
827
 
 
828
        /* text/sensitive */
 
829
        store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_BOOLEAN);
 
830
        gtk_list_store_append(store, &iter);
 
831
        gtk_list_store_set(store, &iter, 0, _("all"), 1, TRUE, -1);
 
832
        gtk_list_store_append(store, &iter);
 
833
        gtk_list_store_set(store, &iter, 0, _("project"), 1, app->project != NULL, -1);
 
834
        gtk_list_store_append(store, &iter);
 
835
        gtk_list_store_set(store, &iter, 0, _("custom"), 1, TRUE, -1);
 
836
 
 
837
        combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
 
838
        g_object_unref(store);
 
839
        gtk_widget_set_tooltip_text(combo, _("All: search all files in the directory\n"
 
840
                                                                                "Project: use file patterns defined in the project settings\n"
 
841
                                                                                "Custom: specify file patterns manually"));
 
842
 
 
843
        renderer = gtk_cell_renderer_text_new();
 
844
        gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
 
845
        gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "text", 0, "sensitive", 1, NULL);
 
846
 
 
847
        return combo;
 
848
}
 
849
 
 
850
 
 
851
/* updates the sensitivity of the project combo item */
 
852
static void update_fif_file_mode_combo(void)
 
853
{
 
854
        GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(fif_dlg.files_mode_combo));
 
855
        GtkTreeIter iter;
 
856
 
 
857
        /* "1" refers to the second list entry, project  */
 
858
        if (gtk_tree_model_get_iter_from_string(model, &iter, "1"))
 
859
                gtk_list_store_set(GTK_LIST_STORE(model), &iter, 1, app->project != NULL, -1);
 
860
}
 
861
 
 
862
 
711
863
static void create_fif_dialog(void)
712
864
{
713
865
        GtkWidget *dir_combo, *combo, *fcombo, *e_combo, *entry;
714
 
        GtkWidget *label, *label1, *label2, *checkbox1, *checkbox2, *check_wholeword,
715
 
                *check_recursive, *check_extra, *entry_extra, *check_regexp, *check;
 
866
        GtkWidget *label, *label1, *label2, *label3, *checkbox1, *checkbox2, *check_wholeword,
 
867
                *check_recursive, *check_extra, *entry_extra, *check_regexp, *combo_files_mode;
716
868
        GtkWidget *dbox, *sbox, *lbox, *rbox, *hbox, *vbox, *ebox;
717
869
        GtkSizeGroup *size_group;
718
870
        gchar *encoding_string;
751
903
        size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
752
904
        gtk_size_group_add_widget(size_group, label);
753
905
 
754
 
        check = gtk_check_button_new_with_mnemonic(_("Fi_les:"));
755
 
        ui_hookup_widget(fif_dlg.dialog, check, "check_files");
756
 
        gtk_button_set_focus_on_click(GTK_BUTTON(check), FALSE);
757
 
        gtk_size_group_add_widget(size_group, check);
 
906
        label3 = gtk_label_new_with_mnemonic(_("Fi_les:"));
 
907
        gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);
758
908
 
759
 
        /* tab from search to the files checkbox */
760
 
        g_signal_connect(entry, "key-press-event",
761
 
                G_CALLBACK(on_widget_key_pressed_set_focus), check);
 
909
        combo_files_mode = create_fif_file_mode_combo();
 
910
        gtk_label_set_mnemonic_widget(GTK_LABEL(label3), combo_files_mode);
 
911
        ui_hookup_widget(fif_dlg.dialog, combo_files_mode, "combo_files_mode");
 
912
        fif_dlg.files_mode_combo = combo_files_mode;
762
913
 
763
914
        fcombo = gtk_combo_box_entry_new_text();
764
 
        gtk_widget_set_sensitive(fcombo, FALSE);
765
915
        entry = gtk_bin_get_child(GTK_BIN(fcombo));
766
916
        ui_entry_add_clear_icon(GTK_ENTRY(entry));
767
917
        gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
768
 
        ui_widget_set_tooltip_text(entry, _("File patterns, e.g. *.c *.h"));
 
918
        gtk_widget_set_tooltip_text(entry, _("File patterns, e.g. *.c *.h"));
769
919
        ui_hookup_widget(fif_dlg.dialog, entry, "entry_files");
770
920
        fif_dlg.files_combo = fcombo;
771
921
 
772
 
        /* enable entry when check is checked */
773
 
        g_signal_connect(check, "toggled",
774
 
                G_CALLBACK(on_widget_toggled_set_sensitive), fcombo);
 
922
        /* update the entry when selection is changed */
 
923
        g_signal_connect(combo_files_mode, "changed", G_CALLBACK(update_file_patterns), fcombo);
775
924
 
776
925
        hbox = gtk_hbox_new(FALSE, 6);
777
 
        gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0);
 
926
        gtk_box_pack_start(GTK_BOX(hbox), label3, FALSE, FALSE, 0);
 
927
        gtk_box_pack_start(GTK_BOX(hbox), combo_files_mode, FALSE, FALSE, 0);
778
928
        gtk_box_pack_start(GTK_BOX(hbox), fcombo, TRUE, TRUE, 0);
779
929
 
780
930
        label1 = gtk_label_new_with_mnemonic(_("_Directory:"));
816
966
 
817
967
        gtk_size_group_add_widget(size_group, label1);
818
968
        gtk_size_group_add_widget(size_group, label2);
 
969
        gtk_size_group_add_widget(size_group, label3);
819
970
        g_object_unref(G_OBJECT(size_group));   /* auto destroy the size group */
820
971
 
821
972
        gtk_box_pack_start(GTK_BOX(vbox), sbox, TRUE, FALSE, 0);
826
977
        check_regexp = gtk_check_button_new_with_mnemonic(_("_Use regular expressions"));
827
978
        ui_hookup_widget(fif_dlg.dialog, check_regexp, "check_regexp");
828
979
        gtk_button_set_focus_on_click(GTK_BUTTON(check_regexp), FALSE);
829
 
        ui_widget_set_tooltip_text(check_regexp, _("See grep's manual page for more information"));
 
980
        gtk_widget_set_tooltip_text(check_regexp, _("See grep's manual page for more information"));
830
981
 
831
982
        check_recursive = gtk_check_button_new_with_mnemonic(_("_Recurse in subfolders"));
832
983
        ui_hookup_widget(fif_dlg.dialog, check_recursive, "check_recursive");
844
995
        checkbox2 = gtk_check_button_new_with_mnemonic(_("_Invert search results"));
845
996
        ui_hookup_widget(fif_dlg.dialog, checkbox2, "check_invert");
846
997
        gtk_button_set_focus_on_click(GTK_BUTTON(checkbox2), FALSE);
847
 
        ui_widget_set_tooltip_text(checkbox2,
 
998
        gtk_widget_set_tooltip_text(checkbox2,
848
999
                        _("Invert the sense of matching, to select non-matching lines"));
849
1000
 
850
1001
        lbox = gtk_vbox_new(FALSE, 0);
869
1020
        entry_extra = gtk_entry_new();
870
1021
        ui_entry_add_clear_icon(GTK_ENTRY(entry_extra));
871
1022
        gtk_widget_set_sensitive(entry_extra, FALSE);
872
 
        ui_widget_set_tooltip_text(entry_extra, _("Other options to pass to Grep"));
 
1023
        gtk_widget_set_tooltip_text(entry_extra, _("Other options to pass to Grep"));
873
1024
        ui_hookup_widget(fif_dlg.dialog, entry_extra, "entry_extra");
874
1025
 
875
1026
        /* enable entry_extra when check_extra is checked */
949
1100
                g_free(cur_dir);
950
1101
        }
951
1102
 
 
1103
        update_fif_file_mode_combo();
 
1104
        update_file_patterns(fif_dlg.files_mode_combo, fif_dlg.files_combo);
 
1105
 
952
1106
        /* set the encoding of the current file */
953
1107
        if (doc != NULL)
954
1108
                enc_idx = encodings_get_idx_from_charset(doc->encoding);
981
1135
                gboolean regex_set = gtk_toggle_button_get_active(chk_regexp);
982
1136
                GtkWidget *check_word = ui_lookup_widget(dialog, "check_word");
983
1137
                GtkWidget *check_wordstart = ui_lookup_widget(dialog, "check_wordstart");
984
 
                GtkToggleButton *check_case = GTK_TOGGLE_BUTTON(
985
 
                        ui_lookup_widget(dialog, "check_case"));
986
1138
                GtkWidget *check_escape = ui_lookup_widget(dialog, "check_escape");
987
 
                static gboolean case_state = FALSE; /* state before regex enabled */
 
1139
                gboolean replace = (dialog != find_dlg.dialog);
 
1140
                const char *back_button[2] = { "btn_previous" , "check_back" };
988
1141
 
989
1142
                /* hide options that don't apply to regex searches */
990
1143
                gtk_widget_set_sensitive(check_escape, ! regex_set);
991
 
 
992
 
                if (dialog == find_dlg.dialog)
993
 
                        gtk_widget_set_sensitive(ui_lookup_widget(dialog, "btn_previous"), ! regex_set);
994
 
                else
995
 
                        gtk_widget_set_sensitive(ui_lookup_widget(dialog, "check_back"), ! regex_set);
996
 
 
 
1144
                gtk_widget_set_sensitive(ui_lookup_widget(dialog, back_button[replace]), ! regex_set);
997
1145
                gtk_widget_set_sensitive(check_word, ! regex_set);
998
1146
                gtk_widget_set_sensitive(check_wordstart, ! regex_set);
999
 
 
1000
 
                if (regex_set)  /* regex enabled */
1001
 
                {
1002
 
                        /* Enable case sensitive but remember original case toggle state */
1003
 
                        case_state = gtk_toggle_button_get_active(check_case);
1004
 
                        gtk_toggle_button_set_active(check_case, TRUE);
1005
 
                }
1006
 
                else    /* regex disabled */
1007
 
                {
1008
 
                        /* If case sensitive is still enabled, revert to what it was before we enabled it */
1009
 
                        if (gtk_toggle_button_get_active(check_case) == TRUE)
1010
 
                                gtk_toggle_button_set_active(check_case, case_state);
1011
 
                }
1012
1147
        }
1013
1148
}
1014
1149
 
1026
1161
        /* clear previous search indicators */
1027
1162
        editor_indicator_clear(doc->editor, GEANY_INDICATOR_SEARCH);
1028
1163
 
1029
 
        if (!NZV(search_text))
 
1164
        if (G_UNLIKELY(! NZV(search_text)))
1030
1165
                return 0;
1031
1166
 
1032
1167
        ttf.chrg.cpMin = 0;
1056
1191
}
1057
1192
 
1058
1193
 
1059
 
static gint get_search_flags(GtkWidget *dialog)
 
1194
static void
 
1195
on_find_entry_activate_backward(GtkEntry *entry, gpointer user_data)
1060
1196
{
1061
 
        gboolean fl1, fl2, fl3, fl4;
1062
 
 
1063
 
        fl1 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
1064
 
                                ui_lookup_widget(dialog, "check_case")));
1065
 
        fl2 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
1066
 
                                ui_lookup_widget(dialog, "check_word")));
1067
 
        fl3 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
1068
 
                                ui_lookup_widget(dialog, "check_regexp")));
1069
 
        fl4 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
1070
 
                                ui_lookup_widget(dialog, "check_wordstart")));
1071
 
 
1072
 
        return (fl1 ? SCFIND_MATCHCASE : 0) |
1073
 
                (fl2 ? SCFIND_WHOLEWORD : 0) |
1074
 
                (fl3 ? SCFIND_REGEXP | SCFIND_POSIX : 0) |
1075
 
                (fl4 ? SCFIND_WORDSTART : 0);
 
1197
        /* can't search backwards with a regexp */
 
1198
        if (search_data.flags & SCFIND_REGEXP)
 
1199
                utils_beep();
 
1200
        else
 
1201
                on_find_dialog_response(NULL, GEANY_RESPONSE_FIND_PREVIOUS,
 
1202
                                        ui_lookup_widget(GTK_WIDGET(entry), "entry"));
1076
1203
}
1077
1204
 
1078
1205
 
 
1206
#define int_search_flags(match_case, whole_word, regexp, word_start) \
 
1207
        ((match_case ? SCFIND_MATCHCASE : 0) | \
 
1208
        (whole_word ? SCFIND_WHOLEWORD : 0) | \
 
1209
        (regexp ? SCFIND_REGEXP | SCFIND_POSIX : 0) | \
 
1210
        (word_start ? SCFIND_WORDSTART : 0))
 
1211
 
 
1212
 
1079
1213
static void
1080
1214
on_find_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
1081
1215
{
1082
1216
        gtk_window_get_position(GTK_WINDOW(find_dlg.dialog),
1083
1217
                &find_dlg.position[0], &find_dlg.position[1]);
1084
1218
 
 
1219
        stash_group_update(find_prefs, find_dlg.dialog);
 
1220
 
1085
1221
        if (response == GTK_RESPONSE_CANCEL || response == GTK_RESPONSE_DELETE_EVENT)
1086
1222
                gtk_widget_hide(find_dlg.dialog);
1087
1223
        else
1088
1224
        {
1089
1225
                GeanyDocument *doc = document_get_current();
1090
 
                gboolean search_replace_escape;
1091
 
                gboolean check_close = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
1092
 
                                                ui_lookup_widget(GTK_WIDGET(find_dlg.dialog), "check_close")));
 
1226
                gboolean check_close = settings.find_close_dialog;
1093
1227
 
1094
1228
                if (doc == NULL)
1095
1229
                        return;
1096
1230
 
1097
 
                search_replace_escape = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
1098
 
                                                ui_lookup_widget(GTK_WIDGET(find_dlg.dialog), "check_escape")));
1099
1231
                search_data.backwards = FALSE;
1100
1232
                search_data.search_bar = FALSE;
1101
1233
 
1102
1234
                g_free(search_data.text);
 
1235
                g_free(search_data.original_text);
1103
1236
                search_data.text = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(user_data)))));
1104
 
                search_data.flags = get_search_flags(find_dlg.dialog);
 
1237
                search_data.original_text = g_strdup(search_data.text);
 
1238
                search_data.flags = int_search_flags(settings.find_case_sensitive,
 
1239
                        settings.find_match_whole_word, settings.find_regexp, settings.find_match_word_start);
1105
1240
 
1106
 
                if (strlen(search_data.text) == 0)
 
1241
                if (! NZV(search_data.text))
1107
1242
                {
1108
1243
                        fail:
1109
1244
                        utils_beep();
1110
1245
                        gtk_widget_grab_focus(find_dlg.entry);
1111
1246
                        return;
1112
1247
                }
1113
 
                if (search_replace_escape || search_data.flags & SCFIND_REGEXP)
 
1248
                if (settings.find_escape_sequences || search_data.flags & SCFIND_REGEXP)
1114
1249
                {
1115
1250
                        if (! utils_str_replace_escape(search_data.text, search_data.flags & SCFIND_REGEXP))
1116
1251
                                goto fail;
1117
1252
                }
1118
 
                ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY(user_data), search_data.text, 0);
 
1253
                ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY(user_data), search_data.original_text, 0);
1119
1254
 
1120
1255
                switch (response)
1121
1256
                {
1122
1257
                        case GEANY_RESPONSE_FIND:
1123
1258
                        case GEANY_RESPONSE_FIND_PREVIOUS:
1124
1259
                        {
1125
 
                                gint result = document_find_text(doc, search_data.text, search_data.flags,
 
1260
                                gint result = document_find_text(doc, search_data.text, search_data.original_text, search_data.flags,
1126
1261
                                        (response == GEANY_RESPONSE_FIND_PREVIOUS), TRUE, GTK_WIDGET(find_dlg.dialog));
1127
1262
                                ui_set_search_entry_background(find_dlg.entry, (result > -1));
1128
1263
                                check_close = FALSE;
1131
1266
                                break;
1132
1267
                        }
1133
1268
                        case GEANY_RESPONSE_FIND_IN_FILE:
1134
 
                                search_find_usage(search_data.text, search_data.flags, FALSE);
 
1269
                                search_find_usage(search_data.text, search_data.original_text, search_data.flags, FALSE);
1135
1270
                                break;
1136
1271
 
1137
1272
                        case GEANY_RESPONSE_FIND_IN_SESSION:
1138
 
                                search_find_usage(search_data.text, search_data.flags, TRUE);
 
1273
                                search_find_usage(search_data.text, search_data.original_text, search_data.flags, TRUE);
1139
1274
                                break;
1140
1275
 
1141
1276
                        case GEANY_RESPONSE_MARK:
1143
1278
                                gint count = search_mark_all(doc, search_data.text, search_data.flags);
1144
1279
 
1145
1280
                                if (count == 0)
1146
 
                                        ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), search_data.text);
 
1281
                                        ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), search_data.original_text);
1147
1282
                                else
1148
1283
                                        ui_set_statusbar(FALSE,
1149
1284
                                                ngettext("Found %d match for \"%s\".",
1150
1285
                                                                 "Found %d matches for \"%s\".", count),
1151
 
                                                count, search_data.text);
 
1286
                                                count, search_data.original_text);
1152
1287
                        }
1153
1288
                        break;
1154
1289
                }
1167
1302
 
1168
1303
static void replace_in_session(GeanyDocument *doc,
1169
1304
                gint search_flags_re, gboolean search_replace_escape_re,
1170
 
                const gchar *find, const gchar *replace)
 
1305
                const gchar *find, const gchar *replace,
 
1306
                const gchar *original_find, const gchar *original_replace)
1171
1307
{
1172
1308
        guint n, page_count, rep_count = 0, file_count = 0;
1173
1309
 
1178
1314
                GeanyDocument *tmp_doc = document_get_from_page(n);
1179
1315
                gint reps = 0;
1180
1316
 
1181
 
                reps = document_replace_all(tmp_doc, find, replace, search_flags_re,
1182
 
                        search_replace_escape_re);
 
1317
                reps = document_replace_all(tmp_doc, find, replace, original_find, original_replace, search_flags_re);
1183
1318
                rep_count += reps;
1184
1319
                if (reps)
1185
1320
                        file_count++;
1187
1322
        if (file_count == 0)
1188
1323
        {
1189
1324
                utils_beep();
1190
 
                ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), find);
 
1325
                ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), original_find);
1191
1326
                return;
1192
1327
        }
1193
1328
        /* if only one file was changed, don't override that document's status message
1209
1344
        GeanyDocument *doc = document_get_current();
1210
1345
        gint search_flags_re;
1211
1346
        gboolean search_backwards_re, search_replace_escape_re;
1212
 
        gboolean close_window;
1213
 
        gchar *find, *replace;
 
1347
        gchar *find, *replace, *original_find = NULL, *original_replace = NULL;
1214
1348
 
1215
1349
        gtk_window_get_position(GTK_WINDOW(replace_dlg.dialog),
1216
1350
                &replace_dlg.position[0], &replace_dlg.position[1]);
1217
1351
 
 
1352
        stash_group_update(replace_prefs, replace_dlg.dialog);
 
1353
 
1218
1354
        if (response == GTK_RESPONSE_CANCEL || response == GTK_RESPONSE_DELETE_EVENT)
1219
1355
        {
1220
1356
                gtk_widget_hide(replace_dlg.dialog);
1221
1357
                return;
1222
1358
        }
1223
1359
 
1224
 
        close_window = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
1225
 
                                ui_lookup_widget(GTK_WIDGET(replace_dlg.dialog), "check_close")));
1226
 
        search_backwards_re = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
1227
 
                                ui_lookup_widget(GTK_WIDGET(replace_dlg.dialog), "check_back")));
1228
 
        search_replace_escape_re = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
1229
 
                                ui_lookup_widget(GTK_WIDGET(replace_dlg.dialog), "check_escape")));
 
1360
        search_backwards_re = settings.replace_search_backwards;
 
1361
        search_replace_escape_re = settings.replace_escape_sequences;
1230
1362
        find = g_strdup(gtk_entry_get_text(GTK_ENTRY(replace_dlg.find_entry)));
1231
1363
        replace = g_strdup(gtk_entry_get_text(GTK_ENTRY(replace_dlg.replace_entry)));
1232
1364
 
1233
 
        search_flags_re = get_search_flags(replace_dlg.dialog);
 
1365
        search_flags_re = int_search_flags(settings.replace_case_sensitive,
 
1366
                settings.replace_match_whole_word, settings.replace_regexp,
 
1367
                settings.replace_match_word_start);
1234
1368
 
1235
1369
        if ((response != GEANY_RESPONSE_FIND) && (search_flags_re & SCFIND_MATCHCASE)
1236
1370
                && (strcmp(find, replace) == 0))
1237
 
        {
1238
 
                fail:
1239
 
                utils_beep();
1240
 
                gtk_widget_grab_focus(replace_dlg.find_entry);
1241
 
                g_free(find);
1242
 
                g_free(replace);
1243
 
                return;
1244
 
        }
 
1371
                goto fail;
 
1372
 
 
1373
        original_find = g_strdup(find);
 
1374
        original_replace = g_strdup(replace);
1245
1375
        if (search_flags_re & SCFIND_REGEXP)
1246
1376
        {
1247
1377
                if (! utils_str_replace_escape(find, TRUE) ||
1256
1386
        }
1257
1387
 
1258
1388
        ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY(
1259
 
                gtk_widget_get_parent(replace_dlg.find_entry)), find, 0);
 
1389
                gtk_widget_get_parent(replace_dlg.find_entry)), original_find, 0);
1260
1390
        ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY(
1261
 
                gtk_widget_get_parent(replace_dlg.replace_entry)), replace, 0);
 
1391
                gtk_widget_get_parent(replace_dlg.replace_entry)), original_replace, 0);
1262
1392
 
1263
1393
        switch (response)
1264
1394
        {
1265
1395
                case GEANY_RESPONSE_REPLACE_AND_FIND:
1266
1396
                {
1267
 
                        gint rep = document_replace_text(doc, find, replace, search_flags_re,
 
1397
                        gint rep = document_replace_text(doc, find, original_find, replace, search_flags_re,
1268
1398
                                search_backwards_re);
1269
1399
                        if (rep != -1)
1270
 
                                document_find_text(doc, find, search_flags_re, search_backwards_re,
 
1400
                                document_find_text(doc, find, original_find, search_flags_re, search_backwards_re,
1271
1401
                                        TRUE, NULL);
1272
1402
                        break;
1273
1403
                }
1274
1404
                case GEANY_RESPONSE_REPLACE:
1275
 
                        document_replace_text(doc, find, replace, search_flags_re,
 
1405
                        document_replace_text(doc, find, original_find, replace, search_flags_re,
1276
1406
                                search_backwards_re);
1277
1407
                        break;
1278
1408
 
1279
1409
                case GEANY_RESPONSE_FIND:
1280
1410
                {
1281
 
                        gint result = document_find_text(doc, find, search_flags_re,
 
1411
                        gint result = document_find_text(doc, find, original_find, search_flags_re,
1282
1412
                                                                search_backwards_re, TRUE, GTK_WIDGET(dialog));
1283
1413
                        ui_set_search_entry_background(replace_dlg.find_entry, (result > -1));
1284
1414
                        break;
1285
1415
                }
1286
1416
                case GEANY_RESPONSE_REPLACE_IN_FILE:
1287
 
                        if (! document_replace_all(doc, find, replace, search_flags_re,
1288
 
                                search_replace_escape_re))
 
1417
                        if (! document_replace_all(doc, find, replace, original_find, original_replace, search_flags_re))
1289
1418
                                utils_beep();
1290
1419
                        break;
1291
1420
 
1292
1421
                case GEANY_RESPONSE_REPLACE_IN_SESSION:
1293
 
                        replace_in_session(doc, search_flags_re, search_replace_escape_re, find, replace);
 
1422
                        replace_in_session(doc, search_flags_re, search_replace_escape_re, find, replace, original_find, original_replace);
1294
1423
                        break;
1295
1424
 
1296
1425
                case GEANY_RESPONSE_REPLACE_IN_SEL:
1297
 
                        document_replace_sel(doc, find, replace, search_flags_re, search_replace_escape_re);
 
1426
                        document_replace_sel(doc, find, replace, original_find, original_replace, search_flags_re);
1298
1427
                        break;
1299
1428
        }
1300
1429
        switch (response)
1302
1431
                case GEANY_RESPONSE_REPLACE_IN_SEL:
1303
1432
                case GEANY_RESPONSE_REPLACE_IN_FILE:
1304
1433
                case GEANY_RESPONSE_REPLACE_IN_SESSION:
1305
 
                        if (close_window)
 
1434
                        if (settings.replace_close_dialog)
1306
1435
                                gtk_widget_hide(replace_dlg.dialog);
1307
1436
        }
1308
1437
        g_free(find);
1309
1438
        g_free(replace);
 
1439
        g_free(original_find);
 
1440
        g_free(original_replace);
 
1441
        return;
 
1442
 
 
1443
fail:
 
1444
        utils_beep();
 
1445
        gtk_widget_grab_focus(replace_dlg.find_entry);
 
1446
        g_free(find);
 
1447
        g_free(replace);
 
1448
        g_free(original_find);
 
1449
        g_free(original_replace);
1310
1450
}
1311
1451
 
1312
1452
 
1339
1479
                }
1340
1480
        }
1341
1481
        g_strstrip(settings.fif_files);
1342
 
        if (settings.fif_use_files && *settings.fif_files)
 
1482
        if (settings.fif_files_mode != FILES_MODE_ALL && *settings.fif_files)
1343
1483
        {
1344
1484
                GString *tmp;
1345
1485
 
1374
1514
                GeanyEncodingIndex enc_idx = gtk_combo_box_get_active(
1375
1515
                        GTK_COMBO_BOX(fif_dlg.encoding_combo));
1376
1516
 
1377
 
                if (!NZV(utf8_dir))
 
1517
                if (G_UNLIKELY(! NZV(utf8_dir)))
1378
1518
                        ui_set_statusbar(FALSE, _("Invalid directory for find in files."));
1379
1519
                else if (NZV(search_text))
1380
1520
                {
1514
1654
}
1515
1655
 
1516
1656
 
 
1657
static gboolean pattern_list_match(GSList *patterns, const gchar *str)
 
1658
{
 
1659
        GSList *item;
 
1660
 
 
1661
        foreach_slist(item, patterns)
 
1662
        {
 
1663
                if (g_pattern_match_string(item->data, str))
 
1664
                        return TRUE;
 
1665
        }
 
1666
        return FALSE;
 
1667
}
 
1668
 
 
1669
 
1517
1670
/* Creates an argument vector of strings, copying argv_prefix[] values for
1518
1671
 * the first arguments, then followed by filenames found in dir.
1519
1672
 * Returns NULL if no files were found, otherwise returned vector should be fully freed. */
1520
1673
static gchar **search_get_argv(const gchar **argv_prefix, const gchar *dir)
1521
1674
{
1522
 
        guint prefix_len, list_len, i;
 
1675
        guint prefix_len, list_len, i, j;
1523
1676
        gchar **argv;
1524
 
        GSList *list, *item;
 
1677
        GSList *list, *item, *patterns = NULL;
1525
1678
        GError *error = NULL;
1526
1679
 
1527
1680
        g_return_val_if_fail(dir != NULL, NULL);
1539
1692
 
1540
1693
        argv = g_new(gchar*, prefix_len + list_len + 1);
1541
1694
 
1542
 
        for (i = 0; i < prefix_len; i++)
1543
 
                argv[i] = g_strdup(argv_prefix[i]);
1544
 
 
1545
 
        foreach_slist(item, list)
1546
 
                argv[i++] = item->data;
1547
 
 
1548
 
        argv[i] = NULL;
 
1695
        for (i = 0, j = 0; i < prefix_len; i++)
 
1696
        {
 
1697
                if (g_str_has_prefix(argv_prefix[i], "--include="))
 
1698
                {
 
1699
                        const gchar *pat = &(argv_prefix[i][10]); /* the pattern part of the argument */
 
1700
 
 
1701
                        patterns = g_slist_prepend(patterns, g_pattern_spec_new(pat));
 
1702
                }
 
1703
                else
 
1704
                        argv[j++] = g_strdup(argv_prefix[i]);
 
1705
        }
 
1706
 
 
1707
        if (patterns)
 
1708
        {
 
1709
                GSList *pat;
 
1710
 
 
1711
                foreach_slist(item, list)
 
1712
                {
 
1713
                        if (pattern_list_match(patterns, item->data))
 
1714
                                argv[j++] = item->data;
 
1715
                        else
 
1716
                                g_free(item->data);
 
1717
                }
 
1718
                foreach_slist(pat, patterns)
 
1719
                        g_pattern_spec_free(pat->data);
 
1720
                g_slist_free(patterns);
 
1721
        }
 
1722
        else
 
1723
        {
 
1724
                foreach_slist(item, list)
 
1725
                        argv[j++] = item->data;
 
1726
        }
 
1727
 
 
1728
        argv[j] = NULL;
1549
1729
        g_slist_free(list);
1550
1730
        return argv;
1551
1731
}
1844
2024
}
1845
2025
 
1846
2026
 
1847
 
void search_find_usage(const gchar *search_text, gint flags, gboolean in_session)
 
2027
void search_find_usage(const gchar *search_text, const gchar *original_search_text,
 
2028
                gint flags, gboolean in_session)
1848
2029
{
1849
2030
        GeanyDocument *doc;
1850
2031
        gint count = 0;
1852
2033
        doc = document_get_current();
1853
2034
        g_return_if_fail(doc != NULL);
1854
2035
 
1855
 
        if (!NZV(search_text))
 
2036
        if (G_UNLIKELY(! NZV(search_text)))
1856
2037
        {
1857
2038
                utils_beep();
1858
2039
                return;
1879
2060
 
1880
2061
        if (count == 0) /* no matches were found */
1881
2062
        {
1882
 
                ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), search_text);
1883
 
                msgwin_msg_add(COLOR_BLUE, -1, NULL, _("No matches found for \"%s\"."), search_text);
 
2063
                ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), original_search_text);
 
2064
                msgwin_msg_add(COLOR_BLUE, -1, NULL, _("No matches found for \"%s\"."), original_search_text);
1884
2065
        }
1885
2066
        else
1886
2067
        {
1887
2068
                ui_set_statusbar(FALSE, ngettext(
1888
2069
                        "Found %d match for \"%s\".", "Found %d matches for \"%s\".", count),
1889
 
                        count, search_text);
 
2070
                        count, original_search_text);
1890
2071
                msgwin_msg_add(COLOR_BLUE, -1, NULL, ngettext(
1891
2072
                        "Found %d match for \"%s\".", "Found %d matches for \"%s\".", count),
1892
 
                        count, search_text);
 
2073
                        count, original_search_text);
1893
2074
        }
1894
2075
}
1895
2076
 
1967
2148
        if (search_data.text)
1968
2149
        {
1969
2150
                gboolean forward = ! search_data.backwards;
1970
 
                gint result = document_find_text(doc, search_data.text, search_data.flags,
 
2151
                gint result = document_find_text(doc, search_data.text, search_data.original_text, search_data.flags,
1971
2152
                        change_direction ? forward : !forward, FALSE, NULL);
1972
2153
 
1973
2154
                if (result > -1)
1978
2159
                                toolbar_get_widget_child_by_name("SearchEntry"), (result > -1));
1979
2160
        }
1980
2161
}
1981
 
 
1982