Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichTextBox.Text ignores newline #67

Open
v1km4n opened this issue Apr 2, 2023 · 1 comment
Open

RichTextBox.Text ignores newline #67

v1km4n opened this issue Apr 2, 2023 · 1 comment

Comments

@v1km4n
Copy link

v1km4n commented Apr 2, 2023

RichTextBox input looks like this:
image

RichTextBox.Text ignores newline and returns this:
image

Using TextRange(RichTextBox.Document.ContentStart, RichTextBox.Document.ContentStart).text (the usual method for extracting RichTextBox text) ignores all the emojis and returns this:
image
Which is understandable since TextRange probably doesn't support emoji at all

I wasn't able to find any workarounds, so please tell me if there is any, but as of now it just looks like newline is ignored completely

@Swindler95
Copy link

Hi,

I modified the class "TextSelection" to take into account the new lines :

case TextPointerContext.EmbeddedElement:
  var nextInsertionPosition = p.GetNextInsertionPosition(LogicalDirection.Forward);
  if (nextInsertionPosition != null && new TextRange(p, nextInsertionPosition).Text.Contains(Environment.NewLine))
    buf.AppendLine();
  break;

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

No branches or pull requests

2 participants