-
Notifications
You must be signed in to change notification settings - Fork 132
feat: revert to using Crossterm as backend (fixes rendering/input bugs) #423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f1cf63b to
f9105cf
Compare
|
@jonathanj I did some progress, it appears to run great!
The tests are broken though D: |
|
That all sounds really positive. I'm happy to contribute fixes for the mouse tests. The 1-indexed lines are annoying in the implementation, but when looking at the snapshot it's really convenient that the snapshot lines are the exact value for the mouse position. I was thinking that maybe the Should make it a bit more robust. |
|
I see you already modified the Anyway, with this diff the test suite passes again! diff --git a/src/tests/helpers/ui.rs b/src/tests/helpers/ui.rs
index 4a75008..76dc5cd 100644
--- a/src/tests/helpers/ui.rs
+++ b/src/tests/helpers/ui.rs
@@ -136,7 +136,7 @@ pub fn mouse_event(x: u16, y: u16, mouse_button: MouseButton) -> Event {
Event::Mouse(crossterm::event::MouseEvent {
kind: crossterm::event::MouseEventKind::Down(mouse_button),
column: x,
- row: y,
+ row: y.saturating_sub(1),
modifiers: KeyModifiers::NONE,
})
} |
|
ah, I was looking at the x-value "It is zero, so it must be 0-indexed". 🤦 Thanks! |
f3fd4e7 to
01b1e72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR reverts the terminal backend from termwiz to crossterm, migrating input handling, event processing, and mouse operations to use crossterm's API instead. This represents a significant architectural change to restore crossterm as the primary terminal library.
- Migration from termwiz to crossterm event handling and input processing
- Replacement of custom prompt implementation with tui-prompts library
- Updated mouse event handling and scroll wheel support
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ui.rs | Imports tui-prompts library and updates cursor position access |
| src/tests/mod.rs | Replaces termwiz mouse types with crossterm equivalents in tests |
| src/tests/helpers/ui.rs | Migrates test helpers from termwiz to crossterm event types |
| src/term.rs | Complete rewrite of terminal backend to use crossterm instead of termwiz |
| src/prompt.rs | Removes custom prompt implementation in favor of tui-prompts |
| src/main.rs | Adds panic handler and restructures terminal initialization |
| src/lib.rs | Updates event handling imports and structures |
| src/key_parser.rs | Migrates key parsing from termwiz to crossterm types |
| src/error.rs | Removes termwiz error handling |
| src/bindings.rs | Updates key binding types for crossterm |
| src/app.rs | Major refactor of event handling and input processing |
| Cargo.toml | Adds crossterm and tui-prompts dependencies, removes termwiz |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #423 +/- ##
==========================================
+ Coverage 86.62% 87.75% +1.13%
==========================================
Files 71 71
Lines 7385 7188 -197
==========================================
- Hits 6397 6308 -89
+ Misses 988 880 -108 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
01b1e72 to
a7d7f82
Compare
Started a bit on going back to using crossterm. I reverted the commits, but might've missed a bunch of stuff. it's not compiling yet. All of this could be squashed to a single commit I think. It's in a messy state.