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 c54e0dd1b1a20fe39e25e0fdcc7a3b57b8a57f2d

Fix absolute path completion when 'autocd' is set
Thanks to Taras Halturin (a.k.a. halturin).

Fixes #962 on GitHub.
Author: xaizek
Author date (UTC): 2024-04-07 09:56
Committer name: xaizek
Committer date (UTC): 2024-04-14 12:13
Parent(s): 5de6c187d05a5e6f7631025f8a76d6cc5c6ec80e
Signing key: 99DC5E4DB05F6BE2
Tree: dc615eda06cb7c21af7062dad20a768f0e6261fc
File Lines added Lines deleted
ChangeLog 3 0
src/engine/cmds.c 4 0
tests/cmds/completion.c 22 0
tests/misc/cmdline_completion.c 10 0
File ChangeLog changed (mode: 100644) (index 534e36fb0..900a6e562)
232 232 Fixed running external commands which start with a dash. Patch by Ivan Fixed running external commands which start with a dash. Patch by Ivan
233 233 Shapovalov. Shapovalov.
234 234
235 Fixed absolute paths not being completed when 'autocd' option is enabled.
236 Thanks to Taras Halturin (a.k.a. halturin).
237
235 238 0.13-beta to 0.13 (2023-04-04) 0.13-beta to 0.13 (2023-04-04)
236 239
237 240 Made "withicase" and "withrcase" affect how files are sorted before Made "withicase" and "withrcase" affect how files are sorted before
File src/engine/cmds.c changed (mode: 100644) (index 3df71f5c2..27697b45c)
... ... vle_cmds_complete(const char cmd[], void *arg)
542 542 prefix_len += complete_cmd_args(cur, args, &cmd_info, arg); prefix_len += complete_cmd_args(cur, args, &cmd_info, arg);
543 543 } }
544 544 } }
545 else
546 {
547 prefix_len += cmds_conf->complete_line(cmd, arg);
548 }
545 549
546 550 return prefix_len; return prefix_len;
547 551 } }
File tests/cmds/completion.c changed (mode: 100644) (index 8563cdb5c..19be14303)
... ... TEST(line_completion_args)
369 369 free(buf); free(buf);
370 370 } }
371 371
372 TEST(line_completion_bad_range)
373 {
374 char *buf;
375
376 line_completion_enabled = 1;
377
378 vle_compl_reset();
379 assert_int_equal(0, vle_cmds_complete("/bad-range", NULL));
380
381 buf = vle_compl_next();
382 assert_string_equal("whole-line1", buf);
383 free(buf);
384
385 buf = vle_compl_next();
386 assert_string_equal("whole-line2", buf);
387 free(buf);
388
389 buf = vle_compl_next();
390 assert_string_equal("/bad-range", buf);
391 free(buf);
392 }
393
372 394 static int static int
373 395 foreign_cmd(const cmd_info_t *cmd_info) foreign_cmd(const cmd_info_t *cmd_info)
374 396 { {
File tests/misc/cmdline_completion.c changed (mode: 100644) (index 6f67c3855..789b9315f)
... ... TEST(autocd_completion)
335 335 make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), SANDBOX_PATH, make_abs_path(curr_view->curr_dir, sizeof(curr_view->curr_dir), SANDBOX_PATH,
336 336 "", saved_cwd); "", saved_cwd);
337 337
338 /* Absolute path completion. */
339 char abs_path[PATH_MAX + 1], expected[PATH_MAX + 1];
340 make_abs_path(abs_path, sizeof(abs_path), SANDBOX_PATH, "mydir", saved_cwd);
341 make_abs_path(expected, sizeof(expected), SANDBOX_PATH, "mydir1/", saved_cwd);
342 wchar_t *wide_abs_path = to_wide_force(abs_path);
343 wchar_t *wide_expected = to_wide_force(expected);
344 ASSERT_COMPLETION(wide_abs_path, wide_expected);
345 free(wide_expected);
346 free(wide_abs_path);
347
338 348 cfg.auto_cd = 0; cfg.auto_cd = 0;
339 349
340 350 ASSERT_NO_COMPLETION(L"myd"); ASSERT_NO_COMPLETION(L"myd");
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