refactor: Modularize pty.rs for better maintainability #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Complete refactoring of monolithic code files into organized, maintainable modules for better code organization and faster development.
Changes
1. PTY Module Refactoring (pty.rs → pty/ directory)
Broke down the 1139-line monolithic pty.rs into 7 focused modules:
pty/client.rspty/socket.rspty/terminal.rspty/io_handler.rspty/session_switcher.rspty/spawn.rspty/mod.rs2. Main Handler Refactoring (main.rs → handlers/ directory)
Extracted all business logic from 621-line main.rs into organized handler modules:
main.rshandlers/session.rshandlers/info.rshandlers/mod.rsImpact
Before
pty.rs(1139 lines),main.rs(621 lines)After
Benefits
✅ Better Code Organization - Related functionality grouped together
✅ Improved Maintainability - Easy to locate and modify specific features
✅ Faster Compilation - Better incremental compilation with smaller modules
✅ Enhanced Testability - Components can be tested in isolation
✅ Reduced Complexity - Each module has a single, clear responsibility
✅ Easier Onboarding - New developers can understand the codebase faster
Testing
Migration Notes
Future Improvements
spawn.rs(865 lines) into smaller modules