sdtui: fix introductory message centring

This commit is contained in:
Přemysl Eric Janouch 2021-10-11 20:46:30 +02:00
parent 9b220b74cc
commit e2790b42f3
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 5 additions and 8 deletions

View File

@ -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++;