From d9d99c1c27732b8ebb973b91ce958ebe5022a640 Mon Sep 17 00:00:00 2001 From: TDaglis Date: Tue, 3 Nov 2015 14:55:24 +0200 Subject: [PATCH] fixed width of fit removed firefox hack since it is no longer needed --- addons/fit/fit.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/addons/fit/fit.js b/addons/fit/fit.js index 3ad264b0..663a600b 100644 --- a/addons/fit/fit.js +++ b/addons/fit/fit.js @@ -20,7 +20,7 @@ } else { /* * Plain browser environment - */ + */ fit(this.Xterm); } })(function (Xterm) { @@ -44,22 +44,12 @@ subjectRow.style.display = 'inline'; subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace - characterWidth = parseInt(subjectRow.offsetWidth); + characterWidth = subjectRow.getBoundingClientRect().width; subjectRow.style.display = ''; // Revert style before calculating height, since they differ. characterHeight = parseInt(subjectRow.offsetHeight); subjectRow.innerHTML = contentBuffer; rows = parseInt(availableHeight / characterHeight); - /* - * The following hack takes place in order to get "fit" work properly - * in Mozilla Firefox. - * Most probably, because of a dimension calculation bug, Firefox - * calculates the width to be 1px less than it is actually drawn on - * screen. - */ - if (navigator.userAgent.match(/Firefox/)) { - characterWidth++; - } cols = parseInt(availableWidth / characterWidth); geometry = {cols: cols, rows: rows}; @@ -71,4 +61,4 @@ this.resize(geometry.cols, geometry.rows); }; -}); \ No newline at end of file +});