From 0c6ebc29e407d2a047bbed64e2dd22ffc87bd2ad Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 24 Aug 2009 12:27:23 +0000 Subject: [PATCH] RichText: fixed... git-svn-id: svn://ultimatepp.org/upp/trunk@1528 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/RichText/Txt.h | 2 +- uppsrc/RichText/TxtData.cpp | 2 +- uppsrc/RichText/TxtPaint.cpp | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/uppsrc/RichText/Txt.h b/uppsrc/RichText/Txt.h index 3be2ce5e3..fd8e3b27c 100644 --- a/uppsrc/RichText/Txt.h +++ b/uppsrc/RichText/Txt.h @@ -67,7 +67,7 @@ protected: int length; String content; Array object; - LazyUpdate dirty; + mutable LazyUpdate dirty; int64 updateserial; mutable int ccx; mutable int cy; diff --git a/uppsrc/RichText/TxtData.cpp b/uppsrc/RichText/TxtData.cpp index aaf279c83..0f743b002 100644 --- a/uppsrc/RichText/TxtData.cpp +++ b/uppsrc/RichText/TxtData.cpp @@ -6,8 +6,8 @@ void RichTxt::Para::Invalidate() { INTERLOCKED { static int64 ss; - dirty.Invalidate(); updateserial = ++ss; + dirty.Invalidate(); ccx = -1; } } diff --git a/uppsrc/RichText/TxtPaint.cpp b/uppsrc/RichText/TxtPaint.cpp index aa86c9bcf..60bb3e15e 100644 --- a/uppsrc/RichText/TxtPaint.cpp +++ b/uppsrc/RichText/TxtPaint.cpp @@ -24,7 +24,7 @@ void RichTxt::Sync0(const Para& pp, int parti, const RichContext& rc) const { int cx = rc.page.Width(); pp.ccx = cx; - RichPara p = Get(parti, rc.styles, true); + RichPara p = Get(parti, rc.styles, false); RichPara::Lines pl = p.FormatLines(cx); pp.ruler = p.format.ruler; pp.before = p.format.before; @@ -44,6 +44,8 @@ inline void RichTxt::Sync(int parti, const RichContext& rc) const { int cx = rc.page.Width(); ASSERT(part[parti].Is()); const Para& pp = part[parti].Get(); + if(rc.page.Width() != pp.ccx) + pp.dirty.Invalidate(); if(pp.dirty.BeginUpdate()) { Sync0(pp, parti, rc); pp.dirty.EndUpdate();