Posted 15 years ago by GeorgeNY - CTO, RatchetSoft, LLC
Version: 4.0.0281
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 15 years ago by Actipro Software Support - Cleveland, OH, USA

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 (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.