]> git.lyx.org Git - features.git/commitdiff
bug 1947: cursor placement in paragraph description
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 7 Nov 2005 11:28:11 +0000 (11:28 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 7 Nov 2005 11:28:11 +0000 (11:28 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10590 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/paragraph.C

index 29d72a188f7cbaf890d0ce1b7995fe4a3a3c5ec1..2825558e496051ee637772b8d901d152a60c175c 100644 (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)
index 795047c923b4b0adfe59725ef7cb1409b7bd3c90..07aff6379a6b94c50be5f636c4366708f3fb7942 100644 (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;
        }