diff options
Diffstat (limited to 'src/ring.h')
| -rw-r--r-- | src/ring.h | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -48,6 +48,12 @@ typedef struct teco_buffer_t { * This is still a guint, so you can call teco_undo_guint(). */ guint state; + + /** + * Dot in glyphs. + * This field is always kept up to date. + */ + teco_int_t dot; } teco_buffer_t; /** @memberof teco_buffer_t */ @@ -149,3 +155,23 @@ teco_current_doc_must_undo(void) */ return !teco_qreg_current || teco_qreg_current->must_undo; } + +/** update dot in the current document (Q-Register or buffer) */ +static inline void +teco_current_doc_set_dot(teco_int_t dot) +{ + if (teco_qreg_current) { + if (teco_qreg_current->must_undo) + teco_undo_int(teco_qreg_current->string.dot); + teco_qreg_current->string.dot = dot; + } else { + teco_undo_int(teco_ring_current->dot) = dot; + } +} + +static inline teco_int_t +teco_current_doc_get_dot(void) +{ + return teco_qreg_current ? teco_qreg_current->string.dot + : teco_ring_current->dot; +} |
