[PR #17120] Make UTextFromTextBuffer newline aware #31119

Open
opened 2026-01-31 09:45:15 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/17120

State: closed
Merged: Yes


This PR achieves two things:

  • When encountering rows with newlines (WasForceWrapped = false)
    we'll now copy the contents out of the row and append a \n.
    To make utext_clone cheap, it adds a reference counted buffer.
  • Text extraction in Terminal::GetHyperlinkAtBufferPosition
    was fixed by using a higher level TextBuffer::GetPlainText
    instead of iterating through each cell.

Closes #16676
Closes #17065

Validation Steps Performed

  • In pwsh execute the following:
    "`e[999C`e[22Dhttps://example.com/foo`nbar"
  • Hovering over the URL only underlines .../foo and not bar
  • The tooltip ends in .../foo and not .../fo
**Original Pull Request:** https://github.com/microsoft/terminal/pull/17120 **State:** closed **Merged:** Yes --- This PR achieves two things: * When encountering rows with newlines (`WasForceWrapped` = `false`) we'll now copy the contents out of the row and append a `\n`. To make `utext_clone` cheap, it adds a reference counted buffer. * Text extraction in `Terminal::GetHyperlinkAtBufferPosition` was fixed by using a higher level `TextBuffer::GetPlainText` instead of iterating through each cell. Closes #16676 Closes #17065 ## Validation Steps Performed * In pwsh execute the following: ``"`e[999C`e[22Dhttps://example.com/foo`nbar"`` * Hovering over the URL only underlines `.../foo` and not `bar` ✅ * The tooltip ends in `.../foo` and not `.../fo` ✅
claunia added the pull-request label 2026-01-31 09:45:15 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31119