Skip to content

tui: fix holding Up in the model picker - #94

Merged
killpanda merged 1 commit into
mainfrom
claude/project-thread-w898cj
Nov 9, 2026
Merged

killpanda merged 1 commit into
mainfrom
claude/project-thread-w898cj

Conversation

@killpanda

Copy link
Copy Markdown
Owner

Requested by jack mini · project thread

问题

模型选择列表里长按 Down 能连续移动,长按 Up 却不动。

原因

Popup::Models 的 Down 是 *selected += 1,没有上界。长按 Down 到底部后索引会继续往上涨(渲染时被 clamp,所以看起来停在最后一行)。之后每次 Up 只是在把这个"隐藏"的超出值往回减,减到列表长度以内之前高亮一直不动。和 #93 的键盘增强无关(只开了 DISAMBIGUATE_ESCAPE_CODES,Up/Down 处理是同一路径)。

修复

  • Up/Down 走新的 step_selection,索引始终限制在过滤后的列表范围内。
  • 过滤逻辑抽成 visible_models,按键处理和渲染共用。
  • 新增测试 picker_tests:修复前失败(长按 40 次 Down 后索引为 40),修复后通过。

cargo test 131 个通过,cargo clippy --all-targets 无警告。


Generated by Claude Code

Down did `selected += 1` with no upper bound. Holding Down past the last
model ran the index far beyond the list (the render clamped it, so it
looked stuck on the last row); every Up afterwards only walked that hidden
index back, so the highlight didn't move until it got below the list end.

Up/Down now go through step_selection, which keeps the index inside the
filtered list, and the picker's filter is shared via visible_models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BrrmTaVCX3fyMxqpJiZXL
@killpanda killpanda self-assigned this Nov 9, 2026
@graphify-labs

graphify-labs Bot commented Nov 9, 2026

Copy link
Copy Markdown

Graphify reviews are paused for this workspace because nobody has used it in 7 days. A workspace owner can resume reviews from the Repositories page: https://app.graphify.com/angus-lab/repositories

@killpanda
killpanda merged commit 753b896 into main Nov 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants