Stretch-to-fit Textareas – Now A Firefox Extension

Since it’s been turning out to be really quite useful, here’s a Firefox extension version of the Stretch-to-fit Textareas Greasemonkey user-script I wrote a few weeks back. In other words, Greasemonkey not required!

This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.


  1. Bart
    Posted September 4, 2006 at 07:34 | Permalink

    I tried this out with Firefox on Linux, and noted some problems.

    First, all text areas appear to start out twice as tall as the rows attribute value.

    Second, the text area only stretches when a carriage return is typed. If instead one types a single long “line” (allowing the text to wrap at the right margin) until the entire text area is eventually filled, the vertical scrollbar appears as usual.

    Third, possibly related to the first, when the textarea finally does stretch it becomes twice as tall as necessary.

  2. Posted September 4, 2006 at 10:08 | Permalink

    Bart — could you have both the Greasemonkey script and the extension active? I think that may have that effect…

  3. Bart
    Posted September 4, 2006 at 23:51 | Permalink

    No, I definitely don’t have the Greasemonkey script. I do have the “Save Text Area 0.4.4” extension, and several others including Web Developer.

    I’ll try re-installing stretch-to-fit and see if anything changes.

  4. Bart
    Posted September 5, 2006 at 00:22 | Permalink

    Nope, still doubles everything. I also tried logging in as a diferent user, one who had never run firefox before, and the extension misbehaved there, too.

    On closer examination, though, it’s not exactly that the text area doubles in size. A textarea with attribute rows=3 does start out 6 lines tall, and then as soon as a carriage return creates a line within three lines of the bottom the area stretches by 6 lines. Then you can input three more lines, and then it stretches by 6 again. I think … once it gets that much too tall it’s hard to tell exactly what’s happening.

  5. Posted September 5, 2006 at 14:08 | Permalink

    Very odd.

    It’s worth noting that the script will always add some “breathing room” — ie, if there’s a 12-line textarea and 12 lines of text is added, the textarea will be expanded to 17 lines — 12 lines plus 5 lines of “breathing room”. But it should do this every time you hit Enter, rather than in jumps of 6 lines. But could that be the issue?

    I do know about that issue with the single long line, need to fix that one ;)

    Finally, 40 lines is the maximum size it’ll expand a textarea to (just fyi).

    Can you point me at a URL that demos the double-rows issue?

  6. Bart
    Posted September 5, 2006 at 15:34 | Permalink

    Do you have a gmail account? (If you don’t, I have a whole lot of invites.) Activate the stretch plugin, click “Compose Mail” and then click the little page-over-page icon to open the editor in a new window. Now start typing. First time I tried it, the message body area rapidly ended up stretched way past the bottom of the window, and I’d have to guess it was more than 40 lines tall though I can’t be certain.

    For that matter, IIRC, this comment entry field on your blog does something similar.

  7. Posted September 5, 2006 at 17:02 | Permalink

    OK, something wierd’s going on on your end, alright. When I do that, it’s pretty consistently resizing to ( (length of body) + 5 lines) — the desired behaviour…

  8. Bart
    Posted September 7, 2006 at 04:33 | Permalink

    I have a bit more info for you … the problems with over-stretching are tied to having one or more very long lines with no carriage returns. The longer the line, and/or the more such long lines there are, the farther off the size of the stretching becomes. If I restrict myself to lines that never fill the width of the text area, it stretches as you described.