Browse Source

Disable low-priority rendering after text input: it did not work correctly and caused WPF to render twice per character entered into AvalonEdit.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5528 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Daniel Grunwald 16 years ago
parent
commit
d0e3f61d60
  1. 7
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs

7
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs

@ -136,9 +136,12 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -136,9 +136,12 @@ namespace ICSharpCode.AvalonEdit.Rendering
protected virtual bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
{
if (managerType == typeof(TextDocumentWeakEventManager.Changing)) {
// put redraw into background so that other input events can be handled before the redraw
// TODO: put redraw into background so that other input events can be handled before the redraw.
// Unfortunately the "easy" approach (just use DispatcherPriority.Background) here makes the editor twice as slow because
// the caret position change forces an immediate redraw, and the text input then forces a background redraw.
// When fixing this, make sure performance on the SharpDevelop "type text in C# comment" stress test doesn't get significantly worse.
DocumentChangeEventArgs change = (DocumentChangeEventArgs)e;
Redraw(change.Offset, change.RemovalLength, DispatcherPriority.Background);
Redraw(change.Offset, change.RemovalLength, DispatcherPriority.Normal);
return true;
} else if (managerType == typeof(PropertyChangedWeakEventManager)) {
OnOptionChanged((PropertyChangedEventArgs)e);

Loading…
Cancel
Save