File src/flist_sel.c changed (mode: 100644) (index 8d5040508..68df20fc5) |
... |
... |
flist_sel_by_filter(FileView *view, const char cmd[], int erase_old, int select) |
255 |
255 |
int nfiles; |
int nfiles; |
256 |
256 |
int i; |
int i; |
257 |
257 |
|
|
258 |
|
if(run_cmd_for_output(cmd, &files, &nfiles) != 0) |
|
|
258 |
|
char *const expanded_cmd = expand_macros(cmd, NULL, NULL, 1); |
|
259 |
|
|
|
260 |
|
if(run_cmd_for_output(expanded_cmd, &files, &nfiles) != 0) |
259 |
261 |
{ |
{ |
|
262 |
|
free(expanded_cmd); |
260 |
263 |
status_bar_error("Failed to start/read output of external command"); |
status_bar_error("Failed to start/read output of external command"); |
261 |
264 |
return 1; |
return 1; |
262 |
265 |
} |
} |
|
266 |
|
free(expanded_cmd); |
263 |
267 |
|
|
264 |
268 |
/* Append to previous selection unless ! is specified. */ |
/* Append to previous selection unless ! is specified. */ |
265 |
269 |
if(select && erase_old) |
if(select && erase_old) |
File tests/misc/commands_selection.c changed (mode: 100644) (index 1cb9916b8..b742c55ba) |
... |
... |
TEST(select_and_unselect_accept_external_command) |
278 |
278 |
assert_false(lwin.dir_entry[2].selected); |
assert_false(lwin.dir_entry[2].selected); |
279 |
279 |
} |
} |
280 |
280 |
|
|
|
281 |
|
TEST(select_expands_macros_in_external_command) |
|
282 |
|
{ |
|
283 |
|
strcpy(lwin.curr_dir, cwd); |
|
284 |
|
assert_success(chdir(cwd)); |
|
285 |
|
|
|
286 |
|
add_some_files_to_view(&lwin); |
|
287 |
|
|
|
288 |
|
assert_success(exec_commands("select !echo %c", &lwin, CIT_COMMAND)); |
|
289 |
|
assert_int_equal(1, lwin.selected_files); |
|
290 |
|
assert_true(lwin.dir_entry[0].selected); |
|
291 |
|
assert_false(lwin.dir_entry[1].selected); |
|
292 |
|
assert_false(lwin.dir_entry[2].selected); |
|
293 |
|
} |
|
294 |
|
|
281 |
295 |
TEST(select_and_unselect_consider_trailing_slash) |
TEST(select_and_unselect_consider_trailing_slash) |
282 |
296 |
{ |
{ |
283 |
297 |
strcpy(lwin.curr_dir, cwd); |
strcpy(lwin.curr_dir, cwd); |