File src/ui/tabs.c changed (mode: 100644) (index 66024380c..ef3ccf9cc) |
... |
... |
clone_view(view_t *dst, view_t *src, const char path[]) |
237 |
237 |
flist_hist_clone(dst, src); |
flist_hist_clone(dst, src); |
238 |
238 |
if(path != NULL && !flist_custom_active(src)) |
if(path != NULL && !flist_custom_active(src)) |
239 |
239 |
{ |
{ |
|
240 |
|
/* Record location we're leaving. */ |
240 |
241 |
flist_hist_save(dst, src->curr_dir, get_current_file_name(src), |
flist_hist_save(dst, src->curr_dir, get_current_file_name(src), |
241 |
242 |
src->list_pos - src->top_line); |
src->list_pos - src->top_line); |
242 |
243 |
} |
} |
|
... |
... |
clone_view(view_t *dst, view_t *src, const char path[]) |
245 |
246 |
/* XXX: do we need to update origins or is this a leftover from before list |
/* XXX: do we need to update origins or is this a leftover from before list |
246 |
247 |
* population was introduced? */ |
* population was introduced? */ |
247 |
248 |
flist_update_origins(dst, &dst->curr_dir[0], &src->curr_dir[0]); |
flist_update_origins(dst, &dst->curr_dir[0], &src->curr_dir[0]); |
|
249 |
|
|
|
250 |
|
/* Record new location. */ |
|
251 |
|
flist_hist_save(dst, NULL, NULL, -1); |
248 |
252 |
} |
} |
249 |
253 |
|
|
250 |
254 |
void |
void |
File tests/misc/tabs.c changed (mode: 100644) (index c3b07164c..163c4e7a1) |
... |
... |
TEST(opening_tab_in_new_location_updates_history) |
266 |
266 |
assert_string_equal(test_data, lwin.history[0].dir); |
assert_string_equal(test_data, lwin.history[0].dir); |
267 |
267 |
assert_string_equal("compare", lwin.history[0].file); |
assert_string_equal("compare", lwin.history[0].file); |
268 |
268 |
tabs_new(NULL, sandbox); |
tabs_new(NULL, sandbox); |
269 |
|
assert_int_equal(0, lwin.history_pos); |
|
|
269 |
|
assert_int_equal(1, lwin.history_pos); |
270 |
270 |
assert_string_equal(test_data, lwin.history[0].dir); |
assert_string_equal(test_data, lwin.history[0].dir); |
271 |
271 |
assert_string_equal("rename", lwin.history[0].file); |
assert_string_equal("rename", lwin.history[0].file); |
272 |
272 |
|
|
|
... |
... |
TEST(opening_tab_in_new_location_updates_history) |
276 |
276 |
assert_string_equal(test_data, tab_info.view->history[0].dir); |
assert_string_equal(test_data, tab_info.view->history[0].dir); |
277 |
277 |
assert_string_equal("compare", tab_info.view->history[0].file); |
assert_string_equal("compare", tab_info.view->history[0].file); |
278 |
278 |
assert_true(tabs_get(&lwin, 1, &tab_info)); |
assert_true(tabs_get(&lwin, 1, &tab_info)); |
279 |
|
assert_int_equal(0, tab_info.view->history_pos); |
|
|
279 |
|
assert_int_equal(1, tab_info.view->history_pos); |
280 |
280 |
assert_string_equal(test_data, tab_info.view->history[0].dir); |
assert_string_equal(test_data, tab_info.view->history[0].dir); |
281 |
281 |
assert_string_equal("rename", tab_info.view->history[0].file); |
assert_string_equal("rename", tab_info.view->history[0].file); |
282 |
282 |
|
|
|
... |
... |
TEST(opening_tab_in_new_location_fetches_position_from_history) |
294 |
294 |
strcpy(lwin.curr_dir, sandbox); |
strcpy(lwin.curr_dir, sandbox); |
295 |
295 |
assert_success(populate_dir_list(&lwin, 0)); |
assert_success(populate_dir_list(&lwin, 0)); |
296 |
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 |
|
|
|
304 |
|
cfg.pane_tabs = 1; |
|
305 |
|
tabs_new(NULL, test_data); |
|
306 |
|
assert_int_equal(1, lwin.history_pos); |
|
307 |
|
assert_string_equal(test_data, lwin.history[1].dir); |
|
308 |
|
|
|
309 |
|
curr_stats.load_stage = 0; |
|
310 |
|
cfg_resize_histories(0); |
|
311 |
|
} |
|
312 |
|
|
|
313 |
|
TEST(opening_tab_in_new_location_records_new_location_in_history) |
|
314 |
|
{ |
|
315 |
|
char cwd[PATH_MAX + 1], sandbox[PATH_MAX + 1], test_data[PATH_MAX + 1]; |
|
316 |
|
assert_non_null(get_cwd(cwd, sizeof(cwd))); |
|
317 |
|
make_abs_path(sandbox, sizeof(sandbox), SANDBOX_PATH, "", cwd); |
|
318 |
|
make_abs_path(test_data, sizeof(test_data), TEST_DATA_PATH, "", cwd); |
|
319 |
|
|
|
320 |
|
strcpy(lwin.curr_dir, sandbox); |
|
321 |
|
assert_success(populate_dir_list(&lwin, 0)); |
|
322 |
|
|
297 |
323 |
/* Emulate proper history initialization (must happen after view |
/* Emulate proper history initialization (must happen after view |
298 |
324 |
* initialization). */ |
* initialization). */ |
299 |
325 |
cfg_resize_histories(5); |
cfg_resize_histories(5); |