Skip to content

Commit

Permalink
pkg/cli/tk: Fix combobox rendering for empty search.
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Penick <[email protected]>
  • Loading branch information
xiaq and mpenick committed Oct 4, 2024
1 parent c20fac4 commit b1d18df
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/cli/tk/combobox.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ func (w *comboBox) Render(width, height int) *term.Buffer {
// TODO: Test the behavior of Render when height is very small
// (https://b.elv.sh/1820)
if height == 1 {
return w.listBox.Render(width, height)
// This could be caused by either the listbox being empty, or the
// terminal actually being very short.
if w.listBox.CopyState().Items.Len() == 0 {
return w.codeArea.Render(width, height)
} else {
return w.listBox.Render(width, height)
}
}
buf := w.codeArea.Render(width, height-1)
bufListBox := w.listBox.Render(width, height-len(buf.Lines))
Expand Down

0 comments on commit b1d18df

Please sign in to comment.