Skip to content

Commit

Permalink
TailTipWidgets: fixed status bar message compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Jun 29, 2020
1 parent 8e979e1 commit c0f0e79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 7 additions & 5 deletions console/src/main/java/org/jline/widget/TailTipWidgets.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,13 @@ private List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descr
out.addAll(mainDesc);
} else {
int tabs = 0;
int row = 0;
for (AttributedString as: mainDesc) {
if (as.columnLength() >= tabs) {
tabs = as.columnLength() + 2;
}
row++;
}
row = 0;
int row = 0;
int col = 0;
List<AttributedString> descList = new ArrayList<>();
for (int i = 0; i < descriptionSize; i++) {
descList.add(new AttributedString(""));
Expand All @@ -511,14 +510,17 @@ private List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descr
continue;
}
AttributedStringBuilder asb = new AttributedStringBuilder().tabs(tabs);
asb.append(descList.get(row));
if (col > 0) {
asb.append(descList.get(row));
asb.append("\t");
}
asb.append(as);
asb.append("\t");
descList.remove(row);
descList.add(row, asb.toAttributedString());
row++;
if (row >= descriptionSize) {
row = 0;
col++;
}
}
out = new ArrayList<>(descList);
Expand Down
4 changes: 3 additions & 1 deletion groovy/src/main/java/org/jline/script/GroovyEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,9 @@ private List<AttributedString> doExceptionMessage(Exception exception) {
out.add(java.highlight(exception.getClass().getCanonicalName()));
if (exception.getMessage() != null) {
for (String s: exception.getMessage().split("\\r?\\n")) {
if (s.length() > 80) {
if (s.trim().length() == 0) {
// do nothing
} else if (s.length() > 80) {
boolean doHeader = true;
int start = 0;
for (int i = 80; i < s.length(); i++) {
Expand Down

0 comments on commit c0f0e79

Please sign in to comment.