mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 00:49:41 +02:00
refactor(tiles): Ctrl+Tab and Alt+[ / ] cycle tiles through one helper
nextSession and prevSession each carried the same grid branch (cycleTile from the active session, a human selection, skip the tab walk). It is now _cycleTileFocus(delta) in tile-grid.js, next to the other focus moves; both call it optionally, so a page or harness without tile-grid.js walks the tabs as before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-11
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user