mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
admit that the caret may move whenever it likes during completion
This commit is contained in:
+7
-12
@@ -593,10 +593,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
|
||||
public void addWatchedPrefix(int startOffset, ElementPattern<String> restartCondition) {
|
||||
int caret = myEditor.getCaretModel().getOffset();
|
||||
if (caret < startOffset) {
|
||||
LOG.error("caret=" + caret + "; start=" + startOffset);
|
||||
}
|
||||
myRestartingPrefixConditions.add(Pair.create(startOffset, restartCondition));
|
||||
}
|
||||
|
||||
@@ -605,14 +601,13 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
final int caretOffset = myEditor.getCaretModel().getOffset();
|
||||
for (Pair<Integer, ElementPattern<String>> pair : myRestartingPrefixConditions) {
|
||||
int start = pair.first;
|
||||
if (caretOffset < start) {
|
||||
LOG.error("caret=" + caretOffset + "; start=" + start + "; phase=" + CompletionServiceImpl.getPhaseRaw() + "; running=" + isRunning() + "; canceled=" + isCanceled());
|
||||
}
|
||||
final String newPrefix = text.subSequence(start, caretOffset).toString();
|
||||
if (pair.second.accepts(newPrefix)) {
|
||||
scheduleRestart();
|
||||
myRestartingPrefixConditions.clear();
|
||||
return;
|
||||
if (caretOffset >= start) {
|
||||
final String newPrefix = text.subSequence(start, caretOffset).toString();
|
||||
if (pair.second.accepts(newPrefix)) {
|
||||
scheduleRestart();
|
||||
myRestartingPrefixConditions.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user