ecSyntMemo

in
  TCustomSyntaxMemo = class(
add fields:
  private
    FNonPrintedSpaces: boolean; //AT
    FNonPrintedEol: boolean; //AT
    FNonPrintedEolDetails: boolean; //AT


after    
    procedure ResetHint;
add
    property NonPrintedSpaces: boolean read FNonPrintedSpaces write FNonPrintedSpaces; //AT
    property NonPrintedEol: boolean read FNonPrintedEol write FNonPrintedEol; //AT
    property NonPrintedEolDetails: boolean read FNonPrintedEolDetails write FNonPrintedEolDetails; //AT


in
  TSyntaxMemo = class(TCustomSyntaxMemo)
add  
  published
    property NonPrintedSpaces; //AT
    property NonPrintedEol; //AT
    property NonPrintedEolDetails; //AT


in
constructor TCustomSyntaxMemo.Create
add
  FNonPrintedSpaces := True;
  FNonPrintedEol := True;
  FNonPrintedEolDetails := False;


  procedure DrawNonPrinted;
  var i, tx, lk, t: integer;
      C: ecChar;
      s, sEnds: ecString; //AT
      HiliteBG: boolean; //AT
      Offset, HeightY: Integer; //AT
  const
    cDx = 2;
    cDy = 2; //indents for CR/LF mark
  begin
    //AT
    if FSelLength = 0 then
      HiliteBG := false
    else
    begin
      Offset := CaretPosToStrPos(Point(0, Line)) + Lines.LineLength(Line);
      HiliteBG := (Offset >= FSelStart) and (Offset < FSelStart + FSelLength);
    end;  
    if not FNonPrinted.Visible and (not LineEnd or not HiliteBG) then Exit;

     //Draw non printed
     Canvas.Brush.Style := bsClear;
     if FNonPrinted.UseFont then Canvas.Font := FNonPrinted.Font
      else Canvas.Font.Color := FNonPrinted.Color;
     HeightY := DefTextExt.cy + FLineSpacing;
     if LineEnd then
      begin
        i := Lines.LineSpace(Line) - Lines.LineLength(Line);
        if (Line < Lines.Count) and (i > 0) then
        if not FNonPrinted.Visible or not (FNonPrintedEol and FNonPrintedEolDetails) then
        begin
          if not FNonPrinted.Visible or not FNonPrintedEol then
            sEnds := ' ' //show space at line-ends
          else
          if (i = 1) and (Lines.TextFormat in [tfCR_NL, tfDefault]) then
            sEnds := FNonPrinted.SoftLineBreakChar
          else
            sEnds := FNonPrinted.LineBreakChar;
          if HiliteBG then
          begin
            Canvas.Brush.Color := DefaultStyles.SelectioMark.BgColor;
            Canvas.FillRect(Rect(X, Y, X + Canvas.TextWidth(sEnds), Y + HeightY));
          end;
          Canvas.TextOut(X, Y, sEnds);
        end
        else
        begin
          Canvas.Font.Size := Canvas.Font.Size - cDy;
          s := Lines.LineEndStr(Line);
          for i := 1 to Length(s) do
          begin
            case s[i] of
              #13: sEnds := 'CR';
              #10: sEnds := 'LF';
              else sEnds := '?';
            end;

            if HiliteBG then
            begin
              Canvas.Brush.Color := DefaultStyles.SelectioMark.BgColor;
              Canvas.FillRect(Rect(X, Y, X + Canvas.TextWidth(sEnds) + cDx*2, Y + HeightY));
            end;

            Inc(X, cDx);
            if opColorNonPrintedBG <> clNone then
              Canvas.Brush.Color:= opColorNonPrintedBG;
            Canvas.TextOut(X, Y + cDy div 2, sEnds);
            Inc(X, Canvas.TextWidth(sEnds));
          end;
        end;
      end
     else
       if FNonPrintedSpaces then //AT
       //below is old MZ's code
       begin
         tx := X;
         lk := LogK;
         for i := 1 to ElemLen do
           begin
             C := GetChar(k + i);
             if C = #9 then
               begin
                 t := NextTab(lk, BasePos + K + i);
                 if t > lk then
                   begin
                     Canvas.TextOut(tX, Y, FNonPrinted.TabChar);
                     Inc(tx, Canvas.TextWidth(' ') * (t - lk));
                     lk := t;
                   end;
               end else
               begin
                 if C = ' ' then
                   begin
                     Canvas.TextOut(tX, Y, FNonPrinted.SpaceChar);
                   end;
                 Inc(tx, ecTextExtent(Canvas, C).cx);
                 Inc(lk);
               end;
           end;
       end;
     Canvas.Brush.Style := bsSolid;
     Canvas.Font := Font;
  end;



    

