Skip to content

Commit 37911a1

Browse files
committed
feat: add ctrl + c
1 parent c0f7f93 commit 37911a1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: src/components/VueCommandQuery.vue

+9-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
type="text"
3030
@click="setCursorPosition($refs.queryRef.selectionStart)"
3131
@input="setQuery($event.target.value)"
32+
@keydown.ctrl.c.exact.prevent="sigint"
3233
@keydown.tab.exact.prevent="autocompleteQuery"
3334
@keydown.ctrl.r.exact.prevent="reverseISearch"
3435
@keyup.arrow-left.exact="setCursorPosition($refs.queryRef.selectionStart)"
@@ -54,6 +55,7 @@ import {
5455
import {
5556
defaultParser,
5657
createStdout,
58+
createQuery,
5759
listFormatter
5860
} from '@/library'
5961
import head from 'lodash.head'
@@ -182,6 +184,12 @@ const showDelayedHelp = () => {
182184
unwatchIsOutdated()
183185
})
184186
}
187+
// Cancels the current query and creates a new one
188+
const sigint = () => {
189+
isOutdated.value = true
190+
local.query = `${local.query}^C`
191+
appendToHistory(createQuery())
192+
}
185193
// Deactivates this query and dispatches it to execute the command
186194
const submit = () => {
187195
isOutdated.value = true
@@ -222,7 +230,7 @@ onMounted(() => {
222230
focus()
223231
224232
// Show eventually help as placeholder
225-
showDelayedHelp()
233+
showDelayedHelp()
226234
})
227235
228236
defineExpose({

0 commit comments

Comments
 (0)