Skip to content
Merged
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 @@ -391,8 +391,9 @@ protected String currentCompletionText() {
if (hintVisible) return ""; //Can't have any text if the hint is visible

Editable editable = getText();
int end = getSelectionEnd();
int start = tokenizer.findTokenStart(editable, end);
int cursorPosition = getSelectionEnd();
int end = tokenizer.findTokenEnd(editable, cursorPosition);
int start = tokenizer.findTokenStart(editable, cursorPosition);
if (start < prefix.length()) {
start = prefix.length();
}
Expand Down Expand Up @@ -428,12 +429,19 @@ public void invalidate() {
public boolean enoughToFilter() {
Editable text = getText();

int end = getSelectionEnd();
if (end < 0 || tokenizer == null) {
if (tokenizer == null)
{
return false;
}

int start = tokenizer.findTokenStart(text, end);
int cursorPosition = getSelectionEnd();

if (cursorPosition < 0) {
return false;
}

int end = tokenizer.findTokenEnd(text, cursorPosition);
int start = tokenizer.findTokenStart(text, cursorPosition);
if (start < prefix.length()) {
start = prefix.length();
}
Expand Down Expand Up @@ -774,8 +782,9 @@ protected void replaceText(CharSequence text) {
TokenImageSpan tokenSpan = buildSpanForObject(selectedObject);

Editable editable = getText();
int end = getSelectionEnd();
int start = tokenizer.findTokenStart(editable, end);
int cursorPosition = getSelectionEnd();
int end = tokenizer.findTokenEnd(editable, cursorPosition);
int start = tokenizer.findTokenStart(editable, cursorPosition);
if (start < prefix.length()) {
start = prefix.length();
}
Expand Down