aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termptyops.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-05-04 11:44:20 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-05-04 11:45:45 +0900
commit3fc3ce4c79d555b4f4dca57861a13dcab1bb16ad (patch)
treec69c4a66e9f2f7c2a6d5bf845ab2409983880a3a /src/bin/termptyops.c
parentconfig.c: set the default value of tab zoom animation time to 0.5 if the valu... (diff)
downloadterminology-3fc3ce4c79d555b4f4dca57861a13dcab1bb16ad.tar.gz
add whitepsace debug mode and termsave abstraction infra.
Diffstat (limited to 'src/bin/termptyops.c')
-rw-r--r--src/bin/termptyops.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 8c3f2b7..22abb9a 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -4,6 +4,7 @@
#include "termptydbl.h"
#include "termptyops.h"
#include "termptygfx.h"
+#include "termptysave.h"
#undef CRITICAL
#undef ERR
@@ -36,22 +37,23 @@ termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max)
if (ty->backmax <= 0) return;
+ termpty_save_freeze();
w = termpty_line_length(cells, w_max);
- ts = calloc(1, sizeof(Termsave) + ((w - 1) * sizeof(Termcell)));
- ts->w = w;
+ ts = termpty_save_new(w);
termpty_cell_copy(ty, cells, ts->cell, w);
if (!ty->back) ty->back = calloc(1, sizeof(Termsave *) * ty->backmax);
if (ty->back[ty->backpos])
{
termpty_cell_fill(ty, NULL, ty->back[ty->backpos]->cell,
ty->back[ty->backpos]->w);
- free(ty->back[ty->backpos]);
+ termpty_save_free(ty->back[ty->backpos]);
}
ty->back[ty->backpos] = ts;
ty->backpos++;
if (ty->backpos >= ty->backmax) ty->backpos = 0;
ty->backscroll_num++;
if (ty->backscroll_num >= ty->backmax) ty->backscroll_num = ty->backmax - 1;
+ termpty_save_thaw();
}
void