Skip to content

fix(tui): scroll transcript when composer is empty, not history#1211

Merged
2 commits merged into
Hmbown:mainfrom
lbcheng888:fix/arrow-scroll-empty-composer
May 13, 2026
Merged

fix(tui): scroll transcript when composer is empty, not history#1211
2 commits merged into
Hmbown:mainfrom
lbcheng888:fix/arrow-scroll-empty-composer

Conversation

@lbcheng888

@lbcheng888 lbcheng888 commented May 8, 2026

Copy link
Copy Markdown
Contributor

Summary

#1117 changed plain Up/Down to always navigate input history, but this broke transcript scrolling for terminals that map trackpad gestures to arrow key events.

Instead of reverting #1117 (which would regress the keyboard history-recall workflow), this PR adds an opt-in config option:

[tui]
composer_arrows_scroll = true

When enabled, empty-composer Up/Down scroll the transcript instead of recalling history. Default behavior is unchanged (#1117).

Changes

  • TuiConfig::composer_arrows_scroll — new config field (default false)
  • App::composer_arrows_scroll — runtime flag read from config at startup
  • handle_composer_history_arrow — gates scroll-on-empty behind the option
  • Updated tests: original tests verify default history behavior; new tests cover the opt-in scroll path

Test plan

  • Default: empty composer + Up → recalls last prompt
  • Opt-in: empty composer + Up → scrolls transcript up
  • Opt-in: non-empty composer + Up → still navigates input history
  • Trackpad two-finger scroll on affected terminals → transcript scrolls (when opt-in enabled)

🤖 Generated with Claude Code

Restore pre-Hmbown#1117 behaviour where plain Up/Down scroll the transcript
when the composer is empty.  Terminals that map trackpad gestures to
arrow keys rely on this to scroll the history area.

When the composer has text, Up/Down still navigate input history.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@Hmbown

Hmbown commented May 8, 2026

Copy link
Copy Markdown
Owner

Thanks for the targeted patch. I do not think we should merge this exact behavior as-is: plain keyboard Up on an empty composer is also the standard input-history recall path, and the KeyCode::Up event does not tell us whether it came from a real keyboard arrow or from a terminal mapping trackpad scroll to arrows. This would fix one scroll setup by regressing another common workflow.

The useful direction is still valid, but it needs a way to avoid stealing empty-composer history recall, such as terminal-specific handling, a separate option, or a mouse/scroll path that does not collapse to the same key event. I am leaving this open rather than merging the current head.

…nals

Instead of unconditionally changing Up/Down behavior, gate the
empty-composer-scroll path behind a new `tui.composer_arrows_scroll`
config option (default false).  Users whose terminals map trackpad
gestures to arrow keys can opt in via:

    [tui]
    composer_arrows_scroll = true

When enabled, empty-composer Up/Down scroll the transcript; otherwise
plain arrows always navigate input history (preserving Hmbown#1117 default).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@lbcheng888

Copy link
Copy Markdown
Contributor Author

@Hmbown

@Hmbown

Hmbown commented May 8, 2026

Copy link
Copy Markdown
Owner

Thank you so much I keep accidentally doing this

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