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 5c15efb3e55d8364915a90ca04044e7ab55ae431

Use historical cursor position on `:tabnew path`
History wasn't consulted for the position.
Author: xaizek
Author date (UTC): 2018-10-27 21:16
Committer name: xaizek
Committer date (UTC): 2018-10-27 21:22
Parent(s): 596e4989b6676823ab40df08a7bbc2d95acfca1e
Signing key: 99DC5E4DB05F6BE2
Tree: 0cdb7d786a240d67a4f25f6b061da8cfb457d948
File Lines added Lines deleted
src/ui/tabs.c 3 1
tests/misc/tabs.c 36 0
File src/ui/tabs.c changed (mode: 100644) (index 40bc9b718..66024380c)
... ... clone_view(view_t *dst, view_t *src, const char path[])
241 241 src->list_pos - src->top_line); src->list_pos - src->top_line);
242 242 } }
243 243
244 (void)populate_dir_list(dst, 1);
244 (void)populate_dir_list(dst, path == NULL);
245 /* XXX: do we need to update origins or is this a leftover from before list
246 * population was introduced? */
245 247 flist_update_origins(dst, &dst->curr_dir[0], &src->curr_dir[0]); flist_update_origins(dst, &dst->curr_dir[0], &src->curr_dir[0]);
246 248 } }
247 249
File tests/misc/tabs.c changed (mode: 100644) (index ac49a69ee..c3b07164c)
... ... TEST(opening_tab_in_new_location_updates_history)
284 284 cfg_resize_histories(0); cfg_resize_histories(0);
285 285 } }
286 286
287 TEST(opening_tab_in_new_location_fetches_position_from_history)
288 {
289 char cwd[PATH_MAX + 1], sandbox[PATH_MAX + 1], test_data[PATH_MAX + 1];
290 assert_non_null(get_cwd(cwd, sizeof(cwd)));
291 make_abs_path(sandbox, sizeof(sandbox), SANDBOX_PATH, "", cwd);
292 make_abs_path(test_data, sizeof(test_data), TEST_DATA_PATH, "", cwd);
293
294 strcpy(lwin.curr_dir, sandbox);
295 assert_success(populate_dir_list(&lwin, 0));
296
297 /* Emulate proper history initialization (must happen after view
298 * initialization). */
299 cfg_resize_histories(5);
300 cfg_resize_histories(0);
301 cfg_resize_histories(5);
302 curr_stats.load_stage = 2;
303 curr_stats.ch_pos = 1;
304
305 flist_hist_save(&lwin, test_data, "rename", 0);
306 flist_hist_save(&lwin, sandbox, "..", 0);
307
308 cfg.pane_tabs = 1;
309 tabs_new(NULL, test_data);
310 assert_string_equal("rename", get_current_file_name(&lwin));
311
312 tab_info_t tab_info;
313 assert_true(tabs_get(&lwin, 0, &tab_info));
314 assert_string_equal("..", get_current_file_name(tab_info.view));
315 assert_true(tabs_get(&lwin, 1, &tab_info));
316 assert_string_equal("rename", get_current_file_name(tab_info.view));
317
318 curr_stats.ch_pos = 0;
319 curr_stats.load_stage = 0;
320 cfg_resize_histories(0);
321 }
322
287 323 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
288 324 /* vim: set cinoptions+=t0 filetype=c : */ /* vim: set cinoptions+=t0 filetype=c : */
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