On Tue, 2005-10-18 at 12:59 +0200, Jean-Marc Lasgouttes wrote: > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > Martin> But let me bring up another matter. The reported bug is > Martin> apparently, that the code in cursorRight: > > Martin> if (cur.boundary()) return setCursor(cur, cur.pit(), > Martin> cur.pos(), true, false); > > Martin> if boundary == true, carries the cursor, not to the next > Martin> *character*, but to the next *table cell*. It is as if the > Martin> positioning is using a cursor slice on the wrong level of the > Martin> cursor. Do you get what I mean? > > I tried to follow this code this morning, and failed to see why > setCursor would change the cell (so presumably the idx() of the cursor > slice). > > Martin> (BTW this bug occurs *only* in tabular. I couldn't find a > Martin> similar bug in any other inset.) > > Martin> Anyway, what to try next? I'm still groping in the blind. Some > Martin> more explanation please :-) > > I think the code that handles LFUN_RIGHT in insettabular::dispatch > sees that the cursor did not move and decides that it should jump to > next cell.
Yes... and in this case *this is wrong*. Why should the cell's decision be overridden? Shouldn't that only happen when at the end of the cell's content? Thinking in this way produced the attached patch, which does the intended job of preventing the cursor from jumping into the next cell. However, when you insert a character and then press <right>, nothing happens first time... because of boundary == true. So I think you may be right in wanting to reverse //setCursor(cur, cur.pit(), cur.pos() + 1, false, cur.boundary()); setCursor(cur, cur.pit(), cur.pos() + 1, false, true); However, I think Juergen V should chime in here. - Martin
Index: insettabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v retrieving revision 1.489 diff -u -p -r1.489 insettabular.C --- insettabular.C 19 Sep 2005 14:38:13 -0000 1.489 +++ insettabular.C 18 Oct 2005 15:21:32 -0000 @@ -511,10 +511,11 @@ void InsetTabular::doDispatch(LCursor & case LFUN_RIGHTSEL: case LFUN_RIGHT: cell(cur.idx())->dispatch(cur, cmd); - cur.dispatched(); // override the cell's decision - if (sl == cur.top()) + cur.dispatched(); + // override the cell's decision + if (sl == cur.top() && cur.pos() == cur.lastpos()) isRightToLeft(cur) ? movePrevCell(cur) : moveNextCell(cur); - if (sl == cur.top()) { + if (sl == cur.top() && cur.pos() == cur.lastpos()) { cmd = FuncRequest(LFUN_FINISHED_RIGHT); cur.undispatched(); } @@ -523,7 +524,8 @@ void InsetTabular::doDispatch(LCursor & case LFUN_LEFTSEL: case LFUN_LEFT: cell(cur.idx())->dispatch(cur, cmd); - cur.dispatched(); // override the cell's decision + cur.dispatched(); + // override the cell's decision if (sl == cur.top()) isRightToLeft(cur) ? moveNextCell(cur) : movePrevCell(cur); if (sl == cur.top()) {
signature.asc
Description: This is a digitally signed message part