diff options
Diffstat (limited to 'txt.c')
| -rw-r--r-- | txt.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -242,7 +242,7 @@ void txt_load_empty(Txt *b) { static inline int txt_hist_unchanged(Txt *t) { if (t->hist.n < 1) return 0; - TxtPieceTbl *pt = &t->hist.v[t->hist.i]; + TxtHistNode *pt = &t->hist.v[t->hist.i]; if (t->ptbl.n != pt->n) return 0; if (memcmp(pt->v, t->ptbl.v, sizeof(TxtPiece) * pt->n)) return 0; return 1; @@ -274,7 +274,7 @@ void txt_free(Txt *t) { void txt_hist_push(Txt *t, TxtLoc cur) { if (txt_hist_unchanged(t)) { - t->hist.cur[t->hist.i] = cur; + t->hist.v[t->hist.i].cur = cur; return; } if (t->hist.i + 1 < t->hist.n) t->hist.n = t->hist.i + 1; @@ -282,7 +282,6 @@ void txt_hist_push(Txt *t, TxtLoc cur) { if (t->hist.i == TXT_HIST_MAX) { free(t->hist.v[0].v); MOVE(&t->hist.v[0], &t->hist.v[1], TXT_HIST_MAX - 1); - MOVE(&t->hist.cur[0], &t->hist.cur[1], TXT_HIST_MAX - 1); memset(&t->hist.v[TXT_HIST_MAX - 1], 0, sizeof(*t->hist.v)); t->hist.i--; t->hist.n--; @@ -291,7 +290,7 @@ void txt_hist_push(Txt *t, TxtLoc cur) { memcpy(t->hist.v[t->hist.i].v, t->ptbl.v, sizeof(TxtPiece) * t->ptbl.n); t->hist.v[t->hist.i].n = t->ptbl.n; t->hist.v[t->hist.i].dirty = t->ptbl.dirty; - t->hist.cur[t->hist.i] = cur; + t->hist.v[t->hist.i].cur = cur; t->hist.n++; ASSERT(t->hist.n == t->hist.i + 1); } @@ -301,7 +300,7 @@ int txt_hist_set(Txt *t, TxtLoc *cur) { DA_FIT(&t->ptbl, t->ptbl.n); memcpy(t->ptbl.v, t->hist.v[t->hist.i].v, sizeof(TxtPiece) * t->ptbl.n); t->ptbl.dirty = t->hist.v[t->hist.i].dirty; - *cur = t->hist.cur[t->hist.i]; + *cur = t->hist.v[t->hist.i].cur; return 1; } |
