]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Use CharMeasure to determine mouse coordinates
authorDaniel Imms <daimms@microsoft.com>
Sun, 19 Feb 2017 20:34:36 +0000 (12:34 -0800)
committerDaniel Imms <daimms@microsoft.com>
Sun, 19 Feb 2017 20:34:36 +0000 (12:34 -0800)
Fixes #555

src/xterm.js

index f76c01b5941482833ad7e2d58849d12ddeabbee2..8aa6236bbc1a6a37a8b4eadd93b03fb147879d61 100644 (file)
@@ -957,10 +957,8 @@ Terminal.prototype.bindMouse = function() {
     }
 
     // convert to cols/rows
-    w = self.element.clientWidth;
-    h = self.element.clientHeight;
-    x = Math.ceil((x / w) * self.cols);
-    y = Math.ceil((y / h) * self.rows);
+    x = Math.ceil(x / self.charMeasure.width);
+    y = Math.ceil(y / self.charMeasure.height);
 
     // be sure to avoid sending
     // bad positions to the program