Surface terminal bells on tabs, and update tab titles immediately - #1881
Open
aymanbagabas wants to merge 5 commits into
Open
aymanbagabas wants to merge 5 commits into
aymanbagabas wants to merge 5 commits into
Conversation
RioEvent::Bell now carries the ringing pane's route_id, so the tab strip can flag the tab it came from with a bell glyph. The mark is set only for background tabs and cleared on the next frame the tab is focused. Gated behind bell.tab-indicator (default true). Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Tab titles were only recomputed by a 2s poll, itself gated behind a
second 2s throttle, so an OSC 0/2 title change could take seconds to
reach the tab strip even though the PTY had already reported it.
RioEvent::Title now carries the route id of the pane that changed, so
the tab title is recomputed on arrival. The poll stays for the variables
no event announces ({{program}}, paths) and now repaints when it finds a
change; both paths mark the frame dirty, since the tab strip is chrome
and a bare redraw request is dropped by the present gate.
The title template regex is compiled once now that it renders per event
rather than per tick.
Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Drives a real 0x07 byte through the processor so the C0 dispatch and the route id the event carries stay covered, not just the handler call. Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
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.
Two related tab-strip changes: a bell indicator, and the title latency that made it look broken.
Bell indicator
A
BELfrom a background tab left no trace: the audio bell fired (on the platforms that default to it) and that was the whole notification. If the tab wasn't focused, nothing said which one rang.RioEvent::Bellnow carries theroute_idof the pane that rang, so the tab strip can flag the tab it came from with a 🔔 next to the title. The mark is only set for background tabs — the focused one is already in front of the user — and is cleared on the first frame its tab is shown, whatever brought it to the front (click, keybinding, tab close).The ringing pane is looked up across every tab, not just the focused one, so a bell from a background split of a background tab still lands on the right tab.
The mark is drawn as its own text run rather than being prefixed onto the title: the UI text layer resolves one font per draw from the run's first char, so gluing them together would shape the whole title in the emoji font. Its width is subtracted from the title budget, so a ringing tab ellipsizes instead of overflowing its island.
Gated behind
bell.tab-indicator, defaulttrue:Immediate tab titles
While testing the above, the mark took seconds to appear. The cause is older than the bell work: tab titles were only recomputed by a 2s poll, itself gated behind a second 2s throttle, so an OSC 0/2 title change could take seconds to reach the tab strip even though the PTY had already reported it.
RioEvent::Titlenow carries aroute_idtoo, and the tab title is recomputed when the event arrives. The poll stays for the variables no event announces ({{program}}, paths) and now reports whether it changed anything, so it can repaint. Both paths mark the frame dirty — the tab strip is chrome, and a bare redraw request is dropped by theany_panel_dirtypresent gate.The title template regex is compiled once now that it renders per event instead of per tick.
Testing
bell_marks_background_tabs_only_and_clears_on_focuscovers the tab flagging: background tabs get marked, the focused tab does not, unknown routes are a no-op, and focusing clears it.bell_emits_bell_event_for_its_routedrives a real0x07byte through the processor, so the C0 dispatch and the route id it carries stay covered.cargo test -p rioterm -p rio-backend -p rio-vtpasses (925 tests),cargo clippy --workspace --all-targetsis clean.printf '\a'from a background tab marks that tab immediately and the mark disappears on focus;printf '\033]0;TITLE\007'from a background tab retitles it immediately with no interaction.