summaryrefslogtreecommitdiffstats
path: root/window-copy.c
diff options
context:
space:
mode:
authornicm <nicm>2020-04-01 07:52:07 +0000
committernicm <nicm>2020-04-01 07:52:07 +0000
commit46092f27605de183056f39fd0859af11ae284041 (patch)
tree29e83a3d90758739db4f8ce1664632b044bdfad7 /window-copy.c
parent46ed81fc45c26e383e6bb97b0bf624a3087b217f (diff)
Use a comparison to check for wrap and avoid an expensive modulus.
Diffstat (limited to 'window-copy.c')
-rw-r--r--window-copy.c5
1 files 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);
}