jline / jline3

JLine is a Java library for handling console input.
Other
1.49k stars 218 forks source link

Columns calculation in MenuSupport is unreliable #191

Closed tpoliaw closed 6 years ago

tpoliaw commented 6 years ago

If Option.LIST_ROW_FIRST and Option.MENU_COMPLETE are both set for a LineReader, the number of columns can be calculated incorrectly in the MenuSupport instance.

In the case I've found, I have 9 completion candidates and it's splitting them onto two rows with 6 and 3 options respectively. The columns calculation assumes the minimum number of columns are used for the number of lines (giving 5 columns).

I'm not sure if the best way to handle it, either forcing the minimum number of columns without increasing the number of rows, or to return the number of columns somehow.

Let me know which you'd prefer and I'm happy to work on a PR. I have another couple in that area that I'd like to submit soonish as well.

gnodet commented 6 years ago

I think forcing the minimum number of columns without increasing the number of rows would be the best looking option, but I don't have a strong opinion.

tpoliaw commented 6 years ago

I'm still not sure either way, but if you want to minimise the number of columns, I think #196 should fix it.