mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #38 from sourcelair/fix/focus-events
Fix xterm focus events
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.js]
|
||||
max_line_length = 100
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
+10
-6
@@ -40,7 +40,7 @@
|
||||
} else {
|
||||
/*
|
||||
* Plain browser environment
|
||||
*/
|
||||
*/
|
||||
this.Xterm = xterm.call(this);
|
||||
this.Terminal = this.Xterm; /* Backwards compatibility with term.js */
|
||||
}
|
||||
@@ -394,7 +394,6 @@
|
||||
this.showCursor();
|
||||
this.textarea.focus();
|
||||
|
||||
this.emit('focus', {terminal: this});
|
||||
};
|
||||
|
||||
Terminal.prototype.blur = function() {
|
||||
@@ -404,12 +403,11 @@
|
||||
|
||||
this.cursorState = 0;
|
||||
this.refresh(this.y, this.y);
|
||||
this.textarea.blur();
|
||||
|
||||
if (this.sendFocus) {
|
||||
this.send('\x1b[O');
|
||||
}
|
||||
|
||||
this.emit('blur', {terminal: this});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -559,6 +557,12 @@
|
||||
this.textarea.setAttribute('autocapitalize', 'off');
|
||||
this.textarea.setAttribute('spellcheck', 'false');
|
||||
this.textarea.tabIndex = 0;
|
||||
this.textarea.onfocus = function() {
|
||||
self.emit('focus', {terminal: self});
|
||||
}
|
||||
this.textarea.onblur = function() {
|
||||
self.emit('blur', {terminal: self});
|
||||
}
|
||||
this.helperContainer.appendChild(this.textarea);
|
||||
|
||||
for (; i < this.rows; i++) {
|
||||
@@ -2379,7 +2383,7 @@
|
||||
|
||||
this.emit('keydown', ev);
|
||||
this.emit('key', key, ev);
|
||||
this.showCursor();
|
||||
this.showCursor();
|
||||
this.handler(key);
|
||||
|
||||
return this.cancel(ev);
|
||||
@@ -4784,4 +4788,4 @@
|
||||
Terminal.cancel = cancel;
|
||||
|
||||
return Terminal;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user