Selecting a whole line in a RichEdit control always includes line break

48 views
Skip to first unread message

Andreas Falkenhahn

unread,
Feb 21, 2021, 6:37:41 AM2/21/21
to wx-u...@googlegroups.com
When selecting a whole line of text in a RichEdit control and copying it to the clipboard, the line break character is always copied as well. Without wxTE_RICH the line break character isn't copied, though. There's also a clearly visible difference between wxTE_RICH and the default wxTextCtrl when selecting a complete line: With wxTE_RICH, the selection extends a little beyond the last character of the line, i.e. as if there was a space character after the last character in the line. Probably this is meant as an indicator for the line break character.

Is there any way to turn this off and make wxTE_RICH behave like the non-RichEdit control here? Or is this a RichEdit thing that can't be turned off?

To see what I mean, open the "widgets" sample, go to the "Text" page, click "rich edit", add a new line after "Hello, Universe!" so that the control contains two lines of text, then mark the line "Hello, Universe!" moving the mouse as far to the right as possible and hit Ctrl-C. Now paste the text and you'll see that it contains the line break as well even though just a single line was marked!

--
Best regards,
Andreas Falkenhahn mailto:and...@falkenhahn.com

Vadim Zeitlin

unread,
Feb 21, 2021, 7:48:06 AM2/21/21
to wx-u...@googlegroups.com
On Sun, 21 Feb 2021 12:38:10 +0100 Andreas Falkenhahn wrote:

AF> When selecting a whole line of text in a RichEdit control and copying
AF> it to the clipboard, the line break character is always copied as well.
AF> Without wxTE_RICH the line break character isn't copied, though.
AF> There's also a clearly visible difference between wxTE_RICH and the
AF> default wxTextCtrl when selecting a complete line: With wxTE_RICH, the
AF> selection extends a little beyond the last character of the line, i.e.
AF> as if there was a space character after the last character in the line.
AF> Probably this is meant as an indicator for the line break character.
AF>
AF> Is there any way to turn this off and make wxTE_RICH behave like the
AF> non-RichEdit control here? Or is this a RichEdit thing that can't be
AF> turned off?
AF>
AF> To see what I mean, open the "widgets" sample, go to the "Text" page,
AF> click "rich edit", add a new line after "Hello, Universe!" so that the
AF> control contains two lines of text, then mark the line "Hello,
AF> Universe!" moving the mouse as far to the right as possible and hit
AF> Ctrl-C. Now paste the text and you'll see that it contains the line
AF> break as well even though just a single line was marked!

This seems to be just how the native control behaves, e.g. I see the same
thing in the standard write.exe and I don't know of any way of changing
this.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Reply all
Reply to author
Forward
0 new messages