Should be a bit better now.
-- 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: BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.498 diff -u -p -r1.498 BufferView_pimpl.C --- BufferView_pimpl.C 3 Feb 2004 11:49:04 -0000 1.498 +++ BufferView_pimpl.C 3 Feb 2004 16:41:26 -0000 @@ -355,7 +355,6 @@ void BufferView::Pimpl::buffer(Buffer * bool BufferView::Pimpl::fitCursor() { - lyxerr << "BufferView::Pimpl::fitCursor." << endl; if (screen().fitCursor(bv_)) { updateScrollbar(); return true; Index: cursor.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v retrieving revision 1.46 diff -u -p -r1.46 cursor.C --- cursor.C 3 Feb 2004 14:28:59 -0000 1.46 +++ cursor.C 3 Feb 2004 16:41:26 -0000 @@ -92,19 +92,15 @@ DispatchResult LCursor::dispatch(FuncReq // remove one level of cursor switch (res.val()) { case FINISHED: - pop(i); cmd = FuncRequest(LFUN_FINISHED_LEFT); break; case FINISHED_RIGHT: - pop(i); cmd = FuncRequest(LFUN_FINISHED_RIGHT); break; case FINISHED_UP: - pop(i); cmd = FuncRequest(LFUN_FINISHED_UP); break; case FINISHED_DOWN: - pop(i); cmd = FuncRequest(LFUN_FINISHED_DOWN); break; default: @@ -112,7 +108,9 @@ DispatchResult LCursor::dispatch(FuncReq break; } } - lyxerr << "trying to dispatch to main text " << bv_->text() << endl; + current_ = 0; + lyxerr << "trying to dispatch to main text " << bv_->text() + << " with cursor: " << *this << endl; DispatchResult res = bv_->text()->dispatch(*this, cmd); lyxerr << " result: " << res.val() << endl; return res; @@ -131,24 +129,18 @@ void LCursor::push(InsetBase * inset) void LCursor::pop(int depth) { - //lyxerr << "LCursor::pop() to depth " << depth << endl; - while (int(cursor_.size()) > depth) + while (int(cursor_.size()) > depth + 1) pop(); + lyxerr << "LCursor::pop() result: " << *this << endl; } void LCursor::pop() { - BOOST_ASSERT(!cursor_.empty()); - //lyxerr << "LCursor::pop() a level" << endl; - if (cursor_.size() <= 1) - lyxerr << "### TRYING TO POP FROM EMPTY CURSOR" << endl; - else { - cursor_.pop_back(); - anchor_.pop_back(); - current_ = cursor_.size() - 1; - } - //lyxerr << "LCursor::pop() current now: " << current_ << endl; + BOOST_ASSERT(cursor_.size() >= 1); + cursor_.pop_back(); + anchor_.pop_back(); + current_ = cursor_.size() - 1; } Index: cursor.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.h,v retrieving revision 1.28 diff -u -p -r1.28 cursor.h --- cursor.h 3 Feb 2004 11:49:05 -0000 1.28 +++ cursor.h 3 Feb 2004 16:41:26 -0000 @@ -82,6 +82,8 @@ public: CursorSlice const & current() const; /// how many nested insets do we have? size_t depth() const { return cursor_.size(); } + /// depth of current slice + int currentDepth() const { return current_; } // // selection Index: text3.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v retrieving revision 1.213 diff -u -p -r1.213 text3.C --- text3.C 3 Feb 2004 11:49:05 -0000 1.213 +++ text3.C 3 Feb 2004 16:41:26 -0000 @@ -1464,24 +1464,32 @@ DispatchResult LyXText::dispatch(LCursor break; case LFUN_FINISHED_LEFT: - lyxerr << "swallow LFUN_FINISHED_LEFT" << endl; + lyxerr << "handle LFUN_FINISHED_LEFT" << endl; + cur.pop(cur.currentDepth()); + cur.bv().cursor() = cur; if (rtl()) cursorLeft(true); break; case LFUN_FINISHED_RIGHT: - lyxerr << "swallow LFUN_FINISHED_RIGHT" << endl; + lyxerr << "handle LFUN_FINISHED_RIGHT" << endl; + cur.pop(cur.currentDepth()); + cur.bv().cursor() = cur; if (!rtl()) cursorRight(true); break; case LFUN_FINISHED_UP: - lyxerr << "swallow LFUN_FINISHED_UP" << endl; + lyxerr << "handle LFUN_FINISHED_UP" << endl; + cur.pop(cur.currentDepth()); + cur.bv().cursor() = cur; cursorUp(true); break; case LFUN_FINISHED_DOWN: - lyxerr << "swallow LFUN_FINISHED_DOWN" << endl; + lyxerr << "handle LFUN_FINISHED_DOWN" << endl; + cur.pop(cur.currentDepth()); + cur.bv().cursor() = cur; cursorDown(true); break; Index: frontends/screen.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/screen.C,v retrieving revision 1.86 diff -u -p -r1.86 screen.C --- frontends/screen.C 2 Feb 2004 17:32:56 -0000 1.86 +++ frontends/screen.C 3 Feb 2004 16:41:26 -0000 @@ -212,9 +212,9 @@ bool LyXScreen::fitCursor(BufferView * b int x, y, asc, desc; bv->cursor().getPos(x, y); - lyxerr << "LyXScreen::fitCursor: x: " << x << " y: " << y - << " top_y: " << top_y << endl; bv->cursor().getDim(asc, desc); + //lyxerr << "LyXScreen::fitCursor: x: " << x << " y: " << y + // << " top_y: " << top_y << endl; bool const big_row = h / 4 < asc + desc && asc + desc < h; Index: insets/inset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inset.C,v retrieving revision 1.124 diff -u -p -r1.124 inset.C --- insets/inset.C 2 Feb 2004 17:32:56 -0000 1.124 +++ insets/inset.C 3 Feb 2004 16:41:26 -0000 @@ -89,7 +89,7 @@ int InsetOld::scroll(bool recursive) con void InsetOld::setPosCache(PainterInfo const &, int x, int y) const { - lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl; + //lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl; xo_ = x; yo_ = y; } Index: insets/insetcollapsable.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v retrieving revision 1.229 diff -u -p -r1.229 insetcollapsable.C --- insets/insetcollapsable.C 30 Jan 2004 11:41:03 -0000 1.229 +++ insets/insetcollapsable.C 3 Feb 2004 16:41:26 -0000 @@ -63,20 +63,19 @@ InsetCollapsable::InsetCollapsable(Inset void InsetCollapsable::write(Buffer const & buf, ostream & os) const { - string st; - + os << "status "; switch (status_) { case Open: - st = "open"; + os << "open"; break; case Collapsed: - st = "collapsed"; + os << "collapsed"; break; case Inlined: - st = "inlined"; + os << "inlined"; break; } - os << "status " << st << "\n"; + os << "\n"; inset.text_.write(buf, os); } @@ -170,12 +169,11 @@ void InsetCollapsable::draw(PainterInfo } else { Dimension dimc; dimension_collapsed(dimc); - int const aa = ascent(); - button_dim.x1 = 0; - button_dim.x2 = dimc.width(); - button_dim.y1 = -aa; - button_dim.y2 = -aa + dimc.height(); + button_dim.x1 = x + 0; + button_dim.x2 = x + dimc.width(); + button_dim.y1 = y - aa; + button_dim.y2 = y - aa + dimc.height(); draw_collapsed(pi, x, y); if (status_ == Open) { @@ -219,6 +217,8 @@ InsetCollapsable::lfunMouseRelease(LCurs if (hitButton(cmd)) { lyxerr << "InsetCollapsable::lfunMouseRelease 2" << endl; setStatus(Collapsed); + // drop one level + cur.bv().cursor() = cur; return DispatchResult(false, FINISHED_RIGHT); } lyxerr << "InsetCollapsable::lfunMouseRelease 3" << endl; @@ -227,7 +227,8 @@ InsetCollapsable::lfunMouseRelease(LCurs case Inlined: return inset.dispatch(cur, cmd); } - + BOOST_ASSERT(false); + // shut up compiler return DispatchResult(true, true); } @@ -262,6 +263,8 @@ int InsetCollapsable::docbook(Buffer con bool InsetCollapsable::hitButton(FuncRequest const & cmd) const { + lyxerr << "InsetCollapsable::hitButton: " << cmd << " " << button_dim +<< endl; return button_dim.contains(cmd.x, cmd.y); } Index: insets/insetert.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v retrieving revision 1.187 diff -u -p -r1.187 insetert.C --- insets/insetert.C 20 Jan 2004 14:25:14 -0000 1.187 +++ insets/insetert.C 3 Feb 2004 16:41:26 -0000 @@ -210,6 +210,7 @@ int InsetERT::docbook(Buffer const &, os DispatchResult InsetERT::priv_dispatch(LCursor & cur, FuncRequest const & cmd) { + lyxerr << "\nInsetERT::priv_dispatch (begin): cmd: " << cmd << endl; switch (cmd.action) { case LFUN_INSET_MODIFY: {