summaryrefslogtreecommitdiffstats
path: root/src/color.c
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-04-01 12:39:53 -0300
committerAndrés <andmarti@gmail.com>2021-04-01 12:39:53 -0300
commit7633c8e177ff19a5ff0ccbfc1c28ac624ac38e06 (patch)
treec829e10c984384f07c8490fc7645d66c1a17444f /src/color.c
parent78611978eb8bbbc9743dc12615e4f1a38368c38e (diff)
Improve undo / yank using malloc for batches
Diffstat (limited to 'src/color.c')
-rw-r--r--src/color.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/color.c b/src/color.c
index 6106853..3b2d01a 100644
--- a/src/color.c
+++ b/src/color.c
@@ -397,7 +397,7 @@ void color_cell(int r, int c, int rf, int cf, char * str) {
#ifdef UNDO
create_undo_action();
- copy_to_undostruct(i, j, i, j, UNDO_DEL);
+ copy_to_undostruct(i, j, i, j, UNDO_DEL, IGNORE_DEPS, NULL);
#endif
}
@@ -448,7 +448,7 @@ void color_cell(int r, int c, int rf, int cf, char * str) {
if (! loading) {
#ifdef UNDO
- copy_to_undostruct(i, j, i, j, UNDO_ADD);
+ copy_to_undostruct(i, j, i, j, UNDO_ADD, IGNORE_DEPS, NULL);
end_undo_action();
#endif
}
@@ -483,6 +483,7 @@ void unformat(int r, int c, int rf, int cf) {
modflg++;
#ifdef UNDO
create_undo_action();
+ copy_to_undostruct(r, rf, c, cf, UNDO_DEL, IGNORE_DEPS, NULL);
#endif
}
@@ -494,26 +495,15 @@ void unformat(int r, int c, int rf, int cf) {
// action
if ( (n = *ATBL(tbl, i, j)) && n->ucolor != NULL) {
- if (! loading) {
- #ifdef UNDO
- copy_to_undostruct(i, j, i, j, UNDO_DEL);
- #endif
- }
-
free(n->ucolor);
n->ucolor = NULL;
-
- if (! loading) {
- #ifdef UNDO
- copy_to_undostruct(i, j, i, j, UNDO_ADD);
- #endif
- }
}
}
}
if (! loading) {
#ifdef UNDO
+ copy_to_undostruct(r, rf, c, cf, UNDO_ADD, IGNORE_DEPS, NULL);
end_undo_action();
#endif
ui_update(TRUE);