WIP: RynthChat: pin channels to the top bar #16

Draft
AwfulWaffle wants to merge 12 commits from AwfulWaffle/RynthCore:chat/pins into main
First-time contributor

Pin any channel to the main chat window's top bar.

Stacked on the server-tabs PR (#15). This branch carries those commits too. Review only the last five: "pinned tab bookkeeping", "pin channels to the top bar", "pins: review fixes", "All is pinned by default" and "source-scan the always-written pin array".

What it does

  • Pin toggle: each row in the Channels drawer gets a push-pin button. Clicking it pins or unpins the tab without selecting it.
  • Top bar: pinned tabs show as buttons between the channel dropdown and search, with the active highlight and unread badges. Right-click a button to Unpin it.
  • Narrow windows: pins that don't fit go into an overflow button. Search keeps 120 px while there is room for it.
  • All pinned by default: pinnedTabs absent (never set, or a file from before pins) means All is pinned.
  • Persistence: pins are saved in pinnedTabs. The array is always written, so unpinning everything persists as [] and is not read back as "never set". A source-scan test pins that save line. Pins follow a tab rename and are dropped when the tab is deleted.
  • Hidden tabs: a pin on a hidden server tab is kept but not drawn.
  • Scope: pins appear in the main window only, not in the extra chat windows, and not in "Tabs across the top" mode, which already shows every tab.
  • Code: the bookkeeping is the pure ChatPins (Toggle, Add, Rename, Remove, Visible, Layout).

Tests

  • tools/ChatFilterTests: 1817/1817 checks pass, including the new ChatPins cases for layout with none, some or all pins fitting.
  • tools/SectionsTests: 245/245 checks pass.
  • The engine Release build has 0 errors.
  • The drawer's click order was checked with a headless ImGui probe:
    • A click on the pin toggles only the pin.
    • A click on the row body selects only the row.
    • A right-click on the pin opens no row menu.
  • Not yet run in game.

🤖 Generated with Claude Code

Pin any channel to the main chat window's top bar. **Stacked on the server-tabs PR (#15).** This branch carries those commits too. Review only the last five: "pinned tab bookkeeping", "pin channels to the top bar", "pins: review fixes", "All is pinned by default" and "source-scan the always-written pin array". ## What it does - **Pin toggle:** each row in the Channels drawer gets a push-pin button. Clicking it pins or unpins the tab without selecting it. - **Top bar:** pinned tabs show as buttons between the channel dropdown and search, with the active highlight and unread badges. Right-click a button to Unpin it. - **Narrow windows:** pins that don't fit go into an overflow button. Search keeps 120 px while there is room for it. - **All pinned by default:** `pinnedTabs` absent (never set, or a file from before pins) means All is pinned. - **Persistence:** pins are saved in `pinnedTabs`. The array is always written, so unpinning everything persists as `[]` and is not read back as "never set". A source-scan test pins that save line. Pins follow a tab rename and are dropped when the tab is deleted. - **Hidden tabs:** a pin on a hidden server tab is kept but not drawn. - **Scope:** pins appear in the main window only, not in the extra chat windows, and not in "Tabs across the top" mode, which already shows every tab. - **Code:** the bookkeeping is the pure `ChatPins` (`Toggle`, `Add`, `Rename`, `Remove`, `Visible`, `Layout`). ## Tests - `tools/ChatFilterTests`: 1817/1817 checks pass, including the new `ChatPins` cases for layout with none, some or all pins fitting. - `tools/SectionsTests`: 245/245 checks pass. - The engine Release build has 0 errors. - The drawer's click order was checked with a headless ImGui probe: - A click on the pin toggles only the pin. - A click on the row body selects only the row. - A right-click on the pin opens no row menu. - Not yet run in game. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SectionRegistry.Rebuild hands every manifest's chatTabs and the active
server ids to ChatModel.ApplyServerTabs, which seeds each entry's tab once
(seededTabs), rewrites its owned rules from the manifest, and gates the tab
(tabServers) and its rules (ChatFilterRule.Server, ChatRouter) on the
server being active. The pump records the Global room from network room
lines (globalRooms) and rewrites the Global-room rule.

- Apply is a no-op when nothing changed (EditFiltersIfChanged; rules
  compared as canonical forms with ChatServerTabs.SameRule), since Rebuild
  runs every second, and waits for the settings file to load first.
- Rules an older engine stripped of "owner" are reclaimed by content
  (ChatServerTabs.Reclaim) instead of a second set being added.
- A deleted server tab stays deleted across a reload: its disabled owned
  rules no longer re-create it in LoadSettings.
- AllTabs caches per filter version and active-server set.
- The rule editor marks server rules; a manifest with a dropped chatTabs
  entry is logged as partly read, not as unread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Dereth Network README names Roleplay as the room a world usually
borrows for the Global room, so an entry that leaves the fallback out
matches Roleplay until chat shows another room.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The decision core of ChatModel.ApplyServerTab moves into
ChatServerTabs.Apply, a pure function returning edits (rule updates,
inserts, removals, tab create, pin, seed mark, tab server); ChatModel
only carries them out. ChatFilterTests drives it through a small
settings model.

- A seeded entry whose tab was deleted never gets a rule turned on: a
  rule the manifest gains, or one re-added after the player deleted
  the rules, is added off. Tab listing skips a tab only an inactive
  server's rule fills.
- Owned rules pair with declared ones by content (Global-room flag,
  then when/action/mode/pattern, then leftovers), never by position,
  so a reorder or delete no longer moves on/off or colour to another
  rule. Reclaim uses the same pairing.
- Settings count as ready only after a successful read (or no file);
  a failed read is retried every 2 s, the unreadable copy kept once.
- Export leaves out server rules and server tabs; Import makes every
  imported rule the player's (no owner, server or globalRoom).
- Both rule editors lock pattern, mode, when, action, tab, move and
  delete on a server rule; on/off and colour stay live, with a note.
- No adopt-by-name: a taken name seeds "<Name> (<server name>)"
  instead, and tabServers is written only for a tab the plugin made.
  Reclaim requires the entry's name, its clash name, or a tab holding
  only the matched rules. AddCustomTab checks hidden tabs.
- Global-room discovery re-reads the entries and active servers under
  the lock. The manifest parser rejects a bad when or mode, and keeps
  a pattern's spaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"New tab: Network" on a server where the DreamWeave Network tab is
hidden returned that hidden tab, so the player's new rule filled the
server's tab. ChatServerTabs.ResolveNewTab now keeps "returns the
existing one" for a visible tab only; a hidden match gets a free
numbered name ("Network 2"). An unreadable settings file is logged
once per run instead of on every 2 s retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ChatPins: pure Toggle/Rename/Remove/Visible over the pinned-tab list
(OrdinalIgnoreCase, order = button order). A pin on a hidden tab is kept
but not returned by Visible. Tests in tools/ChatFilterTests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A push-pin button on each drawer row pins the tab to the main window's
header: one button per pin after the channel button (unread badge,
right-click to unpin), the ones that do not fit in an overflow button,
search keeps 120 px. ChatModel.TogglePin saves; rename, delete and the
server-tab seed now go through ChatPins. Extra windows and "Tabs across
the top" draw no pins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drawer pin was unclickable: the row now allows overlap and the pin takes
the click (and the row menu/tooltip stay off the pin). Header layout is a
pure ChatPins.Layout: the overflow button is always drawn when pins do not
all fit and its width is reserved before search's 120 px. The pinned chip
uses a lighter fill on the current row. ChatPins.Add (idempotent) seeds the
server pin; ChatModel.Unpin (one way) backs the header Unpin menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pinnedTabs absent (never set, or a file from before pins) means All is
pinned (ChatPins.FromSettings); saving always writes the array, so
unpinning everything persists as [] and is not mistaken for "never set".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ChatFilterTests now scans ChatData.cs for the pin save and load lines so a
refactor back to NullIfEmpty cannot silently turn "nothing pinned" into
"All pinned". Also fixes the save comment that still said pins are left
out while empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u chat/pins:AwfulWaffle-chat/pins
git switch AwfulWaffle-chat/pins

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff AwfulWaffle-chat/pins
git switch AwfulWaffle-chat/pins
git rebase main
git switch main
git merge --ff-only AwfulWaffle-chat/pins
git switch AwfulWaffle-chat/pins
git rebase main
git switch main
git merge --no-ff AwfulWaffle-chat/pins
git switch main
git merge --squash AwfulWaffle-chat/pins
git switch main
git merge --ff-only AwfulWaffle-chat/pins
git switch main
git merge AwfulWaffle-chat/pins
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rynth/RynthCore!16
No description provided.