mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-10 09:19:42 +02:00
fix(tiles): file drops, focus handoffs, pop-out fallback, split merge, tablet default
- A file dragged onto the tile grid navigated the browser away: the single view's drop handler sits on #terminalContainer, hidden while tiles are open. The #tileGrid section now cancels every file dragover and drop (bubble phase, so tab and tile drags stay with _acceptTabDrops), and a drop on a tile uploads its images to THAT tile's session through _uploadAndInsertImages, with the same "Only image files are supported" toast as image-input.js (now in the zh-CN table). - App-driven refocus no longer moves DOM focus into another session's xterm: a remote delete of the focused tile, _reconcileTileGrid and a socket closed with 4003/4004/4010 (_onTileExit) pass focus: false. removeTile gains a focus option; user-initiated removes keep focusing. - Popping out the last tile left the parked terminal's stale content under the popped-out tab (and snapshotted it on the next switch). _selectAfterTileGrid treats a detached session as unusable for both the focused id and the fallback. - "Open group as tiles" and Ctrl/Cmd+click with the grid closed pass mergeSplit: false, so an open split no longer adds its two sessions on top of a set already sized to the group, the count and the window. - Touch-primary devices (primary pointer coarse: iPad, Android tablets) default the Tiles button OFF in getDefaultSettings(); touchscreen laptops (fine primary pointer) keep the desktop default ON. The button, the App Settings chip and the Ctrl+Shift+G gate all resolve an absent key through these defaults, so they agree. CLAUDE.md and the invariants doc say so. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -201,6 +201,35 @@ describe('moving focus between tiles', () => {
|
||||
expect(app.markIdleAlertSeen).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
// The last tile popped out closes the grid. The single view must never try
|
||||
// to show that session: selectSession only raises its window, and the parked
|
||||
// terminal's stale pre-grid content would stay up under its tab (and be
|
||||
// saved as its snapshot on the next switch).
|
||||
it('popping out the LAST tile falls through to the next session, never the popped-out one', () => {
|
||||
const app = makeGridApp(['s-a']);
|
||||
app.openTileGrid(['s-a']);
|
||||
app.$ = () => null;
|
||||
app.selectSession = vi.fn();
|
||||
app._markDetached('s-a', true);
|
||||
expect(app._tilesOwnTerminal()).toBe(false);
|
||||
expect(app.selectSession.mock.calls).toEqual([['s-other', { auto: true }]]);
|
||||
// Nulled before the selection, so the parked buffer is not snapshotted as s-a's.
|
||||
expect(app.activeSessionId).toBeNull();
|
||||
});
|
||||
|
||||
it('popping out the last tile with every other session popped out too: the welcome screen, the parked terminal cleared', () => {
|
||||
const app = makeGridApp(['s-a']);
|
||||
app.detachedSessions.add('s-other');
|
||||
app.openTileGrid(['s-a']);
|
||||
app.$ = () => null;
|
||||
app.selectSession = vi.fn();
|
||||
app._markDetached('s-a', true);
|
||||
expect(app.selectSession).not.toHaveBeenCalled();
|
||||
expect(app.activeSessionId).toBeNull();
|
||||
expect(app.terminal.clear).toHaveBeenCalled();
|
||||
expect(app.showWelcome).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('going Home leaves the grid, remembered', () => {
|
||||
const app = openGrid();
|
||||
app.goHome();
|
||||
|
||||
Reference in New Issue
Block a user