]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
Fix working of the spellchecker dialog with ispell when there are no
[lyx.git] / src / text.C
index feac08041ddbdbbe0dd62e5f99cb0d25e60dda8a..6ad71787f855a3821ac3757f1348fa97d89957db 100644 (file)
@@ -1429,7 +1429,8 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
                if (firstpar->params().lineBottom())
                        maxdesc += 2 * lyxfont::ascent('x',
                                                       getFont(bview->buffer(),
-                                                      par, par->size() - 1));
+                                                              par,
+                                                              max(Paragraph::size_type(0), par->size() - 1)));
          
                // and now the pagebreaks
                if (firstpar->params().pagebreakBottom())
@@ -2270,16 +2271,17 @@ bool LyXText::selectWordWhenUnderCursor(BufferView * bview,
 
 // This function is only used by the spellchecker for NextWord().
 // It doesn't handle LYX_ACCENTs and probably never will.
-string const LyXText::selectNextWord(BufferView * bview,
+string const LyXText::selectNextWordToSpellcheck(BufferView * bview,
                                      float & value) const
 {
        if (the_locking_inset) {
-               string str = the_locking_inset->selectNextWord(bview, value);
+               string str = the_locking_inset->selectNextWordToSpellcheck(bview, value);
                if (!str.empty()) {
                        value += float(cursor.y())/float(height);
                        return str;
                }
 #warning Dekel please have a look on this one RTL? (Jug)
+#warning DEKEL!
                // we have to go on checking so move cusor to the right
                if (cursor.pos() == cursor.par()->size()) {
                        if (!cursor.par()->next())
@@ -2307,7 +2309,7 @@ string const LyXText::selectNextWord(BufferView * bview,
                   !cursor.par()->getInset(cursor.pos())->isTextInset()))
               || (cursor.par()->size() == cursor.pos()
                   && cursor.par()->next()))
-       {
+       {      
                if (cursor.pos() == cursor.par()->size()) {
                        cursor.par(cursor.par()->next());
                        cursor.pos(0);
@@ -2317,13 +2319,13 @@ string const LyXText::selectNextWord(BufferView * bview,
 
        // now check if we hit an inset so it has to be a inset containing text!
        if (cursor.pos() < cursor.par()->size() &&
-               cursor.par()->isInset(cursor.pos()))
+           cursor.par()->isInset(cursor.pos()))
        {
                // lock the inset!
                cursor.par()->getInset(cursor.pos())->edit(bview);
                // now call us again to do the above trick
                // but obviously we have to start from down below ;)
-               return bview->text->selectNextWord(bview, value);
+               return bview->text->selectNextWordToSpellcheck(bview, value);
        }               
   
        // Update the value if we changed paragraphs
@@ -3423,7 +3425,7 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
                        y_bottom -= lyxfont::ascent('x',
                                                    getFont(bview->buffer(),
                                                            par,
-                                                           par->size() - 1));
+                                                           max(Paragraph::size_type(0), par->size() - 1)));
                        int const w = (inset_owner ?
                                       inset_owner->width(bview, font) : ww);
                        int const xp = static_cast<int>(inset_owner ? x : 0);
@@ -3434,7 +3436,7 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
                        y_bottom -= lyxfont::ascent('x',
                                                    getFont(bview->buffer(),
                                                            par,
-                                                           par->size() - 1));
+                                                           max(Paragraph::size_type(0), par->size() - 1)));
                }
 
                // draw an endlabel