Repository navigation
Conversation
glani
force-pushed
the
editor-gutter-right-side
branch
from
October 8, 2026 20:32
7eb77d9 to
48a3393
Compare
glani
force-pushed
the
editor-gutter-right-side
branch
from
October 8, 2026 21:14
48a3393 to
fb4861c
Compare
3 of 4 tasks
glani
force-pushed
the
editor-gutter-right-side
branch
from
October 8, 2026 21:30
fb4861c to
f7844c9
Compare
glani
marked this pull request as ready for review
October 8, 2026 21:36
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.
Description
Stacks on #3416 — please review only the last three commits (
editor: Let the gutter sit on the right side,editor: Keep the text clear of a scrollbar on the left,editor: Let the gutter's columns be ordered).Targets
next: it builds on #3359's gutter markers, which are onnext.The editor's gutter is always on the left of the text. In a mirrored side-by-side diff the left pane wants its gutter on its right, facing the middle, and its scrollbar on its outer edge.
This adds
gutter_side(Side)/set_gutter_sideto the editor state, defaultSide::Left(unchanged). On the right the gutter is mirrored: the same columns, in the same order counted from the text, with the line numbers aligned toward it. The text and gutter x offsets are computed once per layout and used for painting, hit testing, IME bounds and scroll-into-view. A scrollbar on the gutter's side stays outermost.The right gutter is the exact mirror of the left one. Line numbers are placed by their shaped width rather than padded with spaces: in a proportional font a space is about a third of a digit, so the default left gutter left right-aligned numbers ragged and 6–11 px short of the text; they now line up against it on either side.
Editorputs its narrow padding on the gutter's side.gutter_order([GutterColumn])orders the gutter's columns from the text outward, on either side: the default is[FoldIcons, LineNumbers, Markers](unchanged);[FoldIcons, Markers, LineNumbers]is IntelliJ's diff, with the change markers by the text and the line numbers at the outer edge. A column left out follows the listed ones in its default order.Screenshot
A side-by-side diff with changed lines marked; the left pane uses
.scrollbar_side(Side::Left).gutter_side(Side::Right), mirrored:The columns in IntelliJ's order,
.gutter_order([GutterColumn::FoldIcons, GutterColumn::Markers, GutterColumn::LineNumbers])on both panes — without and with folding (an empty fold column here):Public API
gpui_base(re-exported bygpui_component):InputBaseState::gutter_side(mut self, side: Side) -> Self— builder: which side of the text the gutter is drawn on; defaultSide::Left.InputBaseState::set_gutter_side(&mut self, side: Side, cx: &mut Context<Self>)— the same, at runtime.GutterColumn { FoldIcons, LineNumbers, Markers }— a column of the gutter.InputBaseState::gutter_order(mut self, columns: impl IntoIterator<Item = GutterColumn>) -> Self/set_gutter_order(&mut self, columns, cx: &mut Context<Self>)— the columns from the text outward; default[FoldIcons, LineNumbers, Markers]; a column left out follows in its default order, a repeat is ignored.How to Test
cargo test -p gpui-base --lib: new tests for the text and gutter origins with an unchanged wrap width, the mirrored fold icons and columns, the scrollbar staying outermost (left/left, right/left, right/right), clicks in the text and in the gutter on both sides, caret / IME /range_to_bounds/ selection-path x including a long line scrolled clear of the gutter, a right-side case in the existing gutter-bounds test, every gutter column — markers included — mirrored to 0.01 px for all six orders with folding on and off, the order normalised and counted from the text on both sides, clicks on the fold icon and the line number in every side/order combination, andEditorkeeping its gutter-side padding. Each fails with its code reverted.cargo runthe story, an editor with.gutter_side(Side::Right)and.scrollbar_side(Side::Left), then.gutter_order([GutterColumn::FoldIcons, GutterColumn::Markers, GutterColumn::LineNumbers]).Checklist
cargo runfor story tests related to the changes.