On Mon, Nov 18, 2002 at 12:53:34PM +0000, John Levon wrote: > > I don't think this is easy to fix. We would have to redo the > > whole page-up/down scroll routine to not scroll on lyx-rows but > > on real screen heigth. > > Well, do we ? Surelly all we need is the cursor placement routine to > open the inset beneath a particular x,y. As in the "Juergen I think this > is wrong".
I can't judge how much effort this is, but it has to be done, and actually I'd prefer this being done for 1.3.0. Using the scrollbar is completely broken in math (just drag the scrollbar when in math and start typing). It looks like the math inset is not unlocked when it should and I don't know how to fix it. If I add unlocking in a few random places it gets better but the cursor blinking stops until one clicks a second time. That's why I did not submit that patch so far. I'll attach the patch in case someone want to work on it. > > The example is really a special one because the tabular is on > > I suppose this is true. Maybe we can delay this stuff again ... Although the behaviour is "special" for this case, it bites a few more times... Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Index: BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.317 diff -u -p -r1.317 BufferView_pimpl.C --- BufferView_pimpl.C 7 Nov 2002 00:28:39 -0000 1.317 +++ BufferView_pimpl.C 8 Nov 2002 12:20:36 -0000 @@ -368,6 +368,12 @@ void BufferView::Pimpl::scrollDocView(in if (!buffer_) return; + // this is an ugly hack to prevent mathed from thinking it knows + // how the world looks like which is only true as long as it + // informed of changes - which it isn't in this case... + lyxerr[Debug::GUI] << "destroying math cursor" << endl; + releaseMathCursor(bv_); + screen().draw(bv_->text, bv_, value); if (!lyxrc.cursor_follows_scrollbar) @@ -388,9 +394,8 @@ void BufferView::Pimpl::scrollDocView(in void BufferView::Pimpl::scroll(int lines) { - if (!buffer_) { + if (!buffer_) return; - } LyXText const * t = bv_->text; int const line_height = t->defaultHeight(); Index: mathed/formulabase.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formulabase.C,v retrieving revision 1.226 diff -u -p -r1.226 formulabase.C --- mathed/formulabase.C 5 Nov 2002 09:55:55 -0000 1.226 +++ mathed/formulabase.C 8 Nov 2002 12:20:36 -0000 @@ -243,9 +243,12 @@ void InsetFormulaBase::toggleInsetCursor void InsetFormulaBase::showInsetCursor(BufferView * bv, bool) { + if (!mathcursor) { + lyxerr << "showInsetCursor impossible\n"; + return; + } if (isCursorVisible()) return; - fitInsetCursor(bv); int x, y, asc, des; mathcursor->getPos(x, y); math_font_max_dim(font_, asc, des); @@ -257,6 +260,8 @@ void InsetFormulaBase::showInsetCursor(B void InsetFormulaBase::hideInsetCursor(BufferView * bv) { + if (!mathcursor) + return; if (!isCursorVisible()) return; bv->hideLockedInsetCursor(); Index: mathed/formulabase.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formulabase.h,v retrieving revision 1.53 diff -u -p -r1.53 formulabase.h --- mathed/formulabase.h 22 Oct 2002 15:15:40 -0000 1.53 +++ mathed/formulabase.h 8 Nov 2002 12:20:36 -0000 @@ -149,4 +149,7 @@ protected: // So do it here. void mathDispatch(FuncRequest const &); +/// +void releaseMathCursor(BufferView * bv); + #endif Index: mathed/math_cursor.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v retrieving revision 1.330 diff -u -p -r1.330 math_cursor.C --- mathed/math_cursor.C 4 Nov 2002 11:53:28 -0000 1.330 +++ mathed/math_cursor.C 8 Nov 2002 12:20:38 -0000 @@ -1467,9 +1467,11 @@ void MathCursor::handleFont(string const void releaseMathCursor(BufferView * bv) { - if (!mathcursor) - return; - mathcursor->formula()->hideInsetCursor(bv); - delete mathcursor; - mathcursor = 0; + if (mathcursor) { + InsetFormulaBase * f = mathcursor->formula(); + f->hideInsetCursor(bv); + delete mathcursor; + mathcursor = 0; + f->insetUnlock(bv); + } }