Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
510990c312 | ||
|
|
37be8e0f34 | ||
|
|
8dd80566d0 | ||
|
|
c6a7e15b03 |
+33
-29
@@ -25,40 +25,44 @@
|
|||||||
}
|
}
|
||||||
})(function (Xterm) {
|
})(function (Xterm) {
|
||||||
Xterm.prototype.proposeGeometry = function () {
|
Xterm.prototype.proposeGeometry = function () {
|
||||||
var container = this.rowContainer,
|
|
||||||
subjectRow = this.rowContainer.firstElementChild,
|
|
||||||
rows,
|
|
||||||
contentBuffer,
|
|
||||||
characterWidth,
|
|
||||||
cols;
|
|
||||||
|
|
||||||
subjectRow.style.display = 'inline';
|
|
||||||
|
|
||||||
contentBuffer = subjectRow.textContent;
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
var parentElementStyle = window.getComputedStyle(this.element.parentElement),
|
var parentElementStyle = window.getComputedStyle(this.element.parentElement),
|
||||||
parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')),
|
parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')),
|
||||||
|
parentElementWidth = parseInt(parentElementStyle.getPropertyValue('width')),
|
||||||
elementStyle = window.getComputedStyle(this.element),
|
elementStyle = window.getComputedStyle(this.element),
|
||||||
elementPadding = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')),
|
elementPaddingVer = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')),
|
||||||
availableHeight = parentElementHeight - elementPadding,
|
elementPaddingHor = parseInt(elementStyle.getPropertyValue('padding-right')) + parseInt(elementStyle.getPropertyValue('padding-left')),
|
||||||
rowHeight = this.rowContainer.firstElementChild.offsetHeight;
|
availableHeight = parentElementHeight - elementPaddingVer,
|
||||||
|
availableWidth = parentElementWidth - elementPaddingHor,
|
||||||
|
container = this.rowContainer,
|
||||||
|
subjectRow = this.rowContainer.firstElementChild,
|
||||||
|
contentBuffer = subjectRow.innerHTML,
|
||||||
|
characterHeight,
|
||||||
|
rows,
|
||||||
|
characterWidth,
|
||||||
|
cols,
|
||||||
|
geometry;
|
||||||
|
|
||||||
rows = parseInt(availableHeight / rowHeight);
|
subjectRow.style.display = 'inline';
|
||||||
|
subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace
|
||||||
var geometry = {
|
characterWidth = parseInt(subjectRow.offsetWidth);
|
||||||
'cols': cols,
|
subjectRow.style.display = ''; // Revert style before calculating height, since they differ.
|
||||||
'rows': rows
|
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};
|
||||||
return geometry;
|
return geometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm.js",
|
"name": "xterm.js",
|
||||||
"version": "0.24",
|
"version": "0.26",
|
||||||
"ignore": ["demo", "docs", "test", ".gitignore"]
|
"ignore": ["demo", "docs", "test", ".gitignore"]
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -51,9 +51,9 @@ copyright = u'2014, SourceLair Limited'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.24'
|
version = '0.26'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.24 Alpha'
|
release = '0.26 Alpha'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
|||||||
Reference in New Issue
Block a user