fix: cycle Command-K CLI picker at query edges (johoja12/Codeman#21)

This commit is contained in:
Saqeb Akhter committed 2026-10-26 01:14:48 +04:00
1 parent 3e06f3c141
commit 0cc9332f3d
3 files changed
+122 -6

No files matched your search

+4 -4
View File
@@ -643,9 +643,9 @@ Object.assign(CodemanApp.prototype, {
/**
* Left/Right change the agent only while the new-session row is highlighted,
* and only when the key would not move the caret anyway (Left at the start of
* the query, Right at its end, no selection), so editing a typed case name
* keeps working.
* and the caret is at either query boundary, with no selection. Both arrows
* stay in picker navigation after typing a case name; inside the query they
* still edit text, as do modified arrows and selection changes.
*/
_commandPaletteArrowCyclesAgent(e) {
const active = (this.commandPaletteItems || [])[this.commandPaletteActiveIndex || 0];
@@ -657,7 +657,7 @@ Object.assign(CodemanApp.prototype, {
const start = Number.isFinite(input?.selectionStart) ? input.selectionStart : value.length;
const end = Number.isFinite(input?.selectionEnd) ? input.selectionEnd : start;
if (start !== end) return false;
return e.key === 'ArrowRight' ? end >= value.length : start <= 0;
return start <= 0 || end >= value.length;
},
_findCommandPaletteCaseMatch(query = '') {