瀏覽代碼

REVIEWED: `TextFormat()`, added "..." for truncation #3366

It seems more standard than [TRUN]
pull/3403/head
Ray 1 年之前
父節點
當前提交
876e6b3a0d
共有 2 個檔案被更改,包括 6 行新增6 行删除
  1. +3
    -3
      src/rcore.c
  2. +3
    -3
      src/rtext.c

+ 3
- 3
src/rcore.c 查看文件

@ -2946,9 +2946,9 @@ const char *TextFormat(const char *text, ...)
// If requiredByteCount is larger than the MAX_TEXT_BUFFER_LENGTH, then overflow occured
if (requiredByteCount >= MAX_TEXT_BUFFER_LENGTH)
{
// We are going to insert [TRUN] at the end of the string so the user knows what happened
char *truncBuffer = buffers[index] + MAX_TEXT_BUFFER_LENGTH - 7; // Adding 7 bytes = six char + '\0';
sprintf(truncBuffer, "[TRUN]");
// Inserting "..." at the end of the string to mark as truncated
char *truncBuffer = buffers[index] + MAX_TEXT_BUFFER_LENGTH - 4; // Adding 4 bytes = "...\0";
sprintf(truncBuffer, "...");
}
index += 1; // Move to next buffer for next function call

+ 3
- 3
src/rtext.c 查看文件

@ -1377,9 +1377,9 @@ const char *TextFormat(const char *text, ...)
// If requiredByteCount is larger than the MAX_TEXT_BUFFER_LENGTH, then overflow occured
if (requiredByteCount >= MAX_TEXT_BUFFER_LENGTH)
{
// We are going to insert [TRUN] at the end of the string so the user knows what happened
char *truncBuffer = buffers[index] + MAX_TEXT_BUFFER_LENGTH - 7; // Adding 7 bytes = six chars + '\0';
sprintf(truncBuffer, "[TRUN]");
// Inserting "..." at the end of the string to mark as truncated
char *truncBuffer = buffers[index] + MAX_TEXT_BUFFER_LENGTH - 4; // Adding 4 bytes = "...\0";
sprintf(truncBuffer, "...");
}
index += 1; // Move to next buffer for next function call

Loading…
取消
儲存