fix(scratch): sort keys. Fixes #193

This commit is contained in:
Folke Lemaitre 2024-12-03 09:45:44 +01:00
parent f955f082e0
commit 0df7a08b01
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -242,6 +242,9 @@ function M.open(opts)
opts.win.buf = buf
local ret = Snacks.win(opts.win)
ret.opts.footer = {}
table.sort(ret.keys, function(a, b)
return a[1] < b[1]
end)
for _, key in ipairs(ret.keys) do
local keymap = vim.fn.keytrans(vim.keycode(key[1]))
table.insert(ret.opts.footer, { " " })