On Thu, Feb 13, 2003 at 07:23:54PM -0600, Bo Peng wrote:
> > and it does not really follow LyX coding rules.
> 
> I have read the 'coding rules' and I would appreciate it if you can show 
> me the problems of my patch. It certainly need time to get used to all 
> the rules.

Ok. Let's have a look.

        diff -u -r1.297 ChangeLog
        --- src/mathed/ChangeLog        2003/01/07 11:24:42     1.297
        +++ src/mathed/ChangeLog        2003/01/12 02:50:40
        @@ -1,3 +1,10 @@
        +2003-01-11  Bo Peng <[EMAIL PROTECTED]>
        +
        +       * math_cursor.h math_cursor.C (backspace, erase): return false
        +       for empty mathboxes.
        +       * formulabase.C: When LFUN_DELETE, LFUN_BACKSPACE return false, delete 
        +       the empty mathbox. Fix Bug 686.
        +

Spacing should follow other entries.

         
        +       // delete empty mathbox (LFUN_BACKSPACE and LFUN_DELETE)
        +       bool remove_inset; 

Uninitialized variable. This is actually a bug I just noticed.
remove_inset may contain a non-zero value which would mean the inset is
removed in all cases.

                case LFUN_DELETE_WORD_BACKWARD:
                case LFUN_BACKSPACE:
                        bv->lockedInsetStoreUndo(Undo::DELETE);
        -               mathcursor->backspace();
        +               result = mathcursor->backspace()?DISPATCHED:FINISHED;
        +               if (result == FINISHED) remove_inset = true;

Split that on two lines:

                        if (result == FINISHED)
                                remove_inset = true;


        -               mathcursor->erase();
        +               result = mathcursor->erase()?DISPATCHED:FINISHED;

Spacing:

        +               result = mathcursor->erase() ? DISPATCHED : FINISHED;

                if (pos() == 0) {
        -               pullArg();
        -               return;
        +               if (par()->ncols() == 1 && par()->nrows() == 1 && depth() == 1 
&& size() == 0)
        +                       return false;
        +               else{

Spacing:  else {


                                p->setName(p->name().substr(0, p->name().size() - 1));
        -                       return;
        +                       return true;
                        }
                }

[...]
         
                plainErase();
        +        return true;

Spacing. Use tab for indentation, not spaces.

        ///
-       void erase();
+       bool erase();

Add a comment ;-)

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)

Reply via email to