I found that many editors and browsers (html display and textarea) on
Windows include whitespace following words (or non-word characters)
for selections initiated by double-clicking and continued by mouse
dragging. This may be an advantage for drag & drop and copy & paste
operations, as there's no need to manually delete and reinsert blanks
after the moved / pasted text block.
Here's a simple patch to achieve this (I will send the full modified
file directly to Neil):
--- scintilla-cvs\src\Document.cxx Sun Jun 29 11:18:44 2008
+++ scintilla-mod\src\Document.cxx Wed Aug 20 20:36:30 2008
@@ -898,0 +899,4 @@
+ char ch = cb.CharAt(pos);
+ while (pos < (Length()) && WordCharClass(ch) == ccSpace) {
+ ch = cb.CharAt(++pos);
+ }
This results in the same behaviour as currently experienced when
expanding the selection using Ctrl+Shift+Right Arrow. If this is
uncommon on non-Windows platforms, maybe this could go in as a
Windows-specific change?
I haven't searched the mailing list to see if this issue has already
been discussed, or maybe even rejected. If so, please ignore this
post.
Greetings
--Florian
Maybe there should be a second set of word char's for the mouse double
clicks as well as the normal SCI_SETWORDCHARS and
SCI_SETWHITESPACECHARS?
I like the current double click behavior but can see why people might
want something different.
Paul Hutchinson
http://coderoar.com
> I found that many editors and browsers (html display and textarea) on
> Windows include whitespace following words (or non-word characters)
> for selections initiated by double-clicking and continued by mouse
> dragging. This may be an advantage for drag & drop and copy & paste
> operations, as there's no need to manually delete and reinsert blanks
> after the moved / pasted text block.
Source code and general text differ in that you generally want to
be more precise with source code and will more often be selecting
pieces of words and attached operators. Automatically selecting
following spaces may require that a spurious space be trimmed off at
the destination. For general text, the right behaviour was defined by
Apple: remember that word ends were selected and ensure that they
remain word ends at their destination.
http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGUserInput/chapter_12_section_5.html#//apple_ref/doc/uid/TP30000361-TPXREF36
I don't believe this is the best behaviour for a source code editor
although its possible that it could be an option.
A related behaviour that is less pleasant (for source code) is
automatically switching to word selection after swiping into a second
word as is done in Internet Explorer and some word processors.
Neil
People sometimes use Scintilla for things other than source editing
though so I would still be in favor of added a second set of word
char's for mouse selections. If you want I can put together the code
for this, if you would like.
Paul Hutchinson
> People sometimes use Scintilla for things other than source editing
> though so I would still be in favor of added a second set of word
> char's for mouse selections.
I can't see how changing the set of word characters for mouse
selection would produce the result Florian wants. Say you double click
on "cat" in "the cat sat": if you include space in the set of word
characters then the whole text would be selected, not just "cat ".
Neil