From c129ed3233d8303f3ae1fc14a9728e8d231c3911 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 1 Apr 2020 07:52:07 +0000 Subject: [PATCH] Use a comparison to check for wrap and avoid an expensive modulus. --- window-copy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/window-copy.c b/window-copy.c index 57228273..4a3ee9ea 100644 --- a/window-copy.c +++ b/window-copy.c @@ -2523,8 +2523,9 @@ window_copy_cstrtocellpos(struct grid *gd, u_int ncells, u_int *ppx, u_int *ppy, cells[cell].d = window_copy_cellstring(gl, px, &cells[cell].dlen); cell++; - px = (px + 1) % gd->sx; - if (px == 0) { + px++; + if (px == gd->sx) { + px = 0; pywrap++; gl = grid_peek_line(gd, pywrap); }