summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-03-17 21:40:54 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-03-17 21:40:54 +0000
commitdbfd0440176d83319b4745462351b8b5131ae689 (patch)
treef9d1a80353385b7f4d0c398cfb9cc9b0f6bc913c
parentc6a04b6545fc26cfdbd13ded8ee522a2a5d4b896 (diff)
Add a wrap-search option to turn off wrapping of searches in copy
mode. From Jacobo de Vera.
-rw-r--r--usr.bin/tmux/options-table.c7
-rw-r--r--usr.bin/tmux/tmux.18
-rw-r--r--usr.bin/tmux/window-copy.c12
3 files changed, 20 insertions, 7 deletions
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c
index 1646c0870b1..7070d22931b 100644
--- a/usr.bin/tmux/options-table.c
+++ b/usr.bin/tmux/options-table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options-table.c,v 1.23 2012/02/29 21:10:51 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.24 2012/03/17 21:40:53 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index e83f069d6d7..1ee48173d69 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.281 2012/03/17 21:33:33 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.282 2012/03/17 21:40:53 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -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/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index ed4232a091a..bfec3fdbd8e 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.77 2012/03/11 23:01:19 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.78 2012/03/17 21:40:53 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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;