First a fix to checkInsetHit. (some insets on screen cannot be 
reached by clicks).
Fixing this remarks another problem: we draw at the row level 
(i.e. stop drawing when the row goes out of screen), 
but use the position information for all insets in the paragraph. 
Thus the last rows in the last paragraph were not draw, 
but we still check for insethits there. 
Patch to checkInsetHit to check only inside on-screen rows (i.e. 
reproduce the check in rowpainter) attached.

Comments?

Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.184
diff -u -p -u -r1.184 text3.C
--- text3.C     20 Nov 2003 10:38:12 -0000      1.184
+++ text3.C     21 Nov 2003 07:12:23 -0000
@@ -259,8 +259,12 @@ InsetOld * LyXText::checkInsetHit(int x,
        ParagraphList::iterator pit;
        ParagraphList::iterator end;
 
+       int const first_y = bv()->top_y() - y0_;
+       int const last_y = bv()->top_y() - y0_ + bv()->workHeight();
+       
        getParsInRange(ownerParagraphs(),
-                      bv()->top_y(), bv()->top_y() + bv()->workHeight(),
+                      first_y,
+                      last_y,
                       pit, end);
        
        lyxerr << "checkInsetHit: x: " << x << " y: " << y << endl;
@@ -275,6 +279,11 @@ InsetOld * LyXText::checkInsetHit(int x,
                        //      << " y: " << inset->y() - inset->ascent() << "..."
                        //      << inset->y() + inset->descent()
                        //      << endl;
+                       if (pit->getRow(iit->pos)->y_offset()
+                           + pit->y > last_y) {
+                               break;
+                       }
+                       
                        if (x >= inset->x()
                            && x <= inset->x() + inset->width()
                            && y >= inset->y() - inset->ascent()
@@ -1242,9 +1251,9 @@ DispatchResult LyXText::dispatch(FuncReq
                // FIXME: shouldn't be top-text-specific
                if (cursorrow == cursorRow() && !in_inset_) {
                        if (cmd.y - bv->top_y() >= bv->workHeight())
-                               cursorDown(false);
+                               cursorDown(true);
                        else if (cmd.y - bv->top_y() < 0)
-                               cursorUp(false);
+                               cursorUp(true);
                }
                setSelection();
                break;

Reply via email to