LineEndStyle for Editor.SelectedView.SelectedText?

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Karl Grambow
Avatar
Hi,

I wanted to know if there is support for selecting the LineEndStyle for the SelectedText property? I want to be able to specifiy that the lineendstyle of my selected text is CarriageReturnLineFeed.

Thanks,

Karl

Comments (4)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Karl,

Just for background for anyone reading this, we convert all properties like Document.Text and EditorView.SelectedText to use line feeds only. This is so that it's easier to parse the test because you know exactly what character marks a line end and there is only one character instead of CRLF as in Windows. But whenever you want to use the text outside of SyntaxEditor parsing, you should call Document.GetText or Document.GetSubstring because those allow you to say you want the CRLF line end version.

So to get the selected text, you'd do something like this:
editor.Document.GetSubstring(editor.SelectedView.Selection.FirstOffset, editor.SelectedView.Selection.Length, LineEndStyle.CarriageReturnNewline);


Actipro Software Support

Posted 19 years ago by Karl Grambow
Avatar
Hi,

Thanks for that. I knew about GetText but not about GetSubstring, which will work perfectly for me.

Out of interest. I had been using the Replace function to find line feeds and replace them with CRLF. Is using your GetSubstring and GetText functions any better performance wise?. I'm just wondering how much effort I should put into changing existing code to use the GetText and GetSubstring function.

Thanks,

Karl
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Our code does the same thing.


Actipro Software Support

Posted 19 years ago by Karl Grambow
Avatar
Thanks for the quick reply. And thanks for clearing that up. At least it means I don't have to change my code other than to make it look cleaner.

Karl
The latest build of this product (v24.1.1) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.