Skip to content

Commit

Permalink
Autosuggestion choices are not refreshed after tab, fixes #545
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Nov 14, 2020
1 parent 2e6638c commit ea6dd89
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 11 additions & 5 deletions console/src/main/java/org/jline/widget/TailTipWidgets.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
import org.jline.reader.LineReader;
import org.jline.reader.Reference;
import org.jline.reader.LineReader.SuggestionType;
import org.jline.utils.AttributedString;
import org.jline.utils.AttributedStringBuilder;
import org.jline.utils.AttributedStyle;
import org.jline.utils.StyleResolver;
import org.jline.utils.*;

import static org.jline.keymap.KeyMap.key;

/**
* Creates and manages widgets for as you type command line suggestions.
Expand Down Expand Up @@ -194,7 +193,14 @@ public void setDescriptionCache(boolean cache) {
* widgets
*/
public boolean tailtipComplete() {
return doTailTip(LineReader.EXPAND_OR_COMPLETE);
if (doTailTip(LineReader.EXPAND_OR_COMPLETE)) {
if (lastBinding().equals("\t")) {
callWidget(LineReader.BACKWARD_CHAR);
reader.runMacro(key(reader.getTerminal(), InfoCmp.Capability.key_right));
}
return true;
}
return false;
}

public boolean tailtipAcceptLine() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4534,6 +4534,9 @@ else if (isSet(Option.RECOGNIZE_EXACT)) {
}
}
if (completion.suffix() != null) {
if (autosuggestion == SuggestionType.COMPLETER) {
listChoices(true);
}
redisplay();
Binding op = readBinding(getKeys());
if (op != null) {
Expand Down

0 comments on commit ea6dd89

Please sign in to comment.