Download raw body.
tog: fix display of lines ending in \r\n
On Thu, Dec 10, 2020 at 11:17:48PM +0100, Christian Weisgerber wrote: > Stefan Sperling: > > > What specific problem are you looking at? > > tog's log view dealing with the attached repository. > > There are two ESC characters in the commit message. They are escaped > to "^[", but then the next line is offset by 4 characters. > > This would be consistent with ESC being handled as a zero-width > character, and a later instance (curses itself?) turning them into > visible sequences. One thing we could do is this. Keeps the display intact, at least. diff 3f670bfb38a502b7309f7db354b9d4f767ea12fc /home/stsp/src/got blob - ee044a71602208bed395a517f0354d580be3407f file + tog/tog.c --- tog/tog.c +++ tog/tog.c @@ -19,6 +19,7 @@ #include <sys/ioctl.h> #include <ctype.h> +#include <wctype.h> #include <errno.h> #define _XOPEN_SOURCE_EXTENDED #include <curses.h> @@ -1175,8 +1176,12 @@ format_line(wchar_t **wlinep, int *widthp, const char i = 0; while (i < wlen) { - int width = wcwidth(wline[i]); + int width; + if (iswcntrl(wline[i])) + wline[i] = L'?'; + + width = wcwidth(wline[i]); if (width == 0) { i++; continue;
tog: fix display of lines ending in \r\n