Commit graph

20 commits

Author SHA1 Message Date
Forrest
83677a2235 fix(choose-fonts): guard preview rendering against partial terminal color query
The choose-fonts kitten queries the terminal for the user's foreground and
background colors at startup by sending a DCS request. The terminal responds
with separate DCS response strings — one per field — which arrive
asynchronously through on_query_response.

The background handler unconditionally called draw_screen() after storing its
value. If the terminal's DCS response for "background" arrived before the
response for "foreground", draw_screen() fired with text_style.Foreground
still at its Go zero value ("").

The font list preview (list.go) only guarded against empty Background, not
empty Foreground, so it passed the check and sent a render_family_samples
command to the Python backend with foreground="". The backend's to_color('')
raised ValueError: Invalid color name: '', crashing the kitten.

The faces pane (faces.go) launched a render_family_samples goroutine
unconditionally when its preview cache was empty, with no guard at all.

Fix
---
1. ui.go — Only trigger draw_screen() from the foreground or background
   handler when the counterpart field is already populated, so the UI
   never renders with a partial TextStyle.

2. list.go — Require both Foreground and Background to be non-empty
   before rendering the font preview, not just Background alone.

3. faces.go — Skip the render_family_samples goroutine if either color
   field is still empty. The preview cache stays empty, so the next
   redraw (triggered when the counterpart query response arrives, or
   by on_wakeup) retries with full colors.
2026-06-10 02:18:18 -07:00
Kovid Goyal
c861259e3b
Rename go module from kitty -> github.com/kovidgoyal/kitty
Makes the code more easily re-useable in other projects
2025-05-16 08:43:39 +05:30
Kovid Goyal
a2b296d73e
Setting of index features now basically works 2024-06-24 07:54:19 +05:30
Kovid Goyal
815df1e210
Wire up applying of font config 2024-06-24 07:54:17 +05:30
Kovid Goyal
7fafdeef48
More work on choose_fonts 2024-06-24 07:54:17 +05:30
Kovid Goyal
5d86f5c93f
Start work on face panel 2024-06-24 07:54:15 +05:30
Kovid Goyal
802ed976a9
Start work on faces panel 2024-06-24 07:54:15 +05:30
Kovid Goyal
5a189b1afe
Fix graphics being freed instead of deleted in draw_screen() 2024-06-24 07:54:15 +05:30
Kovid Goyal
a0840a7328
Get preview to basically display 2024-06-24 07:54:15 +05:30
Kovid Goyal
6c11f0eeb5
Move listing code into its own file 2024-06-24 07:54:15 +05:30
Kovid Goyal
1d6cd27c6f
Code to get specs from options 2024-06-24 07:54:14 +05:30
Kovid Goyal
6d751b94f6
Start work on displaying font sampler images 2024-06-24 07:54:14 +05:30
Kovid Goyal
f0cac79143
Work on rendering sample text for a font 2024-06-24 07:54:14 +05:30
Kovid Goyal
af9f205ec4
Also get the current fg/bg colors to render text with 2024-06-24 07:54:14 +05:30
Kovid Goyal
b6e92dd79d
Query font size and DPI from terminal 2024-06-24 07:54:13 +05:30
Kovid Goyal
8844ae3a10
Report when a family has variable fonts 2024-06-24 07:54:13 +05:30
Kovid Goyal
96f8dbbbeb
Get clicking on family names functional 2024-06-24 07:54:13 +05:30
Kovid Goyal
a0bed32614
... 2024-06-24 07:54:13 +05:30
Kovid Goyal
16d0f4b4ab
Wire up the backend 2024-06-24 07:54:13 +05:30
Kovid Goyal
f2d5631c47
Replace list_fonts with choose-fonts kitten 2024-06-24 07:54:13 +05:30
Renamed from tools/cmd/list_fonts/ui.go (Browse further)