Completed
Last Updated: 21 Jan 2021 09:29 by ADMIN
Morten
Created on: 23 Oct 2020 12:18
Category: RichTextBox
Type: Bug Report
2
RichTextBox: SetPosition() sets the caret position on an earlier location in specific setup

Depending on the current layout of the document, invoking SetPosition() for a specific location might result in positioning the caret on the line prior to the expected one.

Steps to reproduce:

  • Create a document using the following code:

radRichTextBox.Insert("one: ");
radRichTextBox.Insert(Environment.NewLine);
radRichTextBox.Insert("two: ");
radRichTextBox.Insert(Environment.NewLine);
radRichTextBox.Insert("tree: ");
radRichTextBox.Insert(Environment.NewLine);
radRichTextBox.Insert("four: ");
radRichTextBox.Insert(Environment.NewLine);
radRichTextBox.Insert("five: ");
radRichTextBox.Insert(Environment.NewLine);
radRichTextBox.Insert("seks: ");
radRichTextBox.Insert(Environment.NewLine);
radRichTextBox.Insert("seven: ");
radRichTextBox.Insert(Environment.NewLine);
radRichTextBox.Insert("eitgh: ");
radRichTextBox.Insert(Environment.NewLine);
radRichTextBox.Insert("nine: ");
radRichTextBox.Insert(Environment.NewLine);
radRichTextBox.Insert("ten: ");

  • Place the caret at the end of the "nine: " line
  • Invoke SetPosition():

radRichTextBox.Document.CaretPosition.SetPosition(radRichTextBox.Document.CaretPosition.Location);
radRichTextBox.Focus();

Observed: The caret is positioned after "eitgh:"

Expected: The caret shouldn't change its position

0 comments