Skip to content

Fix the location that selecting a mark uses#17138

Merged
zadjii-msft merged 2 commits intomainfrom
dev/migrie/b/17131-marks-selection
May 1, 2024
Merged

Fix the location that selecting a mark uses#17138
zadjii-msft merged 2 commits intomainfrom
dev/migrie/b/17131-marks-selection

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
}

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
@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