fix: issues
This commit is contained in:
@@ -383,9 +383,8 @@ export function useCommander(
|
||||
|
||||
const setSelectedCompletion = (v: number | ((prev: number) => number)) => {
|
||||
const comps = completions();
|
||||
const maxVisible = 3;
|
||||
const maxIdx = Math.min(comps.length - 1, maxVisible - 1);
|
||||
|
||||
const maxIdx = comps.length - 1;
|
||||
|
||||
if (typeof v === 'function') {
|
||||
setSelectedCompletionState(prev => {
|
||||
const next = v(prev);
|
||||
@@ -399,8 +398,7 @@ export function useCommander(
|
||||
const acceptCompletion = () => {
|
||||
const idx = selectedCompletion();
|
||||
const comps = completions();
|
||||
// 确保索引在有效范围内
|
||||
const validIdx = Math.min(idx, Math.min(comps.length - 1, 2));
|
||||
const validIdx = Math.min(idx, comps.length - 1);
|
||||
const comp = comps[validIdx];
|
||||
if (!comp) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user