Support Ghostty 1.4, version 1.0.2

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>
This commit is contained in:
mikeandClaude Opus 5.5 committed 2026-10-28 10:44:23 +01:00
1 parent fb5602452a
commit df261910c5
26 files changed
+920 -132

No files matched your search

+52 -1
View File
@@ -59,6 +59,24 @@ type Option struct {
Category string `json:"-"`
Platform string `json:"-"` // "", "macOS" or "Linux"
// OldValues are values Ghostty no longer documents but still accepts
// (from Schema.Compat).
OldValues []string `json:"-"`
}
// Compat is an entry of Ghostty's compatibility table: a key or value from
// an older release that Ghostty still reads although it is no longer
// documented.
type Compat struct {
Key string `json:"key"`
RenamedTo string `json:"renamedTo,omitempty"` // the key's current name
Values []string `json:"values,omitempty"` // old values of a current option
Sets []string `json:"sets,omitempty"` // options an old key sets instead
}
// IsOldValue reports whether v is an old value Ghostty still accepts.
func (o *Option) IsOldValue(v string) bool {
return contains(o.OldValues, strings.TrimSpace(Unquote(v)))
}
// Default returns the default value for scalar options ("" when unset).
@@ -100,6 +118,9 @@ func (o *Option) TypeLabel() string {
} else if o.Min != nil {
s += fmt.Sprintf(" (%s or more)", num(*o.Min))
}
if len(o.Values) > 0 {
s += " or " + strings.Join(o.Values, ", ")
}
case KindFloat:
s = "number"
if o.Min != nil && o.Max != nil {
@@ -143,10 +164,12 @@ func (o *Option) TypeLabel() string {
type Schema struct {
GhosttyVersion string `json:"ghosttyVersion"`
Options []*Option `json:"options"`
Compat []*Compat `json:"compat,omitempty"`
// Source describes where docs and defaults came from.
Source string `json:"-"`
byKey map[string]*Option
byKey map[string]*Option
compatBy map[string]*Compat
}
//go:embed schema.json
@@ -168,13 +191,41 @@ func (s *Schema) Lookup(key string) *Option {
return s.byKey[key]
}
// OldKey returns the compatibility entry for a key that is no longer an
// option of its own (renamed or replaced), or nil.
func (s *Schema) OldKey(key string) *Compat {
if c := s.compatBy[key]; c != nil && s.byKey[key] == nil {
return c
}
return nil
}
// OldNames returns the old keys that Ghostty reads as key.
func (s *Schema) OldNames(key string) []string {
var out []string
for _, c := range s.Compat {
if c.RenamedTo == key && s.byKey[c.Key] == nil {
out = append(out, c.Key)
}
}
return out
}
func (s *Schema) finish() {
s.byKey = make(map[string]*Option, len(s.Options))
for _, o := range s.Options {
o.Category = categorize(o.Key)
o.Platform = platform(o)
o.OldValues = nil
s.byKey[o.Key] = o
}
s.compatBy = make(map[string]*Compat, len(s.Compat))
for _, c := range s.Compat {
s.compatBy[c.Key] = c
if o := s.byKey[c.Key]; o != nil {
o.OldValues = c.Values
}
}
}
// Refresh replaces docs and defaults with the output of