Browse Source

Validate caret position after document updates; the caret could get outside the document after refactorings.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3075 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
be4618829d
  1. 9
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaControl.cs

9
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaControl.cs

@ -102,7 +102,7 @@ namespace ICSharpCode.TextEditor @@ -102,7 +102,7 @@ namespace ICSharpCode.TextEditor
Document.TextContentChanged += DocumentTextContentChanged;
Document.DocumentChanged += AdjustScrollBarsOnDocumentChange;
Document.UpdateCommited += AdjustScrollBarsOnCommittedUpdate;
Document.UpdateCommited += DocumentUpdateCommitted;
}
protected override void Dispose(bool disposing)
@ -112,7 +112,7 @@ namespace ICSharpCode.TextEditor @@ -112,7 +112,7 @@ namespace ICSharpCode.TextEditor
disposed = true;
Document.TextContentChanged -= DocumentTextContentChanged;
Document.DocumentChanged -= AdjustScrollBarsOnDocumentChange;
Document.UpdateCommited -= AdjustScrollBarsOnCommittedUpdate;
Document.UpdateCommited -= DocumentUpdateCommitted;
motherTextEditorControl = null;
if (vScrollBar != null) {
vScrollBar.Dispose();
@ -187,8 +187,11 @@ namespace ICSharpCode.TextEditor @@ -187,8 +187,11 @@ namespace ICSharpCode.TextEditor
}
}
void AdjustScrollBarsOnCommittedUpdate(object sender, EventArgs e)
void DocumentUpdateCommitted(object sender, EventArgs e)
{
Caret.ValidateCaretPos();
// AdjustScrollBarsOnCommittedUpdate
if (motherTextEditorControl.IsInUpdate == false) {
if (!scrollToPosOnNextUpdate.IsEmpty) {
ScrollTo(scrollToPosOnNextUpdate.Y, scrollToPosOnNextUpdate.X);

Loading…
Cancel
Save