From ccecfa037b1ce6bae0cc147da7d66dee46309401 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 31 Oct 2026 08:33:43 +0530 Subject: [PATCH] Cleanup previous PR --- docs/changelog.rst | 2 +- kittens/themes/main.go | 6 +---- kittens/themes/main_test.go | 50 ------------------------------------- 3 files changed, 2 insertions(+), 56 deletions(-) delete mode 100644 kittens/themes/main_test.go diff --git a/docs/changelog.rst b/docs/changelog.rst index f4bbd6413..e783ba0dc 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -426,7 +426,7 @@ Detailed list of changes not define them (:iss:`10691`, :iss:`10661`, :pull:`10727`, :pull:`10737`) - Themes kitten: Fix overwriting the Unicode input kitten's recent entries - and input mode, and vice versa, by using separate caches + and input mode, and vice versa, by using separate caches (:pull:`10780`) - Transfer kitten: When receiving files, replace existing symbolic and hard links at the destination instead of overwriting the files they point to, and diff --git a/kittens/themes/main.go b/kittens/themes/main.go index 2770338bd..565a9584f 100644 --- a/kittens/themes/main.go +++ b/kittens/themes/main.go @@ -19,10 +19,6 @@ import ( var _ = fmt.Print -func new_cached_values() *utils.CachedValues[*CachedData] { - return utils.NewCachedValues("themes", &CachedData{Category: "All"}) -} - func complete_themes(completions *cli.Completions, word string, arg_num int) { themes.CompleteThemes(completions, word, arg_num) } @@ -67,7 +63,7 @@ func main(_ *cli.Command, opts *Options, args []string) (rc int, err error) { if err != nil { return 1, err } - cv := new_cached_values() + cv := utils.NewCachedValues("themes", &CachedData{Category: "All"}) h := &handler{lp: lp, opts: opts, cached_data: cv.Load()} defer cv.Save() lp.OnInitialize = func() (string, error) { diff --git a/kittens/themes/main_test.go b/kittens/themes/main_test.go deleted file mode 100644 index cd2b179d6..000000000 --- a/kittens/themes/main_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// License: GPLv3 Copyright: 2026, Kovid Goyal, - -package themes - -import ( - "reflect" - "testing" - - "github.com/kovidgoyal/kitty/kittens/unicode_input" - "github.com/kovidgoyal/kitty/tools/utils" -) - -func TestPickerCachesAreIndependent(t *testing.T) { - original_cache_dir := utils.CacheDir - t.Cleanup(func() { utils.CacheDir = original_cache_dir }) - for _, themes_last := range []bool{false, true} { - name := "unicode_after_themes" - if themes_last { - name = "themes_after_unicode" - } - t.Run(name, func(t *testing.T) { - cache_dir := t.TempDir() - utils.CacheDir = func() string { return cache_dir } - want_themes := &CachedData{Category: "dark", Recent: []string{"Gruvbox Dark"}} - want_unicode := &unicode_input.CachedData{Mode: "NAME", Recent: []rune{'π', '♥'}} - themes_cache := new_cached_values() - unicode_cache := utils.NewCachedValues("unicode-input", &unicode_input.CachedData{Mode: unicode_input.DEFAULT_MODE}) - if themes_last { - unicode_cache.Opts = want_unicode - unicode_cache.Save() - themes_cache.Load() - themes_cache.Opts = want_themes - themes_cache.Save() - } else { - themes_cache.Opts = want_themes - themes_cache.Save() - unicode_cache.Load() - unicode_cache.Opts = want_unicode - unicode_cache.Save() - } - if got := new_cached_values().Load(); !reflect.DeepEqual(got, want_themes) { - t.Errorf("theme preferences changed: got %#v, want %#v", got, want_themes) - } - got_unicode := utils.NewCachedValues("unicode-input", &unicode_input.CachedData{Mode: unicode_input.DEFAULT_MODE}).Load() - if !reflect.DeepEqual(got_unicode, want_unicode) { - t.Errorf("Unicode input preferences changed: got %#v, want %#v", got_unicode, want_unicode) - } - }) - } -}