Skip to content

Commit 311cf73

Browse files
committed
fix: indentation from tabs to spaces
1 parent 60380de commit 311cf73

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/lib/forms/floating-label/FloatingLabelInput.svelte

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,14 @@
114114
115115
function selectItem(item: string) {
116116
const currentValue = (value as string) || '';
117-
const lastSpaceIndex = currentValue.lastIndexOf(' ');
117+
const lastSpaceIndex = currentValue.lastIndexOf(' ');
118+
119+
if (lastSpaceIndex === -1) {
120+
value = item + ' '; // Replace the whole value if no space, add trailing space
121+
} else {
122+
value = currentValue.substring(0, lastSpaceIndex + 1) + item + ' '; // Replace last word, add trailing space
123+
}
118124
119-
if (lastSpaceIndex === -1) {
120-
value = item + ' '; // Replace the whole value if no space, add trailing space
121-
} else {
122-
value = currentValue.substring(0, lastSpaceIndex + 1) + item + ' '; // Replace last word, add trailing space
123-
}
124125
if (onSelect) onSelect(item);
125126
filteredSuggestions = [];
126127
selectedIndex = -1;

0 commit comments

Comments
 (0)