rockorager / rockorager/comview

Added diff rows lost their background tint, inconsistent with deleted rows

Open Beginner friendly
#16 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
274
Forks
20
Avg merge
3d 25m
Merged PRs (30d)
1

Description

Summary

Added (+) diff lines render on the neutral theme.Surface background, while deleted lines get a color-derived tint. The result: added lines look like they have no diff highlight, in every theme. Likely an oversight rather than an intentional choice — flagging in case it wasn't.

Where

tui/ui_diff_viewer.go, uiStyleForDiffRow:

case diff.RowAdd:
    return vaxis.Style{Foreground: theme.Success, Background: theme.Surface}            // neutral grey
case diff.RowDelete:
    return vaxis.Style{Foreground: ..., Background: uiDiffLineBackground(theme, theme.Palette.Red)}  // red tint

The two changed-row kinds are otherwise treated consistently (delete = tinted bg + dimmed tokens; add = tinted bg + full-color tokens), so only the add background looks out of place.

History

This coincided with the syntax-highlighting commit 5a123d1 ("tui: theme and highlight ui diff rows"). Just before it, 536fc4c had:

case diff.RowAdd:
    return vaxis.Style{Foreground: theme.Success, Background: uiDiffLineBackground(theme, theme.Palette.Green)}

5a123d1 switched that background to theme.Surface; delete was left intact. Possibly a deliberate attempt to avoid syntax colors clashing with a green wash — but uiDiffLineBackground returns Tone50/Tone950 (a very faint tint), and deleted lines already render full-color/dimmed syntax over their red tint without issue, so the clash concern may not apply.

Suggested fix

Restore the green-derived background (foreground unchanged), matching the pre-5a123d1 line:

case diff.RowAdd:
    return vaxis.Style{Foreground: theme.Success, Background: uiDiffLineBackground(theme, theme.Palette.Green)}

Happy to open a PR if this wasn't intentional.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open tui/ui_diff_viewer.go and inspect uiStyleForDiffRow, especially the diff.RowAdd case and its use of theme.Surface versus uiDiffLineBackground. Restore the green-derived background while keeping the existing foreground, then verify that added rows have a faint green tint consistently across themes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.