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 8a0e24b105f5927f54f886b0e2f17277b8faaa71

Make :goto preserve custom and tree views
Thanks to asmodeus812 (Svetlozar Iliev).

Part of #1019 on GitHub.
Author: xaizek
Author date (UTC): 2024-10-17 12:35
Committer name: xaizek
Committer date (UTC): 2024-10-17 21:14
Parent(s): 2485b506d3835447ca211397b365370418e189f7
Signing key: 99DC5E4DB05F6BE2
Tree: ab09200958730d21a16dc5ef065efee9b9f24d02
File Lines added Lines deleted
ChangeLog 3 0
THANKS 1 0
src/cmd_handlers.c 1 1
tests/commands/goto.c 39 0
File ChangeLog changed (mode: 100644) (index 4e2101776..5f84b0d8a)
158 158 Provide numerical value of a color as a description of a completion item Provide numerical value of a color as a description of a completion item
159 159 for it. for it.
160 160
161 Make :goto preserve custom and tree views. Thanks to
162 asmodeus812 (Svetlozar Iliev).
163
161 164 Fixed line number column not including padding to the left of it. Fixed line number column not including padding to the left of it.
162 165
163 166 Fixed local options not being loaded on Ctrl-W x. Fixed local options not being loaded on Ctrl-W x.
File THANKS changed (mode: 100644) (index c6c24437e..f57775f63)
... ... Anton Gepting
32 32 Anton Kochkov (XVilka) Anton Kochkov (XVilka)
33 33 Artur F. (arturfabriciohahaedgy) Artur F. (arturfabriciohahaedgy)
34 34 Artur Shaik (artur-shaik) Artur Shaik (artur-shaik)
35 asmodeus812 (Svetlozar Iliev)
35 36 astrell astrell
36 37 AtomToast AtomToast
37 38 Aurelio Sanabria (Sufrostico) Aurelio Sanabria (Sufrostico)
File src/cmd_handlers.c changed (mode: 100644) (index 02dc65a8e..a617f7644)
... ... goto_path_cmd(const cmd_info_t *cmd_info)
2731 2731
2732 2732 fname = strdup(get_last_path_component(abs_path)); fname = strdup(get_last_path_component(abs_path));
2733 2733 remove_last_path_component(abs_path); remove_last_path_component(abs_path);
2734 navigate_to_file(curr_view, abs_path, fname, 0);
2734 navigate_to_file(curr_view, abs_path, fname, 1);
2735 2735 free(fname); free(fname);
2736 2736 return 0; return 0;
2737 2737 } }
File tests/commands/goto.c changed (mode: 100644) (index 93f29076d..080cfe78d)
... ... TEST(goto_navigates)
56 56 assert_string_equal("tree", get_current_file_name(&lwin)); assert_string_equal("tree", get_current_file_name(&lwin));
57 57 } }
58 58
59 TEST(goto_preserves_cv)
60 {
61 char path[PATH_MAX + 1];
62
63 make_abs_path(lwin.curr_dir, sizeof(lwin.curr_dir), TEST_DATA_PATH,
64 "existing-files", NULL);
65
66 flist_custom_start(&lwin, "test");
67 snprintf(path, sizeof(path), "%s/%s", test_data, "existing-files/a");
68 flist_custom_add(&lwin, path);
69 snprintf(path, sizeof(path), "%s/%s", test_data, "existing-files/b");
70 flist_custom_add(&lwin, path);
71 assert_true(flist_custom_finish(&lwin, CV_REGULAR, 0) == 0);
72
73 assert_success(cmds_dispatch("goto b", &lwin, CIT_COMMAND));
74 assert_int_equal(1, lwin.list_pos);
75 assert_true(flist_custom_active(&lwin));
76
77 assert_success(cmds_dispatch("goto a", &lwin, CIT_COMMAND));
78 assert_int_equal(0, lwin.list_pos);
79 assert_true(flist_custom_active(&lwin));
80 }
81
82 TEST(goto_preserves_tree)
83 {
84 make_abs_path(lwin.curr_dir, sizeof(lwin.curr_dir), TEST_DATA_PATH, "tree",
85 NULL);
86 assert_success(cmds_dispatch1("tree", &lwin, CIT_COMMAND));
87 assert_true(cv_tree(lwin.custom.type));
88
89 assert_success(cmds_dispatch("goto dir1/file4", &lwin, CIT_COMMAND));
90 assert_int_equal(7, lwin.list_pos);
91 assert_true(cv_tree(lwin.custom.type));
92
93 assert_success(cmds_dispatch("goto dir5/file5", &lwin, CIT_COMMAND));
94 assert_int_equal(10, lwin.list_pos);
95 assert_true(cv_tree(lwin.custom.type));
96 }
97
59 98 TEST(goto_normalizes_slashes, IF(windows)) TEST(goto_normalizes_slashes, IF(windows))
60 99 { {
61 100 char cmd[PATH_MAX*2]; char cmd[PATH_MAX*2];
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