diff options
author | nicm <nicm> | 2020-04-01 07:52:07 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2020-04-01 10:08:54 +0100 |
commit | 3476eccf48001865ee43f98454d76895158063dc (patch) | |
tree | 0382dc9576cee88281dcc8cb6401697e71177aba /window-copy.c | |
parent | 0dbf4145788cda92b983037e3a7dcdd9a8997e23 (diff) |
Use a comparison to check for wrap and avoid an expensive modulus.
Diffstat (limited to 'window-copy.c')
-rw-r--r-- | window-copy.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/window-copy.c b/window-copy.c index b2b61dc7..c00017b7 100644 --- a/window-copy.c +++ b/window-copy.c @@ -2494,8 +2494,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); } |