]> git.proxmox.com Git - mirror_xterm.js.git/blobdiff - src/xterm.js
Refactor TS build and fix testing
[mirror_xterm.js.git] / src / xterm.js
index e9b3f17dc654a748bb4341aef5efee14c94f1af0..ce49d917a76fe7402704db06735ac9822a702e3f 100644 (file)
@@ -63,7 +63,9 @@ var normal = 0, escaped = 1, csi = 2, osc = 3, charset = 4, dcs = 5, ignore = 6;
  * Creates a new `Terminal` object.
  *
  * @param {object} options An object containing a set of options, the available options are:
- *   - cursorBlink (boolean): Whether the terminal cursor blinks
+ *   - `cursorBlink` (boolean): Whether the terminal cursor blinks
+ *   - `cols` (number): The number of columns of the terminal (horizontal size)
+ *   - `rows` (number): The number of rows of the terminal (vertical size)
  *
  * @public
  * @class Xterm Xterm
@@ -125,6 +127,7 @@ function Terminal(options) {
 
   this.cols = options.cols || options.geometry[0];
   this.rows = options.rows || options.geometry[1];
+  this.geometry = [this.cols, this.rows];
 
   if (options.handler) {
     this.on('data', options.handler);
@@ -642,10 +645,10 @@ Terminal.prototype.open = function(parent) {
 Terminal.loadAddon = function(addon, callback) {
   if (typeof exports === 'object' && typeof module === 'object') {
     // CommonJS
-    return require(__dirname + '/../addons/' + addon);
+    return require('./addons/' + addon + '/' + addon);
   } else if (typeof define == 'function') {
     // RequireJS
-    return require(['../addons/' + addon + '/' + addon], callback);
+    return require(['./addons/' + addon + '/' + addon], callback);
   } else {
     console.error('Cannot load a module without a CommonJS or RequireJS environment.');
     return false;
@@ -1309,7 +1312,7 @@ Terminal.prototype.scrollDisp = function(disp, suppressScrollEvent) {
 
 /**
  * Scroll the display of the terminal by a number of pages.
- * @param {number} pageCount The number of pages to scroll.
+ * @param {number} pageCount The number of pages to scroll (negative scrolls up).
  */
 Terminal.prototype.scrollPages = function(pageCount) {
   this.scrollDisp(pageCount * (this.rows - 1));
@@ -2942,6 +2945,7 @@ Terminal.prototype.resize = function(x, y) {
 
   this.normal = null;
 
+  this.geometry = [this.cols, this.rows];
   this.emit('resize', {terminal: this, cols: x, rows: y});
 };
 
@@ -3121,9 +3125,9 @@ Terminal.prototype.is = function(term) {
 
 
 /**
    * Emit the 'data' event and populate the given data.
    * @param {string} data The data to populate in the event.
    */
+ * Emit the 'data' event and populate the given data.
+ * @param {string} data The data to populate in the event.
+ */
 Terminal.prototype.handler = function(data) {
   this.emit('data', data);
 };
@@ -4366,8 +4370,8 @@ Terminal.prototype.scrollUp = function(params) {
 
 
 /**
    * CSI Ps T  Scroll down Ps lines (default = 1) (SD).
    */
+ * CSI Ps T  Scroll down Ps lines (default = 1) (SD).
+ */
 Terminal.prototype.scrollDown = function(params) {
   var param = params[0] || 1;
   while (param--) {