mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 21:32:19 +00:00
Got backspace + autocomplete (CTRL SPACE) working, now functions when cursor mid sentence/word
This commit is contained in:
1 parent
9886dae519
commit
02ce0912c7
1 file changed
+8
@@ -608,12 +608,20 @@ public class AutocompleteManager {
|
||||
private int findDotBeforeWhitespace(String text, int fromPos) {
|
||||
int pos = fromPos;
|
||||
// Skip backwards over whitespace
|
||||
|
||||
while (pos >= 0 && Character.isWhitespace(text.charAt(pos))) {
|
||||
pos--;
|
||||
}
|
||||
|
||||
// Check if we found a dot
|
||||
if (pos >= 0 && text.charAt(pos) == '.') {
|
||||
return pos;
|
||||
} else {
|
||||
while (pos >= 0 && Character.isJavaIdentifierPart(text.charAt(pos)))
|
||||
pos--;
|
||||
|
||||
if (pos >= 0 && text.charAt(pos) == '.')
|
||||
return pos;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user