mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-10-04 15:58:27 +00:00
Merge pull request #828 from sourcelair/issue-#827-fix-terminal-focus
Always focus terminal on click
This commit is contained in:
commit
f13455965c
17
src/xterm.js
17
src/xterm.js
@ -746,15 +746,6 @@ Terminal.prototype.open = function(parent, focus) {
|
|||||||
this.focus();
|
this.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
on(this.element, 'click', function() {
|
|
||||||
var selection = document.getSelection(),
|
|
||||||
collapsed = selection.isCollapsed,
|
|
||||||
isRange = typeof collapsed == 'boolean' ? !collapsed : selection.type == 'Range';
|
|
||||||
if (!isRange) {
|
|
||||||
self.focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Listen for mouse events and translate
|
// Listen for mouse events and translate
|
||||||
// them into terminal mouse protocols.
|
// them into terminal mouse protocols.
|
||||||
this.bindMouse();
|
this.bindMouse();
|
||||||
@ -1025,14 +1016,14 @@ Terminal.prototype.bindMouse = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
on(el, 'mousedown', function(ev) {
|
on(el, 'mousedown', function(ev) {
|
||||||
|
// ensure focus
|
||||||
|
self.focus();
|
||||||
|
|
||||||
if (!self.mouseEvents) return;
|
if (!self.mouseEvents) return;
|
||||||
|
|
||||||
// send the button
|
// send the button
|
||||||
sendButton(ev);
|
sendButton(ev);
|
||||||
|
|
||||||
// ensure focus
|
|
||||||
self.focus();
|
|
||||||
|
|
||||||
// fix for odd bug
|
// fix for odd bug
|
||||||
//if (self.vt200Mouse && !self.normalMouse) {
|
//if (self.vt200Mouse && !self.normalMouse) {
|
||||||
if (self.vt200Mouse) {
|
if (self.vt200Mouse) {
|
||||||
@ -2201,7 +2192,7 @@ Terminal.prototype.ch = function(cur) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluate if the current erminal is the given argument.
|
* Evaluate if the current terminal is the given argument.
|
||||||
* @param {object} term The terminal to evaluate
|
* @param {object} term The terminal to evaluate
|
||||||
*/
|
*/
|
||||||
Terminal.prototype.is = function(term) {
|
Terminal.prototype.is = function(term) {
|
||||||
|
Loading…
Reference in New Issue
Block a user