Skip to content
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

Fix order of mode restoration #136

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

martindisch
Copy link
Contributor

@martindisch martindisch commented Mar 27, 2024

While using Jujutsu on Windows 10/11 in PowerShell, I discovered a bug that's very easy to fix. Whenever I enter the pager (for example with jj log) for the second time in a row, it fails to properly repaint. That's because the order of operations in term::cleanup is not exactly the inverse of term::setup. The problem is that the EnableMouseCapture command in crossterm stores the current mode and DisableMouseCapture restores it, so in effect it used to restore raw mode (which was enabled before enabling mouse capture) during cleanup after having disabled it.

I only observed this behavior in PowerShell so far, not cmd.exe. Maybe only PowerShell respects these accidentally mixed up mode settings between invocations while cmd.exe restores the original mode somehow.

@AMythicDev
Copy link
Owner

AMythicDev commented Mar 27, 2024

It most likely is a Windows-specific problem since I never came across this in all the Linux terminals that I tested minus on. Anyways Merging this. I will drop a patch release for this later this week.

@AMythicDev AMythicDev merged commit 53a3fa8 into AMythicDev:main Mar 27, 2024
6 checks passed
@martindisch martindisch deleted the fix-mode-restoration branch March 28, 2024 09:47
@martindisch
Copy link
Contributor Author

Thank you for the quick turnaround, much appreciated.

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