diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-11-23 20:12:11 +0100 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2020-11-25 20:45:54 +0100 |
commit | adf918520976a5f06181c1c05392a0da6e4bbaa5 (patch) | |
tree | 69caa800c12c7d576f4dbbaa41c3099dd315718c /RichString.c | |
parent | c038326a709f2e62c1c458c4c59dd71e5490fc1c (diff) |
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
Diffstat (limited to 'RichString.c')
-rw-r--r-- | RichString.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); } |