From 88a3d42e8f75d9bc6c94a410f8b2fc48fcd604cd Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 25 Nov 2021 14:45:58 -0500 Subject: [PATCH] [paint] stop processing line of plane on linefeed #2196 --- src/lib/render.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/render.c b/src/lib/render.c index 388cd7c32..4c8fee5da 100644 --- a/src/lib/render.c +++ b/src/lib/render.c @@ -227,8 +227,7 @@ paint_sprixel(ncplane* p, struct crender* rvec, int starty, int startx, // the sprixelstack orders sprixels of the plane (so we needn't keep them // ordered between renders). each time we meet a sprixel, extract it from // the pile's sprixel list, and update the sprixelstack. -__attribute__ ((nonnull (1, 2, 7))) -static void +__attribute__ ((nonnull (1, 2, 7))) static void paint(ncplane* p, struct crender* rvec, int dstleny, int dstlenx, int dstabsy, int dstabsx, sprixel** sprixelstack){ unsigned y, x, dimy, dimx; @@ -289,6 +288,12 @@ paint(ncplane* p, struct crender* rvec, int dstleny, int dstlenx, if(nccell_wide_right_p(targc)){ continue; } + // if we encounter a newline (always a bare linefeed; Windows CRLF + // translation only matters for text stdio), we're done with this + // line *for this plane*. + if(targc->gcluster == '\n'){ + break; + } if(nccell_fg_alpha(targc) > NCALPHA_OPAQUE){ const nccell* vis = &p->fb[nfbcellidx(p, y, x)];