[TxMt] Double-click word selection

Shawn Van Ittersum shawn at vantech.com
Mon Oct 31 21:56:58 UTC 2005


I'll second this request and include the solution I first offered to Allan on 9 August, so the user community can decide if it's on the right track:

> I figured out what TextMate is doing wrong with regard to 
> double-click word selection.  Now that I can see what it's doing, I 
> think the fix will be relatively easy and quick.
> 
> When the user double-clicks a character, TextMate selects the 
> character and expands the selection to get characters of the same 
> class (alnum, or everything else) on either side.  The problem is 
> that these two classes of characters are not enough, because the 
> "everything else" class does not differentiate between white-space 
> and other non-alnum characters, such as punctuation.  If the user 
> starts a double-click selection with a word, then TextMate treats any 
> punctuation on either sides of words as white-space, which makes it 
> impossible to select words and their prepended or trailing 
> punctuation using the double-click technique, without selecting 
> trailing white space and possibly more punctuation from the next word.
> 
> When determining the character class for double-click selection, 
> there should be three classes:
> 1. alpha-numeric (including the user-defined word characters from 
> Preferences)
> 2. white space
> 3. everything else (including punctuation not set as word characters)
> 
> This seems like a pretty simple change.  When you detect a 
> double-click and run the word selection routine, just check which 
> class the clicked character belongs to, then expand each side until a 
> character from one of the other classes is encountered.

Shawn

On Sun, 30 Oct 2005 22:55:00 -0600, Gerd Knops wrote:
> 
> On Oct 30, 2005, at 20:49, Allan Odgaard wrote:
> 
>> But the role-model for behavior when it comes to TextMate is 
>> NSTextView and OS X
> 
> OK, so PLEASE look at how it handles double-click-extend-selection 
> for non-word characters! Pretty please? Pretty, pretty, pretty please?
> 
> Gerd
> 
> 



More information about the textmate mailing list