1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use super::App;
use crate::lint;
use crate::project::Visibility::Dismissed;
use crate::tui::pane::DismissTarget;
use crate::tui::panes::PaneId;
// ── Resolution + dispatch ───────────────────────────────────────
impl App {
/// Resolve the currently focused pane into a dismiss target, if one exists.
pub fn focused_dismiss_target(&self) -> Option<DismissTarget> {
match self.focused_pane_id() {
PaneId::Toasts => self
.framework
.toasts
.focused_toast_id()
.map(DismissTarget::Toast),
PaneId::ProjectList => self
.project_list
.selected_row()
.and_then(|row| self.project_list.dismiss_target_for_row_inner(row)),
_ => None,
}
}
/// Perform the dismiss for the given target.
pub fn dismiss(&mut self, target: DismissTarget) {
match target {
DismissTarget::Toast(id) => self.dismiss_toast(id),
DismissTarget::DeletedProject(path) => {
// The project at `path` is gone from disk and the
// user has confirmed dismissal. Reclaim its lint
// cache so a future worktree/branch reusing this
// exact path starts clean. CI cache is keyed by
// (owner, repo) and shared across sibling worktrees
// — left alone here.
lint::reclaim_project_cache(path.as_path());
let parent_node_index = self.project_list.worktree_parent_node_index(&path);
if let Some(project) = self.project_list.at_path_mut(&path) {
project.visibility = Dismissed;
}
self.panes.clear_for_tree_change();
self.scan.bump_generation();
self.ensure_visible_rows_cached();
if let Some(ni) = parent_node_index {
self.project_list.select_root_row(ni);
} else {
let count = self.project_list.row_count();
let selected = self.project_list.cursor();
if selected >= count {
self.project_list.set_cursor(count.saturating_sub(1));
}
}
},
}
}
}