Page 1 of 1

Select word with subsequent space by doubleclick

Posted: Sat Mar 01, 2014 6:15 pm
by Jim Knopf
In most text programs the subsequent space also is selected if a word is doubleclicked. Is there a solution for TRichViewEdit to imitate this behaviour?

Posted: Mon Mar 03, 2014 5:49 pm
by Sergey Tkachenko
It was made intentionally, because I think that copying a word is more useful than copying a word with following spaces.

Changing this behavior requires modifying TRichView source code.
Open CRVFData.pas, find the function TCustomRVFormattedData.FindWordAtR_, insert BEFORE the line:

Code: Select all

Word := RVU_Copy(Word, Offs, Len, ItemOptions);
the following code:

Code: Select all

        {$IFDEF RVSELECTWORDINCLUDESPACE}
        while (Offs+Len-1<RVU_Length(Word,ItemOptions)) and
          RVU_IsSpace(Word, Offs+Len, ItemOptions) do
            inc(Len);
        {$ENDIF}
And add RVSELECTWORDINCLUDESPACE in the list of compiler defines for your project.
This change will be included in the next update.

Posted: Wed Mar 05, 2014 5:29 pm
by Jim Knopf
Sergey Tkachenko wrote:It was made intentionally, because I think that copying a word is more useful than copying a word with following spaces.
It depends on the context. Usually I agree if you have to do something with this word. But during writing it is more comfortable including the spcae char to move the word to another place in the text.

Optimum would be to enable/disable this behavior via options. Will that be possible in the next version perhaps?

Thank you!

Posted: Wed Mar 05, 2014 7:04 pm
by Sergey Tkachenko
I do not think that such an option is necessary (to many options complicate components and applications).
If you think that selection with spaces is more appropriate, activate RVSELECTWORDINCLUDESPACE