xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit d9e492e70b6046104696d81336353bc6665299a0

Use more generic "items" instead of "files"
Primarily when reporting number of file-system objects. The count can
be referring to directories or a mix of files and directories.

Thanks to qadzek.

See https://q2a.vifm.info/2199/misc-feedback
Author: xaizek
Author date (UTC): 2025-07-22 16:15
Committer name: xaizek
Committer date (UTC): 2025-07-22 17:59
Parent(s): 37d0cf0ffdc703664cecdde9cb4ba1d807c945d4
Signing key: 99DC5E4DB05F6BE2
Tree: e5f96b1694ad0b6cd0efe95456b1c8f69eaa5f1c
File Lines added Lines deleted
ChangeLog 3 0
src/fops_cpmv.c 1 1
src/fops_misc.c 4 4
src/fops_put.c 1 1
src/fops_rename.c 5 5
src/search.c 1 1
tests/commands/cpmv.c 3 3
tests/fileops/rename_files.c 7 7
tests/lua/api_keys.c 2 2
tests/misc/search_functional.c 3 3
File ChangeLog changed (mode: 100644) (index c4ddbd0c7..4763c7656)
53 53
54 54 Reworked --help output to be more compact and readable. Reworked --help output to be more compact and readable.
55 55
56 Prefer to use more generic "items" instead of "files" when referring to
57 file-system objects. Thanks to qadzek.
58
56 59 Fixed 'trashdir' with "%r" on BSD-like systems (those with getmntinfo() Fixed 'trashdir' with "%r" on BSD-like systems (those with getmntinfo()
57 60 instead of getmntent() API). The regression was apparently introduced in instead of getmntent() API). The regression was apparently introduced in
58 61 v0.9.1-beta. Thanks to sublimal. v0.9.1-beta. Thanks to sublimal.
File src/fops_cpmv.c changed (mode: 100644) (index e576089fe..c6b609981)
... ... fops_cpmv(view_t *view, char *list[], int nlines, CopyMoveLikeOp op, int flags)
207 207 free_string_array(list, nlines); free_string_array(list, nlines);
208 208 } }
209 209
210 ui_sb_msgf("%d file%s successfully processed%s", ops->succeeded,
210 ui_sb_msgf("%d item%s successfully processed%s", ops->succeeded,
211 211 (ops->succeeded == 1) ? "" : "s", fops_get_cancellation_suffix()); (ops->succeeded == 1) ? "" : "s", fops_get_cancellation_suffix());
212 212
213 213 fops_free_ops(ops); fops_free_ops(ops);
File src/fops_misc.c changed (mode: 100644) (index 72098469b..234c38f86)
... ... fops_yank(view_t *view, int reg)
472 472
473 473 regs_update_unnamed(reg); regs_update_unnamed(reg);
474 474
475 ui_sb_msgf("%d file%s yanked", nyanked_files,
475 ui_sb_msgf("%d item%s yanked", nyanked_files,
476 476 (nyanked_files == 1) ? "" : "s"); (nyanked_files == 1) ? "" : "s");
477 477
478 478 regs_sync_to_shared_memory(); regs_sync_to_shared_memory();
 
... ... fops_clone(view_t *view, char *list[], int nlines, int force, int copies)
892 892 free_string_array(list, nlines); free_string_array(list, nlines);
893 893 } }
894 894
895 ui_sb_msgf("%d file%s cloned%s", ops->succeeded,
895 ui_sb_msgf("%d item%s cloned%s", ops->succeeded,
896 896 (ops->succeeded == 1) ? "" : "s", fops_get_cancellation_suffix()); (ops->succeeded == 1) ? "" : "s", fops_get_cancellation_suffix());
897 897
898 898 fops_free_ops(ops); fops_free_ops(ops);
 
