mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-29 11:14:23 +00:00
fix: prefer nerd fonts in desktop terminal
This commit is contained in:
parent
17bd7ffbf1
commit
d7111a7072
2 changed files with 11 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ import { useLanguage } from "@/context/language"
|
|||
import { usePlatform } from "@/context/platform"
|
||||
import { useSDK } from "@/context/sdk"
|
||||
import { useServer } from "@/context/server"
|
||||
import { monoFontFamily, useSettings } from "@/context/settings"
|
||||
import { terminalFontFamily, useSettings } from "@/context/settings"
|
||||
import type { LocalPTY } from "@/context/terminal"
|
||||
import { disposeIfDisposable, getHoveredLinkText, setOptionIfSupported } from "@/utils/runtime-adapters"
|
||||
import { terminalWriter } from "@/utils/terminal-writer"
|
||||
|
|
@ -300,7 +300,7 @@ export const Terminal = (props: TerminalProps) => {
|
|||
})
|
||||
|
||||
createEffect(() => {
|
||||
const font = monoFontFamily(settings.appearance.font())
|
||||
const font = terminalFontFamily(settings.appearance.font())
|
||||
if (!term) return
|
||||
setOptionIfSupported(term, "fontFamily", font)
|
||||
scheduleFit()
|
||||
|
|
@ -360,7 +360,7 @@ export const Terminal = (props: TerminalProps) => {
|
|||
cols: restoreSize?.cols,
|
||||
rows: restoreSize?.rows,
|
||||
fontSize: 14,
|
||||
fontFamily: monoFontFamily(settings.appearance.font()),
|
||||
fontFamily: terminalFontFamily(settings.appearance.font()),
|
||||
allowTransparency: false,
|
||||
convertEol: false,
|
||||
theme: terminalColors(),
|
||||
|
|
|
|||
|
|
@ -53,9 +53,13 @@ export const sansDefault = "System Sans"
|
|||
|
||||
const monoFallback =
|
||||
'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
|
||||
const terminalMonoFallback =
|
||||
'"Symbols Nerd Font Mono", "Symbols Nerd Font", "JetBrainsMono NFM", "JetBrainsMono NF", "JetBrainsMono Nerd Font Mono", "Hack Nerd Font Mono", "Hack Nerd Font", "MesloLGM Nerd Font Mono", "MesloLGM Nerd Font", "CaskaydiaCove NFM", "CaskaydiaCove Nerd Font Mono", "CaskaydiaMono Nerd Font Mono", ' +
|
||||
monoFallback
|
||||
const sansFallback = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
|
||||
|
||||
const monoBase = monoFallback
|
||||
const terminalMonoBase = terminalMonoFallback
|
||||
const sansBase = sansFallback
|
||||
|
||||
function input(font: string | undefined) {
|
||||
|
|
@ -85,6 +89,10 @@ export function monoFontFamily(font: string | undefined) {
|
|||
return stack(font, monoBase)
|
||||
}
|
||||
|
||||
export function terminalFontFamily(font: string | undefined) {
|
||||
return stack(font, terminalMonoBase)
|
||||
}
|
||||
|
||||
export function sansFontFamily(font: string | undefined) {
|
||||
return stack(font, sansBase)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue