aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-03-17 21:40:53 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-03-17 21:40:53 +0000
commit95f48a219a3b270e4e6b235745b094db4b7fe9f3 (patch)
treefe233dfc86580889bc4592121ab13297b79d253f
parent87d092d2262031cfb714069525d9d7ec894b7fcc (diff)
downloadrtmux-95f48a219a3b270e4e6b235745b094db4b7fe9f3.tar.gz
rtmux-95f48a219a3b270e4e6b235745b094db4b7fe9f3.tar.bz2
rtmux-95f48a219a3b270e4e6b235745b094db4b7fe9f3.zip
Add a wrap-search option to turn off wrapping of searches in copy
mode. From Jacobo de Vera.
-rw-r--r--options-table.c5
-rw-r--r--tmux.16
-rw-r--r--window-copy.c10
3 files changed, 17 insertions, 4 deletions
diff --git a/options-table.c b/options-table.c
index 305bada8..fa71f399 100644
--- a/options-table.c
+++ b/options-table.c
@@ -669,6 +669,11 @@ const struct options_table_entry window_options_table[] = {
.default_str = "#I:#W#F"
},
+ { .name = "wrap-search",
+ .type = OPTIONS_TABLE_FLAG,
+ .default_num = 1
+ },
+
{ .name = "xterm-keys",
.type = OPTIONS_TABLE_FLAG,
.default_num = 0
diff --git a/tmux.1 b/tmux.1
index 0ab98afe..993a2af3 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2661,6 +2661,12 @@ will generate
function key sequences; these have a number included to indicate modifiers such
as Shift, Alt or Ctrl.
The default is off.
+.Pp
+.It Xo Ic wrap-search
+.Op Ic on | off
+.Xc
+If this option is set, searches will wrap around the end of the pane contents.
+The default is on.
.El
.It Xo Ic show-options
.Op Fl gsw
diff --git a/window-copy.c b/window-copy.c
index 3d491822..2f1c353c 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -984,11 +984,12 @@ window_copy_search_up(struct window_pane *wp, const char *searchstr)
struct grid_cell gc;
size_t searchlen;
u_int i, last, fx, fy, px;
- int utf8flag, n, wrapped;
+ int utf8flag, n, wrapped, wrapflag;
if (*searchstr == '\0')
return;
utf8flag = options_get_number(&wp->window->options, "utf8");
+ wrapflag = options_get_number(&wp->window->options, "wrap-search");
searchlen = screen_write_strlen(utf8flag, "%s", searchstr);
screen_init(&ss, searchlen, 1, 0);
@@ -1021,7 +1022,7 @@ retry:
break;
}
}
- if (!n && !wrapped) {
+ if (wrapflag && !n && !wrapped) {
fx = gd->sx - 1;
fy = gd->hsize + gd->sy - 1;
wrapped = 1;
@@ -1041,11 +1042,12 @@ window_copy_search_down(struct window_pane *wp, const char *searchstr)
struct grid_cell gc;
size_t searchlen;
u_int i, first, fx, fy, px;
- int utf8flag, n, wrapped;
+ int utf8flag, n, wrapped, wrapflag;
if (*searchstr == '\0')
return;
utf8flag = options_get_number(&wp->window->options, "utf8");
+ wrapflag = options_get_number(&wp->window->options, "wrap-search");
searchlen = screen_write_strlen(utf8flag, "%s", searchstr);
screen_init(&ss, searchlen, 1, 0);
@@ -1078,7 +1080,7 @@ retry:
break;
}
}
- if (!n && !wrapped) {
+ if (wrapflag && !n && !wrapped) {
fx = 0;
fy = 0;
wrapped = 1;