From 759849aa42ee0db64b9889b930b81f5d7c95a1b7 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 15 Sep 2006 09:51:41 +0000 Subject: [PATCH] * text.C (setCursorFromCoordinates): * text2.C (setCursorIntern): add an assertion. * BufferView_pimpl.C (scrollDocView): reset cursor before setting it from coordinates (bug 2830). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15004 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 2 ++ src/text.C | 1 + src/text2.C | 1 + 3 files changed, 4 insertions(+) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 6009490263..f0bb1b77a6 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -419,10 +419,12 @@ void BufferView::Pimpl::setCursorFromScrollbar() switch (st) { case bv_funcs::CUR_ABOVE: + cur.reset(buffer_->inset()); t.setCursorFromCoordinates(cur, 0, first); cur.clearSelection(); break; case bv_funcs::CUR_BELOW: + cur.reset(buffer_->inset()); t.setCursorFromCoordinates(cur, 0, last); cur.clearSelection(); break; diff --git a/src/text.C b/src/text.C index 589ad2e982..0d279b7a9f 100644 --- a/src/text.C +++ b/src/text.C @@ -2531,6 +2531,7 @@ pos_type LyXText::x2pos(pit_type pit, int row, int x) const // sets cursor only within this LyXText bool LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y) { + BOOST_ASSERT(this == cur.text()); pit_type pit = getPitNearY(y); int yy = theCoords.get(this, pit).y_ - pars_[pit].ascent(); lyxerr[Debug::DEBUG] diff --git a/src/text2.C b/src/text2.C index 3ea699d4ab..fdfd27f8e4 100644 --- a/src/text2.C +++ b/src/text2.C @@ -719,6 +719,7 @@ void LyXText::setCursor(CursorSlice & cur, pit_type par, pos_type pos) void LyXText::setCursorIntern(LCursor & cur, pit_type par, pos_type pos, bool setfont, bool boundary) { + BOOST_ASSERT(this == cur.text()); cur.boundary(boundary); setCursor(cur.top(), par, pos); cur.setTargetX();