Skip to content

playbook: place a collaborator's name flag where it can't cover text (#1093) - #1129

Merged
edwin-zvs merged 1 commit into
mainfrom
fix-playbook-collab-label
Aug 2, 2026
Merged

playbook: place a collaborator's name flag where it can't cover text (#1093)#1129
edwin-zvs merged 1 commit into
mainfrom
fix-playbook-collab-label

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

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:

before:   • build tWeb 1ing ZZZ
after:    • build the thing ZZZWeb 1

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 1 renders 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/cli changes → construct:

/Users/moon/agentd/.claude/worktrees/fix-playbook-collab-label/target/debug/construct

To 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.

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
edwin-zvs force-pushed the fix-playbook-collab-label branch from 3aa03e2 to 58e3ad0 Compare August 2, 2026 02:29
@edwin-zvs
edwin-zvs merged commit 9df0d80 into main Aug 2, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the fix-playbook-collab-label branch August 2, 2026 02:37
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.

tui: playbook collaborator label paints over the document line above the caret

1 participant