fix #224, deactivated ranges shown in the gutter

This commit is contained in:
Basile Burg 2018-01-22 02:18:43 +01:00
parent c3db2cfcfa
commit 9be04dd9d0
1 changed files with 28 additions and 22 deletions

View File

@ -495,10 +495,10 @@ begin
else else
fCurrRange.rangeKinds += [rkBlockCom1]; fCurrRange.rangeKinds += [rkBlockCom1];
readLine(reader, fTokStop); readLine(reader, fTokStop);
if (fTokKind = tkCommt) then if (fTokKind = tkCommt) and (fkComments1 in fFoldKinds) then
StartCodeFoldBlock(nil, fkComments1 in fFoldKinds) StartCodeFoldBlock(nil)
else if (fTokKind = tkDDocs) then else if (fTokKind = tkDDocs) and (fkDDoc in fFoldKinds) then
StartCodeFoldBlock(nil, fkDDoc in fFoldKinds); StartCodeFoldBlock(nil);
exit; exit;
end else readerReset; end else readerReset;
if (rkBlockCom1 in fCurrRange.rangeKinds) or (rkBlockDoc1 in fCurrRange.rangeKinds) then if (rkBlockCom1 in fCurrRange.rangeKinds) or (rkBlockDoc1 in fCurrRange.rangeKinds) then
@ -507,10 +507,10 @@ begin
else fTokKind := tkCommt; else fTokKind := tkCommt;
if readUntil(reader, fTokStop, '*/') then if readUntil(reader, fTokStop, '*/') then
begin begin
if (fTokKind = tkCommt) then if (fTokKind = tkCommt) and (fkComments1 in fFoldKinds) then
EndCodeFoldBlock(fkComments1 in fFoldKinds) EndCodeFoldBlock()
else if (fTokKind = tkDDocs) then else if (fTokKind = tkDDocs) and (fkDDoc in fFoldKinds) then
EndCodeFoldBlock(fkDDoc in fFoldKinds); EndCodeFoldBlock();
fCurrRange.rangeKinds -= [rkBlockDoc1, rkBlockCom1]; fCurrRange.rangeKinds -= [rkBlockDoc1, rkBlockCom1];
exit; exit;
end; end;
@ -556,10 +556,10 @@ begin
fCurrRange.rangeKinds += [rkBlockDoc2] fCurrRange.rangeKinds += [rkBlockDoc2]
else else
fCurrRange.rangeKinds += [rkBlockCom2]; fCurrRange.rangeKinds += [rkBlockCom2];
if (fTokKind = tkCommt) then if (fTokKind = tkCommt) and (fkComments2 in fFoldKinds) then
StartCodeFoldBlock(nil, fkComments2 in fFoldKinds) StartCodeFoldBlock(nil)
else if (fTokKind = tkDDocs) then else if (fTokKind = tkDDocs) and (fkDDoc in fFoldKinds) then
StartCodeFoldBlock(nil, fkDDoc in fFoldKinds); StartCodeFoldBlock(nil);
end; end;
exit; exit;
end else readerReset; end else readerReset;
@ -590,10 +590,10 @@ begin
end; end;
if fCurrRange.nestedCommentsCount = 0 then if fCurrRange.nestedCommentsCount = 0 then
begin begin
if (fTokKind = tkCommt) then if (fTokKind = tkCommt) and (fkComments2 in fFoldKinds) then
EndCodeFoldBlock(fkComments2 in fFoldKinds) EndCodeFoldBlock()
else if (fTokKind = tkDDocs) then else if (fTokKind = tkDDocs) and (fkDDoc in fFoldKinds) then
EndCodeFoldBlock(fkDDoc in fFoldKinds); EndCodeFoldBlock();
fCurrRange.rangeKinds -= [rkBlockDoc2, rkBlockCom2]; fCurrRange.rangeKinds -= [rkBlockDoc2, rkBlockCom2];
end; end;
exit; exit;
@ -635,7 +635,8 @@ begin
end; end;
end; end;
fCurrRange.rangeKinds += [rkString1]; fCurrRange.rangeKinds += [rkString1];
StartCodeFoldBlock(nil, fkStrings in fFoldKinds); if fkStrings in fFoldKinds then
StartCodeFoldBlock(nil);
exit; exit;
end else _notRawStrng: readerReset; end else _notRawStrng: readerReset;
if rkString1 in fCurrRange.rangeKinds then if rkString1 in fCurrRange.rangeKinds then
@ -659,7 +660,8 @@ begin
fCurrRange.rangeKinds -= [rkString1]; fCurrRange.rangeKinds -= [rkString1];
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
fCurrRange.rString := false; fCurrRange.rString := false;
EndCodeFoldBlock(fkStrings in fFoldKinds); if fkStrings in fFoldKinds then
EndCodeFoldBlock(fkStrings in fFoldKinds);
exit; exit;
end end
else break; else break;
@ -679,7 +681,8 @@ begin
end; end;
fCurrRange.rangeKinds += [rkString2]; fCurrRange.rangeKinds += [rkString2];
readLine(reader, fTokStop); readLine(reader, fTokStop);
StartCodeFoldBlock(nil, fkStrings in fFoldKinds); if fkStrings in fFoldKinds then
StartCodeFoldBlock(nil);
exit; exit;
end else readerReset; end else readerReset;
if rkString2 in fCurrRange.rangeKinds then if rkString2 in fCurrRange.rangeKinds then
@ -688,7 +691,8 @@ begin
if readUntil(reader, fTokStop, '`') then if readUntil(reader, fTokStop, '`') then
begin begin
fCurrRange.rangeKinds -= [rkString2]; fCurrRange.rangeKinds -= [rkString2];
EndCodeFoldBlock(fkStrings in fFoldKinds); if fkStrings in fFoldKinds then
EndCodeFoldBlock();
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
exit; exit;
end; end;
@ -834,10 +838,12 @@ begin
begin begin
fTokKind := tkSymbl; fTokKind := tkSymbl;
case reader^ of case reader^ of
'{': StartCodeFoldBlock(nil, fkBrackets in fFoldKinds); '{': if fkBrackets in fFoldKinds then
StartCodeFoldBlock(nil);
'}': '}':
begin begin
EndCodeFoldBlock(fkBrackets in fFoldKinds); if fkBrackets in fFoldKinds then
EndCodeFoldBlock();
if (reader^ = '}') and (rkAsm in fCurrRange.rangeKinds) then if (reader^ = '}') and (rkAsm in fCurrRange.rangeKinds) then
fCurrRange.rangeKinds -= [rkAsm]; ; fCurrRange.rangeKinds -= [rkAsm]; ;
if (reader+1)^ in stringPostfixes then if (reader+1)^ in stringPostfixes then