Skip to content

Commit

Permalink
LineReaderImpl: readLine() final redisplay() do not add
Browse files Browse the repository at this point in the history
autosuggestions, fixes #461
  • Loading branch information
mattirn committed Nov 7, 2019
1 parent 2189b1f commit 454a286
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions reader/src/main/java/org/jline/reader/impl/LineReaderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ protected enum BellType {
protected boolean searchFailing;
protected boolean searchBackward;
protected int searchIndex = -1;
protected boolean inCompleterMenu;
protected boolean doAutosuggestion;


// Reading buffers
Expand Down Expand Up @@ -1118,6 +1118,7 @@ protected String finish(String str) {
}

protected void handleSignal(Signal signal) {
doAutosuggestion = false;
if (signal == Signal.WINCH) {
Status status = Status.getStatus(terminal, false);
if (status != null) {
Expand Down Expand Up @@ -2535,6 +2536,7 @@ protected void doCleanup(boolean nl) {
buf.cursor(buf.length());
post = null;
if (size.getColumns() > 0 || size.getRows() > 0) {
doAutosuggestion = false;
redisplay(false);
if (nl) {
println();
Expand Down Expand Up @@ -3986,7 +3988,7 @@ public AttributedString getDisplayedBufferWithPrompts(List<AttributedString> sec
AttributedStringBuilder full = new AttributedStringBuilder().tabs(TAB_WIDTH);
full.append(prompt);
full.append(tNewBuf);
if (!inCompleterMenu) {
if (doAutosuggestion) {
String lastBinding = getLastBinding() != null ? getLastBinding() : "";
if (autosuggestion == SuggestionType.HISTORY) {
AttributedStringBuilder sb = new AttributedStringBuilder();
Expand Down Expand Up @@ -4033,7 +4035,7 @@ public AttributedString getDisplayedBufferWithPrompts(List<AttributedString> sec
full.append("\n");
full.append(post.get());
}
inCompleterMenu = false;
doAutosuggestion = true;
return full.toAttributedString();
}

Expand Down Expand Up @@ -4946,7 +4948,7 @@ && getLastBinding().charAt(0) != ' '
return true;
}
}
inCompleterMenu = true;
doAutosuggestion = false;
redisplay();
}
return false;
Expand Down

0 comments on commit 454a286

Please sign in to comment.