R6.3 round 1 fix: restored tabs keep the recent list cleared
A tab reopened from the session counts as already remembered, so clearing the list survives a restart; explicit opens still join it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9b71389a84
commit
1abaa5dc83
4 files changed
+51
No files matched your search
@@ -227,7 +227,12 @@ pub(crate) fn open_in(
|
||||
// Launch files stand alone; unsaved text still returns.
|
||||
if asked.is_empty() {
|
||||
for path in kept {
|
||||
// A restored tab does not rejoin the recent list.
|
||||
let (id, real) = (desk.core.next, dunce::canonicalize(&path).ok());
|
||||
desk.open_path(path, cx);
|
||||
if let Some(real) = real.filter(|_| desk.core.next > id) {
|
||||
desk.remembered.insert(id, real);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (at, name) in desk.keeping.untitled() {
|
||||
|
||||
@@ -441,4 +441,40 @@ mod window {
|
||||
"the session"
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn a_cleared_recent_list_stays_cleared_with_tabs_restored(
|
||||
first: &mut TestAppContext,
|
||||
second: &mut TestAppContext,
|
||||
) {
|
||||
let (data, files) = (
|
||||
tempfile::tempdir().expect("data"),
|
||||
tempfile::tempdir().expect("files"),
|
||||
);
|
||||
let (a, b) = (files.path().join("a.md"), files.path().join("b.md"));
|
||||
std::fs::write(&a, "A
|
||||
").expect("a");
|
||||
std::fs::write(&b, "B
|
||||
").expect("b");
|
||||
let (desk, cx) = start(first, data.path());
|
||||
open(&desk, &a, cx);
|
||||
let button = cx.debug_bounds("mark-clear-recent").expect("the button");
|
||||
cx.simulate_click(button.center(), gpui::Modifiers::none());
|
||||
cx.run_until_parked();
|
||||
desk.update(cx, |desk, cx| {
|
||||
desk.leave(cx);
|
||||
desk.keeping.close();
|
||||
});
|
||||
cx.run_until_parked();
|
||||
|
||||
let (desk, cx) = start(second, data.path());
|
||||
assert_eq!(names(&desk, cx), ["a.md"]);
|
||||
assert!(desk.read_with(cx, |desk, _| desk.recent.is_empty()));
|
||||
let list = data.path().join("recent.json");
|
||||
assert_eq!(std::fs::read_to_string(&list).expect("the list"), "[]");
|
||||
// An explicit open still joins the list.
|
||||
open(&desk, &b, cx);
|
||||
let real = dunce::canonicalize(&b).expect("real");
|
||||
assert_eq!(desk.read_with(cx, |desk, _| desk.recent.clone()), [real]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user