- wxRect drawingArea(GetLogicalPoint(wxPoint(0, 0)), GetClientSize());
- wxRect availableSpace(GetClientSize());
- if (GetBuffer().GetDirty())
- {
- GetBuffer().Layout(dc, availableSpace, GetBuffer().GetRange(), wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
- GetBuffer().SetDirty(false);
- SetupScrollbars();
- PositionCaret();
+ wxRegion dirtyRegion = GetUpdateRegion();
+
+ wxRect drawingArea(GetLogicalPoint(wxPoint(0, 0)), GetClientSize());
+ wxRect availableSpace(GetClientSize());
+ if (GetBuffer().GetDirty())
+ {
+ GetBuffer().Layout(dc, availableSpace, wxRICHTEXT_FIXED_WIDTH|wxRICHTEXT_VARIABLE_HEIGHT);
+ GetBuffer().SetDirty(false);
+ SetupScrollbars();
+ }
+
+ GetBuffer().Draw(dc, GetBuffer().GetRange(), GetSelectionRange(), drawingArea, 0 /* descent */, 0 /* flags */);