Skip to content

Commit

Permalink
fix: only display language-specific codes for chosen host language
Browse files Browse the repository at this point in the history
  • Loading branch information
tenstad committed Nov 14, 2024
1 parent 71654df commit ce363a2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/store/keycodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ const keycodePickerTabLayout = {
ANSI_ISO: [...ansi, ...iso_jis],
ISO_ANSI: [...iso_jis, ...ansi],
special: [...quantum, ...settings, ...media],
extra: Object.values(keymapExtras)
.map(({ keycodeLUT, prefix }) => {
extra: Object.fromEntries(
Object.entries(keymapExtras).map(([keymap, { keycodeLUT, prefix }]) => {
const keycodes = [];

Object.entries(keycodeLUT).forEach(([code, { name, title }]) => {
if (title === undefined) {
return;
Expand All @@ -43,9 +44,10 @@ const keycodePickerTabLayout = {
title: code
});
});
return keycodes;

return [keymap, keycodes];
})
.flat()
)
};

/**
Expand Down Expand Up @@ -113,7 +115,7 @@ function generateKeycodes(osKeyboardLayout, isSteno = false) {
...keycodes.map((keycodeObject) =>
toLocaleKeycode(keycodeLUT, keycodeObject)
),
...keycodePickerTabLayout.extra
...keycodePickerTabLayout.extra[getOSKeyboardLayout()]
];
}

Expand Down Expand Up @@ -153,8 +155,7 @@ export const useKeycodesStore = defineStore('keycodes', {
state: () => ({
keycodes: [
...keycodePickerTabLayout.ANSI_ISO,
...keycodePickerTabLayout.special,
...keycodePickerTabLayout.extra
...keycodePickerTabLayout.special
],
searchFilter: '',
searchCounters: {
Expand Down

0 comments on commit ce363a2

Please sign in to comment.