Posted 18 years ago
by Paul Hasselfeldt
SyntaxEditor v3.1.0203, .NET 2.0, Windows XP
In one of my projects I have a need to insert text optionally before or after the caret keeping the current position of the caret intact. I am currently able to occomplish this with the Document.UndoableInsert function using the retainSelection for text inserted prior to the caret. When inserting values directly after the caret it moves the carets position to the end of the inserted text rather than appending the text to the end of the caret current position which is what I need. I have tried repositioning the selection after insertion but if the text being inserted is long then maintaining the previous relative screen position becomes difficult as scrolling begins to take over. There is no need to have the inserted text as an undoable action however I need to retain the undo history. Is there another means to accomplish this that I am not seeing? Could style of retainSelection be augmented or an new flag added to support this need?
Thanks,
Paul
In one of my projects I have a need to insert text optionally before or after the caret keeping the current position of the caret intact. I am currently able to occomplish this with the Document.UndoableInsert function using the retainSelection for text inserted prior to the caret. When inserting values directly after the caret it moves the carets position to the end of the inserted text rather than appending the text to the end of the caret current position which is what I need. I have tried repositioning the selection after insertion but if the text being inserted is long then maintaining the previous relative screen position becomes difficult as scrolling begins to take over. There is no need to have the inserted text as an undoable action however I need to retain the undo history. Is there another means to accomplish this that I am not seeing? Could style of retainSelection be augmented or an new flag added to support this need?
Thanks,
Paul