Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01c20807c2 | ||
|
|
243ce59806 | ||
|
|
5d6e0356b3 | ||
|
|
8324b43cc2 | ||
|
|
4c3ccc264c | ||
|
|
197c83d993 | ||
|
|
aaded29855 | ||
|
|
e5656b9982 | ||
|
|
7de7bdac71 |
@@ -1,6 +1,6 @@
|
|||||||
# xterm.js
|
# xterm.js
|
||||||
|
|
||||||

|
 [](https://gitter.im/sourcelair/xterm.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||||
|
|
||||||
Xterm.js is a terminal front-end component written in JavaScript that works in the browser.
|
Xterm.js is a terminal front-end component written in JavaScript that works in the browser.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm.js",
|
"name": "xterm.js",
|
||||||
"version": "1.1.0",
|
"version": "1.1.2",
|
||||||
"ignore": ["demo", "test", ".gitignore"]
|
"ignore": ["demo", "test", ".gitignore"]
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm",
|
"name": "xterm",
|
||||||
"version": "1.1.0",
|
"version": "1.1.2",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"demo",
|
"demo",
|
||||||
"test",
|
"test",
|
||||||
|
|||||||
@@ -98,6 +98,7 @@
|
|||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal .composition-view.active {
|
.terminal .composition-view.active {
|
||||||
|
|||||||
+36
-12
@@ -2907,39 +2907,63 @@
|
|||||||
break;
|
break;
|
||||||
// left-arrow
|
// left-arrow
|
||||||
case 37:
|
case 37:
|
||||||
if (modifiers)
|
if (modifiers) {
|
||||||
result.key = '\x1b[1;' + (modifiers + 1) + 'D';
|
result.key = '\x1b[1;' + (modifiers + 1) + 'D';
|
||||||
else if (this.applicationCursor)
|
// HACK: Make Alt + left-arrow behave like Ctrl + left-arrow: move one word backwards
|
||||||
|
// http://unix.stackexchange.com/a/108106
|
||||||
|
if (result.key == '\x1b[1;3D') {
|
||||||
|
result.key = '\x1b[1;5D';
|
||||||
|
}
|
||||||
|
} else if (this.applicationCursor) {
|
||||||
result.key = '\x1bOD';
|
result.key = '\x1bOD';
|
||||||
else
|
} else {
|
||||||
result.key = '\x1b[D';
|
result.key = '\x1b[D';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
// right-arrow
|
// right-arrow
|
||||||
case 39:
|
case 39:
|
||||||
if (modifiers)
|
if (modifiers) {
|
||||||
result.key = '\x1b[1;' + (modifiers + 1) + 'C';
|
result.key = '\x1b[1;' + (modifiers + 1) + 'C';
|
||||||
else if (this.applicationCursor)
|
// HACK: Make Alt + right-arrow behave like Ctrl + right-arrow: move one word forward
|
||||||
|
// http://unix.stackexchange.com/a/108106
|
||||||
|
if (result.key == '\x1b[1;3C') {
|
||||||
|
result.key = '\x1b[1;5C';
|
||||||
|
}
|
||||||
|
} else if (this.applicationCursor) {
|
||||||
result.key = '\x1bOC';
|
result.key = '\x1bOC';
|
||||||
else
|
} else {
|
||||||
result.key = '\x1b[C';
|
result.key = '\x1b[C';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
// up-arrow
|
// up-arrow
|
||||||
case 38:
|
case 38:
|
||||||
if (modifiers)
|
if (modifiers) {
|
||||||
result.key = '\x1b[1;' + (modifiers + 1) + 'A';
|
result.key = '\x1b[1;' + (modifiers + 1) + 'A';
|
||||||
else if (this.applicationCursor)
|
// HACK: Make Alt + up-arrow behave like Ctrl + up-arrow
|
||||||
|
// http://unix.stackexchange.com/a/108106
|
||||||
|
if (result.key == '\x1b[1;3A') {
|
||||||
|
result.key = '\x1b[1;5A';
|
||||||
|
}
|
||||||
|
} else if (this.applicationCursor) {
|
||||||
result.key = '\x1bOA';
|
result.key = '\x1bOA';
|
||||||
else
|
} else {
|
||||||
result.key = '\x1b[A';
|
result.key = '\x1b[A';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
// down-arrow
|
// down-arrow
|
||||||
case 40:
|
case 40:
|
||||||
if (modifiers)
|
if (modifiers) {
|
||||||
result.key = '\x1b[1;' + (modifiers + 1) + 'B';
|
result.key = '\x1b[1;' + (modifiers + 1) + 'B';
|
||||||
else if (this.applicationCursor)
|
// HACK: Make Alt + down-arrow behave like Ctrl + down-arrow
|
||||||
|
// http://unix.stackexchange.com/a/108106
|
||||||
|
if (result.key == '\x1b[1;3B') {
|
||||||
|
result.key = '\x1b[1;5B';
|
||||||
|
}
|
||||||
|
} else if (this.applicationCursor) {
|
||||||
result.key = '\x1bOB';
|
result.key = '\x1bOB';
|
||||||
else
|
} else {
|
||||||
result.key = '\x1b[B';
|
result.key = '\x1b[B';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
// insert
|
// insert
|
||||||
case 45:
|
case 45:
|
||||||
|
|||||||
+21
-1
@@ -55,6 +55,26 @@ describe('xterm.js', function() {
|
|||||||
it('should return \\x1b[5C for ctrl+right', function() {
|
it('should return \\x1b[5C for ctrl+right', function() {
|
||||||
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 39 }).key, '\x1b[1;5C'); // CSI 5 C
|
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 39 }).key, '\x1b[1;5C'); // CSI 5 C
|
||||||
});
|
});
|
||||||
|
it('should return \\x1b[5A for ctrl+up', function() {
|
||||||
|
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 38 }).key, '\x1b[1;5A'); // CSI 5 A
|
||||||
|
});
|
||||||
|
it('should return \\x1b[5B for ctrl+down', function() {
|
||||||
|
assert.equal(xterm.evaluateKeyEscapeSequence({ ctrlKey: true, keyCode: 40 }).key, '\x1b[1;5B'); // CSI 5 B
|
||||||
|
});
|
||||||
|
// Evalueate alt + arrow key movement, which is a feature of terminal emulators but not VT100
|
||||||
|
// http://unix.stackexchange.com/a/108106
|
||||||
|
it('should return \\x1b[5D for alt+left', function() {
|
||||||
|
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 37 }).key, '\x1b[1;5D'); // CSI 5 D
|
||||||
|
});
|
||||||
|
it('should return \\x1b[5C for alt+right', function() {
|
||||||
|
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 39 }).key, '\x1b[1;5C'); // CSI 5 C
|
||||||
|
});
|
||||||
|
it('should return \\x1b[5A for alt+up', function() {
|
||||||
|
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 38 }).key, '\x1b[1;5A'); // CSI 5 A
|
||||||
|
});
|
||||||
|
it('should return \\x1b[5B for alt+down', function() {
|
||||||
|
assert.equal(xterm.evaluateKeyEscapeSequence({ altKey: true, keyCode: 40 }).key, '\x1b[1;5B'); // CSI 5 B
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('attachCustomEventHandler', function () {
|
describe('attachCustomEventHandler', function () {
|
||||||
@@ -88,7 +108,7 @@ describe('xterm.js', function() {
|
|||||||
});
|
});
|
||||||
assert.equal(xterm.keyDown(Object.assign({}, evKeyDown, { keyCode: 77 })), false);
|
assert.equal(xterm.keyDown(Object.assign({}, evKeyDown, { keyCode: 77 })), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should alive after reset(ESC c Full Reset (RIS))', function () {
|
it('should alive after reset(ESC c Full Reset (RIS))', function () {
|
||||||
xterm.attachCustomKeydownHandler(function (ev) {
|
xterm.attachCustomKeydownHandler(function (ev) {
|
||||||
return ev.keyCode !== 77;
|
return ev.keyCode !== 77;
|
||||||
|
|||||||
Reference in New Issue
Block a user