This is a migrated thread and some comments may be shown as answers.

Remove Trailing Space on Selection

3 Answers 84 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 01 Sep 2011, 10:07 PM
When a word is double-clicked, the Editor selects the word along with the space after it. It also selects the end of sentence punctuation if the word happens to be the last in the sentence.

How can I prevent this from happening? I just need the word itself selected.

Thanks-
Dave

3 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 07 Sep 2011, 12:05 PM
Hello Dave,

Unfortunately, it is not possible to achieve this behavior with the current version of the control without modifying the source of the control.
We will consider changing the current behavior when it comes to selecting the punctuation marks after the last word in a sentence. Will that be sufficient in your scenario? If not, could you give us some more details on why you would need to include only the word in the selection?

Regards,
Iva
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Dave
Top achievements
Rank 1
answered on 07 Sep 2011, 03:26 PM
A user double-clicks a word in the editor to select it.

I want to allow a user to underline (among other things) the highlighted text. So, by including the trailing punctuation (or the space at the end of the word) you end up underlining the space as well as the word.

If I could somehow truncate the space from the end of the selection text (just ending up with the text of the selected word) that would be great.

-Dave
0
Iva Toteva
Telerik team
answered on 13 Sep 2011, 01:34 PM
Hi Dave,

On double-clicking a word, the intervals after it are normally also selected. This is particularly convenient for clipboard commands and is what most text editors do in this case. We are not considering a change in the current behavior at this point and unfortunately, there is no workaround that you could use to achieve this behavior.
On the other hand, if you don't select the word, but just position the caret somewhere in it and trigger the ToggleUnderlineCommand, only the word will be underlined.
I hope this answers your question.

All the best,
Iva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Dave
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Dave
Top achievements
Rank 1
Share this question
or