Current cvs is crashing everywhere.

One of the problems is that we have lyxtext using the global cursor, when
the relevant slice of this cursor can belong elsewhere.
This can be a nightmare to debug (and maintain). IMVHO, we don't have enough
willing manpower to afford that.

For instance, in text*.C there are calls to 

LyXText::cursor() (who accesses the back of the LCursor, i.e.
LCursor::cursor())
BufferView::cursor().{pos(),par()} (who accesses LCursor::current)

In some cases, these two calls are mixed toghether for getting the cursor
par and pos (see for instance setCurrentFont):

void LyXText::setCurrentFont()
{
        LCursor & cur = bv()->cursor();
        pos_type pos = cur.pos();
        ParagraphList::iterator pit = cursorPar();
        ...

and cursorPar uses LyXText::cursor.

I think that currently this /may/ be possible to debug (maybe with some
documentation effort from Andre) but it can be a very hard. (in this
particular case, some interpolation makes me believe that
cursorPar/LyXText::cursor should be fixed... is that true?)

IMHO we may have done a step which is a bit too long: we need to settle for
a setup which is not a nightmare to maintain (like "*not* using the global
cursor in LyXText members but passing some explicit pit/pos to those that
need it", or something equivalent) /before/ making a switch that breaks
everything.

Of course, I may be messing up things, since I don't understand the cursor
code completely. For instance, should the LyXText ever try to use the
cursor tip, or should it always use the "current" slice. Does the dispatch
code ensures that the "current" slice belongs to the LyXText before
dispatching to it? Etc etc. If I am, forget me.

Thoughts?

Alfredo


Reply via email to