=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window-copy.c,v retrieving revision 1.169 retrieving revision 1.170 diff -u -r1.169 -r1.170 --- src/usr.bin/tmux/window-copy.c 2017/03/21 09:51:00 1.169 +++ src/usr.bin/tmux/window-copy.c 2017/03/24 07:14:27 1.170 @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.169 2017/03/21 09:51:00 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.170 2017/03/24 07:14:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -174,6 +174,8 @@ int searchtype; char *searchstr; bitstr_t *searchmark; + u_int searchcount; + int searchthis; int searchx; int searchy; int searcho; @@ -1170,7 +1172,7 @@ struct screen *s = data->backing, ss; struct screen_write_ctx ctx; struct grid *gd = s->grid; - int found, cis; + int found, cis, which = -1; u_int px, py, b, nfound = 0, width; if (ssp == NULL) { @@ -1196,7 +1198,10 @@ px, gd->sx, cis); if (!found) break; + nfound++; + if (px == data->cx && py == gd->hsize + data->cy - data->oy) + which = nfound; b = (py * gd->sx) + px; bit_nset(data->searchmark, b, b + width - 1); @@ -1205,6 +1210,12 @@ } } + if (which != -1) + data->searchthis = 1 + nfound - which; + else + data->searchthis = -1; + data->searchcount = nfound; + if (ssp == &ss) screen_free(&ss); return (nfound); @@ -1262,8 +1273,21 @@ gc.flags |= GRID_FLAG_NOPALETTE; if (py == 0) { - size = xsnprintf(hdr, sizeof hdr, - "[%u/%u]", data->oy, screen_hsize(data->backing)); + if (data->searchmark == NULL) { + size = xsnprintf(hdr, sizeof hdr, + "[%u/%u]", data->oy, screen_hsize(data->backing)); + } else { + if (data->searchthis == -1) { + size = xsnprintf(hdr, sizeof hdr, + "(%u results) [%d/%u]", data->searchcount, + data->oy, screen_hsize(data->backing)); + } else { + size = xsnprintf(hdr, sizeof hdr, + "(%u/%u results) [%d/%u]", data->searchthis, + data->searchcount, data->oy, + screen_hsize(data->backing)); + } + } if (size > screen_size_x(s)) size = screen_size_x(s); screen_write_cursormove(ctx, screen_size_x(s) - size, 0);