* 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
This commit is contained in:
Jean-Marc Lasgouttes 2006-09-15 09:51:41 +00:00
parent 77fd733217
commit 759849aa42
3 changed files with 4 additions and 0 deletions

View File

@ -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;

View File

@ -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]

View File

@ -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();