Merge remote-tracking branch 'upstream/master' into 124_add_textarea_back

This commit is contained in:
Daniel Imms
2016-07-12 17:02:11 -07:00
151 changed files with 3633 additions and 56 deletions
+3
View File
@@ -16,6 +16,9 @@
"recurse": true,
"verbose": true
},
"plugins": [
"plugins/markdown"
],
"templates": {
"cleverLinks": false,
"monospaceLinks": false
+11 -5
View File
@@ -1,18 +1,24 @@
{
"name": "xterm",
"version": "0.33.0",
"ignore": ["demo", "test", ".gitignore"],
"ignore": [
"demo",
"test",
".gitignore"
],
"main": "src/xterm.js",
"repository": "https://github.com/sourcelair/xterm.js",
"license": "MIT",
"devDependencies": {
"chai": "3.5.0",
"docdash": "0.4.0",
"express": "4.13.4",
"express-ws": "2.0.0-rc.1",
"pty.js": "0.3.0",
"mocha": "2.5.3",
"chai": "3.5.0",
"glob": "^7.0.5",
"jsdoc": "3.4.0",
"docdash": "0.4.0"
"mocha": "2.5.3",
"pty.js": "0.3.0",
"sleep": "^3.0.1"
},
"scripts": {
"start": "node demo/app",
+94 -51
View File
@@ -149,6 +149,8 @@
* - cursorBlink (boolean): Whether the terminal cursor blinks
*
* @public
* @class Xterm Xterm
* @alias module:xterm/src/xterm
*/
function Terminal(options) {
var self = this;
@@ -314,7 +316,10 @@
inherits(Terminal, EventEmitter);
// back_color_erase feature for xterm.
/**
*
* back_color_erase feature for xterm.
*/
Terminal.prototype.eraseAttr = function() {
// if (this.is('screen')) return this.defAttr;
return (this.defAttr & ~0x1ff) | (this.curAttr & 0x1ff);
@@ -430,8 +435,6 @@
/**
* Focus the terminal. Delegates focus handling to the terminal's DOM element.
*
* @public
*/
Terminal.prototype.focus = function() {
if (document.activeElement === this.textarea) {
@@ -467,8 +470,6 @@
/**
* Blur the terminal. Delegates blur handling to the terminal's DOM element.
*
* @public
*/
Terminal.prototype.blur = function() {
if (Terminal.focus !== this) {
@@ -606,9 +607,10 @@
};
/*
/**
* Insert the given row to the terminal or produce a new one
* if no row argument is passed. Return the inserted row.
* @param {HTMLElement} row (optional) The row to append to the terminal.
*/
Terminal.prototype.insertRow = function (row) {
if (typeof row != 'object') {
@@ -626,8 +628,6 @@
* Opens the terminal within an element.
*
* @param {HTMLElement} parent The element to create the terminal within.
*
* @public
*/
Terminal.prototype.open = function(parent) {
var self=this, i=0, div;
@@ -766,22 +766,19 @@
};
// XTerm mouse events
// http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking
// To better understand these
// the xterm code is very helpful:
// Relevant files:
// button.c, charproc.c, misc.c
// Relevant functions in xterm/button.c:
// BtnCode, EmitButtonCode, EditorButton, SendMousePosition
/**
* XTerm mouse events
* http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking
* To better understand these
* the xterm code is very helpful:
* Relevant files:
* button.c, charproc.c, misc.c
* Relevant functions in xterm/button.c:
* BtnCode, EmitButtonCode, EditorButton, SendMousePosition
*/
Terminal.prototype.bindMouse = function() {
var el = this.element
, self = this
, pressed = 32;
var wheelEvent = 'onmousewheel' in this.context
? 'mousewheel'
: 'DOMMouseScroll';
var el = this.element, self = this, pressed = 32;
var wheelEvent = ('onmousewheel' in this.context) ? 'mousewheel' : 'DOMMouseScroll';
// mouseup, mousedown, mousewheel
// left click: ^[[M 3<^[[M#3<
@@ -1107,8 +1104,6 @@
/**
* Destroys the terminal.
*
* @public
*/
Terminal.prototype.destroy = function() {
this.readable = false;
@@ -1134,28 +1129,27 @@
INVISIBLE: 16
}
/*
* Rendering Engine
*
* In the screen buffer, each character
* is stored as a an array with a character
* and a 32-bit integer.
* First value: a utf-16 character.
* Second value:
* Next 9 bits: background color (0-511).
* Next 9 bits: foreground color (0-511).
* Next 14 bits: a mask for misc. flags:
* 1=bold, 2=underline, 4=blink, 8=inverse, 16=invisible
*/
/**
* Refreshes terminal content within two rows (inclusive).
* Refreshes (re-renders) terminal content within two rows (inclusive)
*
* Rendering Engine:
*
* In the screen buffer, each character is stored as a an array with a character
* and a 32-bit integer:
* - First value: a utf-16 character.
* - Second value:
* - Next 9 bits: background color (0-511).
* - Next 9 bits: foreground color (0-511).
* - Next 14 bits: a mask for misc. flags:
* - 1=bold
* - 2=underline
* - 4=blink
* - 8=inverse
* - 16=invisible
*
* @param {number} start The row to start from (between 0 and terminal's height terminal - 1)
* @param {number} end The row to end at (between fromRow and terminal's height terminal - 1)
* @param {boolean} queue Whether the refresh should ran right now or be queued
*
* @public
*/
Terminal.prototype.refresh = function(start, end, queue) {
var self = this;
@@ -1358,6 +1352,9 @@
this.emit('refresh', {element: this.element, start: start, end: end});
};
/**
* Display the cursor element
*/
Terminal.prototype.showCursor = function() {
if (!this.cursorState) {
this.cursorState = 1;
@@ -1365,6 +1362,9 @@
}
};
/**
* Scroll the terminal
*/
Terminal.prototype.scroll = function() {
var row;
@@ -1405,6 +1405,10 @@
this.updateRange(this.scrollBottom);
};
/**
* Scroll the display of the terminal
* @param {number} disp The number of lines to scroll down (negatives scroll up).
*/
Terminal.prototype.scrollDisp = function(disp) {
this.ydisp += disp;
@@ -1419,10 +1423,7 @@
/**
* Writes text to the terminal.
*
* @param {string} text The text to write to the terminal.
*
* @public
*/
Terminal.prototype.write = function(data) {
var l = data.length, i = 0, j, cs, ch, code, low, ch_width, row;
@@ -2471,12 +2472,20 @@
this.refresh(this.refreshStart, this.refreshEnd);
};
/**
* Writes text to the terminal, followed by a break line character (\n).
* @param {string} text The text to write to the terminal.
*/
Terminal.prototype.writeln = function(data) {
this.write(data + '\r\n');
};
// Key Resources:
// https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent
/**
* Handle a keydown event
* Key Resources:
* - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent
* @param {KeyboardEvent} ev The keydown event to be handled.
*/
Terminal.prototype.keyDown = function(ev) {
// TODO: Ignore event if currently composing text
@@ -2514,6 +2523,7 @@
* returned value is the new key code to pass to the PTY.
*
* Reference: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
* @param {KeyboardEvent} ev The keyboard event to be translated to key escape sequence.
*/
Terminal.prototype.evaluateKeyEscapeSequence = function(ev) {
var result = {
@@ -2702,11 +2712,20 @@
return result;
};
/**
* Set the G level of the terminal
* @param g
*/
Terminal.prototype.setgLevel = function(g) {
this.glevel = g;
this.charset = this.charsets[g];
};
/**
* Set the charset for the given G level of the terminal
* @param g
* @param charset
*/
Terminal.prototype.setgCharset = function(g, charset) {
this.charsets[g] = charset;
if (this.glevel === g) {
@@ -2714,6 +2733,12 @@
}
};
/**
* Handle a keypress event.
* Key Resources:
* - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent
* @param {KeyboardEvent} ev The keypress event to be handled.
*/
Terminal.prototype.keyPress = function(ev) {
var key;
@@ -2745,6 +2770,10 @@
return false;
};
/**
* Send data for handling to the terminal
* @param {string} data
*/
Terminal.prototype.send = function(data) {
var self = this;
@@ -2758,6 +2787,10 @@
this.queue += data;
};
/**
* Ring the bell.
* Note: We could do sweet things with webaudio here
*/
Terminal.prototype.bell = function() {
if (!this.visualBell) return;
var self = this;
@@ -2768,6 +2801,9 @@
if (this.popOnBell) this.focus();
};
/**
* Log the current state to the console.
*/
Terminal.prototype.log = function() {
if (!this.debug) return;
if (!this.context.console || !this.context.console.log) return;
@@ -2775,6 +2811,9 @@
this.context.console.log.apply(this.context.console, args);
};
/**
* Log the current state as error to the console.
*/
Terminal.prototype.error = function() {
if (!this.debug) return;
if (!this.context.console || !this.context.console.error) return;
@@ -2787,8 +2826,6 @@
*
* @param {number} x The number of columns to resize to.
* @param {number} y The number of rows to resize to.
*
* @public
*/
Terminal.prototype.resize = function(x, y) {
var line
@@ -2898,6 +2935,10 @@
this.emit('resize', {terminal: this, cols: x, rows: y});
};
/**
* Updates the range of rows to refresh
* @param {number} y The number of rows to refresh next.
*/
Terminal.prototype.updateRange = function(y) {
if (y < this.refreshStart) this.refreshStart = y;
if (y > this.refreshEnd) this.refreshEnd = y;
@@ -2909,6 +2950,9 @@
// }
};
/**
* Set the range of refreshing to the maximyum value
*/
Terminal.prototype.maxRange = function() {
this.refreshStart = 0;
this.refreshEnd = this.rows - 1;
@@ -4813,12 +4857,11 @@
*
* @param {string} event The name of the event. TODO: Document all event types
* @param {function} callback The function to call when the event is triggered.
*
* @public
*/
Terminal.on = on;
Terminal.off = off;
Terminal.cancel = cancel;
return Terminal;
});
+21
View File
@@ -0,0 +1,21 @@
All tests are made for 80x25 terminal. Make sure to run tests with 80x25.
Create .text files from xterm (expected output)
- open xterm
- resize xterm to 80x25
- run `python run_tests.py`
- copy & paste whole window output into editor
- add 26th empty line (due to line handling in toString) - not a bug, a feature ;)
- advance to next test with ^D
Known problems
##############
t0031-HBP:
- no documentation at all about CSIj found - skipping
t0050-ICH:
- bug in xterm? (cant ICH last real char, always sticks to last col)
- text used from https://github.com/MarkLodato/vt100-parser/blob/master/test/t0050-ICH.text
@@ -0,0 +1,6 @@
!"#$%&'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_
`abcdefghijklmno
pqrstuvwxyz{|}~
@@ -0,0 +1,25 @@
!"#$%&'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_
`abcdefghijklmno
pqrstuvwxyz{|}~
@@ -0,0 +1,95 @@
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
@@ -0,0 +1,25 @@
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
@@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyz0123456789
@@ -0,0 +1,25 @@
abcdefghijklmnopqrstuvwxyz0123456789
@@ -0,0 +1,83 @@
a
ab
abc
abcd
abcde
abcdef
abcdefg
abcdefgh
abcdefghi
abcdefghij
abcdefghijk
abcdefghijkl
abcdefghijklm
abcdefghijklmn
abcdefghijklmno
abcdefghijklmnop
abcdefghijklmnopq
abcdefghijklmnopqr
abcdefghijklmnopqrs
abcdefghijklmnopqrst
abcdefghijklmnopqrstu
abcdefghijklmnopqrstuv
abcdefghijklmnopqrstuvw
abcdefghijklmnopqrstuvwx
abcdefghijklmnopqrstuvwxy
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyzA
abcdefghijklmnopqrstuvwxyzAB
abcdefghijklmnopqrstuvwxyzABC
abcdefghijklmnopqrstuvwxyzABCD
abcdefghijklmnopqrstuvwxyzABCDE
abcdefghijklmnopqrstuvwxyzABCDEF
abcdefghijklmnopqrstuvwxyzABCDEFG
abcdefghijklmnopqrstuvwxyzABCDEFGH
abcdefghijklmnopqrstuvwxyzABCDEFGHI
abcdefghijklmnopqrstuvwxyzABCDEFGHIJ
abcdefghijklmnopqrstuvwxyzABCDEFGHIJK
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890a
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890ab
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abc
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcd
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcde
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdef
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefg
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefgh
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghi
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghij
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijk
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijkl
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklm
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmn
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmno
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnop
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnopq
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnopqr
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnopqrs
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnopqrst
@@ -0,0 +1,25 @@
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890a
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890ab
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abc
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcd
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcde
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdef
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefg
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefgh
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghi
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghij
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijk
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijkl
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklm
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmn
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmno
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnop
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnopq
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnopq
r
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnopq
rs
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890abcdefghijklmnopq
rst
+26
View File
@@ -0,0 +1,26 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
+25
View File
@@ -0,0 +1,25 @@
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
+83
View File
@@ -0,0 +1,83 @@
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
0
1
2
3
4
5
6
7
8
9
0
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
+25
View File
@@ -0,0 +1,25 @@
7
8
9
0
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
+7
View File
@@ -0,0 +1,7 @@
1
x
2
x
3
x
4
+25
View File
@@ -0,0 +1,25 @@
x
x2
x 3
x 4
x 5
x 6
x 7
+82
View File
@@ -0,0 +1,82 @@
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
b
a
+25
View File
@@ -0,0 +1,25 @@
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a b
a
ab

Some files were not shown because too many files have changed in this diff Show More