Posted 14 years ago by tobias weltner
Avatar
There are a number of ways to insert text programmatically into syntaxeditor.

However, they all change selection or replace the entire document text.
Is there a way to insert text while preserving the current selection and caret position?

One addition:

I also noticed that even with UndoableInsert, all collapsed nodes are expanding. Is there a way to insert text without UI effects? I don't really want the user to be annoyed by automatically inserted text.

[Modified at 07/07/2005 07:30 AM]

Comments (4)

Posted 14 years ago by tobias weltner
Avatar
This really is weird:
if I paste in text from the clipboard, collapsed code parts stay collapsed.
If I paste text with UndoableInsert, however, all collapsed nodes expand.

Is there anything I can do to insert text programmatically without changing the UI?
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Right now, selections are modified when you perform a modification. I will add a TODO item for allowing text to be inserted without text modification.

Actually paste operations end up calling UndoableInsert so they should both behave the same if the same parameters are used. Paste simple specifies the current selection offset range as the text to replace.


Actipro Software Support

Posted 10 years ago by David
Avatar
Has anything changed on this since 2005? I am wanting to do the same thing.
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes, use the overload that takes DocumentModificationOptions.RetainSelection.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 7 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.