Skip to content

Commit

Permalink
Tab candidate menu list exceeds from visible terminal display, fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Dec 16, 2021
1 parent 08d27d7 commit afb067f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4626,6 +4626,11 @@ private int displayRows(Status status) {
return size.getRows() - (status != null ? status.size() : 0);
}

private int visibleDisplayRows() {
Status status = Status.getStatus(terminal, false);
return terminal.getSize().getRows() - (status != null ? status.size() : 0);
}

private int promptLines() {
AttributedString text = insertSecondaryPrompts(AttributedStringBuilder.append(prompt, buf.toString()), new ArrayList<>());
return text.columnSplitLength(size.getColumns(), false, display.delayLineWrap()).size();
Expand Down Expand Up @@ -5208,7 +5213,7 @@ else if (item instanceof List) {
AttributedStringBuilder sb = new AttributedStringBuilder();
if (listSize > 0) {
if (isSet(Option.AUTO_MENU_LIST)
&& listSize < Math.min(getInt(MENU_LIST_MAX, DEFAULT_MENU_LIST_MAX), displayRows() - promptLines())) {
&& listSize < Math.min(getInt(MENU_LIST_MAX, DEFAULT_MENU_LIST_MAX), visibleDisplayRows() - promptLines())) {
maxWidth = Math.max(maxWidth, MENU_LIST_WIDTH);
sb.tabs(Math.max(Math.min(candidateStartPosition, width - maxWidth - 1), 1));
width = maxWidth + 2;
Expand Down

0 comments on commit afb067f

Please sign in to comment.