@@ -18,6 +18,7 @@ import {
1818 type ThreadId ,
1919} from "@t3tools/contracts" ;
2020import { getTerminalLabel } from "@t3tools/shared/terminalLabels" ;
21+ import * as Schema from "effect/Schema" ;
2122import {
2223 type PointerEvent as ReactPointerEvent ,
2324 type ReactNode ,
@@ -57,13 +58,15 @@ import {
5758} from "../types" ;
5859import { readLocalApi } from "~/localApi" ;
5960import { useClientSettings } from "../hooks/useSettings" ;
61+ import { useLocalStorage } from "../hooks/useLocalStorage" ;
6062import { useAttachedTerminalSession } from "../state/terminalSessions" ;
6163import { serverEnvironment } from "../state/server" ;
6264import { previewEnvironment } from "../state/preview" ;
6365import { terminalEnvironment } from "../state/terminal" ;
6466import { openTerminalLinkInPreview } from "./preview/openTerminalLinkInPreview" ;
6567import { useAtomCommand } from "../state/use-atom-command" ;
6668import { preventTerminalCloseShortcut } from "../lib/terminalCloseShortcut" ;
69+ import { resolveTerminalFontPreference , TYPOGRAPHY_ADVANCED_STORAGE_KEY } from "../appearanceFonts" ;
6770
6871const MIN_DRAWER_HEIGHT = 180 ;
6972const MAX_DRAWER_HEIGHT_RATIO = 0.75 ;
@@ -241,6 +244,7 @@ export function shouldHandleTerminalExit(
241244}
242245
243246interface TerminalViewportProps {
247+ advancedTypography : boolean ;
244248 threadRef : ScopedThreadRef ;
245249 threadId : ThreadId ;
246250 terminalId : string ;
@@ -264,6 +268,7 @@ interface TerminalLaunchLocation {
264268}
265269
266270export function TerminalViewport ( {
271+ advancedTypography,
267272 threadRef,
268273 threadId,
269274 terminalId,
@@ -312,10 +317,12 @@ export function TerminalViewport({
312317 onAddTerminalContext ( selection ) ;
313318 } ) ;
314319 const readTerminalLabel = useEffectEvent ( ( ) => terminalLabel ) ;
315- // The terminal inherits the monospace (code) preference unless it has an
316- // override of its own, so one font choice drives every mono surface.
317- const terminalFontFamily = useClientSettings (
318- ( settings ) => settings . fontFamilyTerminal . trim ( ) || settings . fontFamilyCode ,
320+ const terminalFontFamily = useClientSettings ( ( settings ) =>
321+ resolveTerminalFontPreference ( {
322+ advanced : advancedTypography ,
323+ code : settings . fontFamilyCode ,
324+ terminal : settings . fontFamilyTerminal ,
325+ } ) ,
319326 ) ;
320327 const terminalFontSize = useClientSettings ( ( settings ) => settings . fontSizeTerminal ) ;
321328 const terminalFontRef = useRef ( { family : terminalFontFamily , size : terminalFontSize } ) ;
@@ -921,6 +928,11 @@ export default function ThreadTerminalDrawer({
921928 terminalLaunchLocationsById,
922929} : ThreadTerminalDrawerProps ) {
923930 const isPanel = mode === "panel" ;
931+ const [ advancedTypography ] = useLocalStorage (
932+ TYPOGRAPHY_ADVANCED_STORAGE_KEY ,
933+ false ,
934+ Schema . Boolean ,
935+ ) ;
924936 const controlledDrawerHeight = clampDrawerHeight ( height ) ;
925937 const [ drawerHeightState , setDrawerHeightState ] = useState ( ( ) => ( {
926938 threadId,
@@ -1357,6 +1369,7 @@ export default function ThreadTerminalDrawer({
13571369 >
13581370 < div className = "h-full p-1" >
13591371 < TerminalViewport
1372+ advancedTypography = { advancedTypography }
13601373 threadRef = { threadRef }
13611374 threadId = { threadId }
13621375 terminalId = { terminalId }
@@ -1384,6 +1397,7 @@ export default function ThreadTerminalDrawer({
13841397 ) : (
13851398 < div className = "h-full p-1" >
13861399 < TerminalViewport
1400+ advancedTypography = { advancedTypography }
13871401 key = { resolvedActiveTerminalId }
13881402 threadRef = { threadRef }
13891403 threadId = { threadId }
0 commit comments