]> git.lyx.org Git - lyx.git/commitdiff
Get rid of annoying warning message
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 27 Apr 2013 18:00:15 +0000 (20:00 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 27 Apr 2013 18:01:02 +0000 (20:01 +0200)
src/Paragraph.cpp

index e5a469f5af9877c15d4c0eb0c3f587c45820ed04..75bf9f838a8035057ce81b96e4fd5a953b78e34b 100644 (file)
@@ -1832,8 +1832,14 @@ Font const & Paragraph::getFontSettings(BufferParams const & bparams,
 FontSpan Paragraph::fontSpan(pos_type pos) const
 {
        LBUFERR(pos <= size(), _("Invalid position"));
-       pos_type start = 0;
 
+       // Last position is a special case. I suspect that it would
+       // actually make sense to extend the last font span to cover
+       // the last character (JMarc)
+       if (pos == size())
+               return FontSpan(pos, pos);
+
+       pos_type start = 0;
        FontList::const_iterator cit = d->fontlist_.begin();
        FontList::const_iterator end = d->fontlist_.end();
        for (; cit != end; ++cit) {
@@ -1850,8 +1856,8 @@ FontSpan Paragraph::fontSpan(pos_type pos) const
        }
 
        // This should not happen, but if so, we take no chances.
-       LYXERR0("Paragraph::getEndPosOfFontSpan: This should not happen!");
-       return FontSpan(pos, pos);
+       LYXERR0("Paragraph::fontSpan: position not found in fontinfo table!");
+       LASSERT(false, return FontSpan(pos, pos));
 }