mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-13 04:24:25 +00:00
fix cellMotion for tmux. fix mousemove check for VTE. fixes #125.
This commit is contained in:
parent
3dd3f22820
commit
36d94d41a6
lib
@ -89,6 +89,8 @@ function Program(options) {
|
|||||||
this.isRxvt = /rxvt/i.test(process.env.COLORTERM);
|
this.isRxvt = /rxvt/i.test(process.env.COLORTERM);
|
||||||
this.isXterm = false;
|
this.isXterm = false;
|
||||||
|
|
||||||
|
this.isTMUX = this.term('screen') && !!process.env.TMUX;
|
||||||
|
|
||||||
this._buf = '';
|
this._buf = '';
|
||||||
this._flush = this.flush.bind(this);
|
this._flush = this.flush.bind(this);
|
||||||
|
|
||||||
@ -3159,6 +3161,16 @@ Program.prototype.enableMouse = function() {
|
|||||||
if (this.term('xterm')
|
if (this.term('xterm')
|
||||||
|| this.term('screen')
|
|| this.term('screen')
|
||||||
|| (this.tput && this.tput.strings.key_mouse)) {
|
|| (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({
|
return this.setMouse({
|
||||||
vt200Mouse: true,
|
vt200Mouse: true,
|
||||||
utfMouse: true,
|
utfMouse: true,
|
||||||
|
@ -342,6 +342,7 @@ Element.prototype.setContent = function(content, noClear, noTags) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Element.prototype.getContent = function() {
|
Element.prototype.getContent = function() {
|
||||||
|
if (!this._clines) return '';
|
||||||
return this._clines.fake.join('\n');
|
return this._clines.fake.join('\n');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -809,7 +810,7 @@ Element.prototype.enableDrag = function(verify) {
|
|||||||
this.onScreenEvent('mouse', this._dragM = function(data) {
|
this.onScreenEvent('mouse', this._dragM = function(data) {
|
||||||
if (self.screen._dragging !== self) return;
|
if (self.screen._dragging !== self) return;
|
||||||
|
|
||||||
if (data.action !== 'mousedown') {
|
if (data.action !== 'mousedown' && data.action !== 'mousemove') {
|
||||||
delete self.screen._dragging;
|
delete self.screen._dragging;
|
||||||
delete self._drag;
|
delete self._drag;
|
||||||
return;
|
return;
|
||||||
|
@ -545,7 +545,11 @@ Screen.prototype._initHover = function() {
|
|||||||
self.render();
|
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) {
|
this.on('element mouseup', function(el, data) {
|
||||||
|
if (!self._hoverText.getContent()) return;
|
||||||
if (!el._hoverOptions) return;
|
if (!el._hoverOptions) return;
|
||||||
self.append(self._hoverText);
|
self.append(self._hoverText);
|
||||||
self.render();
|
self.render();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user