Skip to content

Fix sticky tabs option#157543

Merged
alexdima merged 4 commits intomicrosoft:mainfrom
Timmmm:fix_sticky_tabs
Nov 18, 2022
Merged

Fix sticky tabs option#157543
alexdima merged 4 commits intomicrosoft:mainfrom
Timmmm:fix_sticky_tabs

Conversation

@Timmmm
Copy link
Contributor

@Timmmm Timmmm commented Aug 8, 2022

This fixes two issues:

  1. Occasionally the mouse hit test will find a gap between characters and request.target will be div.overflow-guard. This causes a different code path to be followed and the snapping code is not called. I fixed that by moving the snapping code to the outermost function so it is always called.
  2. request.mouseContentHorizontalOffset is a float but createMouseTargetFromHitTestPosition treats it as an int. I initially thought this was the cause of the broken sticky tabs. I don't think it actually was but it seems like a good idea to fix anyway.

I also slightly simplified the control flow in mouseContentHorizontalOffset.

Fixes #155299

Easiest way to test is to create a text file with a load of random spaces and hard tabs. Zoom VSCode in loads. Then make lots of clicks and selections with the mouse, and move the cursor around with the keyboard. Use multiple cursors etc. Make sure it all looks good. Make some mouse selections by dragging slowly, since there can be errors that only happen at a single pixel.

You guys don't do any GUI end to end testing as far as I can tell (fair enough; it's a right pain) so I think manual testing is the only option.

@Timmmm
Copy link
Contributor Author

Timmmm commented Aug 16, 2022

Do I have to do something to get a reviewer? What does it mean that it has been assigned to me?

This fixes two issues:

1. Occasionally the mouse hit test will find a gap between characters and `request.target` will be `div.overflow-guard`. This causes a different code path to be followed and the snapping code is not called. I fixed that by moving the snapping code to the outermost function so it is always called.
2. `request.mouseContentHorizontalOffset` is a float but `createMouseTargetFromHitTestPosition` treats it as an int. I initially thought this was the cause of the broken sticky tabs. I don't think it actually was but it seems like a good idea to fix anyway.

I also slightly simplified the control flow in `mouseContentHorizontalOffset`.

Fixes microsoft#155299
@hediet hediet added this to the October 2022 milestone Sep 27, 2022
@hediet hediet assigned hediet and unassigned Timmmm Sep 27, 2022
@alexdima alexdima self-assigned this Oct 24, 2022
@hediet hediet modified the milestones: October 2022, November 2022 Oct 25, 2022
@alexdima alexdima self-requested a review November 16, 2022 13:35
@alexdima alexdima merged commit fcb512b into microsoft:main Nov 18, 2022
@alexdima
Copy link
Member

Thank you!

@Timmmm
Copy link
Contributor Author

Timmmm commented Nov 18, 2022

Np, thanks for the review!

@github-actions github-actions bot locked and limited conversation to collaborators Jan 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stick tab stop mouse selection slightly broken

3 participants