fix: refit terminal after sidebar toggle animation completes
toggleSidebar() flipped the sidebar--collapsed CSS class but never told xterm.js to recalculate its dimensions. The terminal canvas kept its old column/row count until a new session was opened (which creates a fresh terminal that measures correctly on first fit()). Fix: expose window._refitTerminal() from terminal.js, then call it via a transitionend listener in toggleSidebar() so the terminal refits once the 250ms CSS width/transform transition finishes. Bumps version to 0.4.5.
This commit is contained in:
@@ -804,6 +804,13 @@ function toggleSidebar() {
|
|||||||
|
|
||||||
var collapseBtn = $('sidebar-collapse-btn');
|
var collapseBtn = $('sidebar-collapse-btn');
|
||||||
if (collapseBtn) collapseBtn.textContent = isOpen ? '\u2039' : '\u203a';
|
if (collapseBtn) collapseBtn.textContent = isOpen ? '\u2039' : '\u203a';
|
||||||
|
|
||||||
|
// Refit xterm.js after the sidebar CSS transition completes (0.25s ease).
|
||||||
|
// 'width' fires on desktop (flex layout); 'transform' fires on mobile (overlay).
|
||||||
|
sidebar.addEventListener('transitionend', function(e) {
|
||||||
|
if (e.propertyName !== 'width' && e.propertyName !== 'transform') return;
|
||||||
|
if (window._refitTerminal) window._refitTerminal();
|
||||||
|
}, { once: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -542,6 +542,13 @@ function setTerminalFontSize(size) {
|
|||||||
|
|
||||||
window._setTerminalFontSize = setTerminalFontSize;
|
window._setTerminalFontSize = setTerminalFontSize;
|
||||||
|
|
||||||
|
// Refit the terminal to its container dimensions.
|
||||||
|
// Call after layout changes (e.g. sidebar toggle) that alter available space.
|
||||||
|
window._refitTerminal = function() {
|
||||||
|
if (!_fitAddon) return;
|
||||||
|
try { _fitAddon.fit(); } catch (_) {}
|
||||||
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Mobile touch scroll — rAF-batched WheelEvent dispatch
|
// Mobile touch scroll — rAF-batched WheelEvent dispatch
|
||||||
// Mobile devices batch touchmove events irregularly; dispatching one WheelEvent
|
// Mobile devices batch touchmove events irregularly; dispatching one WheelEvent
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "muxplex"
|
name = "muxplex"
|
||||||
version = "0.4.4"
|
version = "0.4.5"
|
||||||
description = "Web-based tmux session dashboard — access all your tmux sessions from any browser"
|
description = "Web-based tmux session dashboard — access all your tmux sessions from any browser"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
|
|||||||
Reference in New Issue
Block a user