fix: address follow-up review feedback

This commit is contained in:
2026-05-17 19:05:28 -07:00
parent c369841827
commit 10d9c38037
19 changed files with 191 additions and 38 deletions
+2 -2
View File
@@ -140,8 +140,8 @@ export function renderMpvKeybindingsInput(
removeButton.type = 'button';
removeButton.textContent = 'Remove';
removeButton.addEventListener('click', () => {
rows.splice(i, 1);
applyMpvRows(context, field, rows);
const nextRows = rows.filter((_, index) => index !== i);
applyMpvRows(context, field, nextRows);
requestRender();
});
item.append(keyButton, command, removeButton);
+21
View File
@@ -87,6 +87,27 @@ test('filterSettingsFields normalizes punctuation in query terms', () => {
);
});
test('filterSettingsFields preserves non-Latin query terms', () => {
const japaneseFields: ConfigSettingsField[] = [
{
id: 'subtitleStyle.japaneseFontFamily',
label: '日本語フォント',
description: '字幕の表示に使う書体。',
configPath: 'subtitleStyle.japaneseFontFamily',
category: 'appearance',
section: 'Primary Subtitle Appearance',
control: 'text',
defaultValue: '',
restartBehavior: 'hot-reload',
},
];
assert.deepEqual(
filterSettingsFields(japaneseFields, { query: '日本語' }).map((field) => field.configPath),
['subtitleStyle.japaneseFontFamily'],
);
});
test('settings draft tracks dirty set and emits save operations', () => {
const draft = createSettingsDraft({
'subtitleStyle.autoPauseVideoOnHover': true,
+3 -3
View File
@@ -17,7 +17,7 @@ export interface SettingsDraft {
}
function normalizeQuery(query: string | undefined): string {
return (query ?? '').trim().toLowerCase();
return (query ?? '').trim().toLocaleLowerCase();
}
function searchableText(parts: Array<string | undefined>): string {
@@ -25,8 +25,8 @@ function searchableText(parts: Array<string | undefined>): string {
.filter(Boolean)
.join(' ')
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
.replace(/[^a-zA-Z0-9]+/g, ' ')
.toLowerCase();
.replace(/[^\p{L}\p{N}]+/gu, ' ')
.toLocaleLowerCase();
}
function valuesEqual(a: unknown, b: unknown): boolean {