input: gutter cursor style + line hitbox accessors#2412
Draft
glani wants to merge 1 commit into
Draft
Conversation
Two small, additive primitives for editors that show a line-number gutter. Gutter cursor: when the mode shows line numbers, paint sets `CursorStyle::Arrow` over the line-number hitbox so the gutter no longer reads as the text-insertion area. Gated on `InputMode::line_number()`, so single-line and auto-grow modes are unaffected. Line hitbox accessors on `InputState`: - `line_number_hitbox() -> Option<&Hitbox>` exposes the gutter hitbox captured during the last paint. - `visible_line_bounds(row) -> Option<Bounds<Pixels>>` returns the on-screen bounds of a buffer row from the last layout, soft-wrap aware. Both accessors are primitives for consumer-side click routing. No change to existing behavior.
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.
Problem
Two small gaps for editors that show a line-number gutter:
line-number column reads as part of the text-insertion area even
though it isn't.
a given buffer line is, without re-deriving layout — which it needs
for things like click-to-select-line, breakpoint toggles, or placing
a popover next to a specific line.
Solution
Gutter cursor. When the mode shows line numbers, paint sets
CursorStyle::Arrowover the line-number hitbox so the gutter no longerreads as the text-insertion area. Gated on
InputMode::line_number(), sosingle-line and auto-grow inputs are unaffected.
Two read-only accessors on
InputState:line_number_hitbox()exposes the gutter hitbox captured during thelast paint.
visible_line_bounds(row)returns the on-screen bounds of a buffer rowfrom the last layout, soft-wrap aware.
Both are primitives for consumer-side click routing. The only behavior
change is the mouse cursor over the gutter (which previously had no
special cursor); everything else is strictly additive.