...
|
...
|
@@ -873,20 +873,31 @@ redata_op_undo(redata_t *redata)
|
873
|
873
|
} else if(strcmp(undo->type,"DEL")==0) {
|
874
|
874
|
redata_op_add(redata,undo->posorig,redata->undostack.buf+undo->off,undo->len,&(redata->undostack));
|
875
|
875
|
} else if(strcmp(undo->type,"MOV")==0) {
|
876
|
|
-#warning TODO
|
|
876
|
+ if(undo->posorig<undo->posdest)
|
|
877
|
+ redata_op_move(redata,undo->posdest-undo->len, undo->len, undo->posorig,&(redata->undostack));
|
|
878
|
+ else
|
|
879
|
+ redata_op_move(redata,undo->posdest, undo->len, undo->posorig+undo->len,&(redata->undostack));
|
877
|
880
|
} else
|
878
|
881
|
return(-1); /* unknown operation */
|
879
|
|
- #warning TODO
|
880
|
882
|
return(-1);
|
881
|
883
|
}
|
882
|
884
|
|
883
|
885
|
int
|
884
|
886
|
redata_op_redo(redata_t *redata)
|
885
|
887
|
{
|
|
888
|
+ undo_t *undo;
|
886
|
889
|
if(redata==NULL
|
887
|
890
|
|| redata->redostack.usedundo<1)
|
888
|
891
|
return(-1); /* sanity check failed */
|
889
|
|
-#warning TODO
|
|
892
|
+ undo=redata->redostack.undo+redata->redostack.usedundo-1;
|
|
893
|
+ if(strcmp(undo->type,"ADD")==0) {
|
|
894
|
+ redata_op_add(redata,undo->posorig,redata->redostack.buf+undo->off,undo->len,&(redata->redostack));
|
|
895
|
+ } else if(strcmp(undo->type,"DEL")==0) {
|
|
896
|
+ redata_op_del(redata,undo->posorig,undo->len,&(redata->redostack));
|
|
897
|
+ } else if(strcmp(undo->type,"MOV")==0) {
|
|
898
|
+ redata_op_move(redata,undo->posorig, undo->len, undo->posdest,&(redata->redostack));
|
|
899
|
+ } else
|
|
900
|
+ return(-1); /* unknown operation */
|
890
|
901
|
return(-1);
|
891
|
902
|
}
|
892
|
903
|
|