summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-06-24 08:20:02 +0000
committernicm <nicm@openbsd.org>2019-06-24 08:20:02 +0000
commit7878fe973b782d06a2bd167bbe9b9201a49608cf (patch)
tree6b0be55bdab3132b88f95c8194a835cd77cbaae1 /usr.bin/tmux/window.c
parentDon't retry to get the usb descriptor in usbd_new_device() if the call (diff)
downloadwireguard-openbsd-7878fe973b782d06a2bd167bbe9b9201a49608cf.tar.xz
wireguard-openbsd-7878fe973b782d06a2bd167bbe9b9201a49608cf.zip
Trim trailing spaces when matching.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index fe210533d8c..9c121374483 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.235 2019/06/20 13:40:22 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.236 2019/06/24 08:20:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
@@ -1222,6 +1223,7 @@ window_pane_search(struct window_pane *wp, const char *term, int regex,
char *new = NULL, *line;
u_int i;
int flags = 0, found;
+ size_t n;
if (!regex) {
if (ignore)
@@ -1236,6 +1238,12 @@ window_pane_search(struct window_pane *wp, const char *term, int regex,
for (i = 0; i < screen_size_y(s); i++) {
line = grid_view_string_cells(s->grid, 0, i, screen_size_x(s));
+ for (n = strlen(line); n > 0; n--) {
+ if (!isspace((u_char)line[n - 1]))
+ break;
+ line[n - 1] = '\0';
+ }
+ log_debug("%s: %s", __func__, line);
if (!regex)
found = (fnmatch(new, line, 0) == 0);
else