Here's what I use. I put it in my Scripts menu folder. It operates on the 
current selection or, if there isn't one, the entire file.

(Note that you may have to do some editing on the linefeeds to get this to 
compile.)

Enjoy.

-Mike

=====================

tell application "BBEdit"
    (*
        If nothing is selected, select everything and record the current
        insertion point for later restoration.
    *)
    set selectedText to selection of text window 1 as string
    if selectedText is "" then
        set selPoint to characterOffset of selection of text window 1
        select contents of text window 1
    end if
    
    replace "[ \\t]+\\r" using "\\r" searching in selection of text window 1 
options {search mode:grep, starting at top:true, wrap around:false, 
backwards:false, case sensitive:false, match words:false, extend 
selection:false}
    
    (*
        If nothing was selected, restore the insertion point to its
        original position.
    *)
    if (selectedText is "") then
        select insertion point before character selPoint of window 1
    end if
end tell

=====================


--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to