Fix indentation of src/xterm.js
This commit is contained in:
+15
-30
@@ -118,8 +118,9 @@ import { Viewport } from './Viewport.js';
|
|||||||
|
|
||||||
// this.context = options.context || window;
|
// this.context = options.context || window;
|
||||||
// this.document = options.document || document;
|
// this.document = options.document || document;
|
||||||
this.parent = options.body || options.parent
|
this.parent = options.body || options.parent || (
|
||||||
|| (document ? document.getElementsByTagName('body')[0] : null);
|
document ? document.getElementsByTagName('body')[0] : null
|
||||||
|
);
|
||||||
|
|
||||||
this.cols = options.cols || options.geometry[0];
|
this.cols = options.cols || options.geometry[0];
|
||||||
this.rows = options.rows || options.geometry[1];
|
this.rows = options.rows || options.geometry[1];
|
||||||
@@ -526,25 +527,19 @@ import { Viewport } from './Viewport.js';
|
|||||||
throw new Error('Terminal requires a parent element.');
|
throw new Error('Terminal requires a parent element.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Grab global elements
|
||||||
* Grab global elements
|
|
||||||
*/
|
|
||||||
this.context = this.parent.ownerDocument.defaultView;
|
this.context = this.parent.ownerDocument.defaultView;
|
||||||
this.document = this.parent.ownerDocument;
|
this.document = this.parent.ownerDocument;
|
||||||
this.body = this.document.getElementsByTagName('body')[0];
|
this.body = this.document.getElementsByTagName('body')[0];
|
||||||
|
|
||||||
/*
|
// Parse User-Agent
|
||||||
* Parse User-Agent
|
|
||||||
*/
|
|
||||||
if (this.context.navigator && this.context.navigator.userAgent) {
|
if (this.context.navigator && this.context.navigator.userAgent) {
|
||||||
this.isMSIE = !!~this.context.navigator.userAgent.indexOf('MSIE');
|
this.isMSIE = !!~this.context.navigator.userAgent.indexOf('MSIE');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Find the users platform. We use this to interpret the meta key
|
||||||
* Find the users platform. We use this to interpret the meta key
|
// and ISO third level shifts.
|
||||||
* and ISO third level shifts.
|
// http://stackoverflow.com/q/19877924/577598
|
||||||
* http://stackoverflow.com/questions/19877924/what-is-the-list-of-possible-values-for-navigator-platform-as-of-today
|
|
||||||
*/
|
|
||||||
if (this.context.navigator && this.context.navigator.platform) {
|
if (this.context.navigator && this.context.navigator.platform) {
|
||||||
this.isMac = contains(
|
this.isMac = contains(
|
||||||
this.context.navigator.platform,
|
this.context.navigator.platform,
|
||||||
@@ -558,9 +553,7 @@ import { Viewport } from './Viewport.js';
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
//Create main element container
|
||||||
* Create main element container
|
|
||||||
*/
|
|
||||||
this.element = this.document.createElement('div');
|
this.element = this.document.createElement('div');
|
||||||
this.element.classList.add('terminal');
|
this.element.classList.add('terminal');
|
||||||
this.element.classList.add('xterm');
|
this.element.classList.add('xterm');
|
||||||
@@ -576,19 +569,15 @@ import { Viewport } from './Viewport.js';
|
|||||||
this.viewportScrollArea.classList.add('xterm-scroll-area');
|
this.viewportScrollArea.classList.add('xterm-scroll-area');
|
||||||
this.viewportElement.appendChild(this.viewportScrollArea);
|
this.viewportElement.appendChild(this.viewportScrollArea);
|
||||||
|
|
||||||
/*
|
// Create the container that will hold the lines of the terminal and then
|
||||||
* Create the container that will hold the lines of the terminal and then
|
// produce the lines the lines.
|
||||||
* produce the lines the lines.
|
|
||||||
*/
|
|
||||||
this.rowContainer = document.createElement('div');
|
this.rowContainer = document.createElement('div');
|
||||||
this.rowContainer.classList.add('xterm-rows');
|
this.rowContainer.classList.add('xterm-rows');
|
||||||
this.element.appendChild(this.rowContainer);
|
this.element.appendChild(this.rowContainer);
|
||||||
this.children = [];
|
this.children = [];
|
||||||
|
|
||||||
/*
|
// Create the container that will hold helpers like the textarea for
|
||||||
* Create the container that will hold helpers like the textarea for
|
// capturing DOM Events. Then produce the helpers.
|
||||||
* capturing DOM Events. Then produce the helpers.
|
|
||||||
*/
|
|
||||||
this.helperContainer = document.createElement('div');
|
this.helperContainer = document.createElement('div');
|
||||||
this.helperContainer.classList.add('xterm-helpers');
|
this.helperContainer.classList.add('xterm-helpers');
|
||||||
// TODO: This should probably be inserted once it's filled to prevent an additional layout
|
// TODO: This should probably be inserted once it's filled to prevent an additional layout
|
||||||
@@ -1171,9 +1160,7 @@ import { Viewport } from './Viewport.js';
|
|||||||
classNames.push('xterm-blink');
|
classNames.push('xterm-blink');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// If inverse flag is on, then swap the foreground and background variables.
|
||||||
* If inverse flag is on, then swap the foreground and background variables.
|
|
||||||
*/
|
|
||||||
if (flags & Terminal.flags.INVERSE) {
|
if (flags & Terminal.flags.INVERSE) {
|
||||||
/* One-line variable swap in JavaScript: http://stackoverflow.com/a/16201730 */
|
/* One-line variable swap in JavaScript: http://stackoverflow.com/a/16201730 */
|
||||||
bg = [fg, fg = bg][0];
|
bg = [fg, fg = bg][0];
|
||||||
@@ -2927,9 +2914,7 @@ import { Viewport } from './Viewport.js';
|
|||||||
}
|
}
|
||||||
this.rows = y;
|
this.rows = y;
|
||||||
|
|
||||||
/*
|
// Make sure that the cursor stays on screen
|
||||||
* Make sure that the cursor stays on screen
|
|
||||||
*/
|
|
||||||
if (this.y >= y) {
|
if (this.y >= y) {
|
||||||
this.y = y - 1;
|
this.y = y - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user