fix(command): trim spaces

This commit is contained in:
三咲智子 2023-01-10 15:24:14 +08:00
parent 8fb9739f69
commit b4cda4338f
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
2 changed files with 4 additions and 4 deletions

View file

@ -60,7 +60,7 @@ const searchResult = $computed<QueryResult>(() => {
}) })
const result = $computed<QueryResult>(() => commandMode const result = $computed<QueryResult>(() => commandMode
? registry.query(scopes.map(s => s.id).join('.'), input.slice(1)) ? registry.query(scopes.map(s => s.id).join('.'), input.slice(1).trim())
: searchResult, : searchResult,
) )
@ -79,13 +79,13 @@ const onCommandActivate = (item: QueryResultItem) => {
} }
else if (item.onComplete) { else if (item.onComplete) {
scopes.push(item.onComplete()) scopes.push(item.onComplete())
input = '>' input = '> '
} }
} }
const onCommandComplete = (item: QueryResultItem) => { const onCommandComplete = (item: QueryResultItem) => {
if (item.onComplete) { if (item.onComplete) {
scopes.push(item.onComplete()) scopes.push(item.onComplete())
input = '>' input = '> '
} }
else if (item.onActivate) { else if (item.onActivate) {
item.onActivate() item.onActivate()

View file

@ -119,7 +119,7 @@ export function closePreviewHelp() {
} }
export function openCommandPanel(isCommandMode = false) { export function openCommandPanel(isCommandMode = false) {
commandPanelInput.value = isCommandMode ? '>' : '' commandPanelInput.value = isCommandMode ? '> ' : ''
isCommandPanelOpen.value = true isCommandPanelOpen.value = true
} }