Resizing terminal clears selection #14815

Open
opened 2026-01-31 04:20:12 +00:00 by claunia · 4 comments
Owner

Originally created by @Don-Vito on GitHub (Aug 8, 2021).

Windows Terminal version (or Windows build number)

Dev - latest

Other Software

No response

Steps to reproduce

  1. Select text.
  2. Resize the terminal vertically
  3. Select text
  4. Resize terminal horizontally

Expected Behavior

  • After 2: the selection should be preserved (both block and non-block selection)
  • After 4: probably, non-block selection should remain adjusted to the new position of the selected text

Actual Behavior

Selection is cleared both after 2 and 4 (inside _doResizeUnderLock)

Originally created by @Don-Vito on GitHub (Aug 8, 2021). ### Windows Terminal version (or Windows build number) Dev - latest ### Other Software _No response_ ### Steps to reproduce 1. Select text. 2. Resize the terminal vertically 3. Select text 4. Resize terminal horizontally ### Expected Behavior - After 2: the selection should be preserved (both block and non-block selection) - After 4: probably, non-block selection should remain adjusted to the new position of the selected text ### Actual Behavior Selection is cleared both after 2 and 4 (inside _doResizeUnderLock)
Author
Owner

@zadjii-msft commented on GitHub (Aug 10, 2021):

Yea, I can be open to the idea of doing this again.

We reverted this at some point because we weren't doing it right in Terminal. See #1368 for some context there. I don't believe conhost ever persisted the selection on a resize, so I think that's why we were okay breaking it again.

@zadjii-msft commented on GitHub (Aug 10, 2021): Yea, I can be open to the idea of doing this again. We reverted this at some point because we weren't doing it right in Terminal. See #1368 for some context there. I don't believe conhost _ever_ persisted the selection on a resize, so I think that's why we were okay breaking it again.
Author
Owner

@Don-Vito commented on GitHub (Aug 15, 2021):

Yea, I can be open to the idea of doing this again.

We reverted this at some point because we weren't doing it right in Terminal. See #1368 for some context there. I don't believe conhost ever persisted the selection on a resize, so I think that's why we were okay breaking it again.

Oh.. I looked for it but didn't find it. BTW conhost does not clear selection upon vertical-only resize.

@Don-Vito commented on GitHub (Aug 15, 2021): > > > Yea, I can be open to the idea of doing this again. > > We reverted this at some point because we weren't doing it right in Terminal. See #1368 for some context there. I don't believe conhost _ever_ persisted the selection on a resize, so I think that's why we were okay breaking it again. Oh.. I looked for it but didn't find it. BTW conhost does not clear selection upon vertical-only resize.
Author
Owner

@sourabh112 commented on GitHub (Aug 21, 2021):

Can I take on this issue( If it is not too difficult for a newbie)?
As I'm quite new to this so I might also need some guidance on where should I start.

@sourabh112 commented on GitHub (Aug 21, 2021): Can I take on this issue( If it is not too difficult for a newbie)? As I'm quite new to this so I might also need some guidance on where should I start.
Author
Owner

@zadjii-msft commented on GitHub (Aug 21, 2021):

@sourabh112 You're welcome to try, but I'm guessing that this might be one of the harder issues. The trick is that the resize is handled by TextBuffer::Reflow, but the selection endpoints are stored totally elsewhere - in TerminalSelection and in SCREEN_INFORMATION. So somehow you'd need to pass those points in to Reflow to then track where they should be once the buffer's been resized. Not impossible, but probably not the best issue as a starter IMO. These issues might be better suited for a first issue.

@zadjii-msft commented on GitHub (Aug 21, 2021): @sourabh112 You're welcome to try, but I'm guessing that this might be one of the harder issues. The trick is that the resize is handled by `TextBuffer::Reflow`, but the selection endpoints are stored totally elsewhere - in `TerminalSelection` and in `SCREEN_INFORMATION`. So somehow you'd need to pass those points in to `Reflow` to then track where they should be once the buffer's been resized. Not impossible, but probably not the best issue as a starter IMO. [These issues might be better suited for a first issue](https://github.com/microsoft/terminal/issues?q=is%3Aopen+is%3Aissue+label%3A%22Easy+Starter%22).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14815