| File src/cmd_handlers.c changed (mode: 100644) (index 38ba96c22..f6fff160a) |
| ... |
... |
sync_location(const char path[], int cv, int sync_cursor_pos, int sync_filters, |
| 4887 |
4887 |
* of files, hence no extra work). */ |
* of files, hence no extra work). */ |
| 4888 |
4888 |
if(sync_filters) |
if(sync_filters) |
| 4889 |
4889 |
{ |
{ |
| 4890 |
|
local_filter_apply(other_view, curr_view->local_filter.filter.raw); |
|
|
4890 |
|
local_filter_apply(other_view, local_filter_get(curr_view)); |
| 4891 |
4891 |
} |
} |
| 4892 |
4892 |
|
|
| 4893 |
4893 |
(void)flist_clone_tree(other_view, curr_view); |
(void)flist_clone_tree(other_view, curr_view); |
| |
| ... |
... |
sync_location(const char path[], int cv, int sync_cursor_pos, int sync_filters, |
| 4897 |
4897 |
flist_custom_clone(other_view, curr_view, 0); |
flist_custom_clone(other_view, curr_view, 0); |
| 4898 |
4898 |
if(sync_filters) |
if(sync_filters) |
| 4899 |
4899 |
{ |
{ |
| 4900 |
|
local_filter_apply(other_view, curr_view->local_filter.filter.raw); |
|
|
4900 |
|
local_filter_apply(other_view, local_filter_get(curr_view)); |
| 4901 |
4901 |
replace_dir_entries(other_view, &other_view->custom.entries, |
replace_dir_entries(other_view, &other_view->custom.entries, |
| 4902 |
4902 |
&other_view->custom.entry_count, other_view->dir_entry, |
&other_view->custom.entry_count, other_view->dir_entry, |
| 4903 |
4903 |
other_view->list_rows); |
other_view->list_rows); |
| |
| ... |
... |
sync_location(const char path[], int cv, int sync_cursor_pos, int sync_filters, |
| 4910 |
4910 |
* of files, hence no extra work). */ |
* of files, hence no extra work). */ |
| 4911 |
4911 |
if(sync_filters) |
if(sync_filters) |
| 4912 |
4912 |
{ |
{ |
| 4913 |
|
local_filter_apply(other_view, curr_view->local_filter.filter.raw); |
|
|
4913 |
|
local_filter_apply(other_view, local_filter_get(curr_view)); |
| 4914 |
4914 |
} |
} |
| 4915 |
4915 |
|
|
| 4916 |
4916 |
(void)populate_dir_list(other_view, 0); |
(void)populate_dir_list(other_view, 0); |
| File src/filtering.c changed (mode: 100644) (index 927be6259..628fe55aa) |
| ... |
... |
filters_drop_temporaries(view_t *view, dir_entry_t entries[]) |
| 385 |
385 |
view->list_rows = list_size; |
view->list_rows = list_size; |
| 386 |
386 |
} |
} |
| 387 |
387 |
|
|
|
388 |
|
const char * |
|
389 |
|
local_filter_get(const view_t *view) |
|
390 |
|
{ |
|
391 |
|
return view->local_filter.filter.raw; |
|
392 |
|
} |
|
393 |
|
|
| 388 |
394 |
int |
int |
| 389 |
395 |
local_filter_is_empty(const view_t *view) |
local_filter_is_empty(const view_t *view) |
| 390 |
396 |
{ |
{ |
| |
| ... |
... |
load_unfiltered_list(view_t *view) |
| 442 |
448 |
|
|
| 443 |
449 |
view->local_filter.in_progress = 1; |
view->local_filter.in_progress = 1; |
| 444 |
450 |
|
|
| 445 |
|
view->local_filter.saved = strdup(view->local_filter.filter.raw); |
|
|
451 |
|
view->local_filter.saved = strdup(local_filter_get(view)); |
| 446 |
452 |
|
|
| 447 |
453 |
if(list_is_incomplete(view)) |
if(list_is_incomplete(view)) |
| 448 |
454 |
{ |
{ |
| |
| ... |
... |
local_filter_accept(view_t *view, int update_history) |
| 796 |
802 |
|
|
| 797 |
803 |
if(update_history) |
if(update_history) |
| 798 |
804 |
{ |
{ |
| 799 |
|
hists_filter_save(view->local_filter.filter.raw); |
|
|
805 |
|
hists_filter_save(local_filter_get(view)); |
| 800 |
806 |
} |
} |
| 801 |
807 |
|
|
| 802 |
808 |
/* Some of previously selected files could be filtered out, update number of |
/* Some of previously selected files could be filtered out, update number of |
| |
| ... |
... |
local_filter_apply(view_t *view, const char filter[]) |
| 815 |
821 |
|
|
| 816 |
822 |
int case_sensitive = !regexp_should_ignore_case(filter); |
int case_sensitive = !regexp_should_ignore_case(filter); |
| 817 |
823 |
(void)filter_change(&view->local_filter.filter, filter, case_sensitive); |
(void)filter_change(&view->local_filter.filter, filter, case_sensitive); |
| 818 |
|
hists_filter_save(view->local_filter.filter.raw); |
|
|
824 |
|
hists_filter_save(local_filter_get(view)); |
| 819 |
825 |
|
|
| 820 |
826 |
flist_custom_save(view); |
flist_custom_save(view); |
| 821 |
827 |
|
|
| |
| ... |
... |
local_filter_finish(view_t *view) |
| 856 |
862 |
void |
void |
| 857 |
863 |
local_filter_remove(view_t *view) |
local_filter_remove(view_t *view) |
| 858 |
864 |
{ |
{ |
| 859 |
|
(void)replace_string(&view->local_filter.prev, view->local_filter.filter.raw); |
|
|
865 |
|
(void)replace_string(&view->local_filter.prev, local_filter_get(view)); |
| 860 |
866 |
filter_clear(&view->local_filter.filter); |
filter_clear(&view->local_filter.filter); |
| 861 |
867 |
ui_view_schedule_reload(view); |
ui_view_schedule_reload(view); |
| 862 |
868 |
} |
} |
| File src/filtering.h changed (mode: 100644) (index ff1c36659..a47ca204e) |
| ... |
... |
void name_filters_restore(struct view_t *view); |
| 89 |
89 |
|
|
| 90 |
90 |
/* Local filter related functions. */ |
/* Local filter related functions. */ |
| 91 |
91 |
|
|
|
92 |
|
/* Retrieves value of the local filter of the view. Returns a pointer to the |
|
93 |
|
* filter's internal state. */ |
|
94 |
|
const char * local_filter_get(const struct view_t *view); |
|
95 |
|
|
| 92 |
96 |
/* Checks whether the view has an empty (unset) local filter. Returns non-zero |
/* Checks whether the view has an empty (unset) local filter. Returns non-zero |
| 93 |
97 |
* if so, otherwise zero is returned. */ |
* if so, otherwise zero is returned. */ |
| 94 |
98 |
int local_filter_is_empty(const struct view_t *view); |
int local_filter_is_empty(const struct view_t *view); |
| File src/modes/cmdline.c changed (mode: 100644) (index bb4a6bbdb..075c6ca2f) |
| ... |
... |
cmd_ctrl_xxt(key_info_t key_info, keys_info_t *keys_info) |
| 2431 |
2431 |
static void |
static void |
| 2432 |
2432 |
cmd_ctrl_xequals(key_info_t key_info, keys_info_t *keys_info) |
cmd_ctrl_xequals(key_info_t key_info, keys_info_t *keys_info) |
| 2433 |
2433 |
{ |
{ |
| 2434 |
|
paste_str(curr_view->local_filter.filter.raw, 0); |
|
|
2434 |
|
paste_str(local_filter_get(curr_view), /*allow_escaping=*/0); |
| 2435 |
2435 |
} |
} |
| 2436 |
2436 |
|
|
| 2437 |
2437 |
/* Inserts root/extension of the name file into current cursor position. */ |
/* Inserts root/extension of the name file into current cursor position. */ |
| File src/modes/normal.c changed (mode: 100644) (index da4cf271a..8668bf09b) |
| ... |
... |
cmd_percent(key_info_t key_info, keys_info_t *keys_info) |
| 1307 |
1307 |
static void |
static void |
| 1308 |
1308 |
cmd_equal(key_info_t key_info, keys_info_t *keys_info) |
cmd_equal(key_info_t key_info, keys_info_t *keys_info) |
| 1309 |
1309 |
{ |
{ |
| 1310 |
|
modcline_enter(CLS_FILTER, curr_view->local_filter.filter.raw); |
|
|
1310 |
|
modcline_enter(CLS_FILTER, local_filter_get(curr_view)); |
| 1311 |
1311 |
} |
} |
| 1312 |
1312 |
|
|
| 1313 |
1313 |
/* Continues navigation to word which starts with specified character in |
/* Continues navigation to word which starts with specified character in |
| File tests/commands/sync.c changed (mode: 100644) (index 9254a99d7..69b5ad29b) |
| ... |
... |
TEST(sync_syncs_local_filter) |
| 58 |
58 |
|
|
| 59 |
59 |
assert_success(cmds_dispatch("sync! location filters", curr_view, |
assert_success(cmds_dispatch("sync! location filters", curr_view, |
| 60 |
60 |
CIT_COMMAND)); |
CIT_COMMAND)); |
| 61 |
|
assert_string_equal("a", other_view->local_filter.filter.raw); |
|
|
61 |
|
assert_string_equal("a", local_filter_get(other_view)); |
| 62 |
62 |
} |
} |
| 63 |
63 |
|
|
| 64 |
64 |
TEST(sync_syncs_filelist) |
TEST(sync_syncs_filelist) |
| |
| ... |
... |
TEST(tree_syncing_applies_properties_of_destination_view) |
| 234 |
234 |
|
|
| 235 |
235 |
assert_success(cmds_dispatch("sync! tree", curr_view, CIT_COMMAND)); |
assert_success(cmds_dispatch("sync! tree", curr_view, CIT_COMMAND)); |
| 236 |
236 |
assert_int_equal(2, other_view->list_rows); |
assert_int_equal(2, other_view->list_rows); |
| 237 |
|
assert_string_equal("", other_view->local_filter.filter.raw); |
|
|
237 |
|
assert_string_equal("", local_filter_get(other_view)); |
| 238 |
238 |
|
|
| 239 |
239 |
assert_true(flist_custom_active(other_view)); |
assert_true(flist_custom_active(other_view)); |
| 240 |
240 |
curr_stats.load_stage = 2; |
curr_stats.load_stage = 2; |
| |
| ... |
... |
TEST(tree_syncing_applies_properties_of_destination_view) |
| 242 |
242 |
curr_stats.load_stage = 0; |
curr_stats.load_stage = 0; |
| 243 |
243 |
|
|
| 244 |
244 |
assert_int_equal(2, other_view->list_rows); |
assert_int_equal(2, other_view->list_rows); |
| 245 |
|
assert_string_equal("", other_view->local_filter.filter.raw); |
|
|
245 |
|
assert_string_equal("", local_filter_get(other_view)); |
| 246 |
246 |
|
|
| 247 |
247 |
columns_teardown(); |
columns_teardown(); |
| 248 |
248 |
} |
} |
| |
| ... |
... |
TEST(sync_all_applies_filters_in_trees) |
| 354 |
354 |
local_filter_apply(curr_view, "a"); |
local_filter_apply(curr_view, "a"); |
| 355 |
355 |
assert_success(cmds_dispatch("sync! all", curr_view, CIT_COMMAND)); |
assert_success(cmds_dispatch("sync! all", curr_view, CIT_COMMAND)); |
| 356 |
356 |
|
|
| 357 |
|
assert_string_equal("a", other_view->local_filter.filter.raw); |
|
|
357 |
|
assert_string_equal("a", local_filter_get(other_view)); |
| 358 |
358 |
|
|
| 359 |
359 |
columns_teardown(); |
columns_teardown(); |
| 360 |
360 |
opt_handlers_teardown(); |
opt_handlers_teardown(); |
| File tests/menus/history.c changed (mode: 100644) (index c33697990..9e49a8dcd) |
| 15 |
15 |
#include "../../src/ui/ui.h" |
#include "../../src/ui/ui.h" |
| 16 |
16 |
#include "../../src/cmd_core.h" |
#include "../../src/cmd_core.h" |
| 17 |
17 |
#include "../../src/filelist.h" |
#include "../../src/filelist.h" |
|
18 |
|
#include "../../src/filtering.h" |
| 18 |
19 |
#include "../../src/status.h" |
#include "../../src/status.h" |
| 19 |
20 |
|
|
| 20 |
21 |
static line_stats_t *stats; |
static line_stats_t *stats; |
| |
| ... |
... |
TEST(lfilter_hist_does_not_split_at_bar) |
| 84 |
85 |
hists_filter_save("a|b"); |
hists_filter_save("a|b"); |
| 85 |
86 |
assert_success(show_filterhistory_menu(&lwin)); |
assert_success(show_filterhistory_menu(&lwin)); |
| 86 |
87 |
|
|
| 87 |
|
assert_string_equal("", lwin.local_filter.filter.raw); |
|
|
88 |
|
assert_string_equal("", local_filter_get(&lwin)); |
| 88 |
89 |
(void)vle_keys_exec(WK_CR); |
(void)vle_keys_exec(WK_CR); |
| 89 |
|
assert_string_equal("a|b", lwin.local_filter.filter.raw); |
|
|
90 |
|
assert_string_equal("a|b", local_filter_get(&lwin)); |
| 90 |
91 |
} |
} |
| 91 |
92 |
|
|
| 92 |
93 |
TEST(menu_commands_hist_runs_on_enter) |
TEST(menu_commands_hist_runs_on_enter) |
| File tests/misc/cmdline.c changed (mode: 100644) (index d230832c9..379f154e8) |
| 20 |
20 |
#include "../../src/cmd_core.h" |
#include "../../src/cmd_core.h" |
| 21 |
21 |
#include "../../src/event_loop.h" |
#include "../../src/event_loop.h" |
| 22 |
22 |
#include "../../src/filelist.h" |
#include "../../src/filelist.h" |
|
23 |
|
#include "../../src/filtering.h" |
| 23 |
24 |
#include "../../src/flist_hist.h" |
#include "../../src/flist_hist.h" |
| 24 |
25 |
#include "../../src/status.h" |
#include "../../src/status.h" |
| 25 |
26 |
|
|
| |
| ... |
... |
TEST(each_filtering_prompt_gets_clean_state) |
| 187 |
188 |
* prompt. */ |
* prompt. */ |
| 188 |
189 |
|
|
| 189 |
190 |
(void)vle_keys_exec_timed_out(L"=a"); |
(void)vle_keys_exec_timed_out(L"=a"); |
| 190 |
|
assert_string_equal("a", curr_view->local_filter.filter.raw); |
|
|
191 |
|
assert_string_equal("a", local_filter_get(curr_view)); |
| 191 |
192 |
(void)vle_keys_exec_timed_out(WK_ESC); |
(void)vle_keys_exec_timed_out(WK_ESC); |
| 192 |
|
assert_string_equal("", curr_view->local_filter.filter.raw); |
|
|
193 |
|
assert_string_equal("", local_filter_get(curr_view)); |
| 193 |
194 |
|
|
| 194 |
195 |
(void)vle_keys_exec_timed_out(L"=a"); |
(void)vle_keys_exec_timed_out(L"=a"); |
| 195 |
|
assert_string_equal("a", curr_view->local_filter.filter.raw); |
|
|
196 |
|
assert_string_equal("a", local_filter_get(curr_view)); |
| 196 |
197 |
(void)vle_keys_exec_timed_out(WK_ESC); |
(void)vle_keys_exec_timed_out(WK_ESC); |
| 197 |
198 |
|
|
| 198 |
199 |
conf_teardown(); |
conf_teardown(); |
| |
| ... |
... |
TEST(normal_in_autocmd_does_not_break_filter_navigation) |
| 390 |
391 |
populate_dir_list(curr_view, /*reload=*/0); |
populate_dir_list(curr_view, /*reload=*/0); |
| 391 |
392 |
|
|
| 392 |
393 |
(void)vle_keys_exec_timed_out(L"=" WK_C_y WK_C_m); |
(void)vle_keys_exec_timed_out(L"=" WK_C_y WK_C_m); |
| 393 |
|
assert_string_equal("", curr_view->local_filter.filter.raw); |
|
|
394 |
|
assert_string_equal("", local_filter_get(curr_view)); |
| 394 |
395 |
|
|
| 395 |
396 |
assert_success(cmds_dispatch1("autocmd!", curr_view, CIT_COMMAND)); |
assert_success(cmds_dispatch1("autocmd!", curr_view, CIT_COMMAND)); |
| 396 |
397 |
wait_for_bg(); |
wait_for_bg(); |
| File tests/misc/compare_misc.c changed (mode: 100644) (index f629ff8cd..711ed86b6) |
| 10 |
10 |
#include "../../src/modes/cmdline.h" |
#include "../../src/modes/cmdline.h" |
| 11 |
11 |
#include "../../src/modes/modes.h" |
#include "../../src/modes/modes.h" |
| 12 |
12 |
#include "../../src/ui/ui.h" |
#include "../../src/ui/ui.h" |
| 13 |
|
#include "../../src/utils/filter.h" |
|
| 14 |
13 |
#include "../../src/utils/fs.h" |
#include "../../src/utils/fs.h" |
| 15 |
14 |
#include "../../src/cmd_core.h" |
#include "../../src/cmd_core.h" |
| 16 |
15 |
#include "../../src/compare.h" |
#include "../../src/compare.h" |
| |
| ... |
... |
TEST(local_filter_is_not_set) |
| 222 |
221 |
cmds_dispatch1("f", &lwin, CIT_FILTER_PATTERN); |
cmds_dispatch1("f", &lwin, CIT_FILTER_PATTERN); |
| 223 |
222 |
assert_true(local_filter_is_empty(&lwin)); |
assert_true(local_filter_is_empty(&lwin)); |
| 224 |
223 |
|
|
| 225 |
|
modcline_enter(CLS_FILTER, lwin.local_filter.filter.raw); |
|
|
224 |
|
modcline_enter(CLS_FILTER, local_filter_get(&lwin)); |
| 226 |
225 |
assert_true(vle_mode_is(NORMAL_MODE)); |
assert_true(vle_mode_is(NORMAL_MODE)); |
| 227 |
226 |
} |
} |
| 228 |
227 |
|
|