From 3c3a646d423caad334b2086e76d2ccdf34f6d4f7 Mon Sep 17 00:00:00 2001 From: Michael Irwin Date: Tue, 14 Mar 2017 17:02:53 -0400 Subject: [PATCH] Fixed characterHeight calculation, which could cause overflowing The previous calculation was simply using the height of the letter W, but wasn't taking into account that each row has a lineHeight, which might be greater. If the lineHeight is .4px off, after many rows, it will cause the proposedGeometry to have an extra row, potentially causing hidden rows (based on layout). --- src/addons/fit/fit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/addons/fit/fit.js b/src/addons/fit/fit.js index 11fc6eb7..390cc0e9 100644 --- a/src/addons/fit/fit.js +++ b/src/addons/fit/fit.js @@ -56,7 +56,7 @@ subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace characterWidth = subjectRow.getBoundingClientRect().width; subjectRow.style.display = ''; // Revert style before calculating height, since they differ. - characterHeight = parseInt(subjectRow.offsetHeight); + characterHeight = parseFloat(term.rowContainer.style.lineHeight); subjectRow.innerHTML = contentBuffer; rows = parseInt(availableHeight / characterHeight);