summaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-06-24 11:02:26 +0100
committerThomas Adam <thomas@xteddy.org>2019-06-24 11:02:26 +0100
commitc14b0d7c00373d08b7704a54c88a181aeed8f2ca (patch)
tree8206d928cec1391e44a705b9ebcb35703ec2f13f /window.c
parent50c4c5917d1a47b00360ebe61fe8b002e467c57e (diff)
parentbdab5950955539ea4ffab0816faf182607db4c2b (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'window.c')
-rw-r--r--window.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/window.c b/window.c
index 89a4d8c2..33e21d4c 100644
--- a/window.c
+++ b/window.c
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
@@ -1223,6 +1224,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)
@@ -1237,6 +1239,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