Skip to content

cmux-tui: avoid no-op deletion redraws - #10984

Merged
lawrencecchen merged 3 commits into
mainfrom
audit-tui-input-state-wave66
Aug 27, 2026
Merged

lawrencecchen merged 3 commits into
mainfrom
audit-tui-input-state-wave66

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

  • Return InputEvent::Changed only when deletion or clear changes TextInput state.
  • Add behavior coverage for empty-buffer no-op keys and real deletions.

Why:
TextInput previously reported Changed after boundary no-ops, causing unnecessary redraws and downstream mutation handling. Deletion primitives now return whether bytes were removed.

Verification:

  • rustfmt on changed file
  • git diff --check
  • No local Cargo tests/builds per cmux-tui instructions; hosted verification to follow.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes cmux-tui TextInput so no-op deletions no longer trigger redraws or downstream mutation handling. Previously, pressing backspace or delete at a boundary reported InputEvent::Changed; now it reports InputEvent::None when no text was removed.

  • Deletion and clear primitives now return whether bytes were removed, and callers map that to Changed or None.
  • Adds tests for no-op keys on an empty buffer and for real backspace and delete deletions.

Written for commit 91b73f6. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • Improved text deletion behavior so empty-input or boundary deletion commands no longer report a change when nothing was removed.
    • Backspace and Delete actions now accurately reflect whether text was successfully deleted, helping prevent unnecessary updates when editing.
  • Tests

    • Added coverage for successful deletions and no-op deletion commands to ensure consistent editing behavior.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 72e2e485-4300-4f45-b94e-3e7d37b1271c

📥 Commits

Reviewing files that changed from the base of the PR and between f943f03 and 91b73f6.

📒 Files selected for processing (1)
  • cmux-tui/crates/cmux-tui/src/ui/input.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Deletion helpers now report whether text was removed. Input handling returns Changed only for successful deletion commands and None for no-ops. Tests cover empty and populated input buffers.

Changes

Deletion outcome reporting

Layer / File(s) Summary
Boolean deletion helpers
cmux-tui/crates/cmux-tui/src/ui/input.rs
Deletion helpers return boolean results. Empty or reversed ranges return false; successful deletions update the buffer, cursor, and scroll state.
Deletion event handling and validation
cmux-tui/crates/cmux-tui/src/ui/input.rs
Backspace, Delete, word deletion, kill, clear, and control-key commands return Changed only when text is removed. Tests cover no-op and successful deletion behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 91b73

