diff -Naur mc-4.7.0-pre1~/edit/edit-widget.h mc-4.7.0-pre1/edit/edit-widget.h
old
|
new
|
|
62 | 62 | int replace_mode; |
63 | 63 | int replace_backwards; |
64 | 64 | int replace_case; |
| 65 | int whole_words; |
65 | 66 | int all_codepages; |
66 | 67 | |
67 | 68 | long search_start; /* First character to start searching from */ |
diff -Naur mc-4.7.0-pre1~/edit/editcmd.c mc-4.7.0-pre1/edit/editcmd.c
old
|
new
|
|
1407 | 1407 | edit->search->search_type = edit->search_type; |
1408 | 1408 | edit->search->is_all_charsets = edit->all_codepages; |
1409 | 1409 | edit->search->is_case_sentitive = edit->replace_case; |
| 1410 | edit->search->whole_words = edit->whole_words; |
1410 | 1411 | edit->search->search_fn = edit_search_cmd_callback; |
1411 | 1412 | } |
1412 | 1413 | |
… |
… |
|
1604 | 1605 | edit->search->search_type = edit->search_type; |
1605 | 1606 | edit->search->is_all_charsets = edit->all_codepages; |
1606 | 1607 | edit->search->is_case_sentitive = edit->replace_case; |
| 1608 | edit->search->whole_words = edit->whole_words; |
1607 | 1609 | edit->search->search_fn = edit_search_cmd_callback; |
1608 | 1610 | } |
1609 | 1611 | |
diff -Naur mc-4.7.0-pre1~/edit/editcmd_dialogs.c mc-4.7.0-pre1/edit/editcmd_dialogs.c
old
|
new
|
|
49 | 49 | /*** file scope macro definitions **************************************/ |
50 | 50 | |
51 | 51 | #define SEARCH_DLG_WIDTH 58 |
52 | | #define SEARCH_DLG_MIN_HEIGHT 11 |
| 52 | #define SEARCH_DLG_MIN_HEIGHT 12 |
53 | 53 | #define SEARCH_DLG_HEIGHT_SUPPLY 3 |
54 | 54 | |
55 | 55 | #define REPLACE_DLG_WIDTH 58 |
… |
… |
|
84 | 84 | { |
85 | 85 | int treplace_backwards = edit->replace_backwards; |
86 | 86 | int treplace_case = edit->replace_case; |
| 87 | int twhole_words = edit->whole_words; |
87 | 88 | int tall_codepages = edit->all_codepages; |
88 | 89 | mc_search_type_t ttype_of_search = edit->search_type; |
89 | 90 | int dialog_result; |
… |
… |
|
101 | 102 | 0, 0, NULL, NULL, NULL}, |
102 | 103 | |
103 | 104 | #ifdef HAVE_CHARSET |
104 | | {quick_checkbox, 33, REPLACE_DLG_WIDTH, 9, REPLACE_DLG_HEIGHT, N_("All charsets"), 0, 0, |
| 105 | {quick_checkbox, 33, REPLACE_DLG_WIDTH, 10, REPLACE_DLG_HEIGHT, N_("All charsets"), 0, 0, |
105 | 106 | &tall_codepages, 0, NULL, NULL, NULL}, |
106 | 107 | #endif |
107 | 108 | |
108 | | {quick_checkbox, 33, REPLACE_DLG_WIDTH, 8, REPLACE_DLG_HEIGHT, N_("&Backwards"), 0, 0, |
| 109 | {quick_checkbox, 33, REPLACE_DLG_WIDTH, 9, REPLACE_DLG_HEIGHT, N_("&Backwards"), 0, 0, |
109 | 110 | &treplace_backwards, 0, NULL, NULL, NULL}, |
110 | 111 | |
| 112 | {quick_checkbox, 33, REPLACE_DLG_WIDTH, 8, REPLACE_DLG_HEIGHT, N_("&Whole words"), 0, 0, |
| 113 | &twhole_words, 0, NULL, NULL, NULL}, |
| 114 | |
111 | 115 | {quick_checkbox, 33, REPLACE_DLG_WIDTH, 7, REPLACE_DLG_HEIGHT, N_("case &Sensitive"), 0, 0, |
112 | 116 | &treplace_case, 0, NULL, NULL, NULL}, |
113 | 117 | |
… |
… |
|
153 | 157 | edit->all_codepages = tall_codepages; |
154 | 158 | edit->replace_backwards = treplace_backwards; |
155 | 159 | edit->replace_case = treplace_case; |
| 160 | edit->whole_words = twhole_words; |
156 | 161 | return; |
157 | 162 | } else { |
158 | 163 | *replace_text = NULL; |
… |
… |
|
167 | 172 | editcmd_dialog_search_show (WEdit * edit, char **search_text) |
168 | 173 | { |
169 | 174 | int tsearch_case = edit->replace_case; |
| 175 | int twhole_words = edit->whole_words; |
170 | 176 | int tsearch_backwards = edit->replace_backwards; |
171 | 177 | int tall_codepages = edit->all_codepages; |
172 | 178 | mc_search_type_t ttype_of_search = edit->search_type; |
… |
… |
|
175 | 181 | |
176 | 182 | |
177 | 183 | QuickWidget quick_widgets[] = { |
178 | | {quick_button, 6, 10, 9, SEARCH_DLG_HEIGHT, N_("&Cancel"), 0, B_CANCEL, 0, |
| 184 | {quick_button, 6, 10, 10, SEARCH_DLG_HEIGHT, N_("&Cancel"), 0, B_CANCEL, 0, |
179 | 185 | 0, NULL, NULL, NULL}, |
180 | | {quick_button, 2, 10, 9, SEARCH_DLG_HEIGHT, N_("&OK"), 0, B_ENTER, 0, |
| 186 | {quick_button, 2, 10, 10, SEARCH_DLG_HEIGHT, N_("&OK"), 0, B_ENTER, 0, |
181 | 187 | 0, NULL, NULL, NULL}, |
182 | 188 | |
183 | 189 | #ifdef HAVE_CHARSET |
184 | | {quick_checkbox, 33, SEARCH_DLG_WIDTH, 7, SEARCH_DLG_HEIGHT, N_("All charsets"), 0, 0, |
| 190 | {quick_checkbox, 33, SEARCH_DLG_WIDTH, 8, SEARCH_DLG_HEIGHT, N_("All charsets"), 0, 0, |
185 | 191 | &tall_codepages, 0, NULL, NULL, NULL}, |
186 | 192 | #endif |
187 | 193 | |
188 | | {quick_checkbox, 33, SEARCH_DLG_WIDTH, 6, SEARCH_DLG_HEIGHT, N_("&Backwards"), 0, 0, |
| 194 | {quick_checkbox, 33, SEARCH_DLG_WIDTH, 7, SEARCH_DLG_HEIGHT, N_("&Backwards"), 0, 0, |
189 | 195 | &tsearch_backwards, 0, NULL, NULL, NULL}, |
| 196 | {quick_checkbox, 33, SEARCH_DLG_WIDTH, 6, SEARCH_DLG_HEIGHT, N_("&Whole words"), 0, 0, |
| 197 | &twhole_words, 0, NULL, NULL, NULL}, |
190 | 198 | {quick_checkbox, 33, SEARCH_DLG_WIDTH, 5, SEARCH_DLG_HEIGHT, N_("case &Sensitive"), 0, 0, |
191 | 199 | &tsearch_case, 0, NULL, NULL, NULL}, |
192 | 200 | |
… |
… |
|
213 | 221 | edit->replace_backwards = tsearch_backwards; |
214 | 222 | edit->all_codepages = tall_codepages; |
215 | 223 | edit->replace_case = tsearch_case; |
| 224 | edit->whole_words = twhole_words; |
216 | 225 | } else { |
217 | 226 | *search_text = NULL; |
218 | 227 | } |
diff -Naur mc-4.7.0-pre1~/src/find.c mc-4.7.0-pre1/src/find.c
old
|
new
|
|
89 | 89 | static WCheck *file_case_sens; /* "case sensitive" checkbox */ |
90 | 90 | static WCheck *find_regex_cbox; /* [x] find regular expression */ |
91 | 91 | static WCheck *content_case_sens; /* "case sensitive" checkbox */ |
| 92 | static WCheck *content_whole_words_cbox;/* "whole words" checkbox */ |
92 | 93 | |
93 | 94 | static int running = 0; /* nice flag */ |
94 | 95 | static char *find_pattern = NULL; /* Pattern to search */ |
… |
… |
|
148 | 149 | static gboolean content_regexp_flag = FALSE; |
149 | 150 | static gboolean content_all_charsets_flag = FALSE; |
150 | 151 | static gboolean content_case_sensitive = TRUE; |
| 152 | static gboolean content_whole_words = FALSE; |
151 | 153 | |
152 | 154 | static int find_recursively = 1; |
153 | 155 | |
… |
… |
|
261 | 263 | |
262 | 264 | static const char *file_case_label = N_("Cas&e sensitive"); |
263 | 265 | static const char *content_case_label = N_("Case sens&itive"); |
| 266 | static const char *content_whole_words_label = N_("&Whole words"); |
264 | 267 | static const char *file_recurs_label = N_("&Find recursively"); |
265 | 268 | static const char *file_skip_hidden_label = N_("S&kip hidden"); |
266 | 269 | static const char *file_all_charsets_label = N_("&All charsets"); |
… |
… |
|
327 | 330 | button_new (FIND_Y - 3, FIND_X/4 - b0/2, B_ENTER, DEFPUSH_BUTTON, buts[0], 0)); |
328 | 331 | |
329 | 332 | #ifdef HAVE_CHARSET |
330 | | content_all_charsets_cbox = check_new (9, FIND_X / 2 + 1, |
| 333 | content_all_charsets_cbox = check_new (11, FIND_X / 2 + 1, |
331 | 334 | content_all_charsets_flag, content_all_charsets_label); |
332 | 335 | add_widget (find_dlg, content_all_charsets_cbox); |
333 | 336 | #endif |
334 | 337 | |
335 | | find_regex_cbox = check_new (8, FIND_X / 2 + 1, content_regexp_flag, content_regexp_label); |
| 338 | find_regex_cbox = check_new (9, FIND_X / 2 + 1, content_regexp_flag, content_regexp_label); |
336 | 339 | add_widget (find_dlg, find_regex_cbox); |
337 | 340 | |
| 341 | content_whole_words_cbox = check_new (8, FIND_X / 2 + 1, content_whole_words, content_whole_words_label); |
| 342 | add_widget (find_dlg, content_whole_words_cbox); |
| 343 | |
338 | 344 | content_case_sens = check_new (7, FIND_X / 2 + 1, content_case_sensitive, content_case_label); |
339 | 345 | add_widget (find_dlg, content_case_sens); |
340 | 346 | |
… |
… |
|
385 | 391 | content_all_charsets_flag = content_all_charsets_cbox->state & C_BOOL; |
386 | 392 | #endif |
387 | 393 | content_case_sensitive = content_case_sens->state & C_BOOL; |
| 394 | content_whole_words = content_whole_words_cbox->state & C_BOOL; |
388 | 395 | content_regexp_flag = find_regex_cbox->state & C_BOOL; |
389 | 396 | file_pattern_flag = file_pattern_cbox->state & C_BOOL; |
390 | 397 | file_case_sensitive = file_case_sens->state & C_BOOL; |
… |
… |
|
418 | 425 | content_all_charsets_flag = content_all_charsets_cbox->state & C_BOOL; |
419 | 426 | #endif |
420 | 427 | content_case_sensitive = content_case_sens->state & C_BOOL; |
| 428 | content_whole_words = content_whole_words_cbox->state & C_BOOL; |
421 | 429 | content_regexp_flag = find_regex_cbox->state & C_BOOL; |
422 | 430 | find_recursively = recursively_cbox->state & C_BOOL; |
423 | 431 | file_pattern_flag = file_pattern_cbox->state & C_BOOL; |
… |
… |
|
741 | 749 | { |
742 | 750 | search_content_handle->search_type = (content_regexp_flag) ? MC_SEARCH_T_REGEX : MC_SEARCH_T_NORMAL; |
743 | 751 | search_content_handle->is_case_sentitive = content_case_sensitive; |
| 752 | search_content_handle->whole_words = content_whole_words; |
744 | 753 | search_content_handle->is_all_charsets = content_all_charsets_flag; |
745 | 754 | } |
746 | 755 | search_file_handle = mc_search_new(find_pattern, -1); |
diff -Naur mc-4.7.0-pre1~/src/view.c mc-4.7.0-pre1/src/view.c
old
|
new
|
|
261 | 261 | mc_search_type_t search_type; |
262 | 262 | gboolean search_all_codepages; |
263 | 263 | gboolean search_case; |
| 264 | gboolean whole_words; |
264 | 265 | gboolean search_backwards; |
265 | 266 | |
266 | 267 | int search_numNeedSkipChar; |
… |
… |
|
3146 | 3147 | if (view->search_backwards) { |
3147 | 3148 | search_end = view_get_filesize (view); |
3148 | 3149 | while ((int) search_start >= 0) { |
3149 | | if (search_end - search_start > view->search->original_len && mc_search_is_fixed_search_str(view->search)) |
| 3150 | if (search_end > search_start + view->search->original_len && mc_search_is_fixed_search_str(view->search)) |
3150 | 3151 | search_end = search_start + view->search->original_len; |
3151 | 3152 | |
3152 | 3153 | view_read_start (view, &view->search_onechar_info, search_start); |
… |
… |
|
3268 | 3269 | int ttype_of_search = (int) view->search_type; |
3269 | 3270 | int tall_codepages = (int) view->search_all_codepages; |
3270 | 3271 | int tsearch_case = (int) view->search_case; |
| 3272 | int twhole_words = (int) view->whole_words; |
3271 | 3273 | int tsearch_backwards = (int) view->search_backwards; |
3272 | 3274 | |
3273 | 3275 | gchar **list_of_types = mc_search_get_types_strings_array(); |
… |
… |
|
3282 | 3284 | 0, 0, NULL, NULL, NULL}, |
3283 | 3285 | |
3284 | 3286 | #ifdef HAVE_CHARSET |
3285 | | {quick_checkbox, SEARCH_DLG_WIDTH/2 + 3, SEARCH_DLG_WIDTH, 6, SEARCH_DLG_HEIGHT, N_("All charsets"), 0, 0, |
| 3287 | {quick_checkbox, SEARCH_DLG_WIDTH/2 + 3, SEARCH_DLG_WIDTH, 7, SEARCH_DLG_HEIGHT, N_("All charsets"), 0, 0, |
3286 | 3288 | &tall_codepages, 0, NULL, NULL, NULL}, |
3287 | 3289 | #endif |
3288 | 3290 | |
3289 | | {quick_checkbox, SEARCH_DLG_WIDTH/2 + 3, SEARCH_DLG_WIDTH, 5, SEARCH_DLG_HEIGHT, |
| 3291 | {quick_checkbox, SEARCH_DLG_WIDTH/2 + 3, SEARCH_DLG_WIDTH, 6, SEARCH_DLG_HEIGHT, |
3290 | 3292 | N_("&Backwards"), 0, 0, &tsearch_backwards, 0, NULL, NULL, NULL}, |
3291 | 3293 | |
| 3294 | {quick_checkbox, SEARCH_DLG_WIDTH/2 + 3, SEARCH_DLG_WIDTH, 5, SEARCH_DLG_HEIGHT, N_("&Whole words"), 0, 0, |
| 3295 | &twhole_words, 0, NULL, NULL, NULL}, |
| 3296 | |
3292 | 3297 | {quick_checkbox, SEARCH_DLG_WIDTH/2 + 3, SEARCH_DLG_WIDTH, 4, SEARCH_DLG_HEIGHT, N_("case &Sensitive"), 0, 0, |
3293 | 3298 | &tsearch_case, 0, NULL, NULL, NULL}, |
3294 | 3299 | |
… |
… |
|
3321 | 3326 | |
3322 | 3327 | view->search_all_codepages = (gboolean) tall_codepages; |
3323 | 3328 | view->search_case = (gboolean) tsearch_case; |
| 3329 | view->whole_words = (gboolean) twhole_words; |
3324 | 3330 | |
3325 | 3331 | if (exp == NULL || exp[0] == '\0') |
3326 | 3332 | goto cleanup; |
… |
… |
|
3349 | 3355 | view->search->search_type = view->search_type; |
3350 | 3356 | view->search->is_all_charsets = view->search_all_codepages; |
3351 | 3357 | view->search->is_case_sentitive = view->search_case; |
| 3358 | view->search->whole_words = view->whole_words; |
3352 | 3359 | view->search->search_fn = view_search_cmd_callback; |
3353 | 3360 | view->search->update_fn = view_search_update_cmd_callback; |
3354 | 3361 | |