]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor/completion/SCLCompletionProposal.java
Fixed SCLCompletionProposal.validate to allow complete matches as well
[simantics/platform.git] / bundles / org.simantics.scl.ui / src / org / simantics / scl / ui / editor / completion / SCLCompletionProposal.java
index 11749a4b2b24eef1c717eec74e9129731da58ce6..3734513cb6c3588b054e13a03b7cc15d9d4de1b6 100644 (file)
@@ -166,14 +166,15 @@ public class SCLCompletionProposal implements ICompletionProposal, ICompletionPr
     @Override
     public boolean validate(IDocument document, int offset, DocumentEvent event) {
         try {
-//            System.out.println("replacementOffset : " + replacementOffset);
-//            System.out.println("offset : " + offset);
+            String n = getName();
+            //System.out.println(n + " (" + n.length() + ") " + replacementOffset + " " + offset);
             boolean a = offset >= replacementOffset;
-            boolean b = offset < replacementOffset + getName().length();
+            boolean b = offset <= replacementOffset + n.length();
             String s = document.get(replacementOffset, offset - replacementOffset);
             prefix = s;
-            String d = getName();//.substring(0, offset - prefixStart);
-            boolean c = d.toLowerCase().startsWith(s.toLowerCase());
+            //System.out.println("prefix: " + s + " - " + prefix);
+            boolean c = n.toLowerCase().startsWith(s.toLowerCase());
+            //System.out.println("matches: " + a + " " + b + " " + c);
             return a && b && c;
         } catch (BadLocationException x) {
             //x.printStackTrace();