diff options
| author | ruki <[email protected]> | 2020-05-31 20:56:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-05-31 20:56:42 +0800 |
| commit | e14789b622232874b5d4781550182975de4da8df (patch) | |
| tree | e103f548c97e2fbd3851ed41fe1a2ae0fe99793f /xmake/modules/private/utils/progress.lua | |
| parent | d13d6f467aff3fa3ed8eacfea6757fc6b88780df (diff) | |
improve to show progress message
Diffstat (limited to 'xmake/modules/private/utils/progress.lua')
| -rw-r--r-- | xmake/modules/private/utils/progress.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/xmake/modules/private/utils/progress.lua b/xmake/modules/private/utils/progress.lua index fb713f2bb..95581c67f 100644 --- a/xmake/modules/private/utils/progress.lua +++ b/xmake/modules/private/utils/progress.lua @@ -116,9 +116,11 @@ function show(progress, format, ...) if #msg_plain <= maxwidth then cprintf(msg) else - -- windows width is too small? strip this message and disable colors + -- windows width is too small? strip the partial message in middle local partlen = math.floor(maxwidth / 2) - 3 - printf(msg_plain:sub(1, partlen) .. "..." .. msg_plain:sub(#msg_plain - partlen)) + local sep = msg_plain:sub(partlen, #msg_plain - partlen) + local split = msg:split(sep, {plain = true, strict = true}) + cprintf(table.concat(split, "...")) end if math.floor(progress) == 100 then print("") |
