The built-in schema now describes Ghostty 1.4.0: 212 options, the new choices of copy-on-select, window-padding-balance = equal, number limits that also take "unlimited", and categories for the new options. genschema reads Ghostty's compatibility table, so old names and values Ghostty still accepts are no longer reported as errors: a renamed key such as scrollback-limit is shown in yellow and renamed in place with enter, a replaced option names its successors, and old values such as copy-on-select = true are accepted with a note. Theme previews expand ~/ like Ghostty 1.4 and only look where Ghostty looks for user themes. Theme names with parentheses of their own keep them. A live test checks every ghostty command against the installed Ghostty. Docs and screenshots updated for 1.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package ghostty
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"slices"
|
|
"testing"
|
|
)
|
|
|
|
func TestLoadThemeExpandsHome(t *testing.T) {
|
|
home := t.TempDir()
|
|
t.Setenv("HOME", home)
|
|
dir := filepath.Join(home, "themes")
|
|
if err := os.MkdirAll(dir, 0o755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
theme := "background = #252528\npalette = 1=#f38ba8\n"
|
|
if err := os.WriteFile(filepath.Join(dir, "mine"), []byte(theme), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
th, err := (&Ghostty{}).LoadTheme("~/themes/mine")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if th.Background != "#252528" || th.Palette[1] != "#f38ba8" {
|
|
t.Errorf("theme: %+v", th)
|
|
}
|
|
}
|
|
|
|
// Ghostty looks for user themes in the XDG config directory only, also on
|
|
// macOS, where the config file usually lives under Application Support.
|
|
func TestThemeDirsFollowGhostty(t *testing.T) {
|
|
home := t.TempDir()
|
|
t.Setenv("HOME", home)
|
|
t.Setenv("XDG_CONFIG_HOME", "")
|
|
t.Setenv("GHOSTTY_RESOURCES_DIR", "")
|
|
got := (&Ghostty{}).ThemeDirs()
|
|
want := []string{filepath.Join(home, ".config", "ghostty", "themes")}
|
|
if !slices.Equal(got, want) {
|
|
t.Errorf("ThemeDirs = %v, want %v", got, want)
|
|
}
|
|
}
|