Compare commits

...
10 Commits
Author SHA1 Message Date
paris bc67c788d2 Bump version to 0.17 2014-09-10 11:09:59 +00:00
paris 3f455f90d9 Fix #4 2014-09-10 11:09:23 +00:00
paris ede9ee416a Bump version to 0.16 2014-08-29 09:58:27 +00:00
paris 53f5672524 Fix #3 2014-08-29 09:57:53 +00:00
paris 9d00eec6c4 Fix #2 2014-08-27 09:50:09 +00:00
paris 3b1f1ddb2d Bump version to 0.15 2014-08-19 13:25:27 +00:00
paris a249d2714f Fix terminal fitting height 2014-08-19 13:24:43 +00:00
Paris Kasidiaris 3d40dcf3c5 Update company name 2014-08-18 11:00:49 +03:00
paris d07f61314b Bump version to 0.14 2014-08-16 03:53:52 +00:00
paris 7355a04274 Further fixing of xterm.fit 2014-08-16 03:53:22 +00:00
8 changed files with 4668 additions and 4605 deletions
+1 -1
View File
@@ -17,5 +17,5 @@ all code is your original work.
## License ## License
Copyright (c) 2014, sourceLair, Limited (www.sourcelair.com) (MIT License) Copyright (c) 2014, SourceLair, Limited (www.sourcelair.com) (MIT License)
Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
+17 -2
View File
@@ -5,7 +5,21 @@
* The bidirectional argument indicates, whether the terminal should * The bidirectional argument indicates, whether the terminal should
* send data to the socket as well and is true, by default. * send data to the socket as well and is true, by default.
*/ */
Terminal.prototype.attach = function (socket, bidirectional) {
(function (attach) {
if (typeof define == 'function') {
/*
* Require.js is available
*/
define(['../../src/xterm'], attach);
} else {
/*
* Plain browser environment
*/
attach(this.Xterm);
}
})(function (Xterm) {
Xterm.prototype.attach = function (socket, bidirectional) {
var term = this; var term = this;
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional; bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
@@ -20,4 +34,5 @@ Terminal.prototype.attach = function (socket, bidirectional) {
socket.send(data); socket.send(data);
}); });
} }
} };
});
+33 -3
View File
@@ -11,19 +11,49 @@
* terminal row and truncate its width with the current number * terminal row and truncate its width with the current number
* of columns) * of columns)
*/ */
Terminal.prototype.fit = function () { (function (fit) {
if (typeof define == 'function') {
/*
* Require.js is available
*/
define(['../../src/xterm'], fit);
} else {
/*
* Plain browser environment
*/
fit(this.Xterm);
}
})(function (Xterm) {
Xterm.prototype.fit = function () {
var container = this.rowContainer, var container = this.rowContainer,
subjectRow = this.rowContainer.firstElementChild, subjectRow = this.rowContainer.firstElementChild,
rows = parseInt(container.offsetHeight / subjectRow.offsetHeight), rows,
contentBuffer,
characterWidth, characterWidth,
cols; cols;
subjectRow.style.display = 'inline'; subjectRow.style.display = 'inline';
characterWidth = parseInt(subjectRow.offsetWidth / this.cols);
contentBuffer = subjectRow.textContent;
subjectRow.innerHTML = ' '; /* Arbitrary character to calculate its dimensions */
characterWidth = parseInt(subjectRow.offsetWidth);
characterHeight = parseInt(subjectRow.offsetHeight);
subjectRow.style.display = ''; subjectRow.style.display = '';
cols = container.offsetWidth / characterWidth; cols = container.offsetWidth / characterWidth;
cols = parseInt(cols); cols = parseInt(cols);
var parentElementStyle = window.getComputedStyle(this.element.parentElement),
parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')),
elementStyle = window.getComputedStyle(this.element),
elementPadding = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')),
availableHeight = parentElementHeight - elementPadding,
rowHeight = this.rowContainer.firstElementChild.offsetHeight;
rows = parseInt(availableHeight / rowHeight);
this.resize(cols, rows); this.resize(cols, rows);
}; };
});
+16 -2
View File
@@ -10,7 +10,20 @@
* If the `fullscreen` argument has not been supplied, the * If the `fullscreen` argument has not been supplied, the
* fullscreen mode is being toggled. * fullscreen mode is being toggled.
*/ */
Terminal.prototype.toggleFullscreen = function (fullscreen) { (function (fullscreen) {
if (typeof define == 'function') {
/*
* Require.js is available
*/
define(['../../src/xterm'], fullscreen);
} else {
/*
* Plain browser environment
*/
fullscreen(this.Xterm);
}
})(function (Xterm) {
Xterm.prototype.toggleFullscreen = function (fullscreen) {
var fn; var fn;
if (typeof fullscreen == 'undefined') { if (typeof fullscreen == 'undefined') {
@@ -22,4 +35,5 @@ Terminal.prototype.toggleFullscreen = function (fullscreen) {
} }
this.element.classList[fn]('fullscreen'); this.element.classList[fn]('fullscreen');
} };
});
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"name": "xterm.js", "name": "xterm.js",
"version": "0.13", "version": "0.17",
"ignore": ["demo", "docs", "test", ".gitignore"] "ignore": ["demo", "docs", "test", ".gitignore"]
} }
+1 -1
View File
@@ -3,7 +3,7 @@
<head> <head>
<title>xterm.js demo</title> <title>xterm.js demo</title>
<link rel="stylesheet" href="../src/xterm.css" /> <link rel="stylesheet" href="../src/xterm.css" />
<link rel="stylesheet" href="../addon/fullscreen/fullscreen.css" /> <link rel="stylesheet" href="../addons/fullscreen/fullscreen.css" />
<link rel="stylesheet" href="style.css" /> <link rel="stylesheet" href="style.css" />
<script src="../src/xterm.js" ></script> <script src="../src/xterm.js" ></script>
<script src="../addons/fit/fit.js" ></script> <script src="../addons/fit/fit.js" ></script>
+2 -2
View File
@@ -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.13' version = '0.17'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.13 Alpha' release = '0.17 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.
+19 -15
View File
@@ -31,8 +31,20 @@
* other features. * other features.
*/ */
;(function() { (function (xterm) {
if (typeof define == 'function') {
/*
* Require.js is available
*/
define([], xterm);
} else {
/*
* Plain browser environment
*/
this.Xterm = xterm.call(this);
this.Terminal = this.Xterm; /* Backwards compatibility with term.js */
}
})(function() {
/** /**
* Terminal Emulation References: * Terminal Emulation References:
* http://vt100.net/ * http://vt100.net/
@@ -50,8 +62,7 @@
* Shared * Shared
*/ */
var window = this var window = this, document = this.document;
, document = this.document;
/** /**
* EventEmitter * EventEmitter
@@ -916,9 +927,9 @@ Terminal.prototype.bindMouse = function() {
if (self.mouseEvents) return; if (self.mouseEvents) return;
if (self.applicationKeypad) return; if (self.applicationKeypad) return;
if (ev.type === 'DOMMouseScroll') { if (ev.type === 'DOMMouseScroll') {
self.scrollDisp(ev.detail < 0 ? -5 : 5); self.scrollDisp(ev.detail < 0 ? -1 : 1);
} else { } else {
self.scrollDisp(ev.wheelDeltaY > 0 ? -5 : 5); self.scrollDisp(ev.wheelDeltaY > 0 ? -1 : 1);
} }
return self.cancel(ev); return self.cancel(ev);
}); });
@@ -4763,12 +4774,5 @@ Terminal.on = on;
Terminal.off = off; Terminal.off = off;
Terminal.cancel = cancel; Terminal.cancel = cancel;
if (typeof module !== 'undefined') { return Terminal;
module.exports = Terminal; });
} else {
this.Terminal = Terminal;
}
}).call(function() {
return this || (typeof window !== 'undefined' ? window : global);
}());