diff options
author | nicm <nicm> | 2019-06-24 08:20:02 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-06-24 08:20:02 +0000 |
commit | bdab5950955539ea4ffab0816faf182607db4c2b (patch) | |
tree | 3c3f53f5a56c2b251b4379a6cea216d6d16035bd /window.c | |
parent | f1100f97f7a06fcbebcf18b2c46e7f8f89fdd65b (diff) | |
download | rtmux-bdab5950955539ea4ffab0816faf182607db4c2b.tar.gz rtmux-bdab5950955539ea4ffab0816faf182607db4c2b.tar.bz2 rtmux-bdab5950955539ea4ffab0816faf182607db4c2b.zip |
Trim trailing spaces when matching.
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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 |