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

Delete text from RichTextArea in WPF #2007

Closed
onepiecefreak3 opened this issue Aug 3, 2021 · 0 comments
Closed

Delete text from RichTextArea in WPF #2007

onepiecefreak3 opened this issue Aug 3, 2021 · 0 comments
Labels
Milestone

Comments

@onepiecefreak3
Copy link
Contributor

Expected Behavior

When using RichTextArea.Buffer.Delete(new Range<int>(0,3)) I expect the first 3 characters in the RichTextArea to be deleted from its buffer.

Actual Behavior

No matter the validity of the range, the method throws an ArgumentNullException when the PresentationFramework seems to evaluate the inner _textData to set.

Steps to Reproduce the Problem

  1. Create a RichTextArea.
  2. Fill it with text.
  3. Try to delete a valid range of it by the Delete method on its Buffer.

Specifications

  • Version: 2.5.11, latest develop version
  • Platform(s): WPF (could be an issue on other platforms)
  • Operating System(s): Windows 10 64bit

Fix

PR #2006 fixes this issue by setting the Text property of the text range retrieved by the control handler to string.Empty instead of null. After some tests, this exudes the expected behaviour and doesn't seem to cause any side effects on the remaining text, regarding formatting or selection.

@cwensley cwensley added this to the 2.6.0 milestone Aug 3, 2021
@cwensley cwensley added the bug label Aug 3, 2021
@cwensley cwensley closed this as completed Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants