Reply to topic  [ 3 posts ] 
Selecting Next Sentence Backwards? 
Author Message

Joined: 2010-01-06 10:58:07
Posts: 39
In the case of following sentences:

"Now is the time for this work. Now is the time for this work. Now is the time for this work. Now is the time for this work."

Using the Select Sentence macro with the cursor in front of the first "Now", the entire next sentence is selected.

Moving the cursor between the end of the first sentence and the word "Now" of the second sentence, the macro selects both the first and the second sentences.

Moving he cursor between the end of the second sentence, and the word "Now" of the third sentence, the macro selects the second sentence instead of the third sentences.

Am I missing something, or is this macro buggy?


2010-01-31 08:33:06
Profile

Joined: 2008-05-17 04:02:32
Posts: 400
In NWP 1.3 and later, you’d better use the menu command :Edit:Select:Select Sentence (which takes account of abbreviations) to select the current or the next sentence. As to selecting the previous sentence, something like this will do the job.
Code:
$selSentence = ':Edit:Select:Select Sentence'
$sel = TextSelection.active
Menu $selSentence
Select Start
if Find Previous '\S+', 'E-W'
   Menu $selSentence
else  # restore the selection
   TextSelection.setActiveRange $sel
end


Last edited by Kino on 2010-02-01 20:02:51, edited 1 time in total.



2010-01-31 20:28:02
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Kino's suggestions are good ones, the menu Edit > Select > Select Sentence should behave much more reliably. His macro is also better than our old macro; I'll see about updating our macro repository to take advantage of the new menu.


2010-02-01 14:59:02
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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