这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@andrewleech
Copy link

Description

Adds command history functionality to the terminal toolbar's text input view, accessible via up/down swipe gestures.

Motivation

When using Termux with tmux sessions (especially over SSH), vertical swipes in the terminal scroll within tmux - a very
useful feature. However, if text is submitted from the text input view while tmux is in scroll/copy mode, the command is
lost as tmux doesn't receive it.

This feature allows users to:

  1. Submit text while in tmux scroll mode (text appears lost)
  2. Exit tmux scroll mode
  3. Swipe up in the text input field to retrieve the previously submitted text
  4. Re-submit the command successfully

Implementation

  • Up/down swipe gestures navigate through the last 20 text entries
  • History is session-based (not persisted across app restarts)
  • Preserves existing horizontal swipe behavior for ViewPager navigation
  • Includes comprehensive unit tests

This provides a safety net for the common workflow of using Termux with tmux/SSH sessions where scroll mode can
interfere with command submission.

Disclaimer

This is my first time working with the Termux codebase so I'm not sure if the architecture fits cleanly or if there's other aspects I should have reused rather than reimplement etc.

The change submitted here has been written with the assistance of Claude Code (AI) with code review and testing by me, however I don't code in Java regularly so certainly might have missed things.

I'm very open to feedback and making further changes if requested!

Implements command history functionality for the terminal toolbar text input view:
- Up/down swipe gestures navigate through previous text entries (20 entry limit)
- Preserves existing horizontal swipe behavior for ViewPager navigation
- History management with FIFO behavior and duplicate entry handling
- Comprehensive unit tests for history functionality
- Session-based history (does not persist across app restarts)
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