Skip to content

perf(tui): avoid redundant composer input wrapping per frame#3967

Open
reidliu41 wants to merge 1 commit into
Hmbown:mainfrom
reidliu41:perf/composer-wrap-cache
Open

perf(tui): avoid redundant composer input wrapping per frame#3967
reidliu41 wants to merge 1 commit into
Hmbown:mainfrom
reidliu41:perf/composer-wrap-cache

Conversation

@reidliu41

Copy link
Copy Markdown
Contributor

Summary

Fix performance issue where composer input text was being wrapped up to five times per render frame. The redundant wrapping occurred because layout_input_with_scroll and the selection rendering code each called their own wrap functions.

Fixes

Fixes #3909

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features
  • cargo test --workspace --all-features

Checklist

  • Updated docs or comments as needed
  • Added or updated tests where relevant
  • Verified TUI behavior manually if UI changes
  • Harvested/co-authored credit uses a GitHub numeric noreply address

@reidliu41 reidliu41 requested a review from Hmbown as a code owner July 3, 2026 09:18
@Hmbown

Hmbown commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Thanks @reidliu41. This is a good, focused perf slice and I would like to take it, but I want one small correctness/test follow-up first: please pin the empty-input behavior for wrap_input_lines_for_mouse("", width) and make sure the refactor does not change the empty composer/mouse-selection path.

The PR is clean and green, and it merged into the local scratch train with the other 0.8.67 PRs. If you can add that small guard quickly, this can still fit before I cut 0.8.67; otherwise I will route it to 0.8.68 rather than lose the work.

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.

perf(tui): composer input is re-wrapped up to five times per frame

2 participants