mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-10-30 15:33:56 +00:00
Merge pull request #263 from sourcelair/fix-indentation
Fix indentation of `src/xterm.js`
This commit is contained in:
commit
ecfa44b0e8
45
src/xterm.js
45
src/xterm.js
@ -118,8 +118,9 @@ import { Viewport } from './Viewport.js';
|
||||
|
||||
// this.context = options.context || window;
|
||||
// this.document = options.document || document;
|
||||
this.parent = options.body || options.parent
|
||||
|| (document ? document.getElementsByTagName('body')[0] : null);
|
||||
this.parent = options.body || options.parent || (
|
||||
document ? document.getElementsByTagName('body')[0] : null
|
||||
);
|
||||
|
||||
this.cols = options.cols || options.geometry[0];
|
||||
this.rows = options.rows || options.geometry[1];
|
||||
@ -526,25 +527,19 @@ import { Viewport } from './Viewport.js';
|
||||
throw new Error('Terminal requires a parent element.');
|
||||
}
|
||||
|
||||
/*
|
||||
* Grab global elements
|
||||
*/
|
||||
// Grab global elements
|
||||
this.context = this.parent.ownerDocument.defaultView;
|
||||
this.document = this.parent.ownerDocument;
|
||||
this.body = this.document.getElementsByTagName('body')[0];
|
||||
|
||||
/*
|
||||
* Parse User-Agent
|
||||
*/
|
||||
// Parse User-Agent
|
||||
if (this.context.navigator && this.context.navigator.userAgent) {
|
||||
this.isMSIE = !!~this.context.navigator.userAgent.indexOf('MSIE');
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the users platform. We use this to interpret the meta key
|
||||
* and ISO third level shifts.
|
||||
* http://stackoverflow.com/questions/19877924/what-is-the-list-of-possible-values-for-navigator-platform-as-of-today
|
||||
*/
|
||||
// Find the users platform. We use this to interpret the meta key
|
||||
// and ISO third level shifts.
|
||||
// http://stackoverflow.com/q/19877924/577598
|
||||
if (this.context.navigator && this.context.navigator.platform) {
|
||||
this.isMac = contains(
|
||||
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.classList.add('terminal');
|
||||
this.element.classList.add('xterm');
|
||||
@ -576,19 +569,15 @@ import { Viewport } from './Viewport.js';
|
||||
this.viewportScrollArea.classList.add('xterm-scroll-area');
|
||||
this.viewportElement.appendChild(this.viewportScrollArea);
|
||||
|
||||
/*
|
||||
* Create the container that will hold the lines of the terminal and then
|
||||
* produce the lines the lines.
|
||||
*/
|
||||
// Create the container that will hold the lines of the terminal and then
|
||||
// produce the lines the lines.
|
||||
this.rowContainer = document.createElement('div');
|
||||
this.rowContainer.classList.add('xterm-rows');
|
||||
this.element.appendChild(this.rowContainer);
|
||||
this.children = [];
|
||||
|
||||
/*
|
||||
* Create the container that will hold helpers like the textarea for
|
||||
* capturing DOM Events. Then produce the helpers.
|
||||
*/
|
||||
// Create the container that will hold helpers like the textarea for
|
||||
// capturing DOM Events. Then produce the helpers.
|
||||
this.helperContainer = document.createElement('div');
|
||||
this.helperContainer.classList.add('xterm-helpers');
|
||||
// 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');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
/* One-line variable swap in JavaScript: http://stackoverflow.com/a/16201730 */
|
||||
bg = [fg, fg = bg][0];
|
||||
@ -2927,9 +2914,7 @@ import { Viewport } from './Viewport.js';
|
||||
}
|
||||
this.rows = y;
|
||||
|
||||
/*
|
||||
* Make sure that the cursor stays on screen
|
||||
*/
|
||||
// Make sure that the cursor stays on screen
|
||||
if (this.y >= y) {
|
||||
this.y = y - 1;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user