mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Fix #9
- Calculate character width by using the cursor instead of custom hack in fit addon - Increment character width by 1 in Firefox, since it seems to have a bug in calculating width of specific elements
This commit is contained in:
+14
-14
@@ -27,23 +27,25 @@
|
||||
Xterm.prototype.proposeGeometry = function () {
|
||||
var container = this.rowContainer,
|
||||
subjectRow = this.rowContainer.firstElementChild,
|
||||
cursor = this.element.querySelector('.terminal-cursor'),
|
||||
rows,
|
||||
contentBuffer,
|
||||
characterWidth,
|
||||
cols;
|
||||
|
||||
subjectRow.style.display = 'inline';
|
||||
characterWidth = Math.ceil(cursor.offsetWidth);
|
||||
|
||||
/*
|
||||
* 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(/Gecko/)) {
|
||||
characterWidth++;
|
||||
}
|
||||
|
||||
contentBuffer = subjectRow.innerHTML;
|
||||
|
||||
subjectRow.innerHTML = ' '; /* Arbitrary character to calculate its dimensions */
|
||||
characterWidth = parseInt(subjectRow.offsetWidth);
|
||||
characterHeight = parseInt(subjectRow.offsetHeight);
|
||||
|
||||
subjectRow.style.display = '';
|
||||
|
||||
cols = container.offsetWidth / characterWidth;
|
||||
cols = parseInt(cols);
|
||||
cols = parseInt(container.offsetWidth / characterWidth);
|
||||
|
||||
var parentElementStyle = window.getComputedStyle(this.element.parentElement),
|
||||
parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')),
|
||||
@@ -54,8 +56,6 @@
|
||||
|
||||
rows = parseInt(availableHeight / rowHeight);
|
||||
|
||||
subjectRow.innerHTML = contentBuffer; /* Replace original content */
|
||||
|
||||
var geometry = {
|
||||
'cols': cols,
|
||||
'rows': rows
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "xterm.js",
|
||||
"version": "0.25",
|
||||
"version": "0.26",
|
||||
"ignore": ["demo", "docs", "test", ".gitignore"]
|
||||
}
|
||||
|
||||
+2
-2
@@ -51,9 +51,9 @@ copyright = u'2014, SourceLair Limited'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.25'
|
||||
version = '0.26'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.25 Alpha'
|
||||
release = '0.26 Alpha'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
Reference in New Issue
Block a user