What you wanted was a bit different than what Smart Newlines was for, but 
it was easy enough to create a modified version. I only did a small amount 
of testing, but seemed OK.

(*
    Author: Kendall Conrad of Angelwatt.com
    Name: Smart Prefixed Newline
    Created: 2016-01-22
    Updated: 2016-01-22
    Description: Starts new line with the same line prefix as the current 
line and keeps the text
      from the current cursor position to the end of the line
*)
tell application "BBEdit" to tell front window
    activate
    set lineNum to startLine of selection
    set leng to length of line lineNum
    -- Find leading whitespace
    set theResult to find "(^[\\s]*)" options {search mode:grep} searching 
in line (lineNum)
    -- Set text to the white space found
    set white to ""
    if found of theResult then
        set white to found text of theResult
    end if
    set wleng to length of white
    
    -- Define a tab based on user settings
    set aTab to tab
    if expand tabs then
        set spaceTab to ""
        repeat tab width times
            set spaceTab to spaceTab & space
        end repeat
        set aTab to spaceTab
    end if
    
    -- Check for list style lines
    set theResult to find "^\\s*[\\*#>\\+\\-]+([\\w ]*)" options {search 
mode:grep} searching in (line lineNum)
    if found of theResult then
        set preFind to find "[\\*#>\\+\\-]+" options {search mode:grep} 
searching in (line lineNum)
        set _char to found text of preFind
        set selection to return & white & _char
        select insertion point after selection
        return
    end if
    
    -- Default: Insert a return plus the white space
    set selection to return & white
    select insertion point after selection
end tell


~aw




On Tuesday, January 19, 2016 at 8:58:34 AM UTC-5, Vlad Ghitulescu wrote:
>
> Hello! 
>
>
> While testing MailMate as an alternative to Apple's Mail.app I edit my 
> mails now in BBEdit. 
> That brings all the joy BBEdit makes :-)… and a question. 
>
> Replying to an email generates first text like this: 
>
> --- 
> > Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam 
> > nonumy eirmod 
> > tempor invidunt ut labore et dolore magna aliquyam erat, sed diam 
> --- 
>
> When I put the cursor let's say in the first line, between *(…) amet,* 
> and * consetetur (…)* and press ENTER, the cited text looks like this: 
>
> --- 
> > Lorem ipsum dolor sit amet, 
> consetetur sadipscing elitr, sed diam nonumy 
> > eirmod 
> > tempor invidunt ut labore et dolore magna aliquyam erat, sed diam 
> --- 
>
> instead of what I would like: 
>
> --- 
> > Lorem ipsum dolor sit amet, 
> > consetetur sadipscing elitr, sed diam nonumy 
> > eirmod 
> > tempor invidunt ut labore et dolore magna aliquyam erat, sed diam 
> --- 
>
> that is, the citation mark *> * is not continued. 
>
> I'm using already the Smart Newline - script 
> (http://www.angelwatt.com/words/2011/04/11/bbedit-smart-newline-open-line/), 
>
> but it doesn't do it's magic here. 
>
> Do you have an idea, how could I convince the citation mark to *jump* on 
> the next line when inserting something in the middle of a line? 
>
> Thanks! 
>
>
> Regards, 
> Vlad 
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to