From adf918520976a5f06181c1c05392a0da6e4bbaa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 23 Nov 2020 20:12:11 +0100 Subject: Fully support non-ascii characters in Meter-Bar Currently the code does not handle multi-byte characters, so length- computations take the raw count of C characters and not the to displayed size into account. An example is the degree sign for temperatures. Closes: #329 --- RichString.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'RichString.c') diff --git a/RichString.c b/RichString.c index 904b44b6..1d2a3fee 100644 --- a/RichString.c +++ b/RichString.c @@ -119,6 +119,15 @@ void RichString_prune(RichString* this) { this->chptr = this->chstr; } +void RichString_appendChr(RichString* this, char c, int count) { + int from = this->chlen; + int newLen = from + count; + RichString_setLen(this, newLen); + for (int i = from; i < newLen; i++) { + RichString_setChar(this, i, c); + } +} + void RichString_setAttr(RichString* this, int attrs) { RichString_setAttrn(this, attrs, 0, this->chlen - 1); } -- cgit v1.2.3