client: drive the window state machines through a seam so they can be tested without winit #233
Labels
No labels
Area/ci
Area/cli
Area/client
Area/client-core
Area/daemon
Area/deps
Area/docs
Area/grid
Area/manual
Area/nix
Area/protocol
Area/pty
Area/render
Area/shaping
Area/skills
Area/transport
Area/vt
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Performance
Kind/Security
Kind/Testing
perf-regression-accepted
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Blocked
Status
Need More Info
Status
Upstream
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
felis-terminal/felis#233
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The window-level state machines in
felis-clienthave no tests.App(crates/felis-client/src/main.rs, withapp_methods.rsandevent_handler.rs, ~5.6k lines) owns session switching, parked reattach/retarget pushes, pipe/run visits and their return, the exit ladder, and the search bar, and it reaches them only through a live winit event loop:AppholdsArc<Window>(title, cursor icon, fullscreen, decorations, attention, theme,request_redraw) andEventLoopProxy<AppEvent>(the IPC reader's wake-up), and its methods call both directly.ModifiersState,Key,Ime,MouseScrollDelta,PhysicalPosition) flow through the input handlers rather than stopping at the adapter.The 105 tests in
tests.rstherefore cover pure helpers only (click streak, wheel math, search labels). Bugs in the interplay (a pipe chord refused on a re-pointed session, the scrollback view dropped on a bare modifier) were fixed without a regression test at theApplevel, because none can be written without a window.The same spread makes a winit major upgrade (0.31 reshapes
ApplicationHandlerand the event types) touch most of these 5.6k lines.Proposal
Confine winit to a thin adapter so
Appcan be driven by a fake in tests:winit_keys.rs,input.rs,keymap_adapter.rsalready map keys tofelis_client_coretypes); handlers take that enum.WindowandEventLoopProxycall through one host interface (set title / cursor icon / fullscreen / decorations, request redraw, request attention, wake the loop). The winit build implements it over the real window; tests implement it as a recorder.Behavior does not change.
Appstays infelis-client; whether the seam is a trait, a generic, or acfg(test)swap is decided by the first test, preferring the form that keepsAppnon-generic if it suffices.Out of scope
Appout offelis-clientinto another crate.Notes
Doing this together with the winit 0.31 bump avoids paying the churn twice. Expect conflicts with in-flight
app_methods.rswork (#224).