Hello, I'm a long-time QWhale syntaxedit (now code editor) user in one of my products and just today I learned that Alternet is the new owner of this product. I am recently faced with the task of controlling how the lines are terminated. The default is $0D $0A (CR/LF) which is evident when saving the contents of the editor to a file. I need to be able to use a CR-only for my customers who need this format. I understand that the property for setting this is .LineTerminator, but I can find no documentation on how to use this property.
I've tried:
.LineTerminator = chr(13)
.LineTerminator = chr(13).toString
.LineTerminator = "MAC"
etc. to no success.
I'd like to upgrade to the Alternet version of this editor but I need it to be able to convert CR/LFs upon loading or saving. Thanks.
There seems to be straight bug with ignoring LineTerminator property when saving content of the editor to the file using SaveFile method.
For now you can use code like this:
syntaxEdit1.Lines.LineTerminator = "\u000D";
System.IO.File.WriteAllText(@"c:\test.txt", syntaxEdit1.Lines.Text);
Editor process CR/LF or CRLF the same way when loading text from the file, so this property is only relevant for saving/getting text content.
I was pulling my hair out over this. Thanks for giving another solution. I'll report back with my results.
Ok, this works for VB.NET code:
editor.Lines.LineTerminator = chrW(13)
System.IO.File.WriteAllText(DocPath, editor.lines.Text)