Add text to the document

SyntaxEditor for Windows Forms Forum

Posted 15 years ago by Martin Lundberg - Sweden
Avatar
Hello again!

This may be a stupid question, but how do I add text to where the caret is and then move the caret to the end of the added text.
And can I append text or do I have to do text = text + "my text"; or something like that?

Thanks again!

Martin Lundberg
Student, Sweden

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Use editor.SelectedView.InsertText or editor.SelectedView.InsertSurroundingText depending on what you want to do.

To append text, the best way is probably to do an editor.Document.UndoableInsert and put its offset at the end of the text. I'll add a TODO item to add an AppendText method or something similar which will be a wrapper for the UndoableInsert call.


Actipro Software Support

Posted 15 years ago by Martin Lundberg - Sweden
Avatar
Great, =) thanks!

Martin Lundberg
Student, Sweden

The latest build of this product (v2020.1 build 0400) was released 8 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.