Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gdamore
Copy link
Owner

@gdamore gdamore commented Dec 9, 2025

Summary by CodeRabbit

  • Breaking Changes

    • Removed mouse capability detection method from the Screen interface, which may require updates in code that relied on this check.
  • Bug Fixes

    • Corrected typo in terminal I/O module documentation.
  • Refactor

    • Restructured mouse feature handling in terminal screen implementation to improve code organization and maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

Mouse detection is fraught, and we recently changed it to always
return true.  Let's just remove it because it adds no value, and
our API is not stable yet.
The TTY driver does not guarantee a complete write, and the rawWrite
API (which we used over concerns about data transformation) throws if
the data is not fully written.  The "write" API is free from this flaw,
and if we only use strings, then the data is passed through unadulterated.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Walkthrough

The changes refactor mouse capability handling by removing the public hasMouse() method from the Screen interface, introducing internal terminal capability fields in the Vt struct to replace direct ANSI sequence literals, and correcting a documentation typo in termio.

Changes

Cohort / File(s) Summary
Mouse capability API removal
source/dcell/screen.d, source/dcell/ttyscreen.d
Removes hasMouse() method from Screen interface and its TtyScreen implementation. In TtyScreen, introduces five new terminal capability fields in the Vt struct: disableMouse, enableButtons, enableDrag, enableMotion, mouseSgr. Replaces direct ANSI sequence prints with references to these vt fields in mouse enable/disable logic.
Terminal I/O fixes
source/dcell/termio.d
Fixes typo in TtyImpl.close documentation ("ttye" → "tty"). Changes PosixTty.write implementation from file.rawWrite(s) to file.write(s).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify hasMouse() removal doesn't break upstream callers or introduce compile errors
  • Confirm all five new Vt fields are initialized correctly during TtyScreen construction and teardown
  • Validate that all replaced ANSI sequence literals map correctly to their corresponding vt field assignments
  • Ensure the write method change in PosixTty doesn't alter buffering or output behavior

Poem

🐰 The mouse has left the interface, hooray!
Vt fields now rule the terminal way,
Sequences dance in structured grace,
Typos fixed in every place—
Cleaner code in every trace! 🎯

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately reflects the two main changes: fixing partial writes (rawWrite to write in termio.d) and removing the hasMouse() API from the Screen interface.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gdamore/fix-partial-write

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

@gdamore gdamore changed the title Fix for partial writes Fix for partial writes, remove unuseful hasMouse API Dec 9, 2025
@gdamore gdamore merged commit 030b9d7 into main Dec 9, 2025
3 checks passed
@gdamore gdamore deleted the gdamore/fix-partial-write branch December 9, 2025 17:07
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