Reply to topic  [ 3 posts ] 
Selecting a Single Word 
Author Message

Joined: 2010-01-06 10:58:07
Posts: 39
Is anyone aware of a macro that will select the entire word by simply having the cursor placed somehwhere within that word?

This would make text editing a whole lot easier.


2011-07-07 09:04:58
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
If you double-click any bit of text, the selection will expand to include the whole word that was clicked.

However, if you'd like to use a macro, here's one:
Send Selector ‘selectWord:’

That uses a bit of magic (Cocoa's "selectWord:" selector), and I was hoping for a more reusable example, but strangely our macro language is missing a "rangeOfWordAtIndex" command, which would be the most straightforward.

Here's another macro that also selects the whole word. It uses regular expressions, which may or may not be clearer for you:
Find Previous '\b', 'E'
Find Next '\w+', 'E'

2011-07-07 09:24:02
Profile WWW

Joined: 2010-01-06 10:58:07
Posts: 39
Thanks Martin.

As usual you came through with just what I needed.

This tip will be used by me many thousands of time in the coming years!


2011-07-07 10:11:06
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software