diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-10-11 20:46:30 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-10-11 21:15:11 +0200 |
commit | e2790b42f3d33e5342af6948a21a48b6fdd5a22a (patch) | |
tree | 0268f683b665ecd9a17cee13394ce4d6f7020bcb /src/sdtui.c | |
parent | 9b220b74ccbabb4ed010c7ca745b8338ff222b13 (diff) | |
download | tdv-e2790b42f3d33e5342af6948a21a48b6fdd5a22a.tar.gz tdv-e2790b42f3d33e5342af6948a21a48b6fdd5a22a.tar.xz tdv-e2790b42f3d33e5342af6948a21a48b6fdd5a22a.zip |
sdtui: fix introductory message centring
Diffstat (limited to 'src/sdtui.c')
-rw-r--r-- | src/sdtui.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/sdtui.c b/src/sdtui.c index b2e7066..5e00d7c 100644 --- a/src/sdtui.c +++ b/src/sdtui.c @@ -1087,16 +1087,13 @@ app_show_message (Application *self, const gchar *lines[], gsize len) while (len-- && i < LINES - TOP_BAR_CUTOFF) { - move (TOP_BAR_CUTOFF + i, 0); - clrtoeol (); - - gint x = (COLS - g_utf8_strlen (*lines, -1)) / 2; - if (x < 0) - x = 0; - RowBuffer buf = row_buffer_make (self); row_buffer_append (&buf, *lines, 0); - move (TOP_BAR_CUTOFF + i, x); + gint x = (COLS - buf.total_width) / 2; + + move (TOP_BAR_CUTOFF + i, 0); + clrtoeol (); + move (TOP_BAR_CUTOFF + i, MAX (x, 0)); row_buffer_finish (&buf, -1, 0); lines++; |