On Fri, Dec 08, 2006 at 04:23:23PM +0100, Jean-Marc Lasgouttes wrote:

> >>>>> "Enrico" == Enrico Forestieri <[EMAIL PROTECTED]> writes:
> 
> Enrico> Jean-Marc, may I apply the attached patch? It is unrelated to
> Enrico> bug 2900.
> 
> It looks like a good idea, but wouldn't it be even better to replace
> -     updated |= cursorUp(cur);
> +
> +     if (cur.inMathed())
> +             updated |= cur.up();
> +     else
> +             updated |= cursorUp(cur);
> by 
> -     updated |= cursorUp(cur);
> +       cur.dispatch(FuncRequest(LFUN_UP));
> 
> This would have the advantage to avoid special casing for mathed.

That was a blind backport of the patch applied by Abdel to 1.5 and
I was trusting him because I don't know that code.

> Anyway, I want this patch in 1.4. We may say that it could go as it is
> in 1.4, but for 1.5, I think it would be better to simplify the code
> now when re remember what it does.
> 
> Also, adding the updated flag that we do not use looks a bit weird to
> me. At least for 1.4, it seems useless.
> 
> And I do not know whether the return value of cur.up() means 'updated'.

Indeed, if my understanding of the code is correct, it means 'selection
active'.

Please find attached a patch revised along your observations. However,
now I feel quite uncomfortable with applying a patch which I don't
fully understand...

-- 
Enrico
Index: src/text3.C
===================================================================
--- src/text3.C (revision 16192)
+++ src/text3.C (working copy)
@@ -203,12 +203,12 @@ bool LyXText::cursorPrevious(LCursor & c
        bool updated = setCursorFromCoordinates(cur, x, 0);
        if (updated)
                cur.bv().update();
-       updated |= cursorUp(cur);
+       cur.dispatch(FuncRequest(LFUN_UP));
 
        if (cpar == cur.pit() && cpos == cur.pos()) {
                // we have a row which is taller than the workarea. The
                // simplest solution is to move to the previous row instead.
-               updated |= cursorUp(cur);
+               cur.dispatch(FuncRequest(LFUN_UP));
        }
 
        cur.bv().updateScrollbar();
@@ -226,12 +226,12 @@ bool LyXText::cursorNext(LCursor & cur)
        bool updated = setCursorFromCoordinates(cur, x, cur.bv().workHeight() - 
1);
        if (updated)
                cur.bv().update();
-       updated |= cursorDown(cur);
+       cur.dispatch(FuncRequest(LFUN_DOWN));
 
        if (cpar == cur.pit() && cpos == cur.pos()) {
                // we have a row which is taller than the workarea. The
                // simplest solution is to move to the next row instead.
-               updated |= cursorDown(cur);
+               cur.dispatch(FuncRequest(LFUN_DOWN));
        }
 
        cur.bv().updateScrollbar();

Reply via email to