Cleanup previous PR

This commit is contained in:
Kovid Goyal 2026-10-31 08:33:43 +05:30
parent 0ffa8e1412
commit ccecfa037b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 2 additions and 56 deletions

View file

@ -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

View file

@ -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) {

View file

@ -1,50 +0,0 @@
// License: GPLv3 Copyright: 2026, Kovid Goyal, <kovid at kovidgoyal.net>
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)
}
})
}
}