Skip to content

input: Avoid painting unset gutter background#2572

Merged
huacnlee merged 1 commit into
longbridge:mainfrom
refmdio:fix/editor-gutter-background
Jul 15, 2026
Merged

input: Avoid painting unset gutter background#2572
huacnlee merged 1 commit into
longbridge:mainfrom
refmdio:fix/editor-gutter-background

Conversation

@MuNeNiCK

@MuNeNiCK MuNeNiCK commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Related to #2411

Description

The line-number gutter is painted as a separate quad on top of the editor background.

When editor.gutter.background is unset, the current implementation falls back to editor_background(). Since the editor already paints that background, translucent colors are composited twice in the gutter and make it appear darker than the text area.

The fallback can also conflict with a background applied through the editor's Styled implementation because the gutter still paints the theme's editor background separately.

This change paints the gutter background only when editor.gutter.background is explicitly configured. When it is unset, the editor background remains visible without an additional paint layer. Themes that define a dedicated gutter background continue to render it as before.

Screenshots

Before:
editor-gutter-before

After:
editor-gutter-after

How to Test

  • Run cargo check -p gpui-component.
  • Run cargo run and open the Editor story.
  • Use a theme with a translucent editor.background and no editor.gutter.background.
  • Verify that the gutter and text area have the same visual background.
  • Set editor.gutter.background and verify that the explicit gutter background is still rendered.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (if any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • [N/A] Tested macOS, Windows and Linux platforms performance (not platform-specific).

@huacnlee
huacnlee merged commit 3c270ed into longbridge:main Jul 15, 2026
3 checks passed
@MuNeNiCK

Copy link
Copy Markdown
Contributor Author

Thanks for merging the PR. I really appreciate it.

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.

2 participants