refactor(tiles): removeTile has no auto option, its refocus is always the app's

removeTile took `auto` for the neighbour it focuses, but no caller ever
passed anything but true: a tile leaving is never a human picking its
neighbour. The option is gone (the refocus passes `auto: true` itself, and
the doc comment says so), and the four call sites that spelled out the
defaults (the header's ×, remove-tile, a stopped socket, a popped-out
session) are plain removeTile(id). `refocus: false` callers are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-10-07 09:37:03 +02:00
parent 55b526bc1e
commit 6af38abc76
2 changed files with 8 additions and 10 deletions
+1 -1
View File
@@ -1708,7 +1708,7 @@ class CodemanApp {
if (on) this.detachedSessions.add(id); else this.detachedSessions.delete(id); if (on) this.detachedSessions.add(id); else this.detachedSessions.delete(id);
// A popped-out session's window owns its PTY size now, so it leaves the // A popped-out session's window owns its PTY size now, so it leaves the
// tile grid (one place per session in this browser tab). // tile grid (one place per session in this browser tab).
if (on && this._tileGrid?.has(id)) this.removeTile(id, { refocus: true, auto: true }); if (on && this._tileGrid?.has(id)) this.removeTile(id);
const container = this.$('sessionTabs'); const container = this.$('sessionTabs');
const tab = container && container.querySelector(`.session-tab[data-id="${id}"]`); const tab = container && container.querySelector(`.session-tab[data-id="${id}"]`);
if (tab) tab.classList.toggle('detached', on); if (tab) tab.classList.toggle('detached', on);
+7 -9
View File
@@ -622,7 +622,7 @@ Object.assign(CodemanApp.prototype, {
removeFocusedTile() { removeFocusedTile() {
const grid = this._tileGrid; const grid = this._tileGrid;
if (!grid?.open || !grid.focusedId) return; if (!grid?.open || !grid.focusedId) return;
this.removeTile(grid.focusedId, { refocus: true, auto: true }); this.removeTile(grid.focusedId);
}, },
// The single view after the grid closes: the session the grid was focused on, // The single view after the grid closes: the session the grid was focused on,
@@ -666,11 +666,11 @@ Object.assign(CodemanApp.prototype, {
/** /**
* Removes one tile; the session keeps running. When it held focus, `refocus` * Removes one tile; the session keeps running. When it held focus, `refocus`
* moves focus to the neighbouring tile (next in grid order, else previous). * moves focus to the neighbouring tile (next in grid order, else previous),
* The last tile leaving closes the grid: with `refocus` the single view then * as the app's choice (`auto`: no idle alert is spent). The last tile leaving closes the grid: with `refocus` the single view then
* shows that session, without it the caller decides what comes next. * shows that session, without it the caller decides what comes next.
*/ */
removeTile(sessionId, { refocus = true, auto = true } = {}) { removeTile(sessionId, { refocus = true } = {}) {
const grid = this._tileGrid; const grid = this._tileGrid;
const entry = grid?.open ? grid.tiles.get(sessionId) : null; const entry = grid?.open ? grid.tiles.get(sessionId) : null;
if (!entry) return false; if (!entry) return false;
@@ -695,7 +695,7 @@ Object.assign(CodemanApp.prototype, {
this._applyTileLayout(); this._applyTileLayout();
this._scheduleTileGridRefit(); this._scheduleTileGridRefit();
this.renderSessionTabs?.(); this.renderSessionTabs?.();
if (wasFocused && refocus && neighbor) this._selectTiledSession(neighbor, { auto }); if (wasFocused && refocus && neighbor) this._selectTiledSession(neighbor, { auto: true });
return true; return true;
}, },
@@ -1099,9 +1099,7 @@ Object.assign(CodemanApp.prototype, {
// picker, Ctrl/Cmd+click, a dragged tab, a tab group or Run.) // picker, Ctrl/Cmd+click, a dragged tab, a tab group or Run.)
// Removes the tile ONLY: the session keeps running. Killing it stays // Removes the tile ONLY: the session keeps running. Killing it stays
// behind the menu's Close session and its confirm. // behind the menu's Close session and its confirm.
button('tile-remove', 'Remove tile (the session keeps running)', '\u00D7', () => button('tile-remove', 'Remove tile (the session keeps running)', '\u00D7', () => this.removeTile(sessionId))
this.removeTile(sessionId, { refocus: true, auto: true })
)
); );
el.append(dot, name, actions); el.append(dot, name, actions);
return { el, dot, name, zoomBtn }; return { el, dot, name, zoomBtn };
@@ -1225,7 +1223,7 @@ Object.assign(CodemanApp.prototype, {
this._renderTileOverlay(sessionId); this._renderTileOverlay(sessionId);
return; return;
} }
this.removeTile(sessionId, { refocus: true, auto: true }); this.removeTile(sessionId);
}, },
/** Columns x rows for the current tile count, applied to the grid section. */ /** Columns x rows for the current tile count, applied to the grid section. */