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 the location that selecting a mark uses #17138

Merged
merged 2 commits into from May 1, 2024

Conversation

zadjii-msft
Copy link
Member

I think this subtly regressed in #16611. Jump to 90b8bb7#diff-f9112caf8cb75e7a48a7b84987724d754181227385fbfcc2cc09a879b1f97c12L171-L223

Terminal::SelectNewRegion is the only thing that uses the return value from Terminal::_ScrollToPoints. Before that PR, _ScrollToPoints was just a part of SelectNewRegion, and it moved the start & end coords by the _VisibleStartIndex, not the _scrollOffset.

Kinda weird there weren't any other tests for SelectNewRegion?

I also caught a second bug while I was here - If you had a line with an exact wrap, and tried to select that like with selectOutput, we'd explode.

Closes #17131

I think this subtly regressed in

`Terminal::SelectNewRegion` is the only thing that uses the return value from
`Terminal::_ScrollToPoints`. Before that PR, `_ScrollToPoints` was just a part
of `SelectNewRegion`, and it moved the start & end coords by the
`_VisibleStartIndex`, not the `_scrollOffset`.

Kinda weird there weren't any _other_ tests for `SelectNewRegion`?

I also caught a second bug while I was here - If you had a line with an exact
wrap, and tried to select that like with selectOutput, we'd explode.

Closes #17131
@@ -199,7 +199,7 @@ til::CoordType Terminal::_ScrollToPoints(const til::point coordStart, const til:
_NotifyScrollEvent();
}

return _scrollOffset;
return _VisibleStartIndex();
Copy link
Contributor

@tusharsnx tusharsnx Apr 26, 2024

Choose a reason for hiding this comment

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

Should we also update the comment? It currently reads:

// Return Value:
// - The updated scroll offset

BTW, as someone new to this repo I have a doubt: what's the mutable viewport? And how does it differ from the viewport that _scrollOffset represents?

Not the best place to ask questions, so I'm sorry 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

No worries! I probably didn't do the best job with that particular abstraction, and it bites even me to this day.

image

(I should commit that somehere)

Copy link
Member

Choose a reason for hiding this comment

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

PUT THIS IN THE REPO SOMEWHERE

@zadjii-msft zadjii-msft added this to the Terminal v1.21 milestone Apr 29, 2024
@zadjii-msft zadjii-msft added this pull request to the merge queue May 1, 2024
Merged via the queue into main with commit 77087e6 May 1, 2024
20 checks passed
@zadjii-msft zadjii-msft deleted the dev/migrie/b/17131-marks-selection branch May 1, 2024 15:51
lhecker added a commit that referenced this pull request May 1, 2024
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.

[1.21] Selecting commands, output with the context menu is totally in the wrong place
4 participants