detached 25ff751

fix: resolve omnibox lint regressions

Refactor small sections of omnibox keyboard handling and selection target assignment to satisfy golangci-lint funlen and staticcheck rules without changing runtime behavior.
commit
25ff751509b844d9af709813591a0c79942dce5e
author
brice · · 2026-02-17 17:47 UTC
parent
a5f78e3
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +9 -9
M internal/ui/component/omnibox.go +9 -9
@@ -578,8 +578,7 @@ func (o *Omnibox) initList() error {
578578 return
579579 }
580580
581- var targetURL string
582- targetURL = resolveTargetURLForSelection(mode, idx, suggestions, favorites)
581+ targetURL := resolveTargetURLForSelection(mode, idx, suggestions, favorites)
583582
584583 if targetURL != "" && o.onNavigate != nil {
585584 o.Hide(o.ctx)
@@ -674,9 +673,7 @@ func (o *Omnibox) hasUserNavigated() bool {
674673 // handleKeyPress processes keyboard events.
675674 // Returns true if the event was handled.
676675 func (o *Omnibox) handleKeyPress(keyval, keycode uint, state gdk.ModifierType) bool {
677- o.mu.Lock()
678- o.suppressGhost = nextGhostSuppressionState(o.suppressGhost, keyval)
679- o.mu.Unlock()
676+ o.updateGhostSuppressionFromKey(keyval)
680677
681678 ctrl := state&gdk.ControlMaskValue != 0
682679
@@ -752,10 +749,13 @@ func (o *Omnibox) handleKeyPress(keyval, keycode uint, state gdk.ModifierType) b
752749 }
753750
754751 func nextGhostSuppressionState(_ bool, keyval uint) bool {
755- if isDeletionKey(keyval) {
756- return true
757- }
758- return false
752+ return isDeletionKey(keyval)
753+}
754+
755+func (o *Omnibox) updateGhostSuppressionFromKey(keyval uint) {
756+ o.mu.Lock()
757+ o.suppressGhost = nextGhostSuppressionState(o.suppressGhost, keyval)
758+ o.mu.Unlock()
759759 }
760760
761761 func isDeletionKey(keyval uint) bool {
@@ -578,8 +578,7 @@ func (o *Omnibox) initList() error {
578 return578 return
579 }579 }
580 580
581- var targetURL string581+ targetURL := resolveTargetURLForSelection(mode, idx, suggestions, favorites)
582- targetURL = resolveTargetURLForSelection(mode, idx, suggestions, favorites)
583 582
584 if targetURL != "" && o.onNavigate != nil {583 if targetURL != "" && o.onNavigate != nil {
585 o.Hide(o.ctx)584 o.Hide(o.ctx)
@@ -674,9 +673,7 @@ func (o *Omnibox) hasUserNavigated() bool {
674 // handleKeyPress processes keyboard events.673 // handleKeyPress processes keyboard events.
675 // Returns true if the event was handled.674 // Returns true if the event was handled.
676 func (o *Omnibox) handleKeyPress(keyval, keycode uint, state gdk.ModifierType) bool {675 func (o *Omnibox) handleKeyPress(keyval, keycode uint, state gdk.ModifierType) bool {
677- o.mu.Lock()676+ o.updateGhostSuppressionFromKey(keyval)
678- o.suppressGhost = nextGhostSuppressionState(o.suppressGhost, keyval)
679- o.mu.Unlock()
680 677
681 ctrl := state&gdk.ControlMaskValue != 0678 ctrl := state&gdk.ControlMaskValue != 0
682 679
@@ -752,10 +749,13 @@ func (o *Omnibox) handleKeyPress(keyval, keycode uint, state gdk.ModifierType) b
752 }749 }
753 750
754 func nextGhostSuppressionState(_ bool, keyval uint) bool {751 func nextGhostSuppressionState(_ bool, keyval uint) bool {
755- if isDeletionKey(keyval) {752+ return isDeletionKey(keyval)
756- return true753+}
757- }754+
758- return false755+func (o *Omnibox) updateGhostSuppressionFromKey(keyval uint) {
756+ o.mu.Lock()
757+ o.suppressGhost = nextGhostSuppressionState(o.suppressGhost, keyval)
758+ o.mu.Unlock()
759 }759 }
760 760
761 func isDeletionKey(keyval uint) bool {761 func isDeletionKey(keyval uint) bool {

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