Skip to content

Commit

Permalink
TailTipWidgets: added boolean field command in CmdDesc class
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Nov 13, 2019
1 parent 3a5d132 commit 4083481
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions builtins/src/main/java/org/jline/builtins/Widgets.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ public void initDescription(int size) {
as.add(new AttributedString(""));
}
addDescription(as);
reader.runMacro(KeyMap.ctrl('M'));
executeWidget(LineReader.REDRAW_LINE);
} else if (status != null) {
if (size < 0) {
status.update(null);
reader.runMacro(KeyMap.ctrl('M'));
executeWidget(LineReader.REDRAW_LINE);
} else {
status.clear();
}
Expand Down Expand Up @@ -781,7 +781,9 @@ private boolean doTailTip(String widget) {
resetTailTip();
} else if (cmdDesc.isValid()) {
if (cmdkey.getV()) {
doCommandTailTip(widget, cmdDesc, args);
if (cmdDesc.isCommand()) {
doCommandTailTip(widget, cmdDesc, args);
}
} else {
doDescription(cmdDesc.getMainDescription(descriptionSize));
setErrorPattern(cmdDesc.getErrorPattern());
Expand Down Expand Up @@ -1165,8 +1167,10 @@ public static class CmdDesc {
private Pattern errorPattern;
private int errorIndex = -1;
private boolean valid = true;
private boolean command = false;

public CmdDesc() {
command = false;
}

public CmdDesc(boolean valid) {
Expand All @@ -1190,11 +1194,16 @@ public CmdDesc(List<AttributedString> mainDesc, List<ArgDesc> argsDesc, Map<Stri
} else {
this.mainDesc = new ArrayList<>(mainDesc);
}
this.command = true;
}

public boolean isValid() {
return valid;
}

public boolean isCommand() {
return command;
}

public CmdDesc mainDesc(List<AttributedString> mainDesc) {
this.mainDesc = new ArrayList<>(mainDesc);
Expand Down

0 comments on commit 4083481

Please sign in to comment.