cgmnlm

colorful gemini line mode browser
git clone https://git.clttr.info/cgmnlm.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 81a48d48ed0129181607129cb4f21823a71cfe32
parent 72a763f208a7f1513d363002d1d62d5e1a15ba24
Author: Ondřej Fiala <temp.xanomes@volny.cz>
Date:   Sat,  5 Feb 2022 12:44:52 +0100

gmnlm: strip control sequences from plaintext rendering

Diffstat:
Msrc/gmnlm.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -1152,6 +1152,11 @@ display_plaintext(struct browser *browser, struct gemini_response *resp) if (n < 0) { n = 0; } + for (int i = 0; i < n; i++) { + if (iscntrl(buf[i]) && (buf[i] < '\t' || buf[i] > '\v')) { + buf[i] = '.'; + } + } ssize_t w = 0; while (w < (ssize_t)n) { ssize_t x = fwrite(&buf[w], 1, n - w, browser->tty);