mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-11 03:25:45 +00:00
move el.focus code elsewhere.
This commit is contained in:
parent
a98bef4c90
commit
62ebd04231
@ -1150,6 +1150,7 @@ Screen.prototype.focusPush = function(el) {
|
|||||||
this.history.shift();
|
this.history.shift();
|
||||||
}
|
}
|
||||||
this.history.push(el);
|
this.history.push(el);
|
||||||
|
el._focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
Screen.prototype.focusLast =
|
Screen.prototype.focusLast =
|
||||||
@ -1612,8 +1613,11 @@ Element.prototype.toggle = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Element.prototype.focus = function() {
|
Element.prototype.focus = function() {
|
||||||
var old = this.screen.focused;
|
|
||||||
this.screen.focused = this;
|
this.screen.focused = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
Element.prototype._focus = function() {
|
||||||
|
var old = this.screen.history[this.screen.history.length-2];
|
||||||
|
|
||||||
// Find a scrollable ancestor if we have one.
|
// Find a scrollable ancestor if we have one.
|
||||||
var el = this;
|
var el = this;
|
||||||
@ -1640,7 +1644,7 @@ Element.prototype.focus = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
old.emit('blur', this);
|
if (old) old.emit('blur', this);
|
||||||
this.emit('focus', old);
|
this.emit('focus', old);
|
||||||
this.screen.emit('element blur', old, this);
|
this.screen.emit('element blur', old, this);
|
||||||
this.screen.emit('element focus', old, this);
|
this.screen.emit('element focus', old, this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user