playbook: place a collaborator's name flag where it can't cover text (#1093) - #1129
Merged
Conversation
The flag was painted unconditionally one row above the peer's caret, straight over whatever was already rendered there. A peer editing one line below turned `- build the thing ZZZ` into `- build tWeb 1ing ZZZ`, and there was no way to tell the badge from the document. It now takes the first run of blank cells that fits, scanning right from the preferred spot — the row above beside the caret, then the caret's own row, whose trailing blanks are free on any line shorter than the pane. A cell that is only styled (a shimmer band, a selection tint) still counts as free: covering a background is fine, covering a character is not. When neither row has room the flag is dropped rather than eat a character; the caret cell is already painted in the collaborator's colour, so they stay identifiable. No separator space is needed — the badge carries its own background, so it reads as a chip against the text.
edwin-zvs
force-pushed
the
fix-playbook-collab-label
branch
from
August 2, 2026 02:29
3aa03e2 to
58e3ad0
Compare
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.
Fixes #1093.
A collaborator's name flag was painted unconditionally one row above their caret, straight over whatever was already rendered there. A peer editing one line below turned your own text into gibberish, with no way to tell the badge from the document:
Both captured from a live TUI with two clients on the same Playbook.
Placement
The badge now takes the first run of blank cells that fits, scanning right from the preferred spot — the row above beside the caret, then the caret's own row, whose trailing blanks are free on any line shorter than the pane.
"Blank" means the cell holds no visible glyph. A cell that is merely styled — a shimmer band, a selection tint — still counts as free: painting a badge over a background is fine, painting it over a character is not.
When neither row has room the badge is dropped. The caret cell itself is already painted in the collaborator's colour, so they stay identifiable — which is the fallback #1093 asked for.
No separator space was added between the text and the badge, and it doesn't need one: the badge carries its own background colour, so
ZZZWeb 1renders as a distinct chip rather than running into the text. Confirmed in the rendered escape sequence (48;2;57;255;136).Tests
Three, over a hand-built buffer, so the property is pinned directly rather than through a full render:
playbook_collab_label_never_covers_a_glyph— the occupied case slides right to the trailing blanks; a full row yields no slot at all.playbook_collab_label_keeps_the_preferred_slot_when_free— badges already sitting in blank space don't move, so this doesn't relocate flags that were fine.playbook_collab_label_may_sit_on_a_styled_blank— a shimmer or selection tint doesn't block placement.The first failed on its first run and it was the fixture, not the code: a 5-wide badge in a 21-wide buffer where the blank run began at 17 genuinely has nowhere to go. Widened the fixture rather than loosening the search, which would have quietly defeated the point of the test.
Binaries
Only
crates/clichanges →construct:/Users/moon/agentd/.claude/worktrees/fix-playbook-collab-label/target/debug/constructTo see it: open the same Playbook in the TUI and the web UI, and put the web caret on a line whose predecessor has text.