diff --git a/lib/widget.js b/lib/widget.js index 3698ad3..edc6edc 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -6519,7 +6519,8 @@ Listbar.prototype.addItem = Listbar.prototype.appendItem = function(item, callback) { var self = this , prev = this.items[this.items.length - 1] - , drawn = prev ? prev.aleft + prev.width : 0 + , lpos = prev && (prev._getCoords() || { xi: prev.aleft }) + , drawn = prev ? lpos.xi + prev.width : 0 , cmd , title , len; @@ -6858,10 +6859,12 @@ Terminal.prototype.bootstrap = function() { this.screen.on('mouse', function(data) { if (self.screen.focused !== self) return; - if (data.x < self.aleft + self.ileft) return; - if (data.y < self.atop + self.itop) return; - if (data.x > self.aleft - self.ileft + self.width) return; - if (data.y > self.atop - self.itop + self.height) return; + var lpos = self._getCoords() || { xi: self.aleft, yi: self.atop }; + + if (data.x < lpos.xi + self.ileft) return; + if (data.y < lpos.yi + self.itop) return; + if (data.x > lpos.xi - self.ileft + self.width) return; + if (data.y > lpos.yi - self.itop + self.height) return; if (self.term.x10Mouse || self.term.vt200Mouse @@ -6876,8 +6879,8 @@ Terminal.prototype.bootstrap = function() { } var b = data.raw[0] - , x = data.x - self.aleft - , y = data.y - self.atop + , x = data.x - lpos.xi + , y = data.y - lpos.yi , s; if (self.term.urxvtMouse) { @@ -7217,22 +7220,23 @@ Image.prototype.setImage = function(img, callback) { : callback(null, success); }); - var width = self.width * ratio.tw | 0 + var lpos = self._getCoords() || { xi: self.aleft, yi: self.atop } + , width = self.width * ratio.tw | 0 , height = self.height * ratio.th | 0 - , aleft = self.aleft * ratio.tw | 0 - , atop = self.atop * ratio.th | 0; + , xi = lpos.xi * ratio.tw | 0 + , yi = lpos.yi * ratio.th | 0; var input = '0;1;' - + aleft + ';' - + atop + ';' + + xi + ';' + + yi + ';' + width + ';' + height + ';;;;;' + img + '\n4;\n3;\n'; self._props = { - aleft: aleft, - atop: atop, + xi: xi, + yi: yi, width: width, height: height }; @@ -7264,13 +7268,15 @@ Image.prototype.setImage = function(img, callback) { return callback(err); } + var lpos = self._getCoords() || { xi: self.aleft, yi: self.atop }; + if (self._lastSize && ratio.tw === self._lastSize.tw && ratio.th === self._lastSize.th && size.width === self._lastSize.width && size.height === self._lastSize.height - && self.aleft === self._lastSize.aleft - && self.atop === self._lastSize.atop) { + && lpos.xi === self._lastSize.xi + && lpos.yi === self._lastSize.yi) { if (!callback) return; return callback(null, success); } @@ -7280,8 +7286,8 @@ Image.prototype.setImage = function(img, callback) { th: ratio.th, width: size.width, height: size.height, - aleft: self.aleft, - atop: self.atop + xi: lpos.xi, + yi: lpos.yi }; self.position.width = size.width / ratio.tw | 0; @@ -7330,12 +7336,12 @@ Image.prototype.clearImage = function(callback) { var width = this._props.width + 2 , height = this._props.height + 2 - , aleft = this._props.aleft - , atop = this._props.atop; + , xi = this._props.xi + , yi = this._props.yi; var input = '6;' - + aleft + ';' - + atop + ';' + + xi + ';' + + yi + ';' + width + ';' + height + '\n4;\n3;\n';