Completed
Last Updated: 22 May 2023 10:51 by ADMIN
Release LIB 2023.1.522 (22 May 2023)
Swapnil
Created on: 10 Mar 2023 10:18
Category: RichTextBox
Type: Bug Report
0
RichTextBox: Expanding the table selection with the keyboard leaves the caret behind the selection's edges

Expanding the table selection with the keyboard leaves the caret behind the selection's edges. After we pass the current cell content, the selection is automatically broadened over the next complete cell, but if we continue to press Shift+Arrow, it takes keystrokes = length of content in the cell + 1 to expand the selection to its next cell, though the selection highlights are already covering that cell.

There is a workaround: you will need to subscribe to the SelectionChanged event and use this code snippet for the event handler:

private void SelectionChanged(object sender, EventArgs e)
{
    var selection = this.radRichTextBox.Document.Selection;
    var caretPosition = this.radRichTextBox.Document.CaretPosition;

    if (selection.IsEmpty)
    {
        return;
    }

    if (selection.Ranges.Last.IsReversed)
    {
        caretPosition.MoveToPosition(selection.Ranges.First.StartPosition);
    }
    else
    {
        caretPosition.MoveToPosition(selection.Ranges.Last.EndPosition);
    }
}

Inside it, we move the caret to the selection's edges.

0 comments