... ... fops_mkfiles(view_t *view, int at, char *names[], int count)
1129 1129 go_to_first_file(view, names, count); go_to_first_file(view, names, count);
1130 1130 } }
1131 1131
1132 ui_sb_msgf("%d file%s created%s", n, (n == 1) ? "" : "s",
1132 ui_sb_msgf("%d item%s created%s", n, (n == 1) ? "" : "s",
1133 1133 fops_get_cancellation_suffix()); fops_get_cancellation_suffix());
1134 1134
1135 1135 fops_free_ops(ops); fops_free_ops(ops);
 
... ... fops_chown(int u, int g, uid_t uid, gid_t gid)
1444 1444 } }
1445 1445 un_group_close(); un_group_close();
1446 1446
1447 ui_sb_msgf("%d file%s fully processed%s", ops->succeeded,
1447 ui_sb_msgf("%d item%s fully processed%s", ops->succeeded,
1448 1448 (ops->succeeded == 1) ? "" : "s", fops_get_cancellation_suffix()); (ops->succeeded == 1) ? "" : "s", fops_get_cancellation_suffix());
1449 1449 fops_free_ops(ops); fops_free_ops(ops);
1450 1450
File src/fops_put.c changed (mode: 100644) (index acb03c710..182fe3ded)
... ... put_files_i(view_t *view, int start)
494 494
495 495 regs_pack(put_confirm.reg->name); regs_pack(put_confirm.reg->name);
496 496 update_cursor_position(view); update_cursor_position(view);
497 ui_sb_msgf("%d file%s inserted%s", put_confirm.processed,
497 ui_sb_msgf("%d item%s inserted%s", put_confirm.processed,
498 498 (put_confirm.processed == 1) ? "" : "s", fops_get_cancellation_suffix()); (put_confirm.processed == 1) ? "" : "s", fops_get_cancellation_suffix());
499 499
500 500 return 1; return 1;
File src/fops_rename.c changed (mode: 100644) (index a2328bab1..f141710a6)
... ... fops_rename(view_t *view, char *list[], int nlines, int recursive)
216 216 const int renamed = perform_renaming(view, files, is_dup, nfiles, list); const int renamed = perform_renaming(view, files, is_dup, nfiles, list);
217 217 if(renamed >= 0) if(renamed >= 0)
218 218 { {
219 ui_sb_msgf("%d file%s renamed", renamed, (renamed == 1) ? "" : "s");
219 ui_sb_msgf("%d item%s renamed", renamed, (renamed == 1) ? "" : "s");
220 220 } }
221 221
222 222 flist_sel_stash(view); flist_sel_stash(view);
 
... ... verify_list(char *files[], int nfiles, char *names[], int nnames, char **error,
290 290 const char *suffix = (moves == 1 ? "" : "s"); const char *suffix = (moves == 1 ? "" : "s");
291 291 /* Stray space prevents removal of the line. */ /* Stray space prevents removal of the line. */
292 292 if(!prompt_msgf("Rename", if(!prompt_msgf("Rename",
293 "It appears that the rename list has %d file move%s, which could "
294 "have happened by mistake."
293 "It appears that the rename list has %d move%s, which could have "
294 "happened by mistake."
295 295 "\n \n" "\n \n"
296 296 "Perform the move%s?", "Perform the move%s?",
297 297 moves, suffix, suffix)) moves, suffix, suffix))
 
... ... fops_incdec(view_t *view, int k)
586 586 } }
587 587 else if(err == 0) else if(err == 0)
588 588 { {
589 ui_sb_msgf("%d file%s renamed", nrenamed, (nrenamed == 1) ? "" : "s");
589 ui_sb_msgf("%d item%s renamed", nrenamed, (nrenamed == 1) ? "" : "s");
590 590 } }
591 591
592 592 return 1; return 1;
 
