do not emit focus event if editor is already focused

This commit is contained in:
nightwing 2012-06-01 14:54:32 +04:00
commit 51b15d3588

View file

@ -397,6 +397,9 @@ var Editor = function(renderer, session) {
* Emitted once the editor comes into focus.
**/
this.onFocus = function() {
if (this.$isFocused)
return;
this.$isFocused = true;
this.renderer.showCursor();
this.renderer.visualizeFocus();
this._emit("focus");
@ -408,6 +411,9 @@ var Editor = function(renderer, session) {
* Emitted once the editor has been blurred.
**/
this.onBlur = function() {
if (!this.$isFocused)
return;
this.$isFocused = false;
this.renderer.hideCursor();
this.renderer.visualizeBlur();
this._emit("blur");