On 01/15/2019, at 17:13, Venkat <gvenkata1...@gmail.com 
<mailto:gvenkata1...@gmail.com>> wrote:
> What I want to do is if my cursor is anywhere on the c+=1 line, I want to 
> place a breakpoint line directly above it using a quick keyboard shortcut to 
> a clipping, so as to get this:


Hey Venkat,

That's a little bit tricky but not overly difficult.

--
Best Regards,
Chris

----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2019/01/15 17:29
# dMod: 2019/01/15 18:30 
# Appl: BBEdit
# Task: Create Python Breakpoint at the Cursor.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Create, @Python, @Breakpoint, @Cursor
----------------------------------------------------------------

set textToInsert to "pdb.set_trace()" & linefeed
set insertTextLen to length of textToInsert

tell application "BBEdit"
    tell front text window
        
        set start_Line to startLine of selection
        set character_Offset to characterOffset of selection
        
        tell text of line start_Line
            set findRec to find "^\\h+" options {search mode:grep, case 
sensitive:false, starting at top:false}
            set cLineText to its contents
        end tell
        
        if found of findRec = true then
            set leadingSpacePad to found text of findRec
        else
            set leadingSpacePad to ""
        end if
        
        set contents of line start_Line to leadingSpacePad & textToInsert & 
cLineText
        select insertion point after character (character_Offset + (length of 
leadingSpacePad) + (length of textToInsert) - 1)
        
    end tell
end tell

----------------------------------------------------------------

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <https://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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to