Skip to content

Commit 7f075fb

Browse files
committed
fix: multiline query reverse i search
1 parent 3d15c04 commit 7f075fb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: src/components/VueCommandQuery.vue

+11-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
@keyup.arrow-left.exact="setCursorPosition($refs.queryRef.selectionStart)"
102102
@keyup.arrow-right.exact="setCursorPosition($refs.queryRef.selectionStart)"
103103
@keyup.end.exact="setCursorPosition($refs.queryRef.selectionStart)"
104-
@keyup.enter.exact="submit">': {{ local.query }}
104+
@keyup.enter.exact="submit">': {{ reverseISearchMatch }}
105105
</div>
106106
</div>
107107
</template>
@@ -165,6 +165,7 @@ const multilineQueryRefs = ref(null)
165165
const placeholder = ref('')
166166
const reverseISearch = ref('')
167167
const reverseISearchRef = ref(null)
168+
const reverseISearchMatch = ref('')
168169
const reverseISearchStatus = ref('reverse-i-search')
169170
const queryRef = ref(null)
170171
@@ -314,6 +315,14 @@ const resizeReverseISearch = () => {
314315
}
315316
// Cancels the current query or multiline query and creates a new query
316317
const sigint = () => {
318+
if (isReverseISearch.value) {
319+
reverseISearchMatch.value = `${reverseISearchMatch.value}^C`
320+
// Invalidate current query
321+
isOutdated.value = true
322+
appendToHistory(createQuery())
323+
return
324+
}
325+
317326
if (isEmpty(multilineQueries)) {
318327
// "setQuery" would overwrite the parent query while we only need to
319328
// overwrite the locale one
@@ -413,6 +422,7 @@ const unwatchReverseISearch = watch(reverseISearch, () => {
413422
for (const dispatchedQuery of terminal.value.dispatchedQueries) {
414423
if (dispatchedQuery.startsWith(reverseISearch.value)) {
415424
setQuery(dispatchedQuery)
425+
reverseISearchMatch.value = dispatchedQuery
416426
417427
// Reset status if dispatched query has been found
418428
reverseISearchStatus.value = 'reverse-i-search'

0 commit comments

Comments
 (0)