On Nov 16, 2006, at 11:46 PM, Don Kalar wrote:
In my ideal world, Textmate would expand horizontally only as wide as the longest line of text when you clicked the zoom button.
You could do something like this as bundle command:
#!/bin/sh chars=`perl -ne '$m = length if length > $m; END{print $m}'` cat <<__EOF__ | osascript set fontscale to 6.25 set gutter to 54 set scrollbar to 16 set maxwidth to 1920 tell application "TextMate" set d to bounds of window 1 set l to item 1 of d set t to item 2 of d set r to l + (fontscale * $chars) + gutter + scrollbar if r > maxwidth then set r to maxwidth set b to item 4 of d set bounds of window 1 to {l, t, r, b} end tell __EOF__
Input: Document / Output: Discard.
It's not perfect but gets pretty close in the testing I just did. You'll have to figure out your own fontscale. To get close download FreeRuler [1]. Set your wrap column to 100 and make your right margin indicator visible in the TextMate prefs then just measure with FreeRuler and divide the pixel count by 100. Obviously adjust gutter and maxwidth as appropriate.
Though I can see how vertical only may also be useful, especially when writing text (e.g. LaTeX) instead of code.
Well I primarily use TextMate for Python and prefer lines no wider than 78 chars. In fact, people who code lines wider than that should be shot -- at least until TextMate's wrapping is improved. :-)
That reminds me of another nit ... when scrolling horizontally I'd much prefer if the gutter did not scroll out of the window frame.
j.