Skip to content

Commit

Permalink
TailTipWidgets: set LineReader variable errors=0
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Jun 20, 2020
1 parent fb196ca commit 96defb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions console/src/main/java/org/jline/widget/TailTipWidgets.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public enum TipType {
private int descriptionSize = 0;
private boolean descriptionEnabled = true;
private boolean descriptionCache = false;
private Object readerErrors;

/**
* Creates tailtip widgets used in command line suggestions. Suggestions are created using a command
Expand Down Expand Up @@ -409,11 +410,14 @@ public boolean toggleKeyBindings() {
if (enabled) {
defaultBindings();
destroyDescription();
reader.setVariable(LineReader.ERRORS, readerErrors);
} else {
customBindings();
if (descriptionEnabled) {
initDescription(descriptionSize);
}
readerErrors = reader.getVariable(LineReader.ERRORS);
reader.setVariable(LineReader.ERRORS, 0);
}
try {
callWidget(LineReader.REDRAW_LINE);
Expand Down
2 changes: 1 addition & 1 deletion console/src/main/java/org/jline/widget/Widgets.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public abstract class Widgets {
protected static final String TT_TOGGLE = "tailtip-toggle";
protected static final String TT_ACCEPT_LINE = "_tailtip-accept-line";

private final LineReader reader;
protected final LineReader reader;

public Widgets(LineReader reader) {
this.reader = reader;
Expand Down

0 comments on commit 96defb8

Please sign in to comment.