Repository navigation
feat: color file statuses and change counts in the sidebar - #9
Merged
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 filesterminal.ansiMagenta. A nonzero+Nuses the addition color and a nonzero−Nthe 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_COLORset, crossterm drops every color and the text is the same.theme::Colorsgainsmodifiedandrenamed(noted in the changelog).Tests:
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.tests/process/sidebar_contract.rs: the real binary's colors for each kind in dark and light, and aNO_COLORrun with the same tree text and no colors.