From d38ff94eaa712ffc048b75764e394865ea31c2a8 Mon Sep 17 00:00:00 2001 From: Vicente Date: Mon, 6 Mar 2017 13:53:09 +1100 Subject: Fold a VHDL "entity" on the first line of the file. --- lexers/LexVHDL.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lexers') diff --git a/lexers/LexVHDL.cxx b/lexers/LexVHDL.cxx index 5fa428bce..a1d75b277 100644 --- a/lexers/LexVHDL.cxx +++ b/lexers/LexVHDL.cxx @@ -398,15 +398,17 @@ static void FoldNoBoxVHDLDoc( strcmp(s, "entity") == 0 || strcmp(s, "configuration") == 0 ) { - if (strcmp(prevWord, "end") != 0 && lastStart) + if (strcmp(prevWord, "end") != 0) { // check for instantiated unit by backward searching for the colon. Sci_PositionU pos = lastStart; - char chAtPos, styleAtPos; + char chAtPos=0, styleAtPos; do{// skip white spaces + if(!pos) + break; pos--; styleAtPos = styler.StyleAt(pos); chAtPos = styler.SafeGetCharAt(pos); - }while(pos>0 && + }while(pos && (chAtPos == ' ' || chAtPos == '\t' || chAtPos == '\n' || chAtPos == '\r' || IsCommentStyle(styleAtPos))); -- cgit v1.2.3