Gnome: pin code view scrollbars to LTR#135
Merged
Merged
Conversation
The scrollbars are internal children of the scrolled window and were created before the LTR pin from the RTL mirroring exemption, so they kept the RTL default direction. An RTL scrollbar maps the adjustment mirrored, while the pinned code content stays anchored left: the thumb sat at the right while the view showed the left edge, and dragging felt inverted.
Pinning the scrollbar widgets was not enough: each scrollbar holds an internal GtkRange child that does the actual value-to-thumb mapping, and gtk_widget_set_direction does not propagate to children. The range kept the RTL default, so the horizontal thumb still sat at the right end while the view showed the left edge. Replace the individual pins with one recursive pin over the whole SourceView subtree, verified against the internal scrollbar structure (scrollbar > range > trough > slider). Vertical scroll behavior is direction-independent in GTK and stays unchanged.
…r-direction # Conflicts: # packages/app-gnome/src/widgets/source-view.ts
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.
Follow-up to #126, found while testing the RTL fixes under
he_IL.UTF-8.Problem
In RTL locales the horizontal scrollbar of code blocks mapped the scroll position mirrored: the thumb sat at the right end while the view showed the left edge of the LTR code, and dragging felt inverted.
Cause
gtk_widget_set_directiondoes not propagate to children — and eachGtkScrollbarholds an internalGtkRangechild (scrollbar > range > trough > slider) that does the actual value↔thumb mapping. Both the scrollbars and their internal ranges kept the global RTL default, so the range stayed flipped relative to the LTR-pinned code content. (A first attempt that pinned only the scrollbar widgets was ineffective for exactly this reason.)Fix
Replace the individual direction pins in
SourceViewwith one recursive pin over the whole widget subtree, reaching the internal ranges. This covers all code views (tutorial blocks, editor, debugger hexdump/disassembly/memory monitor) and removes the pin-one-widget-at-a-time whack-a-mole.Verification
GJS micro-tests against the real internal scrollbar structure under global RTL with an LTR-pinned
GtkTextView(the same structure asSourceView):Vertical scrolling is direction-independent in GTK (
should_invert()ignores text direction for vertical ranges, verified against gtk-4-18gtkrange.c/gtkscrolledwindow.c) and stays unchanged.The message console is unaffected on purpose: it is not direction-pinned, so its content and scrollbars are consistently RTL.