Skip to content

feat(tui): empty enter scrolls viewport to bottom#3553

Merged
SivanCola merged 3 commits into
esengine:main-v2from
taibai233:feature/empty-enter-scroll-bottom
Jun 9, 2026
Merged

feat(tui): empty enter scrolls viewport to bottom#3553
SivanCola merged 3 commits into
esengine:main-v2from
taibai233:feature/empty-enter-scroll-bottom

Conversation

@taibai233

@taibai233 taibai233 commented Jun 8, 2026

Copy link
Copy Markdown

小改动:在 TUI 中,输入框为空时按 Enter 不再是无操作,而是自动将 viewport 滚到最底部(tail-follow)。

之前空输入按 Enter 直接 return,改了之后加了一行 m.viewport.GotoBottom()

Closes #3550

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development tui Terminal UI / CLI (internal/cli, internal/control) and removed v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 8, 2026

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

谢谢,这个改动方向是对的,空输入 Enter 用来回到底部很符合 #3550 的诉求。不过现在只覆盖了 idle 分支,运行中的分支还是会提前返回:

if m.state == tuiRunning {
    line := strings.TrimSpace(m.input.Value())
    if line == "" {
        return m, nil
    }
    ...
}

这样在模型流式输出或长任务运行时,用户滚上去看内容后按空 Enter 仍然不会回到底部;这恰好是最需要 tail-follow 的场景。建议在这个 line == "" 分支里也调用 m.viewport.GotoBottom(),并补一个回归测试:先让 transcript 溢出、滚上去、设置 m.state = tuiRunning,再按空 Enter,断言 viewport.AtBottom()

我本地验证过:go test ./internal/cli 通过;临时加上述 running 场景测试时当前 PR 会失败。

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice quality-of-life fix — empty Enter snapping to bottom is the expected behavior. Verified build + cli tests locally. Thanks!

@esengine esengine enabled auto-merge (squash) June 8, 2026 09:00
auto-merge was automatically disabled June 8, 2026 09:35

Head branch was pushed to by a user without write access

@taibai233 taibai233 requested a review from SivanCola June 8, 2026 09:58
@taibai233 taibai233 force-pushed the feature/empty-enter-scroll-bottom branch from 0576a00 to 82dc750 Compare June 9, 2026 05:43
@SivanCola SivanCola enabled auto-merge June 9, 2026 06:45
@SivanCola SivanCola merged commit ece9b77 into esengine:main-v2 Jun 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: TUI回车键快速滚动到最下方

3 participants