qwen-code/packages/web-shell/client/utils
Shaojin Wen 68ff698cd2
feat(web-shell): improve slash command discovery (taller menu, group counts, fuzzy search) (#6267)
* feat(web-shell): show more slash commands with category headers

The slash-command menu capped its visible height at exactly four rows, so
with 40+ merged commands users had to scroll a thin list to find anything,
and the built-in custom/skill/system grouping was only a faint 1px divider
with no label.

Raise the cap to min(12 rows, 40vh) and render the category name as a visible
header at each group boundary (custom / skill / system), keeping the divider
between groups. Sub-command menus are ungrouped and unchanged.

* feat(web-shell): fuzzy-match slash commands and show per-group counts

Typing in the slash menu now fuzzy-ranks commands with the same fzf engine the
TUI uses, so abbreviated input like "mdl" finds "model" and "arf" finds
"agent-reproduce-feature" — substring matching alone could not. An empty query
still browses the category-ordered list; a non-empty query switches to a flat
relevance-ranked list (headers are dropped since results interleave categories).

Each category header also shows how many commands the group holds (e.g. "Skill
commands  28"), so the volume hidden below the fold is visible at a glance.

The fzf index is built once per command set (keyed on the array identity) and
falls back to substring filtering if construction fails.

* refactor(web-shell): address slash menu review feedback

- Extract the section header/divider boundary logic into a pure
  `planSlashSectionRows` helper and unit-test it (headers at group
  boundaries, first row header without a divider, no repeated headers for
  adjacent duplicate sections, per-group counts). This also moves the
  section-count computation past the `!anchorRect` early return so it no
  longer runs on first render.
- Simplify `--slash-panel-max-height` to a round `min(460px, 45vh)` instead
  of a `12 * rowHeight` formula that ignored header/divider overhead and so
  showed only ~9-10 rows; the panel now shows ~12-13 rows.
- Log a warning when fzf fuzzy search throws before falling back to
  substring matching, so a silent failure is diagnosable.
- Add a completion test for the zero-match case returning null.
2026-07-03 14:56:06 +00:00
..
ansi.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
commandDisplay.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
composerInputState.test.ts fix(web-shell): improve disconnected composer handling (#6166) 2026-07-02 07:05:55 +00:00
composerInputState.ts fix(web-shell): improve disconnected composer handling (#6166) 2026-07-02 07:05:55 +00:00
copyCommand.test.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
copyCommand.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
cssUrlVar.ts feat(web-shell): polish chat UI (#5893) 2026-06-26 15:38:23 +00:00
dialogLabels.ts refactor(web-shell): restructure chat UI (#5775) 2026-06-23 22:43:19 +08:00
dom.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
escapeIntent.test.ts feat(web-shell): friendlier Esc interruption + queued-prompt UX (#6025) 2026-06-30 01:27:16 +00:00
escapeIntent.ts feat(web-shell): friendlier Esc interruption + queued-prompt UX (#6025) 2026-06-30 01:27:16 +00:00
formatRelativeTime.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
formatRuntime.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
formatTokenCount.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
localCommandQueue.test.ts feat(web-shell): queue prompts while turns are running (#6005) 2026-06-30 14:51:28 +00:00
localCommandQueue.ts feat(web-shell): queue prompts while turns are running (#6005) 2026-06-30 14:51:28 +00:00
modelDisplay.ts feat(web-shell): polish chat UI (#5893) 2026-06-26 15:38:23 +00:00
modelEncoding.test.ts fix(web-shell): encode vision model picker selection & polish dispatch (#6236) 2026-07-03 13:51:47 +00:00
modelEncoding.ts fix(web-shell): encode vision model picker selection & polish dispatch (#6236) 2026-07-03 13:51:47 +00:00
modelSwitchMessages.test.ts feat(web-shell): polish chat UI (#5893) 2026-06-26 15:38:23 +00:00
modelSwitchMessages.ts feat(web-shell): polish chat UI (#5893) 2026-06-26 15:38:23 +00:00
queueDrain.test.ts feat(web-shell): friendlier Esc interruption + queued-prompt UX (#6025) 2026-06-30 01:27:16 +00:00
queueDrain.ts feat(web-shell): friendlier Esc interruption + queued-prompt UX (#6025) 2026-06-30 01:27:16 +00:00
sentinelMessage.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
sessionPreparation.test.ts fix(web-shell): defer session creation until first prompt (#6066) 2026-07-01 14:04:37 +00:00
sessionPreparation.ts fix(web-shell): defer session creation until first prompt (#6066) 2026-07-01 14:04:37 +00:00
slashSectionPlan.test.ts feat(web-shell): improve slash command discovery (taller menu, group counts, fuzzy search) (#6267) 2026-07-03 14:56:06 +00:00
slashSectionPlan.ts feat(web-shell): improve slash command discovery (taller menu, group counts, fuzzy search) (#6267) 2026-07-03 14:56:06 +00:00
systemInfo.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
todos.test.ts feat(web-shell): per-task token & time detail on completed todos (#5118) 2026-06-15 15:40:06 +08:00
todos.ts feat(web-shell): per-task token & time detail on completed todos (#5118) 2026-06-15 15:40:06 +08:00