Browse Source

Fixed SD2-1087: Setting IEditable.Text does not update undo stack

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2262 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
cc9430b8dc
  1. 1
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultDocument.cs
  2. 5
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/IDocument.cs
  3. 2
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs

1
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultDocument.cs

@ -223,6 +223,7 @@ namespace ICSharpCode.TextEditor.Document
OnDocumentAboutToBeChanged(new DocumentEventArgs(this, 0, 0, value)); OnDocumentAboutToBeChanged(new DocumentEventArgs(this, 0, 0, value));
textBufferStrategy.SetContent(value); textBufferStrategy.SetContent(value);
lineTrackingStrategy.SetContent(value); lineTrackingStrategy.SetContent(value);
undoStack.ClearAll();
OnDocumentChanged(new DocumentEventArgs(this, 0, 0, value)); OnDocumentChanged(new DocumentEventArgs(this, 0, 0, value));
OnTextContentChanged(EventArgs.Empty); OnTextContentChanged(EventArgs.Empty);

5
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/IDocument.cs

@ -193,7 +193,10 @@ namespace ICSharpCode.TextEditor.Document
#region ITextBufferStrategy interface #region ITextBufferStrategy interface
/// <value> /// <value>
/// Get the whole text as string /// Get the whole text as string.
/// When setting the text using the TextContent property, the undo stack is cleared.
/// Set TextContent only for actions such as loading a file; if you want to change the current document
/// use the Replace method instead.
/// </value> /// </value>
string TextContent { string TextContent {
get; get;

2
src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs

@ -209,7 +209,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
void SetText(string value) void SetText(string value)
{ {
textAreaControl.Document.TextContent = value; textAreaControl.Document.Replace(0, textAreaControl.Document.TextLength, value);
} }
public string Text { public string Text {

Loading…
Cancel
Save