fix cellMotion for tmux. fix mousemove check for VTE. fixes #125.
This commit is contained in:
parent
3dd3f22820
commit
36d94d41a6
|
@ -89,6 +89,8 @@ function Program(options) {
|
|||
this.isRxvt = /rxvt/i.test(process.env.COLORTERM);
|
||||
this.isXterm = false;
|
||||
|
||||
this.isTMUX = this.term('screen') && !!process.env.TMUX;
|
||||
|
||||
this._buf = '';
|
||||
this._flush = this.flush.bind(this);
|
||||
|
||||
|
@ -3159,6 +3161,16 @@ Program.prototype.enableMouse = function() {
|
|||
if (this.term('xterm')
|
||||
|| this.term('screen')
|
||||
|| (this.tput && this.tput.strings.key_mouse)) {
|
||||
// NOTE: Latest versions of tmux seem to only
|
||||
// support cellMotion (not allMotion).
|
||||
if (process.env.TMUX) {
|
||||
return this.setMouse({
|
||||
vt200Mouse: true,
|
||||
utfMouse: true,
|
||||
cellMotion: true,
|
||||
allMotion: true
|
||||
}, true);
|
||||
}
|
||||
return this.setMouse({
|
||||
vt200Mouse: true,
|
||||
utfMouse: true,
|
||||
|
|
|
@ -342,6 +342,7 @@ Element.prototype.setContent = function(content, noClear, noTags) {
|
|||
};
|
||||
|
||||
Element.prototype.getContent = function() {
|
||||
if (!this._clines) return '';
|
||||
return this._clines.fake.join('\n');
|
||||
};
|
||||
|
||||
|
@ -809,7 +810,7 @@ Element.prototype.enableDrag = function(verify) {
|
|||
this.onScreenEvent('mouse', this._dragM = function(data) {
|
||||
if (self.screen._dragging !== self) return;
|
||||
|
||||
if (data.action !== 'mousedown') {
|
||||
if (data.action !== 'mousedown' && data.action !== 'mousemove') {
|
||||
delete self.screen._dragging;
|
||||
delete self._drag;
|
||||
return;
|
||||
|
|
|
@ -545,7 +545,11 @@ Screen.prototype._initHover = function() {
|
|||
self.render();
|
||||
});
|
||||
|
||||
// XXX This can cause problems if the
|
||||
// terminal does not support allMotion.
|
||||
// Workaround: check to see if content is set.
|
||||
this.on('element mouseup', function(el, data) {
|
||||
if (!self._hoverText.getContent()) return;
|
||||
if (!el._hoverOptions) return;
|
||||
self.append(self._hoverText);
|
||||
self.render();
|
||||
|
|
Loading…
Reference in New Issue