diff --git a/src/web/public/app.js b/src/web/public/app.js index 8c083d61..0c8be117 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -9063,12 +9063,8 @@ class CodemanApp { } nextSession() { - // With the tile grid open, Ctrl+Tab and Alt+] cycle through the tiles. - if (this._tileGrid?.open) { - const id = window.CodemanTileGrid.cycleTile(this._tileGrid.ids, this.activeSessionId, 1); - if (id) this.selectSession(id); - return; - } + // With the tile grid open, Ctrl+Tab and Alt+[ / Alt+] cycle through the tiles. + if (this._cycleTileFocus?.(1)) return; if (this.sessionOrder.length <= 1) return; const currentIndex = this.sessionOrder.indexOf(this.activeSessionId); @@ -9077,11 +9073,7 @@ class CodemanApp { } prevSession() { - if (this._tileGrid?.open) { - const id = window.CodemanTileGrid.cycleTile(this._tileGrid.ids, this.activeSessionId, -1); - if (id) this.selectSession(id); - return; - } + if (this._cycleTileFocus?.(-1)) return; if (this.sessionOrder.length <= 1) return; const currentIndex = this.sessionOrder.indexOf(this.activeSessionId); diff --git a/src/web/public/tile-grid.js b/src/web/public/tile-grid.js index 978a2170..13857ec1 100644 --- a/src/web/public/tile-grid.js +++ b/src/web/public/tile-grid.js @@ -608,6 +608,19 @@ Object.assign(CodemanApp.prototype, { if (id) this.selectSession(id); }, + /** + * Ctrl+Tab / Alt+] (delta 1) and Alt+[ (delta -1) while the grid is open: a + * human selection of the next tile in reading order, wrapping. Returns + * whether the grid took the chord (it is open), so the tab walk is skipped. + */ + _cycleTileFocus(delta) { + const grid = this._tileGrid; + if (!grid?.open) return false; + const id = window.CodemanTileGrid.cycleTile(grid.ids, this.activeSessionId, delta); + if (id) this.selectSession(id); + return true; + }, + /** Removes the focused tile (the session keeps running); a neighbour takes focus. */ removeFocusedTile() { const grid = this._tileGrid;