diff options
author | Andrés <andmarti@gmail.com> | 2021-04-01 13:00:10 -0300 |
---|---|---|
committer | Andrés <andmarti@gmail.com> | 2021-04-01 13:00:10 -0300 |
commit | 8e397ff0d4df30db3ea429052968a44862531576 (patch) | |
tree | 8095431eb9bc684dc1013f9c4f8e734c7d31aa46 /src/gram.y | |
parent | 877aecba58951524cc549a02f1e86143f22a0b6e (diff) |
Revert "Improve undo / yank using malloc for batches"
This reverts commit 7633c8e177ff19a5ff0ccbfc1c28ac624ac38e06.
Diffstat (limited to 'src/gram.y')
-rwxr-xr-x | src/gram.y | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -417,13 +417,17 @@ command: { // TODO get this code out of gram.y extern graphADT graph; -#ifdef UNDO + #ifdef UNDO + create_undo_action(); + copy_to_undostruct($2.left.vp->row, $2.left.vp->col, $2.left.vp->row, $2.left.vp->col, UNDO_DEL); // here we save in undostruct, all the ents that depends on the deleted one (before change) + extern struct ent_ptr * deps; + int i, n = 0; ents_that_depends_on_range($2.left.vp->row, $2.left.vp->col, $2.left.vp->row, $2.left.vp->col); - create_undo_action(); - copy_to_undostruct($2.left.vp->row, $2.left.vp->col, $2.left.vp->row, $2.left.vp->col, UNDO_DEL, HANDLE_DEPS, NULL); -#endif - + if (deps != NULL) + for (i = 0, n = deps->vf; i < n; i++) + copy_to_undostruct(deps[i].vp->row, deps[i].vp->col, deps[i].vp->row, deps[i].vp->col, UNDO_DEL); + #endif if (getVertex(graph, lookat($2.left.vp->row, $2.left.vp->col), 0) != NULL) destroy_vertex(lookat($2.left.vp->row, $2.left.vp->col)); $2.left.vp->v = (double) 0.0; @@ -440,16 +444,17 @@ command: if (( $2.left.vp->trigger ) && (($2.left.vp->trigger->flag & TRG_WRITE) == TRG_WRITE)) do_trigger($2.left.vp, TRG_WRITE); -#ifdef UNDO + #ifdef UNDO + copy_to_undostruct($2.left.vp->row, $2.left.vp->col, $2.left.vp->row, $2.left.vp->col, UNDO_ADD); // here we save in undostruct, all the ents that depends on the deleted one (after change) - copy_to_undostruct($2.left.vp->row, $2.left.vp->col, $2.left.vp->row, $2.left.vp->col, UNDO_ADD, HANDLE_DEPS, NULL); - extern struct ent_ptr * deps; if (deps != NULL) { + for (i = 0, n = deps->vf; i < n; i++) + copy_to_undostruct(deps[i].vp->row, deps[i].vp->col, deps[i].vp->row, deps[i].vp->col, UNDO_ADD); free(deps); deps = NULL; } end_undo_action(); -#endif + #endif } | S_LABEL var_or_range '=' e { slet($2.left.vp, $4, 0); } |