Skip to content

feat(server): per-client selection state storage (phux-dh4)#43

Merged
phall1 merged 2 commits into
mainfrom
polecat/phux-dh4
Jun 1, 2026
Merged

feat(server): per-client selection state storage (phux-dh4)#43
phall1 merged 2 commits into
mainfrom
polecat/phux-dh4

Conversation

@phall1
Copy link
Copy Markdown
Owner

@phall1 phall1 commented Jun 1, 2026

Wave A server-side selection tracking.

Commits: 5978cb3

phall1 and others added 2 commits May 31, 2026 19:39
…fecycle (phux-dh4)

Implement server-side selection state management in phux-server:

- Add SelectionSpan type to store selection coordinate endpoints (start/end Point)
- Store spans in ServerState via HashMap<(ClientId, TerminalId), SelectionSpan>
- SelectionSpan abstracts over Active (viewport) and History (scrollback) point spaces
- Implement get_selection, set_selection, clear_selection methods
- Clear selections on client detach (clear_client_selections)
- Clear selections on terminal exit (clear_terminal_selections)
- Add 11 comprehensive unit tests covering isolation, lifecycle, and edge cases

Selection data is NOT stored as libghostty_vt::selection::Selection directly because
Selection holds borrowed grid references that become invalid. Instead, we store the
span metadata (coordinates, point space) and can reconstruct the Selection type
on-demand when needed for text extraction.

Test coverage:
- per-terminal isolation
- per-client isolation
- lifecycle cleanup on detach
- lifecycle cleanup on terminal exit
- clearing specific selections
- clearing all for client/terminal

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@phall1 phall1 merged commit ec067a0 into main Jun 1, 2026
2 of 6 checks passed
@phall1 phall1 deleted the polecat/phux-dh4 branch June 1, 2026 00:27
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.

1 participant