Fixes #7056 - only resize textarea in params tab.

also, take into consideration the padding to prevent unneeded scrolling.
accepted, made the function more generic.