... ... rename_marked(view_t *view, const char desc[], const char lhs[],
944 944 ui_view_schedule_redraw(view); ui_view_schedule_redraw(view);
945 945 } }
946 946
947 ui_sb_msgf("%d file%s renamed", nrenamed, (nrenamed == 1) ? "" : "s");
947 ui_sb_msgf("%d item%s renamed", nrenamed, (nrenamed == 1) ? "" : "s");
948 948 return 1; return 1;
949 949 } }
950 950
File src/search.c changed (mode: 100644) (index 2811a5f36..22cc44ccf)
... ... print_search_msg(const view_t *view, int backward)
316 316 } }
317 317 else else
318 318 { {
319 ui_sb_msgf("%d of %d matching file%s for: %s",
319 ui_sb_msgf("%d of %d matching item%s for: %s",
320 320 get_current_entry(view)->search_match, view->matches, get_current_entry(view)->search_match, view->matches,
321 321 (view->matches == 1) ? "" : "s", hists_search_last()); (view->matches == 1) ? "" : "s", hists_search_last());
322 322 } }
File tests/commands/cpmv.c changed (mode: 100644) (index 4a0e2e734..38e9daceb)
... ... TEST(copy_can_skip_existing_files)
87 87 { {
88 88 ui_sb_msg(""); ui_sb_msg("");
89 89 assert_failure(cmds_dispatch("%copy -skip", &lwin, CIT_COMMAND)); assert_failure(cmds_dispatch("%copy -skip", &lwin, CIT_COMMAND));
90 assert_string_equal("2 files successfully processed", ui_sb_last());
90 assert_string_equal("2 items successfully processed", ui_sb_last());
91 91
92 92 assert_int_equal(2, get_file_size(SANDBOX_PATH "/right/a")); assert_int_equal(2, get_file_size(SANDBOX_PATH "/right/a"));
93 93 remove_file(SANDBOX_PATH "/right/b"); remove_file(SANDBOX_PATH "/right/b");
 
... ... TEST(link_can_skip_existing_files, IF(not_windows))
97 97 { {
98 98 ui_sb_msg(""); ui_sb_msg("");
99 99 assert_failure(cmds_dispatch("%alink -skip", &lwin, CIT_COMMAND)); assert_failure(cmds_dispatch("%alink -skip", &lwin, CIT_COMMAND));
100 assert_string_equal("2 files successfully processed", ui_sb_last());
100 assert_string_equal("2 items successfully processed", ui_sb_last());
101 101
102 102 assert_int_equal(2, get_file_size(SANDBOX_PATH "/right/a")); assert_int_equal(2, get_file_size(SANDBOX_PATH "/right/a"));
103 103 remove_file(SANDBOX_PATH "/right/b"); remove_file(SANDBOX_PATH "/right/b");
 
... ... TEST(file_name_can_start_with_a_dash)
107 107 { {
108 108 ui_sb_msg(""); ui_sb_msg("");
109 109 assert_failure(cmds_dispatch("%copy -- -test -skip", &lwin, CIT_COMMAND)); assert_failure(cmds_dispatch("%copy -- -test -skip", &lwin, CIT_COMMAND));
110 assert_string_equal("2 files successfully processed", ui_sb_last());
110 assert_string_equal("2 items successfully processed", ui_sb_last());
111 111
112 112 remove_file(SANDBOX_PATH "/right/-test"); remove_file(SANDBOX_PATH "/right/-test");
113 113 remove_file(SANDBOX_PATH "/right/-skip"); remove_file(SANDBOX_PATH "/right/-skip");
File tests/fileops/rename_files.c changed (mode: 100644) (index b806f3211..eef8a1aeb)
... ... TEST(rename_can_move_files)
354 354
355 355 ui_sb_msg(""); ui_sb_msg("");
356 356 (void)fops_rename(&lwin, names, /*nlines=*/1, /*recursive=*/0); (void)fops_rename(&lwin, names, /*nlines=*/1, /*recursive=*/0);
357 assert_string_equal("1 file renamed", ui_sb_last());
357 assert_string_equal("1 item renamed", ui_sb_last());
358 358
359 359 restore_cwd(saved_cwd); restore_cwd(saved_cwd);
360 360 saved_cwd = save_cwd(); saved_cwd = save_cwd();
 
... ... TEST(case_change_works, IF(on_case_sensitive_fs))
422 422
423 423 ui_sb_msg(""); ui_sb_msg("");
424 424 (void)fops_case(&lwin, /*to_upper=*/0); (void)fops_case(&lwin, /*to_upper=*/0);
425 assert_string_equal("2 files renamed", ui_sb_last());
425 assert_string_equal("2 items renamed", ui_sb_last());
426 426
427 427 assert_failure(unlink(SANDBOX_PATH "/fIlE1")); assert_failure(unlink(SANDBOX_PATH "/fIlE1"));
428 428 assert_failure(unlink(SANDBOX_PATH "/FiLe2")); assert_failure(unlink(SANDBOX_PATH "/FiLe2"));
 
... ... TEST(substitution_and_idential_names_in_different_dirs)
466 466
467 467 ui_sb_msg(""); ui_sb_msg("");
468 468 (void)fops_subst(&lwin, "$", "d", /*ic=*/0, /*glob=*/0); (void)fops_subst(&lwin, "$", "d", /*ic=*/0, /*glob=*/0);
469 assert_string_equal("2 files renamed", ui_sb_last());
469 assert_string_equal("2 items renamed", ui_sb_last());
470 470
471 471 assert_failure(unlink(SANDBOX_PATH "/adir/abc")); assert_failure(unlink(SANDBOX_PATH "/adir/abc"));
472 472 assert_success(unlink(SANDBOX_PATH "/adir/abcd")); assert_success(unlink(SANDBOX_PATH "/adir/abcd"));
 
... ... TEST(translation_and_idential_names_in_different_dirs)
494 494
495 495 ui_sb_msg(""); ui_sb_msg("");
496 496 (void)fops_tr(&lwin, "abc", "xyz"); (void)fops_tr(&lwin, "abc", "xyz");
497 assert_string_equal("2 files renamed", ui_sb_last());
497 assert_string_equal("2 items renamed", ui_sb_last());
498 498
499 499 assert_failure(unlink(SANDBOX_PATH "/adir/abc")); assert_failure(unlink(SANDBOX_PATH "/adir/abc"));
500 500 assert_success(unlink(SANDBOX_PATH "/adir/xyz")); assert_success(unlink(SANDBOX_PATH "/adir/xyz"));
 
... ... TEST(case_change_and_idential_names_in_different_dirs, IF(on_case_sensitive_fs))
522 522
523 523 ui_sb_msg(""); ui_sb_msg("");
524 524 (void)fops_case(&lwin, /*to_upper=*/1); (void)fops_case(&lwin, /*to_upper=*/1);
525 assert_string_equal("2 files renamed", ui_sb_last());
525 assert_string_equal("2 items renamed", ui_sb_last());
526 526
527 527 assert_failure(unlink(SANDBOX_PATH "/adir/abc")); assert_failure(unlink(SANDBOX_PATH "/adir/abc"));
528 528 assert_success(unlink(SANDBOX_PATH "/adir/ABC")); assert_success(unlink(SANDBOX_PATH "/adir/ABC"));
 
... ... allow_move_dlg_cb(const char type[], const char title[], const char message[])
537 537 { {
538 538 assert_string_equal("prompt", type); assert_string_equal("prompt", type);
539 539 assert_string_equal("Rename", title); assert_string_equal("Rename", title);
540 assert_string_starts_with("It appears that the rename list has 1 file move,",
540 assert_string_starts_with("It appears that the rename list has 1 move,",
541 541 message); message);
542 542
543 543 dlg_set_callback(NULL); dlg_set_callback(NULL);
 
... ... deny_move_dlg_cb(const char type[], const char title[], const char message[])
549 549 { {
550 550 assert_string_equal("prompt", type); assert_string_equal("prompt", type);
551 551 assert_string_equal("Rename", title); assert_string_equal("Rename", title);
552 assert_string_starts_with("It appears that the rename list has 1 file move,",
552 assert_string_starts_with("It appears that the rename list has 1 move,",
553 553 message); message);
554 554
555 555 dlg_set_callback(NULL); dlg_set_callback(NULL);
File tests/lua/api_keys.c changed (mode: 100644) (index 0f710e51f..d3ad22d26)
... ... TEST(keys_selector_duplicated_indexes)
190 190 ui_sb_msg(""); ui_sb_msg("");
191 191 (void)vle_keys_exec_timed_out(L"yX"); (void)vle_keys_exec_timed_out(L"yX");
192 192 assert_int_equal(1, curr_stats.save_msg); assert_int_equal(1, curr_stats.save_msg);
193 assert_string_equal("1 file yanked", ui_sb_last());
193 assert_string_equal("1 item yanked", ui_sb_last());
194 194 } }
195 195
196 196 TEST(keys_bad_selector_cursorpos) TEST(keys_bad_selector_cursorpos)
 
... ... TEST(keys_add_selector)
280 280
281 281 (void)vle_keys_exec_timed_out(L"yX"); (void)vle_keys_exec_timed_out(L"yX");
282 282 assert_int_equal(1, curr_stats.save_msg); assert_int_equal(1, curr_stats.save_msg);
283 assert_string_equal("2 files yanked", ui_sb_last());
283 assert_string_equal("2 items yanked", ui_sb_last());
284 284
285 285 const reg_t *reg = regs_find(DEFAULT_REG_NAME); const reg_t *reg = regs_find(DEFAULT_REG_NAME);
286 286 assert_non_null(reg); assert_non_null(reg);
File tests/misc/search_functional.c changed (mode: 100644) (index 72233185e..e846fe156)
... ... TEST(correct_match_number_is_shown_for_search_in_visual_mode)
187 187 assert_int_equal(0, lwin.dir_entry[0].search_match); assert_int_equal(0, lwin.dir_entry[0].search_match);
188 188 assert_int_equal(1, lwin.dir_entry[1].search_match); assert_int_equal(1, lwin.dir_entry[1].search_match);
189 189 assert_int_equal(2, lwin.dir_entry[2].search_match); assert_int_equal(2, lwin.dir_entry[2].search_match);
190 assert_string_starts_with("1 of 2 matching files", ui_sb_last());
190 assert_string_starts_with("1 of 2 matching items", ui_sb_last());
191 191 } }
192 192
193 193 TEST(correct_cursor_position_for_incsearch_with_a_count) TEST(correct_cursor_position_for_incsearch_with_a_count)
 
... ... TEST(message_is_shown_after_incsearch_with_hlsearch_in_visual_mode)
228 228
229 229 (void)vle_keys_exec_timed_out(WK_v WK_SLASH L"." WK_CR); (void)vle_keys_exec_timed_out(WK_v WK_SLASH L"." WK_CR);
230 230
231 assert_string_starts_with("2 of 6 matching files", ui_sb_last());
231 assert_string_starts_with("2 of 6 matching items", ui_sb_last());
232 232 } }
233 233
234 234 TEST(selection_isnt_dropped_on_empty_input_during_incsearch_with_hls_in_vismode) TEST(selection_isnt_dropped_on_empty_input_during_incsearch_with_hls_in_vismode)
 
... ... TEST(message_after_cursor_movements_during_incsearch)
288 288 assert_int_equal(1, lwin.list_pos); assert_int_equal(1, lwin.list_pos);
289 289 fpos_set_pos(&lwin, 2); fpos_set_pos(&lwin, 2);
290 290 (void)vle_keys_exec_timed_out(WK_CR); (void)vle_keys_exec_timed_out(WK_CR);
291 assert_string_starts_with("2 of 2 matching files", ui_sb_last());
291 assert_string_starts_with("2 of 2 matching items", ui_sb_last());
292 292
293 293 /* Show a message if no matches found. */ /* Show a message if no matches found. */
294 294 ui_sb_msg(""); ui_sb_msg("");
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master