On 30 May 2021, at 15:14, TJ Luoma wrote:
But then I often find that I want to adjust the width of the window so
that
it is _just_ wide enough to not need a horizontal scroll bar.
I don’t recall a scriptable way to relate line length to window width.
Different font sizes and non-monospaced fonts would make it complicated,
for one thing.
But if you were satisfied with *visual* rather than programmatic
determination of the right width, you could use a script that simply
enlarged the window width in steps each time it was called, eventually
cycling back to “original” size. With an assigned keyboard shortcut,
you would simply press the shortcut until the window has stepped up to
the width you want.
I use a script like that to widen tabs, to help in viewing tabular data
with wider “columns”.
Something like this, but there are others on this list who can surely
improve it:
##
tell application "BBEdit"
set thisWin to text window 1
set oldBounds to bounds of thisWin
--For help when setting your min and max widths,
--uncomment the next line to see the window width:
--display dialog item 3 of oldBounds
set minWidth to 800
set maxWidth to 1600
set increment to 100
set newBounds to oldBounds
set curWidth to item 3 of oldBounds
if curWidth ≥ maxWidth then
set item 3 of newBounds to minWidth
else
set item 3 of newBounds to (item 3 of oldBounds) + increment
end if
set bounds of thisWin to newBounds
end tell
##
Save that in your BBEdit Scripts folder, and assign it a keyboard
shortcut.
Thanks,
- Bruce
_bruce__van_allen__santa_cruz__ca
--
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/1C176CDE-2FC9-41FE-9EBF-298A10F6087C%40cruzio.com.