The change only suppresses redraw and mutation notifications when deletion keys do not remove text; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: preventing redraws caused by no-op deletion operations.
Description check ✅ Passed The description clearly explains what changed, why it changed, and how it was verified. It omits the template's Demo Video, Review Trigger, and Checklist sections, but the core information is complete…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. The diff from the merge base contains no .swift paths or Swift actor-isolation changes, so the custom che…
Cmux Swift Blocking Runtime ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. The diff introduces no production Swift changes and no Swift blocking or timing synchronization primitive.
Cmux Browser Automation Off-Main ✅ Passed PASS. The complete PR diff from origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs. It contains Rust text-input deletion logic and tests, with no browser.* commands, WebKit/AppKit a…
Cmux Expensive Synchronous Load ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. The diff adds no Swift code or agent-history loading, parsing, directory scanning, or interactive-path call…
Cmux Cache Substitution Correctness ✅ Passed PASS: The PR diff contains only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. It changes TextInput deletion methods and InputEvent handling, with no Swift, TypeScript, or JavaScript pro…
Cmux No Hacky Sleeps ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust source file. The diff introduces no sleeps, timers, polling, delays, or wall-clock waits. The custom check applie…
Cmux Algorithmic Complexity ✅ Passed PASS. The PR changes only cmux-tui/crates/cmux-tui/src/ui/input.rs. Production changes propagate a boolean from existing deletion operations and select InputEvent; they do not add collection scans…
Cmux Swift Concurrency ✅ Passed PASS: The pull-request range changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. The diff contains no Swift paths or Swift concurrency patterns. Therefore, it does not introduce or e…
Cmux Swift @Concurrent ✅ Passed PASS: The PR diff against origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. It contains no Swift changes or Swift concurrency call-site changes, so the @concurrent …
Cmux Swift Package Boundaries ✅ Passed PASS: The pull-request diff against origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. It contains no Swift, SwiftPM manifest, or Swift package-boundary changes. The c…
Cmux Swiftpm Lockfiles ✅ Passed The PR diff contains only cmux-tui/crates/cmux-tui/src/ui/input.rs. It does not change a SwiftPM package, Package.resolved, .gitignore, workflow, Xcode project, or dependency declaration. Theref…
Cmux Swift Logging ✅ Passed PASS: The PR changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, which is Rust. The diff contains no Swift files or added logging statements. Therefore the Swift logging rule is not applicable.
Cmux User-Facing Error Privacy ✅ Passed PASS. The PR changes only cmux-tui/crates/cmux-tui/src/ui/input.rs. Production code changes deletion and clear return values and maps them to InputEvent::Changed or InputEvent::None; it adds no …
Cmux Full Internationalization ✅ Passed PASS — The PR changes only Rust cmux-tui deletion behavior and adds Rust unit tests. It introduces no Swift UI text, app localization catalog changes, web UI/API/metadata copy, or locale data. The a…
Cmux Swiftui State Layout ✅ Passed PASS: The PR diff against origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust TUI file. It contains no Swift files or SwiftUI state/layout constructs. The SwiftUI state-layout …
Cmux Architecture Rethink ✅ Passed PASS. The PR diff changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. It updates deletion results to return InputEvent::Changed only when text is removed and adds unit tests. It in…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. The main...HEAD diff contains no Swift files and no auxiliary-window code. The Swift auxiliary-window clo…
Cmux Source Artifacts ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs. The diff contains hand-written Rust source and unit tests. No local output, generated artifact, scratch directory, cache…
Cmux No Test Or Debug Seam In Production Source ✅ Passed PASS: The PR diff against origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file outside any production **/Sources/** Swift path. No Swift production source changed, so the…
Cmux No Ambient Global State ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, which is Rust. The full PR-range diff contains no .swift files, so the production Swift ambient-global-state check is …
Full details: Description check

Explanation

The description clearly explains what changed, why it changed, and how it was verified. It omits the template's Demo Video, Review Trigger, and Checklist sections, but the core information is complete.

Full details: Cmux Swift Actor Isolation

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. The diff from the merge base contains no .swift paths or Swift actor-isolation changes, so the custom check is not applicable.

Full details: Cmux Browser Automation Off-Main

Explanation

PASS. The complete PR diff from origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs. It contains Rust text-input deletion logic and tests, with no browser.* commands, WebKit/AppKit access, socket-worker routing, or policy-test changes. Therefore the browser automation off-main failure conditions are not applicable.

Full details: Cmux Expensive Synchronous Load

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. The diff adds no Swift code or agent-history loading, parsing, directory scanning, or interactive-path calls. The custom check applies only to production Swift changes.

Full details: Cmux Cache Substitution Correctness

Explanation

PASS: The PR diff contains only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. It changes TextInput deletion methods and InputEvent handling, with no Swift, TypeScript, or JavaScript production changes and no cache substitution in a persistence, history, undo, or snapshot path.

Full details: Cmux No Hacky Sleeps

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust source file. The diff introduces no sleeps, timers, polling, delays, or wall-clock waits. The custom check applies only to TypeScript, JavaScript, shell, and non-Swift build/runtime scripts.

Full details: Cmux Algorithmic Complexity

Explanation

PASS. The PR changes only cmux-tui/crates/cmux-tui/src/ui/input.rs. Production changes propagate a boolean from existing deletion operations and select InputEvent; they do not add collection scans, sorting, filtering, joins, or batch rescans. Existing grapheme scans remain unchanged. The added loop iterates over nine fixed test keys, which the rule explicitly permits.

Full details: Cmux Swift Concurrency

Explanation

PASS: The pull-request range changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. The diff contains no Swift paths or Swift concurrency patterns. Therefore, it does not introduce or expand any legacy async pattern covered by this check.

Full details: Cmux Swift `@Concurrent`

Explanation

PASS: The PR diff against origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. It contains no Swift changes or Swift concurrency call-site changes, so the @concurrent check is not applicable.

Full details: Cmux Swift Package Boundaries

Explanation

PASS: The pull-request diff against origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. It contains no Swift, SwiftPM manifest, or Swift package-boundary changes. The custom check is therefore inapplicable.

Full details: Cmux Swiftpm Lockfiles

Explanation

The PR diff contains only cmux-tui/crates/cmux-tui/src/ui/input.rs. It does not change a SwiftPM package, Package.resolved, .gitignore, workflow, Xcode project, or dependency declaration. Therefore, no SwiftPM lockfile policy failure applies.

Full details: Cmux User-Facing Error Privacy

Explanation

PASS. The PR changes only cmux-tui/crates/cmux-tui/src/ui/input.rs. Production code changes deletion and clear return values and maps them to InputEvent::Changed or InputEvent::None; it adds no user-facing error, alert, command-output, recovery text, or diagnostic payload. The added string literals are test inputs ("" and "x"). Consumers use the event only to refresh or apply input filtering, so no prohibited implementation detail is exposed.

Full details: Cmux Full Internationalization

Explanation

PASS — The PR changes only Rust cmux-tui deletion behavior and adds Rust unit tests. It introduces no Swift UI text, app localization catalog changes, web UI/API/metadata copy, or locale data. The added test strings are covered by the rule's test exemption.

Full details: Cmux Swiftui State Layout

Explanation

PASS: The PR diff against origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust TUI file. It contains no Swift files or SwiftUI state/layout constructs. The SwiftUI state-layout check is therefore not applicable.

Full details: Cmux Architecture Rethink

Explanation

PASS. The PR diff changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. It updates deletion results to return InputEvent::Changed only when text is removed and adds unit tests. It introduces no Swift code, timing repair, polling, locks, observers, side channels, duplicate entrypoint wiring, or split Swift UI lifecycle ownership. The rule also allows small local correctness fixes with clear invariants.

Full details: Cmux Swift Auxiliary Window Close Shortcuts

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file. The main...HEAD diff contains no Swift files and no auxiliary-window code. The Swift auxiliary-window close-shortcut check is therefore not applicable.

Full details: Cmux Source Artifacts

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs. The diff contains hand-written Rust source and unit tests. No local output, generated artifact, scratch directory, cache, build output, or artifact-like path appears in the changed paths.

Full details: Cmux No Test Or Debug Seam In Production Source

Explanation

PASS: The PR diff against origin/main changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, a Rust file outside any production **/Sources/** Swift path. No Swift production source changed, so the custom check is not applicable.

Full details: Cmux No Ambient Global State

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui/src/ui/input.rs, which is Rust. The full PR-range diff contains no .swift files, so the production Swift ambient-global-state check is not applicable.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch audit-tui-input-state-wave66

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lawrencecchen
lawrencecchen merged commit e954360 into main Aug 27, 2026
41 checks passed
@lawrencecchen
lawrencecchen deleted the audit-tui-input-state-wave66 branch August 27, 2026 16:11
rustybret pushed a commit to rustybret/bmux that referenced this pull request Aug 27, 2026
3f6673f fix(tui): bound CDP outbound commands (manaflow-ai#10983)
e954360 cmux-tui: avoid no-op deletion redraws (manaflow-ai#10984)
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.

1 participant