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

Macro to Delete Unitl End of Sentence
https://www.nisus.com/forum/viewtopic.php?f=17&t=2609
Page 1 of 1

Author:  lawrencegoodman [ 2007-10-19 08:25:46 ]
Post subject:  Macro to Delete Unitl End of Sentence

Another macro request:
I need a macro that will deletete from the cursor to the end of the sentence (i.e. the period).

Any advice?

Thanks.

Author:  martin [ 2007-10-19 14:25:03 ]
Post subject: 

This should do what you're looking for:

Code:
$deleteStart = Selection Location
$deleteLen = 0

# find the end of the current sentence
Find '($|\.(?![0-9])|[!?]+)[ \t]*', "E"
$selStart = Selection Location
$selLen = Selection Length
Begin Perl
$deleteLen = $selStart - $deleteStart;
End

# Select the sentence and delete it
Set Selection $deleteStart, $deleteLen
Delete


We also have some other sentence navigation macros in our macro repository.

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