On Mon, 2005-09-19 at 11:47 +0200, Juergen Spitzmueller wrote:
> Another day, another patch...
> 
> The attached fixes the cursor positioning problems almost completely. The 
> main 
> fix is that nested math insets are now added to the cache.
> 
> The change in Martins code in x2pos (which I don't really understand -- the 
> code, that is) assures that pos 0 of an inset is accessible again.

Here's the explanation:

        // The below code guarantees that in this slice, the cursor will
        // never be on the right edge of an inset after a mouse click.
        if (it != begin()) // we can afford to move left...
                --it;      // ...so we do. After that, we *try* to
                           // move right again, but only if
        if (it < end()     // there is space, and
                && (*it)->getChar())  // this thing here is a true
                                      // character, not an inset.
                ++it;

So the idea is, that if the cursor is on the right edge of a (deeper)
inset, it is moved to its left edge. 

> Now there's only one point which is not accesible with the mouse, and I have 
> no idea ATM how to change it: the first position of the containing math inset 
> just right of the nested inset.

(Actually this is relevant only for positioning *inside* this inset,
i.e., the case where this cursor slice is not at the tip. Positioning
the visible cursor in this way is a side effect. Perhaps one should test
for _not_ being at the tip around the above statements... how?)

>  Maybe someone has a clue.

> Can I commit this?

        if (moved && it < end() && (*it)->getChar())

I believe you can leave out it < end(), as moved == true already implies
that.

> Jürgen

- Martin

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to