From 3bc8aa826c28d91b5e5cf248234a0db09f7b07a6 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 10 Feb 2015 12:53:34 +1100 Subject: Fix hang in folding when document starts with "entity". From Vicente. --- lexers/LexVHDL.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lexers') diff --git a/lexers/LexVHDL.cxx b/lexers/LexVHDL.cxx index fe1b33317..474726c8f 100644 --- a/lexers/LexVHDL.cxx +++ b/lexers/LexVHDL.cxx @@ -388,13 +388,14 @@ static void FoldNoBoxVHDLDoc( strcmp(s, "entity") == 0 || strcmp(s, "configuration") == 0 ) { - if (strcmp(prevWord, "end") != 0) + if (strcmp(prevWord, "end") != 0 && lastStart) { // check for instantiated unit by backward searching for the colon. - unsigned pos = lastStart-1; + unsigned pos = lastStart; char chAtPos, styleAtPos; do{// skip white spaces + pos--; styleAtPos = styler.StyleAt(pos); - chAtPos = styler.SafeGetCharAt(pos--); + chAtPos = styler.SafeGetCharAt(pos); }while(pos>0 && (chAtPos == ' ' || chAtPos == '\t' || chAtPos == '\n' || chAtPos == '\r' || -- cgit v1.2.3