From eb4894e02b345b179f552896171a744bddd6c9c7 Mon Sep 17 00:00:00 2001 From: mongo Date: Thu, 22 Mar 2018 16:24:03 -0300 Subject: work on issue 244 --- src/cmds_normal.c | 25 ++++++++++++++++++++++++- src/yank.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cmds_normal.c b/src/cmds_normal.c index 6f66118..0b8c53a 100644 --- a/src/cmds_normal.c +++ b/src/cmds_normal.c @@ -566,6 +566,11 @@ void do_normalmode(struct block * buf) { if (bs != 2) break; struct mark * m = get_mark(buf->pnext->value); if ( m == NULL) return; + + // added for #244 - 22/03/2018 + int i; + extern struct ent_ptr * deps; + // if m represents a range if ( m->row == -1 && m->col == -1) { srange * r = m->rng; @@ -605,12 +610,30 @@ void do_normalmode(struct block * buf) { n->row += currow - get_mark(buf->pnext->value)->row; n->col += c1 - get_mark(buf->pnext->value)->col; - n->flags |= is_changed; if (n->expr) EvalJustOneVertex(n, n->row, n->col, 1); + #ifdef UNDO copy_to_undostruct(currow, c1, currow, c1, 'a'); #endif + + // added for #244 - 22/03/2018 + ents_that_depends_on_range(n->row, n->col, n->row, n->col); + if (deps != NULL) { + for (i = 0; i < deps->vf; i++) { +#ifdef UNDO + copy_to_undostruct(deps[i].vp->row, deps[i].vp->col, deps[i].vp->row, deps[i].vp->col, 'd'); +#endif + EvalJustOneVertex(deps[i].vp, deps[i].vp->row, deps[i].vp->col, 0); +#ifdef UNDO + copy_to_undostruct(deps[i].vp->row, deps[i].vp->col, deps[i].vp->row, deps[i].vp->col, 'a'); +#endif + } + } + + + + } #ifdef UNDO end_undo_action(); diff --git a/src/yank.c b/src/yank.c index c3e243c..762aa02 100644 --- a/src/yank.c +++ b/src/yank.c @@ -247,6 +247,8 @@ int paste_yanked_ents(int above, int type_paste) { struct ent * yl = yanklist; struct ent * yll = yl; int diffr = 0, diffc = 0 , ignorelock = 0; + extern struct ent_ptr * deps; + int i; #ifdef UNDO create_undo_action(); @@ -305,10 +307,23 @@ int paste_yanked_ents(int above, int type_paste) { // otherwise continue // por cada ent en yanklist while (yl != NULL) { + + #ifdef UNDO copy_to_undostruct(yl->row + diffr, yl->col + diffc, yl->row + diffr, yl->col + diffc, 'd'); #endif + + // save graph dependencies as well + // added for #244 - 22/03/2018 + ents_that_depends_on_range(yl->row + diffr, yl->col + diffc, yl->row + diffr, yl->col + diffc); + if (deps != NULL) { + for (i = 0; i < deps->vf; i++) +#ifdef UNDO + copy_to_undostruct(deps[i].vp->row, deps[i].vp->col, deps[i].vp->row, deps[i].vp->col, 'd'); +#endif + } + // here we delete current content of "destino" ent if (type_paste == 'a' || type_paste == 's') erase_area(yl->row + diffr, yl->col + diffc, yl->row + diffr, yl->col + diffc, ignorelock, 0); @@ -344,7 +359,24 @@ int paste_yanked_ents(int above, int type_paste) { copy_to_undostruct(yl->row + diffr, yl->col + diffc, yl->row + diffr, yl->col + diffc, 'a'); #endif + // store dependencies after the change as well + // added for #244 - 22/03/2018 + if (deps != NULL) { + for (i = 0; i < deps->vf; i++) { + EvalJustOneVertex(deps[i].vp, deps[i].vp->row, deps[i].vp->col, 0); +#ifdef UNDO + copy_to_undostruct(deps[i].vp->row, deps[i].vp->col, deps[i].vp->row, deps[i].vp->col, 'a'); +#endif + } + } + + + + + yl = yl->next; + + // TODO save graph dependencies as well } //EvalAll(); sync_refs(); -- cgit v1.2.3