diff --git a/src/xterm.js b/src/xterm.js index f3b278f1..8d8bffb8 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -801,9 +801,19 @@ Terminal.prototype.bindMouse = function() { button = getButton(ev); // get mouse coordinates - pos = Mouse.getCoords(ev, this.rowContainer, this.charMeasure); + pos = Mouse.getCoords(ev, self.rowContainer, self.charMeasure); if (!pos) return; + // Temp fix until getcoords PR is pushed + pos.x = pos[0]; + pos.y = pos[1]; + if (pos.x < 0) pos.x = 0; + if (pos.x > self.cols) pos.x = self.cols; + if (pos.y < 0) pos.y = 0; + if (pos.y > self.rows) pos.y = self.rows; + pos.x += 32; + pos.y += 32; + sendEvent(button, pos); switch (ev.overrideType || ev.type) { @@ -829,9 +839,19 @@ Terminal.prototype.bindMouse = function() { var button = pressed , pos; - pos = Mouse.getCoords(ev, this.rowContainer, this.charMeasure); + pos = Mouse.getCoords(ev, self.rowContainer, self.charMeasure); if (!pos) return; + // Temp fix until getcoords PR is pushed + pos.x = pos[0]; + pos.y = pos[1]; + if (pos.x < 0) pos.x = 0; + if (pos.x > self.cols) pos.x = self.cols; + if (pos.y < 0) pos.y = 0; + if (pos.y > self.rows) pos.y = self.rows; + pos.x += 32; + pos.y += 32; + // buttons marked as motions // are incremented by 32 button += 32;