virtual bool SetFont(const wxFont& font);
/// Set up scrollbars, e.g. after a resize
- virtual void SetupScrollbars();
+ virtual void SetupScrollbars(bool atTop = false);
/// Keyboard navigation
virtual bool Navigate(int keyCode, int flags);
/// Lay the item out
bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style)
{
+ // ClearLines();
+
// Increase the size of the paragraph due to spacing
int spaceBeforePara = ConvertTenthsMMToPixels(dc, GetAttributes().GetParagraphSpacingBefore());
int spaceAfterPara = ConvertTenthsMMToPixels(dc, GetAttributes().GetParagraphSpacingAfter());
{
int ch = stream.GetC();
- if (ch == 10 && lastCh != 13)
- str += wxT('\n');
-
- if (ch > 0 && ch != 10)
- str += wxChar(ch);
-
- lastCh = ch;
+ if (!stream.Eof())
+ {
+ if (ch == 10 && lastCh != 13)
+ str += wxT('\n');
+
+ if (ch > 0 && ch != 10)
+ str += wxChar(ch);
+
+ lastCh = ch;
+ }
}
buffer->Clear();
}
/// Set up scrollbars, e.g. after a resize
-void wxRichTextCtrl::SetupScrollbars()
+void wxRichTextCtrl::SetupScrollbars(bool atTop)
{
if (m_freezeCount)
return;
int unitsY = maxHeight/pixelsPerUnit;
- int startX, startY;
- GetViewStart(& startX, & startY);
+ int startX = 0, startY = 0;
+ if (!atTop)
+ GetViewStart(& startX, & startY);
int maxPositionX = 0; // wxMax(sz.x - clientSize.x, 0);
int maxPositionY = (wxMax(maxHeight - clientSize.y, 0))/pixelsPerUnit;
SetInsertionPoint(0);
Layout();
PositionCaret();
+ SetupScrollbars(true);
Refresh();
SendUpdateEvent();