Skip to content

[Bug]: TUI /resume exact completion cannot submit when another index shares the same prefix #3592

@lizhengwu

Description

@lizhengwu

Version line

v2 — Go rewrite (1.x), main-v2 (active development)

Exact version

reasonix desktop-v1.3.0-44-gba094b9f

What happened?

In the terminal TUI, /resume argument completion can get stuck when the selected session index is also a prefix of another
index.

For example, when there are at least 10 resumable sessions:

  1. Type /resume
  2. Press Space to open the session index completion list
  3. Select 1
  4. Press Tab, so the input becomes /resume 1
  5. The completion list still contains both 1 and 10
  6. Press Enter

Expected: /resume 1 should submit and resume session 1.

Actual: Enter is captured by the completion menu and does not submit. The user has to type an extra space or otherwise
dismiss the menu first.

Selecting 10 does not hit the same issue because after accepting 10, there is no longer another matching prefix item, so
the menu closes and Enter submits normally.

Why this is confusing

The selected completion value is already fully present in the input. Pressing Enter should execute the command, not keep
accepting the same completion item again.

Expected behavior

When Enter is pressed and the currently selected completion item's inserted text is already present in the current input
token, the completion menu should close and Enter should fall through to normal command submission, even if other prefix
matches still exist.

Affected area

Terminal TUI autocomplete, especially /resume <index> when indices like 1 and 10 both exist.

Steps to reproduce

Steps to reproduce

  1. Start the terminal TUI.
  2. Make sure there are at least 10 resumable sessions.
  3. Type /resume.
  4. Press Space to open the session index completion list.
  5. Select 1 in the completion list.
  6. Press Tab.
  7. Observe that the input is /resume 1, but the completion list still shows both 1 and 10.
  8. Press Enter.

Expected

/resume 1 should submit and resume session 1.

Actual

Enter is captured by the completion menu and the command is not submitted. The user has to type an extra space or dismiss
the menu before Enter works.

OS / platform

macos

Relevant logs or output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmacosmacOS-specifictuiTerminal UI / CLI (internal/cli, internal/control)v2Go rewrite (1.x) — main-v2 branch, active development

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions