allways delete the previousChar?

C. Boemann cbo at boemann.dk
Sat Oct 8 17:37:46 BST 2011


Good catch, please fix

On Saturday 08 October 2011 18:19:11 Jaime wrote:
> Hi,
> 
>   There is something wrong here, there are two ifs and the same action
> is taken in the true and the false part.
>   This was found by a new check in cppcheck, but really amazing.
> 
> void KoTextEditor::deleteChar(MoveOperation direction, bool
> trackChanges, KoShapeController *shapeController)
> {
>     if (isEditProtected()) {
>         return;
>     }
> 
>     if (trackChanges) {
>         if (direction == PreviousChar) {
>             addCommand(new
> ChangeTrackedDeleteCommand(ChangeTrackedDeleteCommand::PreviousChar,
>                                                       d->document,
>                                                       shapeController));
>         }
>         else {
>             addCommand(new
> ChangeTrackedDeleteCommand(ChangeTrackedDeleteCommand::PreviousChar,
>                                                       d->document,
>                                                       shapeController));
>         }
>     }
>     else {
>         if (direction == PreviousChar) {
>             addCommand(new DeleteCommand(DeleteCommand::PreviousChar,
>                                          d->document,
>                                          shapeController));
>         }
>         else {
>             addCommand(new DeleteCommand(DeleteCommand::PreviousChar,
>                                          d->document,
>                                          shapeController));
>         }
>     }
> }
> 
> Best Regards.
> _______________________________________________
> calligra-devel mailing list
> calligra-devel at kde.org
> https://mail.kde.org/mailman/listinfo/calligra-devel



More information about the calligra-devel mailing list