Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jonathanj
Copy link
Contributor

When pressing a mouse button on empty lines, or in the empty region at the bottom of the screen, the effect is the same as having clicked on the currently selected line. This is a bit of a jarring experience because it will often perform an unexpected action relative to where the mouse cursor actually is.

This PR changes mouse click events on invalid lines to be ignored, where invalid screens lines are:

  • Lines that are unselectable
  • Empty lines
  • Lines beyond the bounds of the screen

I added tests for selecting hunk lines and other things that I found were missing test coverage.

When pressing a mouse button on an invalid line the effect is the same
as having clicked on the currently selected line. This is a bit of a
jarring experience because it will often perform an unexpected action.

Invalid screens lines include:

- Lines that are unselectable
- Empty lines
- Lines beyond the bounds of the screen
Copy link
Owner

@altsem altsem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I'll merge it in and make a release πŸ₯³

ctx.update(&mut app, vec![mouse_event(0, 4, MouseButtons::LEFT)]);
insta::assert_snapshot!(ctx.redact_buffer());
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to move these things into src/tests/editor.rs at some point.

@codecov
Copy link

codecov bot commented Sep 28, 2025

Codecov Report

❌ Patch coverage is 99.14530% with 1 line in your changes missing coverage. Please review.
βœ… Project coverage is 86.62%. Comparing base (41b4381) to head (cbce0f0).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/app.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #425      +/-   ##
==========================================
+ Coverage   86.50%   86.62%   +0.12%     
==========================================
  Files          71       71              
  Lines        7319     7385      +66     
==========================================
+ Hits         6331     6397      +66     
  Misses        988      988              

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@altsem altsem merged commit a07e6be into altsem:master Sep 28, 2025
5 checks passed
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