Skip to content

Fix crash with drag selecting and staging #4480

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Apr 13, 2025

Conversation

stefanhaller
Copy link
Collaborator

  • PR Description

Fix a crash in the staging view when clicking below the end of the diff, dragging upwards into the diff to select a range, and pressing space to stage.

Fixes #4479.

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

And reimplement using lo.Clamp instead of comparing manually.
…en staging the range

We need to clamp the range start index of a selection range in the same way as
we clamp the selection index.
@stefanhaller stefanhaller added bug Something isn't working blocks-release Must be addressed before we can cut the next release labels Apr 11, 2025
@stefanhaller
Copy link
Collaborator Author

@jesseduffield I labeled this as "blocks-release" because it's a crash bug, and I think we always want to fix those as quickly as we can.

I tried to add a regression test for this, but we don't have a way to click-and-drag in integration tests yet. I tried to add this, but couldn't immediately get it to work; I'm out of time now, but let me know if you want me to try harder.

Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 61636d81 80.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (61636d8) Report Missing Report Missing Report Missing
Head commit (825e5c2) 54394 47167 86.71%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4480) 5 4 80.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@jesseduffield jesseduffield merged commit d70a405 into master Apr 13, 2025
14 checks passed
@jesseduffield jesseduffield deleted the fix-crash-with-drag-selecting-and-staging branch April 13, 2025 08:25
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
blocks-release Must be addressed before we can cut the next release bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crash when drag selecting and then staging ranges
2 participants