more tmux 2.0 workarounds.
This commit is contained in:
parent
a04c944069
commit
44017d988b
|
@ -467,7 +467,7 @@ The base element.
|
||||||
- __border__ - Border object, see below.
|
- __border__ - Border object, see below.
|
||||||
- __content__ - Element's text content.
|
- __content__ - Element's text content.
|
||||||
- __clickable__ - Element is clickable.
|
- __clickable__ - Element is clickable.
|
||||||
- __input__ - Element is focusable and can receive key input.
|
- __input, keyable__ - Element is focusable and can receive key input.
|
||||||
- __focused__ - Element is focused.
|
- __focused__ - Element is focused.
|
||||||
- __hidden__ - Whether the element is hidden.
|
- __hidden__ - Whether the element is hidden.
|
||||||
- __label__ - A simple text label for the element.
|
- __label__ - A simple text label for the element.
|
||||||
|
|
|
@ -1496,11 +1496,13 @@ Program.prototype._write = function(text) {
|
||||||
// Real: `DCS tmux; ESC Pt ESC \`
|
// Real: `DCS tmux; ESC Pt ESC \`
|
||||||
Program.prototype._twrite = function(data) {
|
Program.prototype._twrite = function(data) {
|
||||||
if (this.tmux) {
|
if (this.tmux) {
|
||||||
|
// Replace all STs with BELs so they can be nested within the DCS code.
|
||||||
|
data = data.replace(/\x1b\\/g, '\x07');
|
||||||
|
// Wrap in tmux forward DCS:
|
||||||
data = '\x1bPtmux;\x1b' + data + '\x1b\\';
|
data = '\x1bPtmux;\x1b' + data + '\x1b\\';
|
||||||
// Should work but tmux doesn't implement ST correctly:
|
|
||||||
// data = '\x1bPtmux;\x1b' + data + '\x07';
|
|
||||||
// NOTE: Flushing the buffer is required in some cases.
|
// NOTE: Flushing the buffer is required in some cases.
|
||||||
this.flush();
|
this.flush();
|
||||||
|
// Write out raw now that the buffer is flushed.
|
||||||
return this.output.write(data);
|
return this.output.write(data);
|
||||||
}
|
}
|
||||||
return this._write(data);
|
return this._write(data);
|
||||||
|
|
|
@ -136,6 +136,7 @@ function Element(options) {
|
||||||
if (this.border.bottom == null) this.border.bottom = true;
|
if (this.border.bottom == null) this.border.bottom = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (options.mouse || options.clickable) {
|
||||||
if (options.clickable) {
|
if (options.clickable) {
|
||||||
this.screen._listenMouse(this);
|
this.screen._listenMouse(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,6 +262,7 @@ Listbar.prototype.appendItem = function(item, callback) {
|
||||||
this.select(0);
|
this.select(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX May be affected by new element.options.mouse option.
|
||||||
if (this.mouse) {
|
if (this.mouse) {
|
||||||
el.on('click', function(data) {
|
el.on('click', function(data) {
|
||||||
self.emit('action', el, self.selected);
|
self.emit('action', el, self.selected);
|
||||||
|
|
|
@ -97,6 +97,7 @@ Message.prototype.display = function(text, time, callback) {
|
||||||
self.removeScreenEvent('keypress', fn);
|
self.removeScreenEvent('keypress', fn);
|
||||||
end();
|
end();
|
||||||
});
|
});
|
||||||
|
// XXX May be affected by new element.options.mouse option.
|
||||||
if (!self.options.mouse) return;
|
if (!self.options.mouse) return;
|
||||||
self.onScreenEvent('mouse', function fn(data) {
|
self.onScreenEvent('mouse', function fn(data) {
|
||||||
if (data.action === 'mousemove') return;
|
if (data.action === 'mousemove') return;
|
||||||
|
|
|
@ -31,6 +31,11 @@ function Terminal(options) {
|
||||||
|
|
||||||
Box.call(this, options);
|
Box.call(this, options);
|
||||||
|
|
||||||
|
// XXX Workaround for all motion
|
||||||
|
if (this.screen.program.tmux && this.screen.program.tmuxVersion >= 2) {
|
||||||
|
this.screen.program.enableMouse();
|
||||||
|
}
|
||||||
|
|
||||||
this.handler = options.handler;
|
this.handler = options.handler;
|
||||||
this.shell = options.shell || process.env.SHELL || 'sh';
|
this.shell = options.shell || process.env.SHELL || 'sh';
|
||||||
this.args = options.args || [];
|
this.args = options.args || [];
|
||||||
|
@ -187,6 +192,11 @@ Terminal.prototype.bootstrap = function() {
|
||||||
self.emit('title', title);
|
self.emit('title', title);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.term.on('passthrough', function(data) {
|
||||||
|
self.screen.program.flush();
|
||||||
|
self.screen.program.output.write(data);
|
||||||
|
});
|
||||||
|
|
||||||
this.on('resize', function() {
|
this.on('resize', function() {
|
||||||
nextTick(function() {
|
nextTick(function() {
|
||||||
self.term.resize(self.width - self.iwidth, self.height - self.iheight);
|
self.term.resize(self.width - self.iwidth, self.height - self.iheight);
|
||||||
|
|
Loading…
Reference in New Issue