File src/ui/tabs.c changed (mode: 100644) (index 47174d5b3..40bc9b718) |
... |
... |
clone_view(view_t *dst, view_t *src, const char path[]) |
235 |
235 |
|
|
236 |
236 |
flist_hist_resize(dst, cfg.history_len); |
flist_hist_resize(dst, cfg.history_len); |
237 |
237 |
flist_hist_clone(dst, src); |
flist_hist_clone(dst, src); |
|
238 |
|
if(path != NULL && !flist_custom_active(src)) |
|
239 |
|
{ |
|
240 |
|
flist_hist_save(dst, src->curr_dir, get_current_file_name(src), |
|
241 |
|
src->list_pos - src->top_line); |
|
242 |
|
} |
238 |
243 |
|
|
239 |
244 |
(void)populate_dir_list(dst, 1); |
(void)populate_dir_list(dst, 1); |
240 |
245 |
flist_update_origins(dst, &dst->curr_dir[0], &src->curr_dir[0]); |
flist_update_origins(dst, &dst->curr_dir[0], &src->curr_dir[0]); |
File tests/misc/tabs.c changed (mode: 100644) (index 72baacb77..ac49a69ee) |
5 |
5 |
#include "../../src/cfg/config.h" |
#include "../../src/cfg/config.h" |
6 |
6 |
#include "../../src/ui/tabs.h" |
#include "../../src/ui/tabs.h" |
7 |
7 |
#include "../../src/ui/ui.h" |
#include "../../src/ui/ui.h" |
|
8 |
|
#include "../../src/utils/fs.h" |
8 |
9 |
#include "../../src/utils/str.h" |
#include "../../src/utils/str.h" |
|
10 |
|
#include "../../src/filelist.h" |
|
11 |
|
#include "../../src/flist_hist.h" |
|
12 |
|
#include "../../src/flist_pos.h" |
|
13 |
|
#include "../../src/status.h" |
9 |
14 |
|
|
10 |
15 |
#include "utils.h" |
#include "utils.h" |
11 |
16 |
|
|
|
... |
... |
TEST(tabs_get_returns_inactive_global_tab) |
235 |
240 |
assert_true(tab_info.view != &rwin); |
assert_true(tab_info.view != &rwin); |
236 |
241 |
} |
} |
237 |
242 |
|
|
|
243 |
|
TEST(opening_tab_in_new_location_updates_history) |
|
244 |
|
{ |
|
245 |
|
char cwd[PATH_MAX + 1], sandbox[PATH_MAX + 1], test_data[PATH_MAX + 1]; |
|
246 |
|
assert_non_null(get_cwd(cwd, sizeof(cwd))); |
|
247 |
|
make_abs_path(sandbox, sizeof(sandbox), SANDBOX_PATH, "", cwd); |
|
248 |
|
make_abs_path(test_data, sizeof(test_data), TEST_DATA_PATH, "", cwd); |
|
249 |
|
|
|
250 |
|
strcpy(lwin.curr_dir, test_data); |
|
251 |
|
assert_success(populate_dir_list(&lwin, 0)); |
|
252 |
|
|
|
253 |
|
lwin.list_pos = fpos_find_by_name(&lwin, "compare"); |
|
254 |
|
|
|
255 |
|
/* Emulate proper history initialization (must happen after view |
|
256 |
|
* initialization). */ |
|
257 |
|
cfg_resize_histories(5); |
|
258 |
|
cfg_resize_histories(0); |
|
259 |
|
cfg_resize_histories(5); |
|
260 |
|
curr_stats.load_stage = 2; |
|
261 |
|
|
|
262 |
|
lwin.list_pos = fpos_find_by_name(&lwin, "rename"); |
|
263 |
|
|
|
264 |
|
cfg.pane_tabs = 1; |
|
265 |
|
assert_int_equal(0, lwin.history_pos); |
|
266 |
|
assert_string_equal(test_data, lwin.history[0].dir); |
|
267 |
|
assert_string_equal("compare", lwin.history[0].file); |
|
268 |
|
tabs_new(NULL, sandbox); |
|
269 |
|
assert_int_equal(0, lwin.history_pos); |
|
270 |
|
assert_string_equal(test_data, lwin.history[0].dir); |
|
271 |
|
assert_string_equal("rename", lwin.history[0].file); |
|
272 |
|
|
|
273 |
|
tab_info_t tab_info; |
|
274 |
|
assert_true(tabs_get(&lwin, 0, &tab_info)); |
|
275 |
|
assert_int_equal(0, tab_info.view->history_pos); |
|
276 |
|
assert_string_equal(test_data, tab_info.view->history[0].dir); |
|
277 |
|
assert_string_equal("compare", tab_info.view->history[0].file); |
|
278 |
|
assert_true(tabs_get(&lwin, 1, &tab_info)); |
|
279 |
|
assert_int_equal(0, tab_info.view->history_pos); |
|
280 |
|
assert_string_equal(test_data, tab_info.view->history[0].dir); |
|
281 |
|
assert_string_equal("rename", tab_info.view->history[0].file); |
|
282 |
|
|
|
283 |
|
curr_stats.load_stage = 0; |
|
284 |
|
cfg_resize_histories(0); |
|
285 |
|
} |
|
286 |
|
|
238 |
287 |
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ |
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ |
239 |
288 |
/* vim: set cinoptions+=t0 filetype=c : */ |
/* vim: set cinoptions+=t0 filetype=c : */ |