This makes room for another cursor slice at the bottom of the global cursor which will contain the main LyXText's cursor in the end.
Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson or B. Franklin or both...)
Index: cursor.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v retrieving revision 1.30 diff -u -p -r1.30 cursor.C --- cursor.C 8 Jan 2004 18:30:11 -0000 1.30 +++ cursor.C 13 Jan 2004 11:05:19 -0000 @@ -42,7 +42,7 @@ std::ostream & operator<<(std::ostream & LCursor::LCursor(BufferView * bv) - : bv_(bv) + : data_(1), bv_(bv) {} @@ -51,7 +51,7 @@ DispatchResult LCursor::dispatch(FuncReq lyxerr << "\nLCursor::dispatch: " << *this << endl; FuncRequest cmd = cmd0; - for (int i = data_.size() - 1; i >= 0; --i) { + for (int i = data_.size() - 1; i >= 1; --i) { CursorSlice const & citem = data_[i]; lyxerr << "trying to dispatch to inset " << citem.inset_ << endl; DispatchResult res = citem.inset_->dispatch(cmd); @@ -119,7 +119,7 @@ void LCursor::pop() { lyxerr << "LCursor::pop() " << endl; //BOOST_ASSERT(!data_.empty()); - if (data_.empty()) + if (data_.size() <= 1) lyxerr << "### TRYING TO POP FROM EMPTY CURSOR" << endl; else data_.pop_back(); @@ -128,16 +128,16 @@ void LCursor::pop() UpdatableInset * LCursor::innerInset() const { - return data_.empty() ? 0 : data_.back().asUpdatableInset(); + return data_.size() <= 1 ? 0 : data_.back().asUpdatableInset(); } LyXText * LCursor::innerText() const { - if (!data_.empty()) { + if (data_.size() > 1) { // go up until first non-0 text is hit // (innermost text is 0 e.g. for mathed and the outer tabular level) - for (int i = data_.size() - 1; i >= 0; --i) + for (int i = data_.size() - 1; i >= 1; --i) if (data_[i].text()) return data_[i].text(); } @@ -147,7 +147,7 @@ LyXText * LCursor::innerText() const void LCursor::updatePos() { - if (!data_.empty()) + if (data_.size() > 1) cached_y_ = bv_->top_y() + innerInset()->y(); } @@ -167,7 +167,7 @@ void LCursor::getDim(int & asc, int & de void LCursor::getPos(int & x, int & y) const { - if (data_.empty()) { + if (data_.size() <= 1) { x = bv_->text()->cursorX(); y = bv_->text()->cursorY(); // y -= bv_->top_y(); @@ -190,7 +190,7 @@ void LCursor::getPos(int & x, int & y) c UpdatableInset * LCursor::innerInsetOfType(int code) const { - for (int i = data_.size() - 1; i >= 0; --i) + for (int i = data_.size() - 1; i >= 1; --i) if (data_[i].asUpdatableInset()->lyxCode() == code) return data_[i].asUpdatableInset(); return 0; @@ -206,22 +206,13 @@ InsetTabular * LCursor::innerInsetTabula void LCursor::cell(int idx) { -#if 0 BOOST_ASSERT(!data_.empty()); data_.back().idx_ = idx; -#else - if (!data_.empty()) - data_.back().idx_ = idx; -#endif } int LCursor::cell() const { -#if 0 BOOST_ASSERT(!data_.empty()); return data_.back().idx_; -#else - return data_.empty() ? 0 : data_.back().idx_; -#endif }