Skip to content

Commit e4c010e

Browse files
chore: allow vertical wrap on select/multiselect
1 parent b5092a6 commit e4c010e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cli/cliui/select.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,19 @@ func (m selectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
140140
}
141141

142142
case tea.KeyUp:
143+
options := m.filteredOptions()
143144
if m.cursor > 0 {
144145
m.cursor--
146+
} else {
147+
m.cursor = len(options) - 1
145148
}
146149

147150
case tea.KeyDown:
148151
options := m.filteredOptions()
149152
if m.cursor < len(options)-1 {
150153
m.cursor++
154+
} else {
155+
m.cursor = 0
151156
}
152157
}
153158
}
@@ -332,13 +337,19 @@ func (m multiSelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
332337
}
333338

334339
case tea.KeyUp:
340+
options := m.filteredOptions()
335341
if m.cursor > 0 {
336342
m.cursor--
343+
} else {
344+
m.cursor = len(options) - 1
337345
}
338346

339347
case tea.KeyDown:
340-
if m.cursor < len(m.options)-1 {
348+
options := m.filteredOptions()
349+
if m.cursor < len(options)-1 {
341350
m.cursor++
351+
} else {
352+
m.cursor = 0
342353
}
343354

344355
case tea.KeyRight:

0 commit comments

Comments
 (0)