Skip to content

Commit

Permalink
pkg/cli/tk: Handle small height when rendering combobox.
Browse files Browse the repository at this point in the history
This fixes #1820.
  • Loading branch information
xiaq committed Aug 12, 2024
1 parent 3080501 commit 177a366
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/cli/tk/combobox.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ func NewComboBox(spec ComboBoxSpec) ComboBox {

// Render renders the codearea and the listbox below it.
func (w *comboBox) Render(width, height int) *term.Buffer {
buf := w.codeArea.Render(width, height)
// 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)
}
buf := w.codeArea.Render(width, height-1)
bufListBox := w.listBox.Render(width, height-len(buf.Lines))
buf.Extend(bufListBox, false)
return buf
Expand Down

0 comments on commit 177a366

Please sign in to comment.