View Issue Details

IDProjectCategoryView StatusLast Update
0017296LazarusLCLpublic2010-10-25 09:48
ReporterValentin CalinovAssigned ToMartin Friebe 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.29 (SVN)Product Build 
Target Version1.0.0Fixed in Version0.9.29 (SVN) 
Summary0017296: On Windows TSynMemo.SaveToFile method use 0000010 character as line ending (and should use 0000013#10)
Description  The attached project contains the following code:

procedure TForm1.FormActivate(Sender: TObject);
begin
  SynMemo1.Clear;
  SynMemo1.Lines.Add('first line');
  SynMemo1.Lines.Add('second line');
  SynMemo1.Lines.Add('third line');
end;

procedure TForm1.SaveToFileButtonClick(Sender: TObject);
const
  File_Name = 'test_file.txt';
begin
  SynMemo1.Lines.SaveToFile(File_Name);
  ShowMessage('Saved to file: ' + File_Name);
end;

  Examine the content of the saved file (with a hex editor for example) and
you will see that lines end with 0000010 character.
  I even try to use:
    System.DefaultTextLineBreakStyle := tlbsCRLF;
in FormCreate event but with no success.
TagsNo tags attached.
Fixed in Revision27840
LazTarget1.2
WidgetsetWin32/Win64
Attached Files

Activities

2010-08-29 10:58

 

bug_syn_memo.zip (131,911 bytes)

Martin Friebe

2010-08-29 12:07

manager   ~0040582

Should probably be automated, but you can set

SynMemo.Lines.DosFileFormat := True;

Valentin Calinov

2010-08-29 14:34

reporter   ~0040589

It works only after including SynEditLines unit in the project and
typecasting to TSynEditLines:
  TSynEditLines(SynMemo1.Lines).DosFileFormat := True;

  I think this should be changed to be the default value on Windows.

Martin Friebe

2010-10-24 22:35

manager   ~0042073

TSynEditLines(SynMemo1.Lines).DosFileFormat
has been deprecated.

As replacement has been introduced:
  TSynEditLines(SynMemo1.Lines)
for the loaded file
    property FileLineEndType: TSynLinesFileLineEndType ;
for writing
    property FileWriteLineEndType: TSynLinesFileLineEndType
             

with the values
    ( sfleSystem,
      sfleLoaded,
      sfleCrLf,
      sfleCr,
      sfleLf


sfleSystem is the default, so normal operation requires no changes

sfleLoaded will save back with the value determined during loading

--------
please close if ok

Valentin Calinov

2010-10-25 09:48

reporter   ~0042088

Thank you.

Issue History

Date Modified Username Field Change
2010-08-29 10:58 Valentin Calinov New Issue
2010-08-29 10:58 Valentin Calinov File Added: bug_syn_memo.zip
2010-08-29 10:58 Valentin Calinov Widgetset => Win32/Win64
2010-08-29 12:07 Martin Friebe Note Added: 0040582
2010-08-29 14:34 Valentin Calinov Note Added: 0040589
2010-09-30 04:01 Martin Friebe Status new => assigned
2010-09-30 04:01 Martin Friebe Assigned To => Martin Friebe
2010-09-30 04:03 Martin Friebe LazTarget => 1.2
2010-10-24 22:35 Martin Friebe Fixed in Revision => 27840
2010-10-24 22:35 Martin Friebe Status assigned => resolved
2010-10-24 22:35 Martin Friebe Fixed in Version => 0.9.29 (SVN)
2010-10-24 22:35 Martin Friebe Resolution open => fixed
2010-10-24 22:35 Martin Friebe Note Added: 0042073
2010-10-24 22:35 Martin Friebe Target Version => 1.0.0
2010-10-25 09:48 Valentin Calinov Status resolved => closed
2010-10-25 09:48 Valentin Calinov Note Added: 0042088