Browse Source

Fix applying ScrollBarNever to DropDown or InputField

merge-requests/1/merge
Trevor Slocum 2 years ago
parent
commit
de6819cc76
  1. 2
      dropdown.go
  2. 2
      inputfield.go

2
dropdown.go

@ -386,7 +386,7 @@ func (d *DropDown) Draw(screen tcell.Screen) { @@ -386,7 +386,7 @@ func (d *DropDown) Draw(screen tcell.Screen) {
lheight = sheight - ly
}
lwidth := maxWidth
if len(d.options) > lheight {
if d.list.scrollBarVisibility == ScrollBarAlways || (d.list.scrollBarVisibility == ScrollBarAuto && len(d.options) > lheight) {
lwidth++ // Add space for scroll bar
}
d.list.SetRect(lx, ly, lwidth, lheight)

2
inputfield.go

@ -422,7 +422,7 @@ func (i *InputField) Draw(screen tcell.Screen) { @@ -422,7 +422,7 @@ func (i *InputField) Draw(screen tcell.Screen) {
if ly+lheight >= sheight {
lheight = sheight - ly
}
if i.autocompleteList.GetItemCount() > lheight {
if i.autocompleteList.scrollBarVisibility == ScrollBarAlways || (i.autocompleteList.scrollBarVisibility == ScrollBarAuto && i.autocompleteList.GetItemCount() > lheight) {
lwidth++ // Add space for scroll bar
}
i.autocompleteList.SetRect(lx, ly, lwidth, lheight)

Loading…
Cancel
Save