revert(session): drop the cross-device needsRefresh buffer reload

The post-takeover/re-assert needsRefresh made multi-client redraws worse
in practice (fragmented mixed-width frames on the phone) — reverted to
the behavior the user verified as good: cross-device reflows rely on
Ink's own redraw, stale scrollback scrolls away with new output.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-06-10 20:50:24 +02:00
co-authored by Claude Fable 5
parent 68310619a7
commit 28b531fa5b
2 changed files with 1 additions and 73 deletions
-36
View File
@@ -171,41 +171,5 @@ describe('Session resize arbitration', () => {
session.noteDesktopActivity();
expect(resize).not.toHaveBeenCalled();
});
it('emits needsRefresh after a mobile takeover and after a desktop re-assert', () => {
vi.useFakeTimers();
const session = new Session({ workingDir: '/tmp', mode: 'shell' });
attachFakePty(session, 160, 48);
const refresh = vi.fn();
session.on('needsRefresh', refresh);
session.resize(208, 45, { viewportType: 'desktop' });
session.claimDesktopSizing(Symbol('desktop-conn'));
vi.advanceTimersByTime(800);
expect(refresh).not.toHaveBeenCalled(); // plain desktop resize: no refresh
vi.advanceTimersByTime(PAST_IDLE_MS);
session.resize(48, 28, { viewportType: 'mobile' }); // takeover
vi.advanceTimersByTime(800);
expect(refresh).toHaveBeenCalledTimes(1);
session.noteDesktopActivity(); // re-assert to 208x45
vi.advanceTimersByTime(800);
expect(refresh).toHaveBeenCalledTimes(2);
});
it('does not emit needsRefresh for ordinary single-device resizes', () => {
vi.useFakeTimers();
const session = new Session({ workingDir: '/tmp', mode: 'shell' });
attachFakePty(session, 160, 48);
const refresh = vi.fn();
session.on('needsRefresh', refresh);
session.resize(48, 28, { viewportType: 'mobile' }); // mobile-only, no claims
session.resize(208, 45, { viewportType: 'desktop' });
session.resize(100, 30); // untyped
vi.advanceTimersByTime(1000);
expect(refresh).not.toHaveBeenCalled();
});
});
});