Skip to content

Commit

Permalink
Make Ctrl-enter populate the vomnibar with the selected entry's URL
Browse files Browse the repository at this point in the history
Thanks @Gu1nness !

Closes philc#2464, philc#2914.
  • Loading branch information
philc authored and tripfish committed Apr 3, 2021
1 parent 6bc8388 commit 63b2702
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pages/vomnibar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ class VomnibarUI
else if (key == "down" ||
(event.ctrlKey && (key == "j" || key == "n")))
return "down"
else if (event.ctrlKey && event.key == "Enter")
return "ctrl-enter"
else if (event.key == "Enter")
return "enter"
else if event.key == "Delete" and event.shiftKey and not event.ctrlKey and not event.altKey
Expand Down Expand Up @@ -172,6 +174,12 @@ class VomnibarUI
else
completion = @completions[@selection]
@hide -> completion.performAction openInNewTab
else if action == "ctrl-enter"
# Populate the vomnibar with the current selection's URL.
if not @customSearchMode? and @selection >= 0
@previousInputValue ?= @input.value
@input.value = @completions[@selection]?.url
@input.scrollLeft = @input.scrollWidth
else if action == "delete"
if @customSearchMode? and @input.selectionEnd == 0
# Normally, with custom search engines, the keyword (e,g, the "w" of "w query terms") is suppressed.
Expand Down

0 comments on commit 63b2702

Please sign in to comment.