Skip to content

feat: color file statuses and change counts in the sidebar - #9

Merged
backnotprop merged 2 commits into
mainfrom
feat/sidebar-change-colors
Nov 15, 2026
Merged

backnotprop merged 2 commits into
mainfrom
feat/sidebar-change-colors

Conversation

@backnotprop

Copy link
Copy Markdown
Contributor

The Files sidebar now colors each row's status letter by kind of change. Added files use the addition color, deleted files the deletion color, modified and type-changed files terminal.ansiBlue, and renamed or copied files terminal.ansiMagenta. A nonzero +N uses the addition color and a nonzero −N the deletion color. Zero counts, folder file counts and binary entries stay muted. Folder totals use the same count colors, and the file header in the diff (Modified +69 −121) is colored the same way.

Why: Hunk colors the status and the counts in its file tree, so you can see the shape of a change at a glance. This brings diffs-rs to parity with it.

The text, widths and layout are the same as before. Only the foreground of cells that were already drawn changes, the sidebar still draws only visible rows, and nothing new is allocated per row. The cursor row keeps its highlight background. With NO_COLOR set, crossterm drops every color and the text is the same.

theme::Colors gains modified and renamed (noted in the changelog).

Tests:

  • Buffer-level unit tests in src/render/tests.rs, dark and light: added, modified, deleted, renamed and copied rows, zero counts, a folder total, the cursor row, file headers, and a muted ellipsis on a truncated summary.
  • Process tests in tests/process/sidebar_contract.rs: the real binary's colors for each kind in dark and light, and a NO_COLOR run with the same tree text and no colors.

@backnotprop
backnotprop merged commit b6f7c8c into main Nov 15, 2026
3 checks passed
@backnotprop
backnotprop deleted the feat/sidebar-change-colors branch November 15, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant