Skip to content

Commit 598b859

Browse files
committed
Meter_drawCaptionFixedWidth() compute actual terminal width
1 parent 9b8c443 commit 598b859

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Meter.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ typedef struct MeterMode_ {
4242
static void Meter_drawCaptionFixedWidth(const Meter* this, int x, int y, int w) {
4343
attrset(CRT_colors[METER_TEXT]);
4444
const char* caption = Meter_getCaption(this);
45-
mvaddnstr(y, x, caption, w);
45+
const char* ptr = caption;
46+
int nCols = String_mbswidth(&ptr, 256, w);
47+
int len = (int)(ptr - caption);
48+
mvprintw(y, x, "%-*.*s", len + w - nCols, len, caption);
4649
}
4750

4851
static inline void Meter_displayBuffer(const Meter* this, RichString* out) {

0 commit comments

Comments
 (0)