Posted 10 years ago by GeorgeNY - CTO, RatchetSoft, LLC
Version: 4.0.0281
Avatar
I have a button in my toolbar labeled "convert" which, when clicked, converts the source in the editor from VB to C#. The problem is that the undo stack seems to get cleared by this, so the user cannot undo this operation. Heres my code for the convert button:

string convertedCode = GetConvertedCode();
editor.Document.Language = new CSharpSyntaxLanguage();
editor.Document.LanguageData = GetLanguageData();
editor.Document.Text = convertedCode;

Can you tell me specifically why the undo stack clears?

George P Weihs

Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
George,

Using Document.Text will clear the undo stack. If you wish to retain the undo stack, use Document.ReplaceText instead and specify the full range of the document as the range to replace.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.