brain: Cross out dropped commit metadata
d429fb8a9ffc45cdf86a8c4d3cc582d7af4f9da5
Dropped commits still showed review progress and left their author and timestamp visually active. Clear the progress column and strike through the author and timestamp so the entire row reflects its final state. Assisted-by: Codex:gpt-5.6
1 parent
909ec447
crates/brain/src/session/status.rs
+43 -10
| 51 | 51 | pub(super) const SELECTED_COMMIT_BG: Color = Color::Fixed(235); |
|
| 52 | 52 | /// Marker shown beside a commit whose hunks have all been accepted: ✔. |
|
| 53 | 53 | const REVIEWED_MARK: char = '✔'; |
|
| 54 | 54 | /// Marker shown beside a rejected commit: ✗. |
|
| 55 | 55 | const REJECTED_MARK: char = '✗'; |
|
| 56 | - | /// Marker shown beside a dropped commit: -. |
|
| 57 | - | const DROPPED_MARK: char = '-'; |
|
| 58 | 56 | /// Marker highlighted when all hunks are visible in the footer: ✔. |
|
| 59 | 57 | const ALL_HUNKS_MODE_ICON: &str = "✔"; |
|
| 60 | 58 | /// Marker shown when full-file mode is visible in the footer: ↕. |
|
| 61 | 59 | const FULL_FILE_MODE_ICON: &str = "↕"; |
|
| 62 | 60 | /// Separator shown between footer status segments: ·. |
| 389 | 387 | ), |
|
| 390 | 388 | CommitReviewState::Rejected => ( |
|
| 391 | 389 | Label::from_char(REJECTED_MARK).fg(palette.negative_fg), |
|
| 392 | 390 | full_progress_bar(palette.negative_fg), |
|
| 393 | 391 | ), |
|
| 394 | - | CommitReviewState::Dropped => ( |
|
| 395 | - | Label::from_char(DROPPED_MARK).fg(colors::fixed::DIM), |
|
| 396 | - | full_progress_bar(colors::fixed::DIM), |
|
| 397 | - | ), |
|
| 392 | + | CommitReviewState::Dropped => (Label::space(), Line::blank()), |
|
| 398 | 393 | CommitReviewState::Pending => ( |
|
| 399 | 394 | Label::space(), |
|
| 400 | 395 | progress_bar(slot.progress, palette, FOOTER_FG), |
|
| 401 | 396 | ), |
|
| 402 | 397 | }; |
|
| 403 | - | let progress = Line::new(status).item(Label::space()).extend(progress); |
|
| 398 | + | let progress = if matches!(slot.state, CommitReviewState::Dropped) { |
|
| 399 | + | Line::blank() |
|
| 400 | + | } else { |
|
| 401 | + | Line::new(status).item(Label::space()).extend(progress) |
|
| 402 | + | }; |
|
| 404 | 403 | ||
| 405 | 404 | let row_style = if matches!(slot.state, CommitReviewState::Dropped) { |
|
| 406 | 405 | Style::default().dim() |
|
| 407 | 406 | } else { |
|
| 408 | 407 | Style::default() |
|
| 409 | 408 | }; |
|
| 409 | + | let identity_style = if matches!(slot.state, CommitReviewState::Dropped) { |
|
| 410 | + | Style::default().dim().strikethrough() |
|
| 411 | + | } else { |
|
| 412 | + | Style::default() |
|
| 413 | + | }; |
|
| 410 | 414 | [ |
|
| 411 | - | Line::new(Label::new(slot.commit.author.as_str()).fg(HISTORY_VALUE_FG)).style(row_style), |
|
| 415 | + | Line::new(Label::new(slot.commit.author.as_str()).fg(HISTORY_VALUE_FG)) |
|
| 416 | + | .style(identity_style), |
|
| 412 | 417 | Line::new( |
|
| 413 | 418 | Label::from(relative_time( |
|
| 414 | 419 | slot.commit.recency.seconds.into(), |
|
| 415 | 420 | now.into(), |
|
| 416 | 421 | )) |
|
| 417 | 422 | .fg(colors::fixed::MUTED), |
|
| 418 | 423 | ) |
|
| 419 | - | .style(row_style), |
|
| 424 | + | .style(identity_style), |
|
| 420 | 425 | Line::new(Label::new(&slot.commit.branches.join(", ")).fg(colors::rgb::TEAL)) |
|
| 421 | 426 | .style(row_style), |
|
| 422 | 427 | progress.style(row_style), |
|
| 423 | 428 | diffstat.style(row_style), |
|
| 424 | 429 | ] |
| 661 | 666 | ||
| 662 | 667 | assert!(rendered.ends_with("━━━━━━━━ · ✔ ↕ ")); |
|
| 663 | 668 | } |
|
| 664 | 669 | ||
| 665 | 670 | #[test] |
|
| 666 | - | fn completed_commit_rows_hide_diff_summary() { |
|
| 671 | + | fn completed_commit_rows_render_final_state() { |
|
| 667 | 672 | let now = 2_000_000_000; |
|
| 668 | 673 | let stats = DiffStat { |
|
| 669 | 674 | files_changed: 1, |
|
| 670 | 675 | insertions: 2, |
|
| 671 | 676 | deletions: 3, |
| 704 | 709 | )[4] |
|
| 705 | 710 | .to_string() |
|
| 706 | 711 | .is_empty() |
|
| 707 | 712 | ); |
|
| 708 | 713 | } |
|
| 714 | + | ||
| 715 | + | slot.state = CommitReviewState::Dropped; |
|
| 716 | + | let [mut author, mut age, _, progress, diffstat] = commit_row_suffix( |
|
| 717 | + | &slot, |
|
| 718 | + | DiffPalette::default(), |
|
| 719 | + | now as u64, |
|
| 720 | + | stats.insertions + stats.deletions, |
|
| 721 | + | 8, |
|
| 722 | + | ); |
|
| 723 | + | assert!(progress.to_string().is_empty()); |
|
| 724 | + | assert!(diffstat.to_string().is_empty()); |
|
| 725 | + | ||
| 726 | + | let mut author_buffer = Buffer::empty(Rect::new(0, 0, slot.commit.author.len(), 1)); |
|
| 727 | + | let mut age_buffer = Buffer::empty(Rect::new(0, 0, 16, 1)); |
|
| 728 | + | author.render(author_buffer.area(), &mut author_buffer); |
|
| 729 | + | age.render(age_buffer.area(), &mut age_buffer); |
|
| 730 | + | ||
| 731 | + | assert_eq!( |
|
| 732 | + | author_buffer.get(0, 0).unwrap().style(), |
|
| 733 | + | Style::default().fg(HISTORY_VALUE_FG).dim().strikethrough() |
|
| 734 | + | ); |
|
| 735 | + | assert_eq!( |
|
| 736 | + | age_buffer.get(0, 0).unwrap().style(), |
|
| 737 | + | Style::default() |
|
| 738 | + | .fg(colors::fixed::MUTED) |
|
| 739 | + | .dim() |
|
| 740 | + | .strikethrough() |
|
| 741 | + | ); |
|
| 709 | 742 | } |
|
| 710 | 743 | ||
| 711 | 744 | #[test] |
|
| 712 | 745 | fn history_diffstat_scales_against_largest_commit() { |
|
| 713 | 746 | let palette = DiffPalette::default(); |