On Nov 24, 2021, at 03:21, jj <[email protected]> wrote:
> It only has effect once your text overflows the window because it takes 
> advantage of the fact that, when jumping around, BBEdit repositions the 
> current line at ± 25% of the window height.

On Nov 24, 2021, at 03:26, jj <[email protected]> wrote:
> BTW, you should also set BBEdit Preferences > Editing > 'Extra vertical space 
> ("overscroll") in text view' to 'Full Window'.


Hey Folks,

In the thread “Re: Typewriter mode possible?” JJ presents an AppleScript that 
adds a linefeed and repositions the working line toward the top of the document.

I repurposed it to scroll the currently selected text (or bare cursor position) 
toward the top of the document (the top 25%) and to retain the selection if 
there is one or the cursor position if not.

I've been wanting this for ages.

Thanks JJ!

I have some Keyboard Maestro macros that kludge repositioning the working line 
to the top, middle, and bottom of the document, but they are clunky.

I fervently wish BBEdit could do this natively.  The Z editor (a superset of 
Vi) on Windows could do this way back in the early 90's.  At the time I thought 
that was pretty slick but a little bit of overkill – I've since edited hundreds 
of thousands of lines of code and learned otherwise.


--
Best Regards,
Chris

--------------------------------------------------------
# Auth: Christopher Stone { Building upon work by Jean Jourdain }
# dCre: 2021/11/24 20:41
# dMod: 2021/11/24 20:41 
# Appl: BBEdit
# Task: Attempt to reposition the working line to the top 25% of the working 
document.
#     : Restores the cursor position or the selection if there is one.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Reposition, @Cursor, @Selection
--------------------------------------------------------

try
    
    tell application "BBEdit"
        tell first window
            set selectedText to its selection
            tell its first document
                select insertion point after its text
                select selectedText
            end tell
        end tell
    end tell
    
on error aMessage
    display alert aMessage
end try

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

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/E6A169E1-AD83-4B05-8CFE-D7B30F934633%40gmail.com.

Reply via email to