+2005-11-03 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * paragraph.C (fontSpan): make sure that the FontSpan does not
+ span across beginOfBody (bug 1947).
+
2005-11-02 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxlength.h: undefine macros that clash with solaris/x86 (bug 992)
#include <boost/tuple/tuple.hpp>
#include <boost/bind.hpp>
+#include <algorithm>
#include <list>
#include <stack>
#include <sstream>
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
for (; cit != end; ++cit) {
- if (cit->pos() >= pos)
- return FontSpan(start, cit->pos());
+ if (cit->pos() >= pos) {
+ if (pos >= beginOfBody())
+ return FontSpan(std::max(start, beginOfBody()),
+ cit->pos());
+ else
+ return FontSpan(start,
+ std::min(beginOfBody() - 1,
+ cit->pos()));
+ }
start = cit->pos() + 1;
}