From e03b7c5869e602893a247773a35d6e9dde009768 Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 23 Jul 2008 11:59:52 +0000 Subject: [PATCH] codetools: identifier completion: do not add semicolon twice git-svn-id: trunk@15846 - --- components/codetools/identcompletiontool.pas | 31 +++++++++++--------- lcl/interfaces/gtk2/gtk2widgetset.inc | 2 ++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index 56aaa791f9..7e6c3ef650 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -1540,22 +1540,25 @@ begin // check if in statement if (ilcfStartInStatement in CurrentIdentifierList.ContextFlags) then begin - if (CurrentIdentifierList.StartBracketLvl=0) - and (not (ilcfStartIsLValue in CurrentIdentifierList.ContextFlags)) + // check if a semicolon is needed at the end + if (CurrentIdentifierList.StartBracketLvl>0) + or (CurPos.Flag in [cafSemicolon, cafEqual, cafColon, cafComma, + cafPoint, cafRoundBracketOpen, cafRoundBracketClose, + cafEdgedBracketOpen, cafEdgedBracketClose]) + or ((CurPos.Flag=cafWord) + and (UpAtomIs('ELSE') + or UpAtomIs('THEN') + or UpAtomIs('DO') + or UpAtomIs('TO') + or UpAtomIs('OF'))) + then begin + // do not add semicolon + CurrentIdentifierList.ContextFlags:= + CurrentIdentifierList.ContextFlags+[ilcfNoEndSemicolon]; + end + else if (not (ilcfStartIsLValue in CurrentIdentifierList.ContextFlags)) then begin // check if a semicolon is needed at the end - if (CurPos.Flag=cafWord) - and (UpAtomIs('ELSE') - or UpAtomIs('THEN') - or UpAtomIs('DO') - or UpAtomIs('TO') - or UpAtomIs('OF')) - then begin - // do not add semicolon - CurrentIdentifierList.ContextFlags:= - CurrentIdentifierList.ContextFlags+[ilcfNoEndSemicolon]; - end - else if (CurPos.Flag in [cafEnd,cafBegin]) or WordIsBlockKeyWord.DoItUpperCase(UpperSrc, CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) diff --git a/lcl/interfaces/gtk2/gtk2widgetset.inc b/lcl/interfaces/gtk2/gtk2widgetset.inc index bf02f3688c..64b5e951bf 100644 --- a/lcl/interfaces/gtk2/gtk2widgetset.inc +++ b/lcl/interfaces/gtk2/gtk2widgetset.inc @@ -564,7 +564,9 @@ begin inherited AppInit(ScreenInfo); {$if defined(cpui386) or defined(cpux86_64)} // needed otherwise some gtk theme engines crash with division by zero + {$IFNDEF DisableGtkDivZeroFix} SetExceptionMask(GetExceptionMask + [exZeroDivide]); + {$ENDIF} {$endif} end;