summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormongo <andmarti@gmail.com>2018-03-22 16:24:03 -0300
committermongo <andmarti@gmail.com>2018-03-22 16:24:03 -0300
commiteb4894e02b345b179f552896171a744bddd6c9c7 (patch)
tree7ef50bc94abc626a49c66069afc122af8f783d94 /src
parent38d3cc5b7da94ee77c6a51768d48d80c3b2f93bf (diff)
work on issue 244
Diffstat (limited to 'src')
-rw-r--r--src/cmds_normal.c25
-rw-r--r--src/yank.c32
2 files changed, 56 insertions, 1 deletions
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();