From 6af38abc76ec87fcb104e32c5707843ff040b14a Mon Sep 17 00:00:00 2001 From: Codeman maintainer Date: Wed, 7 Oct 2026 03:40:05 +0200 Subject: [PATCH] refactor(tiles): removeTile has no `auto` option, its refocus is always the app's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/web/public/app.js | 2 +- src/web/public/tile-grid.js | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/web/public/app.js b/src/web/public/app.js index bcb2cf99..8c083d61 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -1708,7 +1708,7 @@ class CodemanApp { 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 // 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 tab = container && container.querySelector(`.session-tab[data-id="${id}"]`); if (tab) tab.classList.toggle('detached', on); diff --git a/src/web/public/tile-grid.js b/src/web/public/tile-grid.js index ef8aa64b..489f9b59 100644 --- a/src/web/public/tile-grid.js +++ b/src/web/public/tile-grid.js @@ -622,7 +622,7 @@ Object.assign(CodemanApp.prototype, { removeFocusedTile() { const grid = this._tileGrid; 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, @@ -666,11 +666,11 @@ Object.assign(CodemanApp.prototype, { /** * Removes one tile; the session keeps running. When it held focus, `refocus` - * 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 + * moves focus to the neighbouring tile (next in grid order, else previous), + * 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. */ - removeTile(sessionId, { refocus = true, auto = true } = {}) { + removeTile(sessionId, { refocus = true } = {}) { const grid = this._tileGrid; const entry = grid?.open ? grid.tiles.get(sessionId) : null; if (!entry) return false; @@ -695,7 +695,7 @@ Object.assign(CodemanApp.prototype, { this._applyTileLayout(); this._scheduleTileGridRefit(); this.renderSessionTabs?.(); - if (wasFocused && refocus && neighbor) this._selectTiledSession(neighbor, { auto }); + if (wasFocused && refocus && neighbor) this._selectTiledSession(neighbor, { auto: true }); return true; }, @@ -1099,9 +1099,7 @@ Object.assign(CodemanApp.prototype, { // picker, Ctrl/Cmd+click, a dragged tab, a tab group or Run.) // Removes the tile ONLY: the session keeps running. Killing it stays // behind the menu's Close session and its confirm. - button('tile-remove', 'Remove tile (the session keeps running)', '\u00D7', () => - this.removeTile(sessionId, { refocus: true, auto: true }) - ) + button('tile-remove', 'Remove tile (the session keeps running)', '\u00D7', () => this.removeTile(sessionId)) ); el.append(dot, name, actions); return { el, dot, name, zoomBtn }; @@ -1225,7 +1223,7 @@ Object.assign(CodemanApp.prototype, { this._renderTileOverlay(sessionId); return; } - this.removeTile(sessionId, { refocus: true, auto: true }); + this.removeTile(sessionId); }, /** Columns x rows for the current tile count, applied to the grid section. */