prevent excessive trimming in emoji picker's input box

there's no reason to trim before assigning to `q.value` (which gets
reflected to the `<input>` control and ends up trimming end spaces
when back-spacing)

the stated reason for messing with the control's own value every time
it changes, is to handle changes while Android is composing; I've
tested that, while I'm composing a character with my input method on
X11, search responds to each keypress, and I think it's good enough
This commit is contained in:
dakkar 2025-07-28 15:27:20 +01:00
parent 7d005876fb
commit 884ccad588

View file

@ -218,13 +218,15 @@ parseAndMergeCategories('', customEmojiFolderRoot);
watch(q, () => {
if (emojisEl.value) emojisEl.value.scrollTop = 0;
if (q.value === '') {
const query = q.value.trim();
if (query === '') {
searchResultCustom.value = [];
searchResultUnicode.value = [];
return;
}
const newQ = q.value.replace(/:/g, '').normalize('NFC').toLowerCase();
const newQ = query.replace(/:/g, '').normalize('NFC').toLowerCase();
const searchCustom = () => {
const max = 100;
@ -442,7 +444,7 @@ function input(): void {
// Using custom input event instead of v-model to respond immediately on
// Android, where composition happens on all languages
// (v-model does not update during composition)
q.value = searchEl.value?.value.trim() ?? '';
q.value = searchEl.value?.value ?? '';
}
function paste(event: ClipboardEvent): void {
@ -467,7 +469,7 @@ function onKeydown(ev: KeyboardEvent) {
}
function done(query?: string): boolean | void {
if (query == null) query = q.value;
if (query == null) query = q.value.trim();
if (query == null || typeof query !== 'string') return;
const q2 = query.replace(/:/g, '');