anomalyco / anomalyco/opencode
TUI: typing large amounts of text into the chat input causes severe lag
@kommander is already working on this.
Since Sep 17, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Typing (or dictating) a large amount of text into the TUI chat input (the prompt box) makes the UI lag heavily and effectively stop responding as the buffer grows. Pasting large blobs is usually collapsed into a "[Pasted ~N lines]" summary, so this is most visible when typing or voice-dictating directly into the input.
Root cause found while profiling: mentionTriggerIndex runs on every keystroke (onContentChange → autocomplete onInput) and performs two full-buffer Intl.Segmenter passes per keystroke. Measured per-keystroke cost:
- 5 KB buffer: ~3.1 ms
- 20 KB: ~13 ms
- 100 KB: ~65 ms
The underlying opentui textarea is not the bottleneck (~0.2 ms/keystroke into a 20 KB buffer).
Waiting on PR #49634 which adds cheap raw-string gates so the display-aware scan only runs when an actual @ trigger needs resolving.
Plugins
None
OpenCode version
1.18.31
Steps to reproduce
- Open the opencode TUI
- Type or dictate a large amount of text into the chat input (tens of KB)
- Observe keystroke latency climbing as the buffer grows until the UI appears frozen
Expected behavior
Keystroke latency stays roughly constant regardless of how much text is in the input box.
Operating System
Linux
Terminal
Any
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.