X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLUnitContext.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLUnitContext.java index c324f5d..afec8f5 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLUnitContext.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/HTMLUnitContext.java @@ -37,7 +37,7 @@ public class HTMLUnitContext extends DocumentTemplateContext { protected HTMLUnitContext(ContextType type, IDocument document, int completionPosition) //,ICompilationUnit compilationUnit) { - super(type, document, completionPosition); + super(type, document, completionPosition, 0); // fCompilationUnit= compilationUnit; } @@ -94,22 +94,44 @@ public class HTMLUnitContext extends DocumentTemplateContext { public int getStart() { IDocument document = getDocument(); try { - int start = getCompletionPosition(); - - while (((start != 0) && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) - || ((start != 0) && specialChars.indexOf(document.getChar(start - 1)) != (-1) )) { - start--; + int start = getCompletionOffset(); + char ch = ' '; + while (start != 0) { + ch = document.getChar(start - 1); + if (specialChars.indexOf(ch) != (-1)) { + return --start; + } + if (Character.isUnicodeIdentifierPart(ch)) { + start--; + } else { + break; + } } - - if (((start != 0) && Character.isUnicodeIdentifierStart(document.getChar(start - 1))) - || ((start != 0) && specialChars.indexOf(document.getChar(start - 1)) != (-1) )) { + if ((start != 0) && Character.isUnicodeIdentifierStart(document.getChar(start - 1))) { start--; + if ((start != 0) && specialChars.indexOf(document.getChar(start - 1)) != (-1)) { + start--; + } } + // while (((start != 0) + // && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) + // || ((start != 0) + // && specialChars.indexOf(document.getChar(start - 1)) != (-1))) { + // start--; + // } + // + //if (((start != 0) + // && Character.isUnicodeIdentifierStart(document.getChar(start - 1))) + // || ((start != 0) + // && specialChars.indexOf(document.getChar(start - 1)) != (-1))) { + // start--; + //} + return start; } catch (BadLocationException e) { - return getCompletionPosition(); + return getCompletionOffset(); } }