Download raw body.
tog: fix display of lines ending in \r\n
jrick reported that this commit log message doesn't display correctly in tog:
https://github.com/decred/dcrd/commit/ced647dbcf6b572e39b1c6106b07b00c30b639d8
This commit displays as follows:
[[[
[1/128] diff c56c9ea00e9c30b609a2f7ac735d240a6cb49e59 ced647dbcf6b572e39b1c6106b07b00c30b639d8
commit ced647dbcf6b572e39b1c6106b07b00c30b639d8
from: Josh Rickmar <jrick@companyzero.com>
date: Wed Dec 2 19:04:27 2020 UTC
via: GitHub <noreply@github.com>
rpcserver: Hash auth using random-keyed MAC.
access on architectures where that is forbidden.
M internal/rpcserver/rpcserver.go
]]]
The "problem" is that this log message contains \r\n line endings.
Quick and simple fix below. OK?
diff 9a2d6ca19c544d6f55347ccb18c566434f6f8d4c ac7edcfb7479cb3379bc90df5540e8d9565ea7bf
blob - 457fcc6885530f6eb53c478998fd277562f91f45
blob + ee044a71602208bed395a517f0354d580be3407f
--- tog/tog.c
+++ tog/tog.c
@@ -1164,6 +1164,15 @@ format_line(wchar_t **wlinep, int *widthp, const char
if (err)
return err;
+ if (wlen > 0 && wline[wlen - 1] == L'\n') {
+ wline[wlen - 1] = L'\0';
+ wlen--;
+ }
+ if (wlen > 0 && wline[wlen - 1] == L'\r') {
+ wline[wlen - 1] = L'\0';
+ wlen--;
+ }
+
i = 0;
while (i < wlen) {
int width = wcwidth(wline[i]);
tog: fix display of lines ending in \r\n