fix(terminal): restore terminal input and cursor visibility
All checks were successful
Beta Release / beta (push) Successful in 38s

- Fix shell execution to avoid --login flag causing issues on some shells
- Improve terminal initialization timing with requestAnimationFrame
- Force display visibility on xterm instances via CSS
- Ensure container has proper min-height and overflow handling

Assisted-by: MiniMax-M2.7 via Crush <crush@charm.land>
This commit is contained in:
Augustin
2026-04-22 18:46:29 +02:00
parent 04b0fff791
commit bcba5932d5
3 changed files with 27 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"os" "os"
"os/exec" "os/exec"
"path/filepath"
"runtime" "runtime"
"strings" "strings"
"sync" "sync"
@@ -109,12 +110,16 @@ func (s *Server) handleTerminalWS(w http.ResponseWriter, r *http.Request) {
return return
} }
if strings.Contains(shell, "wsl") { shellName := filepath.Base(shell)
switch shellName {
case "wsl":
cmd = exec.Command(shell, "--shell-type", "login") cmd = exec.Command(shell, "--shell-type", "login")
} else if strings.Contains(shell, "powershell") || strings.Contains(shell, "pwsh") { case "powershell", "pwsh":
cmd = exec.Command(shell, "-NoLogo", "-NoProfile") cmd = exec.Command(shell, "-NoLogo", "-NoProfile")
} else { case "fish":
cmd = exec.Command(shell, "--login") cmd = exec.Command(shell, "--login")
default:
cmd = exec.Command(shell)
} }
} }

View File

@@ -239,15 +239,25 @@ export default function Shell({ api }) {
useEffect(() => { useEffect(() => {
const tab = tabs.find(t => t.id === activeTab) const tab = tabs.find(t => t.id === activeTab)
if (tab && !tabsRef.current[tab.id]) { if (!tab) return
const timer = setTimeout(() => initTerminal(tab.id, tab), 50)
return () => clearTimeout(timer) const container = document.getElementById(`terminal-${tab.id}`)
} else if (tab && tabsRef.current[tab.id]) { if (!container) return
if (!tabsRef.current[tab.id]) {
const timer = setTimeout(() => { const timer = setTimeout(() => {
const { fitAddon } = tabsRef.current[tab.id] initTerminal(tab.id, tab)
fitAddon.fit() requestAnimationFrame(() => {
}, 50) const entry = tabsRef.current[tab.id]
if (entry) entry.fitAddon.fit()
})
}, 100)
return () => clearTimeout(timer) return () => clearTimeout(timer)
} else {
requestAnimationFrame(() => {
const entry = tabsRef.current[tab.id]
if (entry) entry.fitAddon.fit()
})
} }
}, [activeTab, tabs, initTerminal]) }, [activeTab, tabs, initTerminal])

View File

@@ -269,7 +269,7 @@ input::placeholder { color: var(--text-disabled); }
.sidebar-tab.active { background: var(--accent); color: #fff; font-weight: 600; } .sidebar-tab.active { background: var(--accent); color: #fff; font-weight: 600; }
.shell-layout { display: flex; height: 100%; } .shell-layout { display: flex; height: 100%; }
.shell-terminal-col { flex: 1; display: flex; flex-direction: column; min-width: 0; } .shell-terminal-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.shell-tabs-bar { .shell-tabs-bar {
display: flex; align-items: center; background: var(--bg-surface); display: flex; align-items: center; background: var(--bg-surface);
@@ -377,6 +377,7 @@ input::placeholder { color: var(--text-disabled); }
.shell-xterm-wrapper { flex: 1; background: var(--bg); overflow: hidden; position: relative; } .shell-xterm-wrapper { flex: 1; background: var(--bg); overflow: hidden; position: relative; }
.shell-xterm-instance { .shell-xterm-instance {
position: absolute; inset: 0; padding: 4px; position: absolute; inset: 0; padding: 4px;
display: block !important;
} }
.shell-xterm-instance .xterm { height: 100%; padding: 4px; } .shell-xterm-instance .xterm { height: 100%; padding: 4px; }