Skip to content

Commit

Permalink
JLine option AUTO_MENU_LIST: bug fix for candidate list start positio…
Browse files Browse the repository at this point in the history
…n calculation
  • Loading branch information
mattirn committed Nov 14, 2020
1 parent a5686ab commit a015a5d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5186,7 +5186,7 @@ protected PostResult computePost(List<Candidate> possible, Candidate selection,

private int candidateStartPosition(List<Candidate> cands) {
List<String> values = cands.stream().map(c -> AttributedString.stripAnsi(c.displ()))
.filter(c -> !c.matches("\\w+")).collect(Collectors.toList());
.filter(c -> !c.matches("\\w+") && c.length() > 1).collect(Collectors.toList());
Set<String> notDelimiters = new HashSet<>();
values.forEach(v -> v.substring(0, v.length() - 1).chars()
.filter(c -> !Character.isDigit(c) && !Character.isAlphabetic(c))
Expand Down Expand Up @@ -5249,7 +5249,7 @@ else if (item instanceof List) {
if (isSet(Option.AUTO_MENU_LIST) && listSize < displayRows() - promptLines()) {
doMenuList = true;
maxWidth = Math.max(maxWidth, MENU_LIST_WIDTH);
sb.tabs(Math.min(candidateStartPosition, width - maxWidth - 1));
sb.tabs(Math.max(Math.min(candidateStartPosition, width - maxWidth - 1), 1));
width = maxWidth + 2;
}
for (Object list : items) {
Expand Down

0 comments on commit a015a5d

Please sign in to comment.