fix(shell): default fontSize 10px and init new tabs immediately
All checks were successful
Beta Release / beta (push) Successful in 48s
All checks were successful
Beta Release / beta (push) Successful in 48s
- Base font size reduced from 12px to 10px - New tabs now initialize directly when added (was waiting for tab switch because the MutationObserver only fired on visibility changes, not on tab additions) - Zoom level applied to newly created terminals 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
This commit is contained in:
@@ -350,7 +350,7 @@ export default function Shell({ api }) {
|
|||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const tabsRef = useRef({})
|
const tabsRef = useRef({})
|
||||||
const nextIdRef = useRef(1)
|
const nextIdRef = useRef(1)
|
||||||
const settingsRef = useRef({ fontSize: 12, fontFamily: "'JetBrains Mono', 'Fira Code', monospace", theme: 'system' })
|
const settingsRef = useRef({ fontSize: 10, fontFamily: "'JetBrains Mono', 'Fira Code', monospace", theme: 'system' })
|
||||||
const pendingCommandsRef = useRef({})
|
const pendingCommandsRef = useRef({})
|
||||||
|
|
||||||
const [tabs, setTabs] = useState(() => {
|
const [tabs, setTabs] = useState(() => {
|
||||||
@@ -399,7 +399,7 @@ export default function Shell({ api }) {
|
|||||||
const [editingTab, setEditingTab] = useState(null)
|
const [editingTab, setEditingTab] = useState(null)
|
||||||
const [editName, setEditName] = useState('')
|
const [editName, setEditName] = useState('')
|
||||||
const [terminalSettings, setTerminalSettings] = useState({
|
const [terminalSettings, setTerminalSettings] = useState({
|
||||||
fontSize: 12,
|
fontSize: 10,
|
||||||
fontFamily: "'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', 'Menlo', monospace",
|
fontFamily: "'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', 'Menlo', monospace",
|
||||||
theme: 'system',
|
theme: 'system',
|
||||||
})
|
})
|
||||||
@@ -496,7 +496,7 @@ export default function Shell({ api }) {
|
|||||||
api.getConfig().then(d => {
|
api.getConfig().then(d => {
|
||||||
if (d.terminal) {
|
if (d.terminal) {
|
||||||
setTerminalSettings({
|
setTerminalSettings({
|
||||||
fontSize: d.terminal.font_size || 12,
|
fontSize: d.terminal.font_size || 10,
|
||||||
fontFamily: d.terminal.font_family || "'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', 'Menlo', monospace",
|
fontFamily: d.terminal.font_family || "'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', 'Menlo', monospace",
|
||||||
theme: d.terminal.theme || 'system',
|
theme: d.terminal.theme || 'system',
|
||||||
})
|
})
|
||||||
@@ -511,8 +511,9 @@ export default function Shell({ api }) {
|
|||||||
if (!container) return
|
if (!container) return
|
||||||
|
|
||||||
const s = settingsRef.current
|
const s = settingsRef.current
|
||||||
|
const effectiveFontSize = s.fontSize + zoomLevel * 2
|
||||||
const { term, fitAddon, searchAddon } = createTerminal(container, {
|
const { term, fitAddon, searchAddon } = createTerminal(container, {
|
||||||
fontSize: s.fontSize,
|
fontSize: effectiveFontSize,
|
||||||
fontFamily: s.fontFamily,
|
fontFamily: s.fontFamily,
|
||||||
theme: s.theme,
|
theme: s.theme,
|
||||||
})
|
})
|
||||||
@@ -706,6 +707,12 @@ export default function Shell({ api }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const tab of tabs) {
|
||||||
|
if (!tabsRef.current[tab.id]) {
|
||||||
|
tryInitTab(tab, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const wrapper = document.querySelector('.shell-layout')?.parentElement
|
const wrapper = document.querySelector('.shell-layout')?.parentElement
|
||||||
let observer
|
let observer
|
||||||
if (wrapper) {
|
if (wrapper) {
|
||||||
|
|||||||
Reference in New Issue
Block a user