Fixed "%s" always being left justify (#2331) (#2332)

This commit is contained in:
F1F88
2025-11-08 16:36:01 +00:00
committed by GitHub
parent 2ae0d05a23
commit 74e9cdd709
+15 -3
View File
@@ -188,6 +188,15 @@ bool AddString(char **buf_p, size_t &maxlen, const char *string, int width, int
width -= size;
if (!(flags & LADJUST))
{
while ((width-- > 0) && maxlen)
{
*buf++ = ' ';
maxlen--;
}
}
if (g_FormatEscapeDatabase && (flags & NOESCAPE) == 0)
{
char *tempBuffer = NULL;
@@ -226,10 +235,13 @@ bool AddString(char **buf_p, size_t &maxlen, const char *string, int width, int
}
}
while ((width-- > 0) && maxlen)
if (flags & LADJUST)
{
*buf++ = ' ';
maxlen--;
while ((width-- > 0) && maxlen)
{
*buf++ = ' ';
maxlen--;
}
}
*buf_p = buf;