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
//! Selection state and mode types for [`crate::DirectoryTree`].
//!
//! The authoritative selection is held **by path** on the tree root —
//! never by node reference — so it survives node rebuilds, filter
//! changes, and re-merges transparently.
//!
//! Per-node [`crate::TreeNode::is_selected`] flags are derived view
//! hints re-synced after every mutation by the `sync_flags` helper.
use HashSet;
use PathBuf;
use crateTreeNode;
/// How a click or keyboard gesture modifies the selection set.
///
/// Modifier-key mapping (Ctrl → `Toggle`, Shift → `ExtendRange`) is
/// handled by the component layer (RFC 006) because keyboard modifiers
/// arrive on the event object, not in widget state.
/// Re-derive the per-node `is_selected` flag for every loaded node.
///
/// Builds a `HashSet` over the path references so the walk is
/// O(N_loaded) in node visits — not O(N_loaded × M_selected).
pub