From 5452986ce32db941d5ee7fe44e3bbe8a91d2261c Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sun, 19 Feb 2017 12:34:36 -0800 Subject: [PATCH] Use CharMeasure to determine mouse coordinates Fixes #555 --- src/xterm.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/xterm.js b/src/xterm.js index f76c01b..8aa6236 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -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