Browse Source

Fixed AvalonEdit bugs.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4670 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
945b3d54a3
  1. 6
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs
  2. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs
  3. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs

6
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs

@ -284,6 +284,8 @@ namespace ICSharpCode.AvalonEdit.Document @@ -284,6 +284,8 @@ namespace ICSharpCode.AvalonEdit.Document
public void BeginUpdate()
{
VerifyAccess();
if (inDocumentChanging)
throw new InvalidOperationException("Cannot change document within another document change.");
beginUpdateCount++;
if (beginUpdateCount == 1) {
if (UpdateStarted != null)
@ -474,10 +476,10 @@ namespace ICSharpCode.AvalonEdit.Document @@ -474,10 +476,10 @@ namespace ICSharpCode.AvalonEdit.Document
if (offsetChangeMap != null)
offsetChangeMap.Freeze();
// Ensure that all changes take place inside an update group.
// Will also take care of throwing an exception if inDocumentChanging is set.
BeginUpdate();
try {
if (inDocumentChanging)
throw new InvalidOperationException("Cannot change document within another document change.");
// protect document change against corruption by other changes inside the event handlers
inDocumentChanging = true;
try {

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/Selection.cs

@ -33,7 +33,7 @@ namespace ICSharpCode.AvalonEdit.Editing @@ -33,7 +33,7 @@ namespace ICSharpCode.AvalonEdit.Editing
/// <summary>
/// Gets the smallest segment that contains all segments in this selection.
/// Returns null if the selection is empty.
/// May return null if the selection is empty.
/// </summary>
public abstract ISegment SurroundingSegment { get; }

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs

@ -511,7 +511,7 @@ namespace ICSharpCode.AvalonEdit @@ -511,7 +511,7 @@ namespace ICSharpCode.AvalonEdit
/// </summary>
public void SelectAll()
{
ApplicationCommands.SelectAll.Execute(null, TextArea);
Execute(ApplicationCommands.SelectAll);
}
/// <summary>
@ -666,7 +666,7 @@ namespace ICSharpCode.AvalonEdit @@ -666,7 +666,7 @@ namespace ICSharpCode.AvalonEdit
public int SelectionLength {
get {
TextArea textArea = this.TextArea;
if (textArea != null)
if (textArea != null && !textArea.Selection.IsEmpty)
return textArea.Selection.SurroundingSegment.Length;
else
return 0;

Loading…
Cancel
Save