fix(run): turn on tmux mouse mode on every attach, not just at session creation
Sessions created before the mouse-on fix landed (or before the server restarted to pick it up) never got the set-option call, so their pane still had no drag/wheel scroll. Moving it into pty-attach's attach() makes it idempotent per-connection instead of once-at-birth.
This commit is contained in:
+12
-4
@@ -40,10 +40,17 @@ function hasSession(name) {
|
||||
*/
|
||||
function newSession({ name, cwd, argv }) {
|
||||
execImpl(["new-session", "-d", "-s", name, "-c", cwd, "--", ...argv]);
|
||||
// Without this the pane has no scrollbar/drag scroll at all — wheel events
|
||||
// just pass through to the running program instead of entering tmux's own
|
||||
// copy-mode scrollback. xterm.js forwards tmux's mouse-tracking escapes
|
||||
// automatically once mouse mode is on, so no client-side change is needed.
|
||||
enableMouse(name);
|
||||
}
|
||||
|
||||
// Without this the pane has no scrollbar/drag scroll at all — wheel events
|
||||
// just pass through to the running program instead of entering tmux's own
|
||||
// copy-mode scrollback. xterm.js forwards tmux's mouse-tracking escapes
|
||||
// automatically once mouse mode is on, so no client-side change is needed.
|
||||
// Called on every attach (not just at creation) so a session started before
|
||||
// this option existed — or before a server restart picked up the change —
|
||||
// still gets it; `set-option` is idempotent, so re-running it is harmless.
|
||||
function enableMouse(name) {
|
||||
execImpl(["set-option", "-t", name, "mouse", "on"]);
|
||||
}
|
||||
|
||||
@@ -112,6 +119,7 @@ function isTmuxAvailable() {
|
||||
module.exports = {
|
||||
hasSession,
|
||||
newSession,
|
||||
enableMouse,
|
||||
paneCommand,
|
||||
sendCommand,
|
||||
killSession,
|
||||
|
||||
Reference in New Issue
Block a user