nisus.com
https://www.nisus.com/forum/

Selecting a Single Word
https://www.nisus.com/forum/viewtopic.php?f=17&t=4383
Page 1 of 1

Author:  bjast [ 2011-07-07 09:04:58 ]
Post subject:  Selecting a Single Word

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.

Thanks

Author:  martin [ 2011-07-07 09:24:02 ]
Post subject:  Re: Selecting a Single Word

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:
Code:
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:
Code:
Find Previous '\b', 'E'
Find Next '\w+', 'E'

Author:  bjast [ 2011-07-07 10:11:06 ]
Post subject:  Re: Selecting a Single Word

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!

Bill

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/