Skip to content

Fix text selection styling#677

Merged
dgageot merged 1 commit intodocker:mainfrom
Deepam02:fix-text-selection-styling
Nov 1, 2025
Merged

Fix text selection styling#677
dgageot merged 1 commit intodocker:mainfrom
Deepam02:fix-text-selection-styling

Conversation

@Deepam02
Copy link
Copy Markdown
Contributor

@Deepam02 Deepam02 commented Nov 1, 2025

Fixes #665

Replaced string manipulation logic to use ansi.Cut() which preserves ANSI escape codes (colors, formatting) in unselected text segments while applying selection styling only to the selected portion.

Signed-off-by: Deepam02 <116721751+Deepam02@users.noreply.github.com>
@Deepam02 Deepam02 requested a review from a team as a code owner November 1, 2025 13:29
@Deepam02
Copy link
Copy Markdown
Contributor Author

Deepam02 commented Nov 1, 2025

Screenshot of the fix
image

Copy link
Copy Markdown
Member

@rumpl rumpl left a comment

Choose a reason for hiding this comment

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

Amazing!

I started looking at this last night but I ended up with something that was 200 lines more complex and didn’t work.

Thanks!

@rumpl
Copy link
Copy Markdown
Member

rumpl commented Nov 1, 2025

Would it be possible to also keep the styling on the selected text? Not sure how good that will look though.

I’m curious to see how code selection looks like too

@Deepam02
Copy link
Copy Markdown
Contributor Author

Deepam02 commented Nov 1, 2025

I experimented with keeping the original styling visible when text is selected, but it didn’t work out cleanly. The problem is that when you layer a background color over existing ANSI color codes, it either wipes out the foreground colors or fails to apply properly.

@dgageot dgageot merged commit f29bc29 into docker:main Nov 1, 2025
5 checks passed
@Deepam02 Deepam02 deleted the fix-text-selection-styling branch November 29, 2025 07:05
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.

Text selection styling

3 participants