detached 0d6e493

fix(omnibox): top-align omnibox when a top margin percentage is configured

commit
0d6e4937ff2b49821ea97d473b76c98e58991488
author
brice · · 2026-10-10 01:28 UTC
parent
cdd2182
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
refs
fix/omnibox-layout
2 files · +6 -6
M internal/ui/component/modal_sizing_test.go +2 -0
@@ -176,6 +176,8 @@ func TestOmniboxSizeDefaults_Values(t *testing.T) {
176176 func TestOmniboxValign(t *testing.T) {
177177 assert.Equal(t, gtk.AlignCenterValue, omniboxValign(OmniboxSizeDefaults))
178178 assert.Equal(t, gtk.AlignStartValue, omniboxValign(ModalSizeConfig{UseFixedTopMargin: true}))
179+ assert.Equal(t, gtk.AlignStartValue, omniboxValign(ResolveModalSizeConfig(
180+ ModalSizeConfig{TopMarginPct: 0.2}, OmniboxSizeDefaults)))
179181 }
180182
181183 func TestOmniboxListDefaults_ScrollableResults(t *testing.T) {
@@ -176,6 +176,8 @@ func TestOmniboxSizeDefaults_Values(t *testing.T) {
176 func TestOmniboxValign(t *testing.T) {176 func TestOmniboxValign(t *testing.T) {
177 assert.Equal(t, gtk.AlignCenterValue, omniboxValign(OmniboxSizeDefaults))177 assert.Equal(t, gtk.AlignCenterValue, omniboxValign(OmniboxSizeDefaults))
178 assert.Equal(t, gtk.AlignStartValue, omniboxValign(ModalSizeConfig{UseFixedTopMargin: true}))178 assert.Equal(t, gtk.AlignStartValue, omniboxValign(ModalSizeConfig{UseFixedTopMargin: true}))
179+ assert.Equal(t, gtk.AlignStartValue, omniboxValign(ResolveModalSizeConfig(
180+ ModalSizeConfig{TopMarginPct: 0.2}, OmniboxSizeDefaults)))
179 }181 }
180 182
181 func TestOmniboxListDefaults_ScrollableResults(t *testing.T) {183 func TestOmniboxListDefaults_ScrollableResults(t *testing.T) {
M internal/ui/component/omnibox.go +4 -6
@@ -782,10 +782,11 @@ func (o *Omnibox) initOuterBox() error {
782782 return nil
783783 }
784784
785-// omniboxValign centers the in-pane omnibox vertically; a fixed top margin
786-// (standalone window sized by its content) keeps it top-aligned.
785+// omniboxValign centers the omnibox vertically by default. Any configured top
786+// margin (fixed for the content-sized standalone window, or a percentage
787+// override) keeps it top-aligned so the margin is applied as requested.
787788 func omniboxValign(cfg ModalSizeConfig) gtk.Align {
788- if cfg.UseFixedTopMargin {
789+ if cfg.UseFixedTopMargin || cfg.TopMarginPct > 0 {
789790 return gtk.AlignStartValue
790791 }
791792 return gtk.AlignCenterValue
@@ -2814,9 +2815,6 @@ func (o *Omnibox) Show(ctx context.Context, query string) {
28142815 parentHeight = o.parentOverlay.GetAllocatedHeight()
28152816 }
28162817 width, marginTop := o.requestedDimensions()
2817- if omniboxValign(o.sizeCfg) == gtk.AlignCenterValue {
2818- marginTop = 0 // centered by GTK; a margin would push it off-center
2819- }
28202818 log.Debug().
28212819 Int("parentWidth", parentWidth).
28222820 Int("parentHeight", parentHeight).
@@ -782,10 +782,11 @@ func (o *Omnibox) initOuterBox() error {
782 return nil782 return nil
783 }783 }
784 784
785-// omniboxValign centers the in-pane omnibox vertically; a fixed top margin785+// omniboxValign centers the omnibox vertically by default. Any configured top
786-// (standalone window sized by its content) keeps it top-aligned.786+// margin (fixed for the content-sized standalone window, or a percentage
787+// override) keeps it top-aligned so the margin is applied as requested.
787 func omniboxValign(cfg ModalSizeConfig) gtk.Align {788 func omniboxValign(cfg ModalSizeConfig) gtk.Align {
788- if cfg.UseFixedTopMargin {789+ if cfg.UseFixedTopMargin || cfg.TopMarginPct > 0 {
789 return gtk.AlignStartValue790 return gtk.AlignStartValue
790 }791 }
791 return gtk.AlignCenterValue792 return gtk.AlignCenterValue
@@ -2814,9 +2815,6 @@ func (o *Omnibox) Show(ctx context.Context, query string) {
2814 parentHeight = o.parentOverlay.GetAllocatedHeight()2815 parentHeight = o.parentOverlay.GetAllocatedHeight()
2815 }2816 }
2816 width, marginTop := o.requestedDimensions()2817 width, marginTop := o.requestedDimensions()
2817- if omniboxValign(o.sizeCfg) == gtk.AlignCenterValue {
2818- marginTop = 0 // centered by GTK; a margin would push it off-center
2819- }
2820 log.Debug().2818 log.Debug().
2821 Int("parentWidth", parentWidth).2819 Int("parentWidth", parentWidth).
2822 Int("parentHeight", parentHeight).2820 Int("parentHeight", parentHeight).

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