detached a934acc

fix(omnibox): navigate bang queries on Enter

commit
a934acc0274bc25fe9fc22cc11f31d0480bf729f
author
brice · · 2025-12-28 14:20 UTC
parent
0515f15
signature
unsigned
1 file · +23 -15
M internal/ui/component/omnibox.go +23 -15
@@ -1237,25 +1237,33 @@ func (o *Omnibox) navigateToSelected() {
12371237 o.mu.RUnlock()
12381238
12391239 entryText := o.entry.GetText()
1240- if shortcutKey, query, found := url.ParseBangShortcut(entryText); found {
1241- resolvedKey := shortcutKey
1242- for key := range o.shortcuts {
1243- if strings.EqualFold(key, shortcutKey) {
1244- resolvedKey = key
1245- break
1246- }
1247- }
1248- entryText = "!" + resolvedKey + " " + query
1249- }
12501240
12511241 if bangMode {
1252- // If the user already typed a bang query ("!key something"), Enter should navigate.
1253- if _, _, found := url.ParseBangShortcut(entryText); !found {
1254- if idx >= 0 && idx < len(bangSuggestions) {
1255- o.entry.SetText("!" + bangSuggestions[idx].Key + " ")
1256- o.entry.SetPosition(-1)
1242+ // If user typed a full bang query, navigate using the bang URL.
1243+ if shortcutKey, query, found := url.ParseBangShortcut(entryText); found {
1244+ resolvedKey := shortcutKey
1245+ for key := range o.shortcuts {
1246+ if strings.EqualFold(key, shortcutKey) {
1247+ resolvedKey = key
1248+ break
1249+ }
1250+ }
1251+ targetURL := o.buildURL("!" + resolvedKey + " " + query)
1252+ if targetURL == "" {
12571253 return
12581254 }
1255+ o.Hide(o.ctx)
1256+ if o.onNavigate != nil {
1257+ o.onNavigate(targetURL)
1258+ }
1259+ return
1260+ }
1261+
1262+ // Otherwise, Enter autocompletes the selected bang.
1263+ if idx >= 0 && idx < len(bangSuggestions) {
1264+ o.entry.SetText("!" + bangSuggestions[idx].Key + " ")
1265+ o.entry.SetPosition(-1)
1266+ return
12591267 }
12601268 }
12611269
@@ -1237,25 +1237,33 @@ func (o *Omnibox) navigateToSelected() {
1237 o.mu.RUnlock()1237 o.mu.RUnlock()
1238 1238
1239 entryText := o.entry.GetText()1239 entryText := o.entry.GetText()
1240- if shortcutKey, query, found := url.ParseBangShortcut(entryText); found {
1241- resolvedKey := shortcutKey
1242- for key := range o.shortcuts {
1243- if strings.EqualFold(key, shortcutKey) {
1244- resolvedKey = key
1245- break
1246- }
1247- }
1248- entryText = "!" + resolvedKey + " " + query
1249- }
1250 1240
1251 if bangMode {1241 if bangMode {
1252- // If the user already typed a bang query ("!key something"), Enter should navigate.1242+ // If user typed a full bang query, navigate using the bang URL.
1253- if _, _, found := url.ParseBangShortcut(entryText); !found {1243+ if shortcutKey, query, found := url.ParseBangShortcut(entryText); found {
1254- if idx >= 0 && idx < len(bangSuggestions) {1244+ resolvedKey := shortcutKey
1255- o.entry.SetText("!" + bangSuggestions[idx].Key + " ")1245+ for key := range o.shortcuts {
1256- o.entry.SetPosition(-1)1246+ if strings.EqualFold(key, shortcutKey) {
1247+ resolvedKey = key
1248+ break
1249+ }
1250+ }
1251+ targetURL := o.buildURL("!" + resolvedKey + " " + query)
1252+ if targetURL == "" {
1257 return1253 return
1258 }1254 }
1255+ o.Hide(o.ctx)
1256+ if o.onNavigate != nil {
1257+ o.onNavigate(targetURL)
1258+ }
1259+ return
1260+ }
1261+
1262+ // Otherwise, Enter autocompletes the selected bang.
1263+ if idx >= 0 && idx < len(bangSuggestions) {
1264+ o.entry.SetText("!" + bangSuggestions[idx].Key + " ")
1265+ o.entry.SetPosition(-1)
1266+ return
1259 }1267 }
1260 }1268 }
1261 1269

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close