aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc.h')
-rw-r--r--src/doc.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/doc.h b/src/doc.h
index 3218a70..c4e0f3a 100644
--- a/src/doc.h
+++ b/src/doc.h
@@ -51,10 +51,17 @@ typedef struct {
/*
* The so called "parameters".
+ * They are all in bytes.
* Updated/restored only when required
*/
- gint anchor, dot;
- gint first_line, xoffset;
+ gsize anchor, pos;
+ guint first_line, xoffset;
+
+ /**
+ * Dot in glyphs.
+ * This field is always kept up to date.
+ */
+ teco_int_t dot;
} teco_doc_t;
/** @memberof teco_doc_t */
@@ -85,8 +92,9 @@ void teco_doc_update_from_doc(teco_doc_t *ctx, const teco_doc_t *from);
static inline void
teco_doc_reset(teco_doc_t *ctx)
{
- ctx->anchor = ctx->dot = 0;
+ ctx->anchor = ctx->pos = 0;
ctx->first_line = ctx->xoffset = 0;
+ ctx->dot = 0;
}
/** @memberof teco_doc_t */
@@ -98,10 +106,12 @@ teco_doc_undo_reset(teco_doc_t *ctx)
* and called with teco_undo_call() if we really
* wanted to save more memory.
*/
- teco_undo_gint(ctx->anchor);
- teco_undo_gint(ctx->dot);
- teco_undo_gint(ctx->first_line);
- teco_undo_gint(ctx->xoffset);
+ teco_undo_gsize(ctx->anchor);
+ teco_undo_gsize(ctx->pos);
+ teco_undo_guint(ctx->first_line);
+ teco_undo_guint(ctx->xoffset);
+
+ teco_undo_int(ctx->dot);
}
void teco_doc_exchange(teco_doc_t *ctx, teco_doc_t *other);