diff --git a/components/synedit/synhighlighterhtml.pp b/components/synedit/synhighlighterhtml.pp
index 7f0f4f656e..075c616c3a 100644
--- a/components/synedit/synhighlighterhtml.pp
+++ b/components/synedit/synhighlighterhtml.pp
@@ -2523,18 +2523,21 @@ begin
end;
procedure TSynHTMLSyn.IdentProc;
+var
+ R: LongInt;
begin
case fRange of
rsKey:
begin
fRange := rsParam;
fTokenID := IdentKind((fLine + Run));
- if ((FMode = shmXHtml) or (not fSimpleTag)) then
- if fLine[Run] = '/' then
- EndHtmlNodeCodeFoldBlock(Run+1, copy(fline, Run+2, fStringLen-1))
- else if fLine[Run] <> '!' then
- StartHtmlNodeCodeFoldBlock(cfbtHtmlNode, Run, copy(fline, Run+1, fStringLen));
+ R := Run;
Inc(Run, fStringLen);
+ if ((FMode = shmXHtml) or (not fSimpleTag)) then
+ if fLine[R] = '/' then
+ EndHtmlNodeCodeFoldBlock(R+1, copy(fline, R+2, fStringLen-1))
+ else if fLine[R] <> '!' then
+ StartHtmlNodeCodeFoldBlock(cfbtHtmlNode, R, copy(fline, R+1, fStringLen));
end;
rsValue:
begin
@@ -2759,6 +2762,10 @@ function TSynHTMLSyn.GetFoldConfigInstance(Index: Integer): TSynCustomFoldConfig
begin
Result := inherited GetFoldConfigInstance(Index);
Result.Enabled := True;
+ if THtmlCodeFoldBlockType(Index) in [cfbtHtmlNode] then begin
+ Result.SupportedModes := Result.SupportedModes + [fmMarkup];
+ Result.Modes := Result.Modes + [fmMarkup];
+ end;
end;
function TSynHTMLSyn.StartHtmlCodeFoldBlock(ABlockType: THtmlCodeFoldBlockType): TSynCustomCodeFoldBlock;
diff --git a/components/synedit/synhighlighterxml.pas b/components/synedit/synhighlighterxml.pas
index 581470e963..a563cc49a3 100644
--- a/components/synedit/synhighlighterxml.pas
+++ b/components/synedit/synhighlighterxml.pas
@@ -747,6 +747,10 @@ function TSynXMLSyn.GetFoldConfigInstance(Index: Integer): TSynCustomFoldConfig;
begin
Result := inherited GetFoldConfigInstance(Index);
Result.Enabled := True;
+ if TXmlCodeFoldBlockType(Index) in [cfbtXmlNode] then begin
+ Result.SupportedModes := Result.SupportedModes + [fmMarkup];
+ Result.Modes := Result.Modes + [fmMarkup];
+ end;
end;
procedure TSynXMLSyn.IdentProc;