Skip to content

Commit e3bcf7e

Browse files
committed
refactor: add sizing to SelectCfg, adjust spacer sizing logic in select view
1 parent 169ef02 commit e3bcf7e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

view_select.v

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub:
3030
no_wrap bool
3131
fill bool = gui_theme.select_style.fill
3232
fill_border bool = gui_theme.select_style.fill_border
33+
sizing Sizing
3334
}
3435

3536
// select creates a select (a.k.a. drop-down) view from the given [SelectCfg](#SelectCfg)
@@ -70,7 +71,11 @@ pub fn (window &Window) select(cfg SelectCfg) View {
7071
text_style: txt_style
7172
mode: wrap_mode
7273
),
73-
row(name: 'select spacer', sizing: fill_fill, padding: padding_none),
74+
row(
75+
name: 'select spacer'
76+
sizing: if wrap_mode == .single_line { fill_fill } else { fit_fill }
77+
padding: padding_none
78+
),
7479
text(
7580
text: if is_open { '▲' } else { '▼' }
7681
text_style: cfg.text_style
@@ -131,7 +136,7 @@ pub fn (window &Window) select(cfg SelectCfg) View {
131136
padding: cfg.padding_border
132137
radius: cfg.radius
133138
color: cfg.color_border
134-
sizing: fill_fit
139+
sizing: cfg.sizing
135140
amend_layout: cfg.amend_layout
136141
content: content
137142
)

0 commit comments

Comments
 (0)