Skip to content

Annotation text while typing uses color-normal, so it blends into the diff #343

Closed

Description

@denysshnurenko

What happens

While an annotation is being typed, its text is indistinguishable from the diff text around it.
Once Enter is pressed the saved annotation is clearly visible (annotation colour + italic), so
the contrast problem exists only in the input state — exactly the moment you are looking at what
you are writing.

Why

app/ui/style/resolver.go builds the annotation-input style from the normal foreground:

inputStyle := lipgloss.NewStyle()
if c.Normal != "" {
    inputStyle = inputStyle.Foreground(lipgloss.Color(c.Normal))
}
...
m[StyleKeyAnnotInputText] = inputStyle
// cursor uses same style as input text
m[StyleKeyAnnotInputCursor] = inputStyle

c.Normal is the body-text colour, so the text being typed is painted the same as the diff line
under it.

The three style keys already exist and are already wired through newAnnotationInput
(app/ui/annotate.go) — StyleKeyAnnotInputText, StyleKeyAnnotInputPlaceholder,
StyleKeyAnnotInputCursor. They just have no colour of their own to resolve to.

The comment beside that code says the intent was for the input to be "visually distinct from
saved annotations (which use Annotation color + italic)"
. Being unlike the saved annotation
looks deliberate; landing on body text looks like the side effect.

Why a theme cannot fix it

--dump-theme reports 22 keys and none covers the input state, so there is nothing to override
in a theme file. The only lever a user has is color-normal, which repaints every line of every
diff.

Suggested fix

Give the input its own resolvable colour. Either would work from a user's side:

  • a new theme key (color-annotation-input), defaulting to color-annotation so existing
    themes need no change; or
  • resolve StyleKeyAnnotInputText to c.Annotation without the italic — that keeps the
    "distinct from saved annotations" intent while staying distinct from body text too.

Environment

  • revdiff v1.12.0-ad8c796-20260804T171719
  • macOS 15.7.2, running inside a terminal overlay
  • reproduced on the built-in themes and on a local theme file derived from solarized-dark
    (only color-annotation changed) — the base makes no difference, since the input never reads
    that key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions