]> git.lyx.org Git - features.git/commitdiff
Small fix for spellchecking in tabulars. Removed a check and put an assert
authorJürgen Vigna <jug@sad.it>
Wed, 18 Jul 2001 08:38:14 +0000 (08:38 +0000)
committerJürgen Vigna <jug@sad.it>
Wed, 18 Jul 2001 08:38:14 +0000 (08:38 +0000)
in LyXTabular::GetCellNumber.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2266 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/insets/ChangeLog
src/insets/insettabular.C
src/tabular.C

index f88ed698918d3e056a688121ead43c96f9becc4c..5a8c35dbcf52421c9b7d34accb0af81a5ac67288 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-18  Juergen Vigna  <jug@sad.it>
+
+       * tabular.C (GetCellNumber): put an assert here instead of the check!
+
 2001-07-17  Juergen Vigna  <jug@sad.it>
 
        * BufferView_pimpl.C (toggleSelection): adapted too.
index de2e6acc3d46c3bbc1cbd6cad20d77e394b638ff..215c426f52ada850a490ba5bfba93baac66c70b4 100644 (file)
@@ -1,3 +1,8 @@
+2001-07-18  Juergen Vigna  <jug@sad.it>
+
+       * insettabular.C (selectNextWord): fixed spellchecking for the
+       first cell of a tabular (wasn't entered!)
+
 2001-07-17  Juergen Vigna  <jug@sad.it>
 
        * various files: implemented the below functions.
index f02b5e0556afc5862889b1cfc80b0c2596e33909..a1fbaf152c2e851850eb98236e3f6f57f9f1540e 100644 (file)
@@ -2443,15 +2443,16 @@ string InsetTabular::selectNextWord(BufferView * bv, float & value) const
                str = the_locking_inset->selectNextWord(bv, value);
                if (!str.empty())
                        return str;
-       }
-       if (tabular->IsLastCell(actcell)) {
-               bv->unlockInset(const_cast<InsetTabular *>(this));
-               return string();
+               if (tabular->IsLastCell(actcell)) {
+                       bv->unlockInset(const_cast<InsetTabular *>(this));
+                       return string();
+               }
+               ++actcell;
        }
        
        // otherwise we have to lock the next inset and ask for it's selecttion
        UpdatableInset * inset =
-               static_cast<UpdatableInset*>(tabular->GetCellInset(++actcell));
+               static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
        inset->edit(bv, 0,  0, 0);
        string str = selectNextWordInt(bv, value);
        if (!str.empty())
@@ -2461,12 +2462,14 @@ string InsetTabular::selectNextWord(BufferView * bv, float & value) const
 
 string InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
 {
-       if (the_locking_inset) {
-               string str;
-               str = the_locking_inset->selectNextWord(bv, value);
-               if (!str.empty())
-                       return str;
-       }
+       // when entering this function the inset should be ALWAYS locked!
+       lyx::Assert(the_locking_inset);
+
+       string str;
+       str = the_locking_inset->selectNextWord(bv, value);
+       if (!str.empty())
+               return str;
+
        if (tabular->IsLastCell(actcell)) {
                bv->unlockInset(const_cast<InsetTabular *>(this));
                return string();
index ce9179602ba15ce461bf614574eaa43b0d279418..2202e3367bf818c2ec9959cfb7b9440345ff9c4e 100644 (file)
@@ -1534,7 +1534,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
        for (int i = 0; i < par->size(); ++i) {
                if (par->isNewline(i)) {
                        ++cell;
-                       if (cell > GetNumberOfCells()) {
+                       if (cell > numberofcells) {
                                lyxerr << "Some error in reading old table format occured!" <<
                                        endl << "Terminating when reading cell[" << cell << "]!" <<
                                        endl;
@@ -1686,7 +1686,7 @@ bool LyXTabular::NeedRotating() const
 
 bool LyXTabular::IsLastCell(int cell) const
 {
-       if ((cell + 1) < GetNumberOfCells())
+       if ((cell + 1) < numberofcells)
                return false;
        return true;
 }
@@ -1730,7 +1730,7 @@ int LyXTabular::GetLastCellBelow(int cell) const
 
 int LyXTabular::GetCellNumber(int row, int column) const
 {
-#if 1
+#if 0
        if (column >= columns_)
                column = columns_ - 1;
        else if (column < 0)
@@ -1740,7 +1740,7 @@ int LyXTabular::GetCellNumber(int row, int column) const
        else if (row < 0)
                row = 0;
 #else
-       lyx::Assert(column < 0 || column >= columns_ || row < 0 || row >= rows_);
+       lyx::Assert(column >= 0 || column < columns_ || row >= 0 || row < rows_);
 #endif
        return cell_info[row][column].cellno;
 }