summaryrefslogtreecommitdiffstats
path: root/RichString.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-01-14 10:24:36 +0100
committercgzones <cgzones@googlemail.com>2021-01-15 20:41:10 +0100
commitb9adc30b86ef550655de1e8a8122dae20a6b13df (patch)
tree1c61cd8fe540451c7c9175cc70002a285b286581 /RichString.c
parent08ac22ddb9e848123934dad215c58cb03e7ad094 (diff)
RichString: implement safe rewind
The current rewind logic causes issues when rewinding over the short string optimization boundary.
Diffstat (limited to 'RichString.c')
-rw-r--r--RichString.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/RichString.c b/RichString.c
index 5a2c2e14..c4ecc258 100644
--- a/RichString.c
+++ b/RichString.c
@@ -46,6 +46,10 @@ static void RichString_setLen(RichString* this, int len) {
}
}
+void RichString_rewind(RichString* this, int count) {
+ RichString_setLen(this, this->chlen - count);
+}
+
#ifdef HAVE_LIBNCURSESW
static inline int RichString_writeFromWide(RichString* this, int attrs, const char* data_c, int from, int len) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy