From e01cdf1a8758c95d8e75ebd5b574feae0eecc1a2 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 30 Jun 2010 11:45:39 -0600 Subject: [PATCH] Fix compose textarea sizing in dimp --- imp/js/compose-dimp.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/imp/js/compose-dimp.js b/imp/js/compose-dimp.js index e0b9d65df..19a5e428d 100644 --- a/imp/js/compose-dimp.js +++ b/imp/js/compose-dimp.js @@ -693,10 +693,14 @@ var DimpCompose = { * row, and resize the textarea. */ rows = parseInt(mah / (msg.clientHeight / msg.readAttribute('rows')), 10); if (!isNaN(rows)) { - msg.writeAttribute({ rows: rows, disabled: false }); - if (de.scrollHeight - de.clientHeight) { - msg.writeAttribute('rows', rows - 1); - } + /* Due to the funky (broken) way some browsers (FF) count + * rows, we need to overshoot row estimate and increment + * downward until textarea size does not cause window + * scrolling. */ + ++rows; + do { + msg.writeAttribute({ rows: rows--, disabled: false }); + } while (de.scrollHeight - de.clientHeight); } } }, -- 2.11.0