elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.53k stars 297 forks source link

pkg/cli/tk/listbox_window.go: Fix divide by zero #1736

Closed rsteube closed 6 months ago

rsteube commented 7 months ago

Fix divide by zero when resizing terminal.

Steps to reproduce:

  1. invoke completion menu
  2. reduce height of terminal window

related https://github.com/elves/elvish/issues/1282

xiaq commented 6 months ago

This does fix the crash, but it means that when the available height is 1 all that is visible is the scrollbar, which isn't ideal. Better to show one row of actual content instead. I'm preparing that fix.

xiaq commented 6 months ago

I've implemented the fix I described so I'll close this PR. Thanks for the contribution.