• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A CLI tool for downloading from pixiv.net


Commit MetaInfo

Revisão081637a32943c1815825d7e4341edbbbcbc8e32b (tree)
Hora2023-09-29 19:40:47
Autormio <stigma@disr...>
Commitermio

Mensagem de Log

Fix trailing percentage for previously downloaded

e.g.:

Previously downloaded page 1/2.%).
Previously downloaded page 2/2.

Mudança Sumário

Diff

--- a/source/app.d
+++ b/source/app.d
@@ -60,23 +60,30 @@ class ProgressMonitor
6060 {
6161 import std.conv : ConvException, to;
6262 import std.format : format;
63+ import std.range : repeat;
64+ import util : getTerminalColumns;
6365
6466 string value;
6567 if (convertToString(ev.totalPages, value)) {
6668 const numerOfDigits = value.length;
6769 const modifier = format("%%%dd", numerOfDigits);
6870 // ^ Determines the padding (e.g. %2d)
69- const prompt = format("\r Previously downloaded page %s/%d.",
71+ const msg = format("\r Previously downloaded page %s/%d.",
7072 modifier, ev.totalPages);
71- writefln(prompt, ev.currentPage);
73+ const prompt = format(msg, ev.currentPage);
74+ write(prompt);
75+ write(' '.repeat(getTerminalColumns() - prompt.length));
7276 } else {
7377 debug(app)
7478 {
7579 log.errorf("Converting size_t to string: %d", ev.totalPages);
7680 }
77- writefln("\r Previously downloaded page %d/%d.",
81+ const prompt = format("\r Previously downloaded page %d/%d.",
7882 ev.currentPage, ev.totalPages);
83+ write(prompt);
84+ write(' '.repeat(getTerminalColumns() - prompt.length));
7985 }
86+ write("\n");
8087 currentPage += 1;
8188 }
8289