From c4290272548ce8805ebbdb9703acd271b45f8cfd Mon Sep 17 00:00:00 2001 From: khartlage Date: Sat, 3 May 2003 13:57:55 +0000 Subject: [PATCH 1/1] improved auto trigger for html --- .../corext/template/php/HTMLUnitContext.java | 40 ++++++++++++++----- 1 files changed, 29 insertions(+), 11 deletions(-) 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 76343dd..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 @@ -95,21 +95,39 @@ public class HTMLUnitContext extends DocumentTemplateContext { IDocument document = getDocument(); try { int start = getCompletionOffset(); - - if ( ((start != 0) && specialChars.indexOf(document.getChar(start - 1)) != (-1) )) { - return --start; - } - - while (((start != 0) && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) - || ((start != 0) && specialChars.indexOf(document.getChar(start - 1)) != (-1) )) { - start--; + 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) { -- 1.7.1