From 68f1e30f06d286ea11f12c7caf64dcca6515eec7 Mon Sep 17 00:00:00 2001 From: thomasmhr Date: Mon, 12 Jan 2026 23:41:20 +0100 Subject: [PATCH] Add Alt+Up/Down to reorder enabled models in scoped-models selector - Add move() pure function for swapping adjacent items - Handle Alt+Up/Down in handleInput to reorder enabled models - Selection follows the moved item - Update footer hint with new shortcut Co-Authored-By: Claude Opus 4.5 --- .../components/scoped-models-selector.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/coding-agent/src/modes/interactive/components/scoped-models-selector.ts b/packages/coding-agent/src/modes/interactive/components/scoped-models-selector.ts index 5e5fe20f..76631731 100644 --- a/packages/coding-agent/src/modes/interactive/components/scoped-models-selector.ts +++ b/packages/coding-agent/src/modes/interactive/components/scoped-models-selector.ts @@ -155,7 +155,7 @@ export class ScopedModelsSelectorComponent extends Container { const enabledCount = this.enabledIds?.length ?? this.allIds.length; const allEnabled = this.enabledIds === null; const countText = allEnabled ? "all enabled" : `${enabledCount}/${this.allIds.length} enabled`; - const parts = ["Enter toggle", "^A all", "^X clear", "^P provider", "^S save", countText]; + const parts = ["Enter toggle", "^A all", "^X clear", "^P provider", "Alt+↑↓ reorder", "^S save", countText]; return this.isDirty ? theme.fg("dim", ` ${parts.join(" · ")} `) + theme.fg("warning", "(unsaved)") : theme.fg("dim", ` ${parts.join(" · ")}`); @@ -220,6 +220,25 @@ export class ScopedModelsSelectorComponent extends Container { return; } + // Alt+Up/Down - Reorder enabled models + if (matchesKey(data, Key.alt("up")) || matchesKey(data, Key.alt("down"))) { + const item = this.filteredItems[this.selectedIndex]; + if (item && isEnabled(this.enabledIds, item.fullId)) { + const delta = matchesKey(data, Key.alt("up")) ? -1 : 1; + const enabledList = this.enabledIds ?? this.allIds; + const currentIndex = enabledList.indexOf(item.fullId); + const newIndex = currentIndex + delta; + // Only move if within bounds + if (newIndex >= 0 && newIndex < enabledList.length) { + this.enabledIds = move(this.enabledIds, this.allIds, item.fullId, delta); + this.isDirty = true; + this.selectedIndex += delta; + this.refresh(); + } + } + return; + } + // Toggle on Enter if (matchesKey(data, Key.enter)) { const item = this.filteredItems[this.selectedIndex];