fix, range HL problem when not all foldkinds activated

This commit is contained in:
Basile Burg 2015-10-15 01:53:56 +02:00
parent e148ae8901
commit a604e9cacf
1 changed files with 23 additions and 29 deletions

View File

@ -572,10 +572,10 @@ begin
else else
fCurrRange.rangeKinds += [rkBlockCom1]; fCurrRange.rangeKinds += [rkBlockCom1];
readLine(reader, fTokStop); readLine(reader, fTokStop);
if (fTokKind = tkCommt) and (fkComments1 in fFoldKinds) then if (fTokKind = tkCommt) then
StartCodeFoldBlock(nil) StartCodeFoldBlock(nil, fkComments1 in fFoldKinds)
else if (fTokKind = tkDDocs) and (fkDDoc in fFoldKinds) then else if (fTokKind = tkDDocs) then
StartCodeFoldBlock(nil); StartCodeFoldBlock(nil, fkDDoc in fFoldKinds);
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
@ -584,10 +584,10 @@ begin
else fTokKind := tkCommt; else fTokKind := tkCommt;
if readUntil(reader, fTokStop, '*/') then if readUntil(reader, fTokStop, '*/') then
begin begin
if (fkComments1 in fFoldKinds) and (fTokKind = tkCommt) then if (fTokKind = tkCommt) then
EndCodeFoldBlock() EndCodeFoldBlock(fkComments1 in fFoldKinds)
else if (fkDDoc in fFoldKinds) and (fTokKind = tkDDocs) then else if (fTokKind = tkDDocs) then
EndCodeFoldBlock(); EndCodeFoldBlock(fkDDoc in fFoldKinds);
fCurrRange.rangeKinds -= [rkBlockDoc1, rkBlockCom1]; fCurrRange.rangeKinds -= [rkBlockDoc1, rkBlockCom1];
exit; exit;
end; end;
@ -610,10 +610,10 @@ begin
else else
fCurrRange.rangeKinds += [rkBlockCom2]; fCurrRange.rangeKinds += [rkBlockCom2];
readLine(reader, fTokStop); readLine(reader, fTokStop);
if (fTokKind = tkCommt) and (fkComments2 in fFoldKinds) then if (fTokKind = tkCommt) then
StartCodeFoldBlock(nil) StartCodeFoldBlock(nil, fkComments2 in fFoldKinds)
else if (fTokKind = tkDDocs) and (fkDDoc in fFoldKinds) then else if (fTokKind = tkDDocs) then
StartCodeFoldBlock(nil); StartCodeFoldBlock(nil, fkDDoc in fFoldKinds);
exit; exit;
end else readerReset; end else readerReset;
if (rkBlockCom2 in fCurrRange.rangeKinds) or (rkBlockDoc2 in fCurrRange.rangeKinds) then if (rkBlockCom2 in fCurrRange.rangeKinds) or (rkBlockDoc2 in fCurrRange.rangeKinds) then
@ -628,10 +628,10 @@ begin
dec(fCurrRange.nestedCommentsCount); dec(fCurrRange.nestedCommentsCount);
if fCurrRange.nestedCommentsCount <> 0 then if fCurrRange.nestedCommentsCount <> 0 then
exit; exit;
if (fkComments2 in fFoldKinds) and (fTokKind = tkCommt) then if (fTokKind = tkCommt) then
EndCodeFoldBlock() EndCodeFoldBlock(fkComments2 in fFoldKinds)
else if (fkDDoc in fFoldKinds) and (fTokKind = tkDDocs) then else if (fTokKind = tkDDocs) then
EndCodeFoldBlock(); EndCodeFoldBlock(fkDDoc in fFoldKinds);
fCurrRange.rangeKinds -= [rkBlockDoc2, rkBlockCom2]; fCurrRange.rangeKinds -= [rkBlockDoc2, rkBlockCom2];
exit; exit;
end; end;
@ -673,8 +673,7 @@ begin
end; end;
end; end;
fCurrRange.rangeKinds += [rkString1]; fCurrRange.rangeKinds += [rkString1];
if fkStrings in fFoldKinds then StartCodeFoldBlock(nil, fkStrings in fFoldKinds);
StartCodeFoldBlock(nil);
exit; exit;
end else _postString1: readerReset; end else _postString1: readerReset;
if rkString1 in fCurrRange.rangeKinds then if rkString1 in fCurrRange.rangeKinds then
@ -695,8 +694,7 @@ begin
fCurrRange.rangeKinds -= [rkString1]; fCurrRange.rangeKinds -= [rkString1];
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
fCurrRange.rString := false; fCurrRange.rString := false;
if fkStrings in fFoldKinds then EndCodeFoldBlock(fkStrings in fFoldKinds);
EndCodeFoldBlock();
exit; exit;
end end
else break; else break;
@ -717,8 +715,7 @@ begin
end; end;
fCurrRange.rangeKinds += [rkString2]; fCurrRange.rangeKinds += [rkString2];
readLine(reader, fTokStop); readLine(reader, fTokStop);
if fkStrings in fFoldKinds then StartCodeFoldBlock(nil, fkStrings in fFoldKinds);
StartCodeFoldBlock(nil);
exit; exit;
end else readerReset; end else readerReset;
if rkString2 in fCurrRange.rangeKinds then if rkString2 in fCurrRange.rangeKinds then
@ -727,8 +724,7 @@ begin
if readUntil(reader, fTokStop, '`') then if readUntil(reader, fTokStop, '`') then
begin begin
fCurrRange.rangeKinds -= [rkString2]; fCurrRange.rangeKinds -= [rkString2];
if fkStrings in fFoldKinds then EndCodeFoldBlock(fkStrings in fFoldKinds);
EndCodeFoldBlock();
readDelim(reader, fTokStop, stringPostfixes); readDelim(reader, fTokStop, stringPostfixes);
exit; exit;
end; end;
@ -742,8 +738,7 @@ begin
fTokKind := tkSymbl; fTokKind := tkSymbl;
inc(fCurrRange.tokenStringBracketsCount); inc(fCurrRange.tokenStringBracketsCount);
fCurrRange.rangeKinds += [rkTokString]; fCurrRange.rangeKinds += [rkTokString];
if fkBrackets in fFoldKinds then StartCodeFoldBlock(nil, fkBrackets in fFoldKinds);
StartCodeFoldBlock(nil);
exit; exit;
end else readerReset; end else readerReset;
@ -782,11 +777,10 @@ begin
begin begin
fTokKind := tkSymbl; fTokKind := tkSymbl;
case reader^ of case reader^ of
'{': if fkBrackets in fFoldKinds then StartCodeFoldBlock(nil); '{': StartCodeFoldBlock(nil, fkBrackets in fFoldKinds);
'}': '}':
begin begin
if fkBrackets in fFoldKinds then EndCodeFoldBlock(fkBrackets in fFoldKinds);
EndCodeFoldBlock();
if (reader^ = '}') and (rkAsm in fCurrRange.rangeKinds) then if (reader^ = '}') and (rkAsm in fCurrRange.rangeKinds) then
fCurrRange.rangeKinds -= [rkAsm]; ; fCurrRange.rangeKinds -= [rkAsm]; ;
if (rkTokString in fCurrRange.rangeKinds) then if (rkTokString in fCurrRange.rangeKinds) then