bug 1947: cursor placement in paragraph description

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10590 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-11-07 11:28:11 +00:00
parent 17ac5b3f52
commit b6f2f97af1
2 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,8 @@
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)

View File

@ -48,6 +48,7 @@
#include <boost/tuple/tuple.hpp>
#include <boost/bind.hpp>
#include <algorithm>
#include <list>
#include <stack>
#include <sstream>
@ -333,8 +334,15 @@ FontSpan Paragraph::fontSpan(lyx::pos_type pos) const
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;
}