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 crash in goto_window_center at EOF #5987

Merged

Conversation

pascalkuthe
Copy link
Member

Fixes #5965

Reverts a small change from #5892 that caused crashes at the EOF.
std::cmp::clamp crashes when max < min which was the case at the EOF.
By using max(..).min(..) directly we ensure that the min always takes predence and avoid the crash.

In the other place where min/max was replaced with clamp in #5892 it is impossible for max < min to occur
and therefore didn't need to be reverted.

@pascalkuthe pascalkuthe added C-bug Category: This is a bug E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer. labels Feb 14, 2023
@the-mikedavis the-mikedavis changed the title fix crash in goto_window_center at EOF Fix crash in goto_window_center at EOF Feb 14, 2023
@the-mikedavis the-mikedavis merged commit 715c4b2 into helix-editor:master Feb 14, 2023
@pascalkuthe pascalkuthe deleted the goto_window_center_crash branch February 14, 2023 19:02
wes-adams pushed a commit to wes-adams/helix that referenced this pull request Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helix panics on goto_window_center when lines fill less than half the screen
2 participants