Skip to content

feat: add text selection across multiple text views (MVP)#15

Draft
Tnixc wants to merge 3 commits into
llsc12:mainfrom
Tnixc:feat/multi-text-select
Draft

feat: add text selection across multiple text views (MVP)#15
Tnixc wants to merge 3 commits into
llsc12:mainfrom
Tnixc:feat/multi-text-select

Conversation

@Tnixc
Copy link
Copy Markdown
Contributor

@Tnixc Tnixc commented Feb 2, 2026

Screen.Recording.2026-02-01.at.20.52.18.mov

theres a tiny bug regarding the lines when selecting wildly. otherwise very usable.

Copilot AI review requested due to automatic review settings February 2, 2026 01:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds cross-block text selection functionality for markdown text on macOS, allowing users to select text across multiple markdown blocks in a single selection. This is an MVP (Minimum Viable Product) implementation that improves the user experience when copying text from messages.

Changes:

  • Added new SelectableMarkdownText component that combines multiple markdown blocks into a single selectable NSTextView
  • Modified MarkdownText to conditionally use the new selection mode via an environment value on macOS
  • Enabled cross-block text selection in MessageBody by default for message content

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
SelectableMarkdownText.swift New component implementing multi-block text selection using NSTextView with custom clipboard handling for Discord markdown
MarkdownText.swift Added environment key and conditional rendering to support cross-block selection mode on macOS
MessageBody.swift Enabled the cross-block text selection feature for message content

Copy link
Copy Markdown
Owner

@llsc12 llsc12 left a comment

Choose a reason for hiding this comment

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

These changes make MarkdownText ignore block elements, meaning things like codeblocks, lists and more do not show up anymore.

@llsc12
Copy link
Copy Markdown
Owner

llsc12 commented Feb 3, 2026

For now, it might be best to look into this later since it seems a lot more difficult to tackle than anticipated. Tagging as help needed.

@llsc12 llsc12 added the help wanted Extra attention is needed label Feb 3, 2026
@Tnixc
Copy link
Copy Markdown
Contributor Author

Tnixc commented Feb 3, 2026

yes help wanted indeed.

i built a small prototype with NSAttributedString with code blocks.

Since HighlightSwift already has an option to return NSattributed text, this is fine. Lists shouldn't be too hard, looks like NSAttributedString has built-in styling for it

the problem is with the codeblock styling, I have to create a custom model with ObservableObject to read the rects of the code and return/update where to draw the background and to put the copy button (feels more complicated than it has to be)

This is probably not inexpensive but I think it's possible to get away with it if we only do it for the content onscreen. If this really tanks performance i hope we could have a toggle (which shouldn't be hard since none of this will be on iOS anyway?)

And for custom emojis I think I can use NSTextAttachment.

I think with how this is going there is no chance of cross message select, which is unfortunate

@Tnixc Tnixc marked this pull request as draft February 3, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants