-
Notifications
You must be signed in to change notification settings - Fork 157
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
Attempt to fix multiline prompt resize issue #841
Conversation
Thanks for taking this on. We've had prompt issues for a long time and a while back (incorrectly) disabled some of it. What I've learned since then is some terminals, when resized, leave it to the shell to redraw things. Ghostty is one of those shells. May be related or unrelated, just thought I'd share. I'm trying to figure how where/how to test this. Do we have an example with a multi-line prompt? |
No test case found for the resize handling. nu 0.98 Screen.Recording.2024-10-06.at.22.14.54.movnu 0.98 + fixed reedline Screen.Recording.2024-10-06.at.22.18.02.mov |
BTW, I tested it on both wezterm and alacrity. This PR probably won't fix all multiline prompt drawing issues at once, but the code I quoted above is obviously buggy, prompt_start_row will just increase over each resize op. So I think we'd better start from fixing this function. |
When I tested earlier, it seems ok on the left prompt, but the right prompt was still wrapping but not unwrapping. I'm fine with leaving that to another PR. |
You are right, the right prompt wrapping is not tackled at all. diff --git a/src/engine.rs b/src/engine.rs
index c5ae7d2..ee0d930 100644
--- a/src/engine.rs
+++ b/src/engine.rs
@@ -1197,6 +1197,7 @@ impl Reedline {
ReedlineEvent::OpenEditor => self.open_editor().map(|_| EventStatus::Handled),
ReedlineEvent::Resize(width, height) => {
self.painter.handle_resize(width, height);
+ self.repaint(prompt)?;
Ok(EventStatus::Inapplicable)
}
ReedlineEvent::Repaint => {
To me personally, the left prompt duplication is much more annoying because tmux new pane will trigger it. |
Maybe in another PR because I'm guessing there will be edge cases. |
Let's run with this to see how it goes this week. |
Tried to fix #809 in this PR.
The problem lies in the handle_resize function
reedline/src/painting/painter.rs
Lines 475 to 492 in 4634f71