]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Merge remote-tracking branch 'upstream/master' into 124_add_textarea_back
authorDaniel Imms <daimms@microsoft.com>
Wed, 13 Jul 2016 00:02:11 +0000 (17:02 -0700)
committerDaniel Imms <daimms@microsoft.com>
Wed, 13 Jul 2016 00:02:11 +0000 (17:02 -0700)
1  2 
src/xterm.js

diff --cc src/xterm.js
index 6682f83a157b6a4775323311eb0fc90dbab92ba7,7211dde7d8c21e5dc4e19e8e125a3a021b3ee9f2..a6cdd8d4073fee4790ec0fce2b0d395738c85810
  
      /**
       * Focus the terminal. Delegates focus handling to the terminal's DOM element.
-      *
-      * @public
       */
      Terminal.prototype.focus = function() {
 -      return this.element.focus();
 +      if (document.activeElement === this.textarea) {
 +        return;
 +      }
 +
 +      if (this.sendFocus) {
 +        this.send('\x1b[I');
 +      }
 +
 +      this.element.classList.add('focus');
 +      this.showCursor();
 +      this.textarea.focus();
 +      Terminal.focus = this;
      };
  
      /**
  
      /**
       * Blur the terminal. Delegates blur handling to the terminal's DOM element.
-      *
-      * @public
       */
      Terminal.prototype.blur = function() {
 -      return this.element.blur();
 +      if (Terminal.focus !== this) {
 +        return;
 +      }
 +
 +      this.element.classList.remove('focus');
 +      this.cursorState = 0;
 +      this.refresh(this.y, this.y);
 +      this.textarea.blur();
 +      if (this.sendFocus) {
 +        this.send('\x1b[0]');
 +      }
 +      Terminal.focus = null;
      };
  
      /**
        this.write(data + '\r\n');
      };
  
-     // Key Resources:
-     // https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent
+       /**
+        * Handle a keydown event
+      * Key Resources:
+      *   - https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent
+      * @param {KeyboardEvent} ev The keydown event to be handled.
+      */
      Terminal.prototype.keyDown = function(ev) {
 +      // TODO: Ignore event if currently composing text
 +
        var self = this;
        var result = this.evaluateKeyEscapeSequence(ev);