Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes logic for checking if user has typed ahead #264

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ public void documentChanged(final DocumentEvent event) {
}
}

session.setHasBeenTypedahead(currentOffset - session.getInvocationOffset() > 0);

boolean isOutOfBounds = distanceTraversed + input.length() >= currentSuggestion.length()
|| distanceTraversed < 0;
if (isOutOfBounds || !isInputAMatch(currentSuggestion, distanceTraversed, input)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public final class QInvocationSession extends QResource {
private QInlineInputListener inputListener = null;
private QInlineTerminationListener terminationListener = null;
private int[] headOffsetAtLine = new int[500];
private boolean hasBeenTypedahead = false;
private boolean isTabOnly = false;
private Consumer<Integer> unsetVerticalIndent;
private ConcurrentHashMap<UUID, Future<?>> unresolvedTasks = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -407,12 +406,8 @@ public void incrementCurentSuggestionIndex() {
}
}

public void setHasBeenTypedahead(final boolean hasBeenTypedahead) {
this.hasBeenTypedahead = hasBeenTypedahead;
}

public boolean hasBeenTypedahead() {
return hasBeenTypedahead;
return getInvocationOffset() != getViewer().getTextWidget().getCaretOffset();
}

public void executeCallbackForCodeReference() {
Expand Down Expand Up @@ -509,7 +504,6 @@ public void dispose() {
inlineTextFont = null;
inlineTextFontBold = null;
caretMovementReason = CaretMovementReason.UNEXAMINED;
hasBeenTypedahead = false;
unresolvedTasks.forEach((uuid, task) -> {
boolean cancelled = task.cancel(true);
if (cancelled) {
Expand Down
Loading