pointless

This commit is contained in:
Paris
2016-04-08 18:10:27 +03:00
parent 18b2a1c3b4
commit 6406a88ddf
2 changed files with 27 additions and 5 deletions
+3 -1
View File
@@ -15,7 +15,9 @@ term.writeln('');
term.prompt();
term.on('key', function (key, ev) {
var printable = (!ev.altKey && !ev.altGraphKey && !ev.ctrlKey && !ev.metaKey);
var printable = (
!ev.altKey && !ev.altGraphKey && !ev.ctrlKey && !ev.metaKey
);
if (ev.keyCode == 13) {
term.prompt();
+24 -4
View File
@@ -100,10 +100,11 @@
};
EventEmitter.prototype.once = function(type, listener) {
var self = this;
function on() {
var args = Array.prototype.slice.call(arguments);
this.removeListener(type, on);
return listener.apply(this, args);
self.removeListener(type, on);
return listener.apply(self, args);
}
on.listener = listener;
return this.on(type, on);
@@ -430,7 +431,6 @@
var text = ev.clipboardData.getData('text/plain');
term.handler(text);
}
return term.cancel(ev, true);
});
};
@@ -440,6 +440,16 @@
*/
Terminal.bindKeys = function(term) {
on(term.element, 'keydown', function(ev) {
/*
* Clear all selections if the key pressed was not among
* Shift, Alt, Cmd, Ctrl.
*/
var selection = window.getSelection();
if (selection.toString() != '') {
if ([16, 17, 18, 91].indexOf(ev.keyCode) == -1) {
selection.removeAllRanges();
}
}
term.keyDown(ev);
}, true);
@@ -470,6 +480,17 @@
};
Terminal.click = function (term) {
/*
* Do not perform the "drop" event. Altering the contents of the
* terminal with drag n drop is unwanted behavior.
*/
on(term.element, 'click', function (ev) {
term.cancel(ev, true);
});
};
/*
* Insert the given row to the terminal or produce a new one
* if no row argument is passed. Return the inserted row.
@@ -523,7 +544,6 @@
this.element.classList.add('xterm');
this.element.classList.add('xterm-theme-' + this.theme);
this.element.setAttribute('tabindex', 0);
this.element.contentEditable = 'true';
this.element.spellcheck = 'false';
/*