Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to CarWash will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed
- In the TUI, marking a directory marks everything beneath it, including recently used and
needs-review artifacts; before, those had to be expanded and marked one by one. Protected
artifacts are still never marked, and the review screen still lists what is recent or needs
review before anything is deleted. `a` still marks only what is ready.

## [0.4.1] - 2026-09-27

### Fixed
Expand Down
56 changes: 35 additions & 21 deletions crates/carwash/src/tui/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,33 +1001,32 @@ impl App {
return;
}
} else {
let ready: Vec<ArtifactId> = ids
// A directory marks everything beneath it except protected artifacts, which can
// never be marked; the review screen still calls out recent and needs-review ones.
let markable: Vec<ArtifactId> = ids
.iter()
.copied()
.filter(|&id| self.markable(id) && self.hold(id).is_none())
.filter(|&id| self.markable(id))
.collect();
let held = ids
.iter()
.filter(|&&id| self.markable(id) && self.hold(id).is_some())
.count();
if !ready.is_empty() && ready.iter().all(|id| self.marked.contains(id)) {
let protected = ids.len() - markable.len();
if markable.is_empty() {
self.toast(
format!("Nothing to mark here: {protected} protected"),
Level::Warn,
);
return;
}
if markable.iter().all(|id| self.marked.contains(id)) {
for id in &ids {
self.marked.remove(id);
}
} else {
self.marked.extend(ready.iter().copied());
if ready.is_empty() && held > 0 {
self.marked.extend(markable.iter().copied());
if protected > 0 {
self.toast(
format!(
"Nothing ready here: {held} held back (expand to mark individually)"
),
Level::Warn,
);
} else if held > 0 {
self.toast(
format!(
"Marked {} · {held} held back (recent or needs review)",
ready.len()
"Marked {} · {protected} protected left alone",
markable.len()
),
Level::Info,
);
Expand Down Expand Up @@ -1313,21 +1312,36 @@ pub(crate) mod tests {
}

#[test]
fn marking_a_project_marks_only_ready_artifacts() {
fn marking_a_project_marks_everything_beneath_it() {
let mut app = app();
assert_eq!(app.rows.rows[0].label, "a");
press(&mut app, KeyCode::Char(' '));
assert!(app.marked.contains(&ArtifactId(0)));
assert!(
!app.marked.contains(&ArtifactId(1)),
"recently used is held back"
app.marked.contains(&ArtifactId(1)),
"recently used is marked too"
);
// Marking again unmarks.
press(&mut app, KeyCode::Char('k'));
press(&mut app, KeyCode::Char(' '));
assert!(app.marked.is_empty());
}

#[test]
fn marking_a_project_skips_protected_artifacts() {
let mut app = app();
let b = app
.rows
.rows
.iter()
.position(|row| row.label == "b")
.expect("project b row");
app.select(b);
press(&mut app, KeyCode::Char(' '));
assert!(app.marked.is_empty());
assert!(app.toast.as_ref().unwrap().text.contains("protected"));
}

#[test]
fn protected_artifacts_cannot_be_marked() {
let mut app = app();
Expand Down
2 changes: 1 addition & 1 deletion crates/carwash/src/tui/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ pub const RECLAIM: &[Binding] = &[
"Space",
A::Mark,
S::Select,
"mark / unmark (directories mark their ready artifacts)",
"mark / unmark (directories mark everything beneath them)",
)
.hint("mark"),
bind(
Expand Down
2 changes: 1 addition & 1 deletion crates/carwash/src/tui/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ fn mark_cell(app: &App, row: &Row) -> Span<'static> {
Span::styled(g.locked, t.muted())
} else if totals.marked == 0 {
Span::styled(g.unmarked, t.muted())
} else if totals.marked >= totals.ready.max(1) {
} else if totals.marked >= totals.markable {
Span::styled(g.marked, t.bold(t.accent2))
} else {
Span::styled(g.partial, t.fg(t.accent2))
Expand Down
Loading