Skip to content

qt: header rules fill the row; the conversation scrollbar can float over the text (Transient) - #2120

Closed
trissim wants to merge 1 commit into
mainfrom
fork-qt-header-rule-scrollbar
Closed

trissim wants to merge 1 commit into
mainfrom
fork-qt-header-rule-scrollbar

Conversation

@trissim

@trissim trissim commented Nov 18, 2026

Copy link
Copy Markdown

Two of Tristan's phone requests:

  • Header rules: "the horizontal line on the message block headers doesn't expand horizontally. Depending on the name's length, the line is longer or shorter."
  • Scrollbar: "the scrollbar in the message view is always showing … an option not to show it, or to show it only when there's movement … it isn't on top of the text, so everything looks narrow."

Depends on ui-theme#33 (RuleColour), then a runtime rebuild. The rule colour is ui_theme.scheme.RuleColour, from the contrast fork's ui-theme branch. With today's installed runtime, toad.qt.lines fails to import. Rollout: merge ui-theme#33, then pyqt-reactive, then rebuild the runtime, then merge this.

Header rules

The shared Divider already describes a header as structure: title spans, a role and a timestamp. Only Qt's renderer turned the rule into a whole number of ─ characters on each side of the title. So each rule's ends moved with the title's length and never met the row's edges.

Qt now draws each side as a real line in its own table cell, coloured RuleColour. The title's cell takes its content's width and the two sides share the rest, so every rule meets both edges whatever the title. Wrapped titles still give one row per line, as Textual does, and row height is unchanged. The sticky header draws through the same renderer (header_document), so it gets the same rule. Textual's divider code is untouched and keeps drawing its rule in cells.

The same titles rendered at 380 px, measuring where the rule's pixels start and end:

title main left / right branch left / right
Al 7 / 372 0 / 379
user 7 / 372 0 / 379
#scratch <── user 4 / 375 0 / 379
scratch-live-pipeline ──> #scratch 7 / 372 0 / 379
a much longer sender name 9 / 370 0 / 379

In the live drive (header_rule on scratch-live-pipeline, phone profile), every header's rule spans 0–186 of its 187 px row, for titles of 17, 30 and 34 characters.

Scrollbar

The Scrollbar family declares, per member:

  • size: the cells it takes beside the text;
  • overlay (new): the cells it draws over the text while the conversation moves.
member size overlay Qt Textual
Normal 2 0 bar beside the text same
Thin 1 0 thin bar beside the text same
Transient (new) 0 1 no width; a bar over the text while scrolling, faded out 1 s after it goes still no bar: a terminal can't draw over its text
Hidden 0 0 none none
  • Default: comes from the platform, through Platform.select: Transient on Android, Normal everywhere else (Scrollbar.for_host()).
  • Settings: the setting appears in both frontends' settings forms through FamilyChoices(Scrollbar), and applies live through conversation_layout.
  • Qt: OverlayScrollBar mirrors the area's own bar, which stays the model of the position, so dragging it scrolls and any scroll shows it.
    • It floats over the viewport's right edge with its handle in SurfaceHoverColour.
    • It fades on the app's clock (SCROLLBAR_FADE) through WidgetAnimation, so a destroyed view stops it.
    • Once faded it is hidden, so it never takes a tap meant for the text.
    • The ratchet lists it in QT_ONLY; the shared fact is Scrollbar.overlay.

The header_rule drive, phone profile, scratch-live-pipeline:

  • Normal: the bar is 16 px wide beside the text, and the rules end at x≈360.
  • Transient, idle: no bar, and the rules and text run to x≈376.
  • Transient, scrolling: the overlay is visible at full strength, 8 px wide, over the text's right edge.
  • Transient, still for 2 s: the overlay has faded to 0 and is hidden.
  • Hidden: no bar while scrolling.

I read the screenshots for each step.

Gates, on this head (2b66d73), with ui-theme#33's ui_theme

  • Ratchet: bare Qt classes 21/21, parallel copies 0, Textual-UI 11/11, qt→widgets 0.
  • shadow_check: 0.
  • glyph_check: 0.
  • Drives (header_rule, history, arrival, chrome): each exit 0, with 0 error files and 0 tracebacks. These ran with ui-theme#33 on PYTHONPATH.
  • tools/android/check.sh with PYTHONFAULTHANDLER=1: exit 0, including the shipped app on a scratch bus. It ran against a copy of the installed runtime whose ui_theme is ui-theme#33's.
  • Drives against that runtime copy: they ran afterwards and failed with TimeoutError: welcome rows. The host's out-of-memory kill at 04:53 took down the user manager that serves the live bus, which was still down when this was written.

Overlap

The history fork (fork-qt-history-snappy) is in qt/history.py. This PR doesn't touch that file: the rule is in qt/lines.py, and the scrollbar is in qt/view_settings.py plus the new qt/overlay_scrollbar.py.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

…ver the text

A message header's rule was a count of ─ characters beside the title, so its
ends moved with the title's length and never met the row's edges. Qt now
draws each side as a real line in its own cell (the theme's RuleColour), so
every rule meets both edges whatever the title; the TUI keeps its cell rule.

The Scrollbar setting declares, per member, the width it takes beside the text
(`size`) and the width it draws over the text while the conversation moves
(`overlay`). The new Transient member takes no width and shows a bar over the
text while scrolling, faded out a second after; Hidden shows none. Qt floats
the overlay over the viewport (OverlayScrollBar, handle in SurfaceHoverColour,
fading on the app clock through SCROLLBAR_FADE); a terminal cannot draw over
its text, so Textual shows `size` only and Transient is no bar there. The
default is the platform's: Transient on Android, Normal elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
@trissim

trissim commented Nov 18, 2026

Copy link
Copy Markdown
Author

Merged as part of #2130: this branch was rebased onto main and gated together with the other UI branches, since they edit the same lines.

@trissim trissim closed this Nov 18, 2026
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