Skip to content

fix(tui): filter terminal controls in editable filenames - #239

Merged
thisisgm merged 2 commits into
thisisgm:mainfrom
GreyforgeLabs:fix/tui-editor-terminal-controls
Oct 6, 2026
Merged

thisisgm merged 2 commits into
thisisgm:mainfrom
GreyforgeLabs:fix/tui-editor-terminal-controls

Conversation

@GreyforgeLabs

@GreyforgeLabs GreyforgeLabs commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Apply the normal TUI renderer's character-safety rule when painting the text editor. Filenames can contain terminal control sequences and bidirectional formatting characters; the normal rows filter them, but opening Rename previously wrote those characters directly into the terminal output buffer.

Filter only the rendered characters. Keep the original filename, byte offsets, selection and filesystem identity intact, so displaying a name cannot silently rename it or change what the operation targets.

Validation: both new regression tests fail before the fix and pass afterward. They cover control and bidi characters, Unicode, Rename selection, cursor movement and a narrow viewport, while checking that the filename and file contents are preserved. All 58 TUI tests pass in debug and release profiles. Flea's Clippy baseline gate and file-budget check pass.

The full Rust suite under TMPDIR=/var/tmp reports 1,140 passed and one failure in backend::undomanifest_tests::a_file_added_mid_copy_survives_inside_a_kept_directory. That exact failure reproduces on the unchanged upstream Rust tree. The initial /tmp run also encountered scratch-space quota failures; a representative test passes when moved to /var/tmp.

Summary by CodeRabbit

  • Bug Fixes
    • Terminal control characters in filename text are no longer displayed in the editor. The original filename and file contents remain unchanged, and stored values and cursor positions are preserved. Filtering applies both to existing path text and while selecting a name during renaming or moving the cursor.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 8817ff9c-0c10-42dd-b28e-65d5149f7d52

📥 Commits

Reviewing files that changed from the base of the PR and between de7afa7 and d869343.

📒 Files selected for processing (1)
  • src/tui/editor.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tui/editor.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The editor now skips characters rejected by render::safe when it renders the edited value. The stored value and byte offsets remain unchanged. Tests cover terminal-control filtering and preservation of the filename and file contents during rename interactions.

Changes

Editor rendering

Layer / File(s) Summary
Filter unsafe characters in editor rendering
src/tui/editor.rs
Editor::line skips unsafe characters in rendered output without changing the stored value or byte offsets. Tests cover filtering, selection, cursor movement, and preservation of the filename and file contents.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to d8693

Editable filenames filter unsafe characters while preserving the filename used for rename. No actionable merge-blocking risk was identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: filtering terminal control characters in editable filenames rendered by the TUI.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@thisisgm
thisisgm merged commit f478d0e into thisisgm:main Oct 6, 2026
1 check passed
thisisgm added a commit that referenced this pull request Oct 6, 2026
PRs #239, #240 and #236 with GM corrections and the #244 side-column watch, advloop APPROVED r6.
Natives on 416c9c18: colwatch, watch, click and picker exit 0; suite lists merged as a union.
@thisisgm

thisisgm commented Oct 6, 2026

Copy link
Copy Markdown
Owner

merged as authored; the TUI rename editor no longer paints terminal controls from a name (d869343, v0.3.8). Thanks @GreyforgeLabs! https://github.com/thisisgm/flea/releases/tag/v0.3.8

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