Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0997f4398f | ||
|
|
e278837de8 |
+2
-2
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "xterm.js",
|
||||
"version": "0.5",
|
||||
"version": "0.7",
|
||||
"ignore": ["demo", "docs", "test", ".gitignore"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ term.on('key', function (key, ev) {
|
||||
var printable = (!ev.altKey && !ev.altGraphKey && !ev.ctrlKey && !ev.metaKey);
|
||||
|
||||
if (ev.keyIdentifier == 'Enter') {
|
||||
ev.preventDefault();
|
||||
term.prompt();
|
||||
} else if (ev.keyCode == 8) {
|
||||
term.write('\b \b');
|
||||
|
||||
+14
-12
@@ -953,7 +953,7 @@ Terminal.prototype.destroy = function() {
|
||||
* 1=bold, 2=underline, 4=blink, 8=inverse, 16=invisible
|
||||
*/
|
||||
Terminal.prototype.refresh = function(start, end) {
|
||||
var x, y, i, line, out, ch, width, data, attr, bg, fg, flags, row, parent;
|
||||
var x, y, i, line, out, ch, width, data, attr, bg, fg, flags, row, parent, focused = document.activeElement;
|
||||
|
||||
if (end - start >= this.rows / 2) {
|
||||
parent = this.element.parentNode;
|
||||
@@ -1086,6 +1086,10 @@ Terminal.prototype.refresh = function(start, end) {
|
||||
parent.appendChild(this.element);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return focus to previously focused element
|
||||
*/
|
||||
focused.focus();
|
||||
this.emit('refresh', {element: this.element, start: start, end: end});
|
||||
};
|
||||
|
||||
@@ -2169,14 +2173,17 @@ Terminal.prototype.keyDown = function(ev) {
|
||||
break;
|
||||
}
|
||||
key = '\t';
|
||||
this.cancel(ev, true);
|
||||
break;
|
||||
// return/enter
|
||||
case 13:
|
||||
key = '\r';
|
||||
this.cancel(ev, true);
|
||||
break;
|
||||
// escape
|
||||
case 27:
|
||||
key = '\x1b';
|
||||
this.cancel(ev, true);
|
||||
break;
|
||||
// left-arrow
|
||||
case 37:
|
||||
@@ -2350,7 +2357,7 @@ Terminal.prototype.keyDown = function(ev) {
|
||||
|
||||
this.emit('keydown', ev);
|
||||
this.emit('key', key, ev);
|
||||
|
||||
console.log('keydown');
|
||||
this.showCursor();
|
||||
this.handler(key);
|
||||
|
||||
@@ -2392,7 +2399,7 @@ Terminal.prototype.keyPress = function(ev) {
|
||||
|
||||
this.emit('keypress', key, ev);
|
||||
this.emit('key', key, ev);
|
||||
|
||||
console.log('keypress');
|
||||
this.showCursor();
|
||||
this.handler(key);
|
||||
|
||||
@@ -4656,17 +4663,12 @@ function off(el, type, handler, capture) {
|
||||
el.removeEventListener(type, handler, capture || false);
|
||||
}
|
||||
|
||||
function cancel(ev) {
|
||||
if (!this.cancelEvents) {
|
||||
function cancel(ev, force) {
|
||||
if (!this.cancelEvents && !force) {
|
||||
return;
|
||||
}
|
||||
if (ev.preventDefault) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
if (ev.stopPropagation) {
|
||||
ev.stopPropagation();
|
||||
}
|
||||
ev.cancelBubble = true;
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user