kitty/kittens/choose_fonts
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
..
__init__.py Replace list_fonts with choose-fonts kitten 2024-06-24 07:54:13 +05:30
backend.go Rename go module from kitty -> github.com/kovidgoyal/kitty 2025-05-16 08:43:39 +05:30
backend.py rename typing module to avoid conflicts with stdlib typing 2025-04-28 09:20:10 +05:30
face.go run modernize 2025-11-11 17:09:37 +05:30
faces.go fix(choose-fonts): guard preview rendering against partial terminal color query 2026-06-10 02:18:18 -07:00
family_list.go Rename go module from kitty -> github.com/kovidgoyal/kitty 2025-05-16 08:43:39 +05:30
final.go Rename go module from kitty -> github.com/kovidgoyal/kitty 2025-05-16 08:43:39 +05:30
graphics.go Nicer error message 2025-07-09 11:48:40 +05:30
index_feature.go Rename go module from kitty -> github.com/kovidgoyal/kitty 2025-05-16 08:43:39 +05:30
list.go fix(choose-fonts): guard preview rendering against partial terminal color query 2026-06-10 02:18:18 -07:00
main.go Rename go module from kitty -> github.com/kovidgoyal/kitty 2025-05-16 08:43:39 +05:30
main.py DRYer 2024-07-05 13:23:41 +05:30
styles.go Rename go module from kitty -> github.com/kovidgoyal/kitty 2025-05-16 08:43:39 +05:30
types.go Make go vet happy 2025-09-08 10:08:37 +05:30
ui.go fix(choose-fonts): guard preview rendering against partial terminal color query 2026-06-10 02:18:18 -07:00