ecSyntAnal

//add
function IndentOf(const S: ecString): Integer;
var
  i: Integer;
begin
  Result:= 0;
  for i:= 1 to Length(S) do
    case S[i] of
      ' ': Inc(Result);
      #9: Inc(Result, 4);
      else Break;
   end;
end;


//change
procedure TClientSyntAnalyzer.CloseAtEnd(StartTagIdx: integer);
const
  cSpecIndentID = 20;
    //special number for "Group index" lexer property, which activates indent-based folding for a rule
  cSpecTokenStart: char = '1';
    //special char - must be first of token's type name (e.g. "1keyword");
    //Also such tokens must contain spaces+tabs at the beginning (use parser regex like "^[\x20\x09]*\w+")
var i, j, Ind: integer;
    Range: TTextRange;
    s: string;
begin
  for i := FOpenedBlocks.Count - 1 downto 0 do
   begin
    Range := TTextRange(FOpenedBlocks[i]);
    if Range.FRule.EndOfTextClose and
       ((StartTagIdx = 0) or (Range.StartIdx >= StartTagIdx)) then
     begin
       Range.FEnd := TagCount - 1;
       if Range.FRule.GroupIndex = cSpecIndentID then
       begin
         Ind := IndentOf(TagStr[Range.StartIdx]);
         for j := Range.StartIdx+1 to TagCount-1 do
         begin
           s := Owner.TokenTypeNames[Tags[j].FTokenType];
           if (s[1] = cSpecTokenStart) and (IndentOf(TagStr[j]) <= Ind) then
           begin
             Range.FEnd := j-1;
             Break
           end;
         end;
       end;
       FOpenedBlocks.Delete(i);
     end;
   end;
end;


ecSyntmemo

//after
   else ColRangeText := GetColRangeTextAtPos(Line, ColIconPos);
//add   
  if Pos(#9, ColRangeText)>0 then
    ColRangeText := StringReplace(ColRangeText, #9, StringOfChar(' ', TabList[0]), [rfReplaceAll]);
