I hadn't considered that inset_x could be < 0. This patch fixes bug #162 reported by Herbert.
please apply john -- "Unless everyone else on earth is attending meetings I haven't been told about." - /. paranoia at its finest
Index: src/BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.187 diff -u -p -r1.187 BufferView_pimpl.C --- src/BufferView_pimpl.C 2001/12/28 13:26:48 1.187 +++ src/BufferView_pimpl.C 2002/01/06 21:26:23 @@ -910,6 +910,8 @@ Inset * BufferView::Pimpl::checkInset(Ly Box b(insetDimensions(text, cursor)); if (!b.contained(x, y)) { + lyxerr[Debug::GUI] << "Missed inset at x,y " << x << "," << y + << " box " << b << endl; return 0; } Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.492 diff -u -p -r1.492 ChangeLog --- src/ChangeLog 2002/01/06 19:34:29 1.492 +++ src/ChangeLog 2002/01/06 21:26:27 @@ -1,3 +1,10 @@ +2002-01-06 John Levon <[EMAIL PROTECTED]> + + * box.h: make signed dimensions to allow insets wider than + the screen (bug #162) + + * BufferView_pimpl.C: add some insetHit debug + 2002-01-06 Juergen Vigna <[EMAIL PROTECTED]> * text.C (nextBreakPoint): fixed up this function we had this bug Index: src/box.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/box.h,v retrieving revision 1.2 diff -u -p -r1.2 box.h --- src/box.h 2001/12/20 15:11:50 1.2 +++ src/box.h 2002/01/06 21:26:27 @@ -14,15 +14,17 @@ * It is expected that the box be constructed in * normalised form, that is to say : x1,y1 is top-left, * x2,y2 is bottom-right. + * + * Negative values are allowed. */ struct Box { - unsigned int x1; - unsigned int x2; - unsigned int y1; - unsigned int y2; + int x1; + int x2; + int y1; + int y2; - Box(unsigned int x1_, unsigned int x2_, - unsigned int y1_, unsigned int y2_) : + Box(int x1_, int x2_, + int y1_, int y2_) : x1(x1_), x2(x2_), y1(y1_), y2(y2_) {} /** @@ -30,10 +32,18 @@ struct Box { * the box. Check is exclusive (point on a border * returns false). */ - bool contained(unsigned int x, unsigned int y) { + bool contained(int x, int y) { return (x1 < x && x2 > x && y1 < y && y2 > y); } + + }; + +inline std::ostream & operator<<(std::ostream & o, Box & b) +{ + return o << "x1,y1: " << b.x1 << "," << b.y1 + << " x2,y2: " << b.x2 << "," << b.y2 << std::endl; +} #endif // BOX_H