summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-02-11 20:39:41 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-02-11 20:39:41 +0000
commit8f57591a1f77dc939ec406ed3ca3ea098b9696ac (patch)
treed085f44613d08cb1e32363d0c414c9b59a57c54d /usr.bin
parent70093180cdbc104acbac7be10f349c22a88d479b (diff)
Add "N" key to search the opposite way from the last search (reverse of "n"),
from Micah Cowan.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/mode-key.c5
-rw-r--r--usr.bin/tmux/tmux.15
-rw-r--r--usr.bin/tmux/tmux.h3
-rw-r--r--usr.bin/tmux/window-copy.c17
4 files changed, 22 insertions, 8 deletions
diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c
index 2f2538c83f5..7ad7b704265 100644
--- a/usr.bin/tmux/mode-key.c
+++ b/usr.bin/tmux/mode-key.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mode-key.c,v 1.32 2010/02/06 17:35:01 nicm Exp $ */
+/* $OpenBSD: mode-key.c,v 1.33 2010/02/11 20:39:40 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -104,6 +104,7 @@ struct mode_key_cmdstr mode_key_cmdstr_copy[] = {
{ MODEKEYCOPY_SCROLLUP, "scroll-up" },
{ MODEKEYCOPY_SEARCHAGAIN, "search-again" },
{ MODEKEYCOPY_SEARCHDOWN, "search-forward" },
+ { MODEKEYCOPY_SEARCHREVERSE, "search-reverse" },
{ MODEKEYCOPY_SEARCHUP, "search-backward" },
{ MODEKEYCOPY_STARTOFLINE, "start-of-line" },
{ MODEKEYCOPY_STARTSELECTION, "begin-selection" },
@@ -187,6 +188,7 @@ const struct mode_key_entry mode_key_vi_copy[] = {
{ 'K', 0, MODEKEYCOPY_SCROLLUP },
{ 'L', 0, MODEKEYCOPY_BOTTOMLINE },
{ 'M', 0, MODEKEYCOPY_MIDDLELINE },
+ { 'N', 0, MODEKEYCOPY_SEARCHREVERSE },
{ 'W', 0, MODEKEYCOPY_NEXTSPACE },
{ '\002' /* C-b */, 0, MODEKEYCOPY_PREVIOUSPAGE },
{ '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL },
@@ -296,6 +298,7 @@ const struct mode_key_entry mode_key_emacs_copy[] = {
{ '\026' /* C-v */, 0, MODEKEYCOPY_NEXTPAGE },
{ '\027' /* C-w */, 0, MODEKEYCOPY_COPYSELECTION },
{ '\033' /* Escape */, 0, MODEKEYCOPY_CANCEL },
+ { 'N', 0, MODEKEYCOPY_SEARCHREVERSE },
{ 'b' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSWORD },
{ 'f' | KEYC_ESCAPE, 0, MODEKEYCOPY_NEXTWORDEND },
{ 'g', 0, MODEKEYCOPY_GOTOLINE },
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 99a86842d64..891848eb91c 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.151 2010/02/10 19:17:27 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.152 2010/02/11 20:39:40 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 10 2010 $
+.Dd $Mdocdate: February 11 2010 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -572,6 +572,7 @@ The following keys are supported as appropriate for the mode:
.It Li "Scroll down" Ta "C-Down or C-e" Ta "C-Down"
.It Li "Scroll up" Ta "C-Up or C-y" Ta "C-Up"
.It Li "Search again" Ta "n" Ta "n"
+.It Li "Search again in reverse" Ta "N" Ta "N"
.It Li "Search backward" Ta "?" Ta "C-r"
.It Li "Search forward" Ta "/" Ta "C-s"
.It Li "Start of line" Ta "0" Ta "C-a"
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 3766e45adf2..446cd5bd10e 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.206 2010/02/06 23:22:27 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.207 2010/02/11 20:39:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -475,6 +475,7 @@ enum mode_key_cmd {
MODEKEYCOPY_SCROLLUP,
MODEKEYCOPY_SEARCHAGAIN,
MODEKEYCOPY_SEARCHDOWN,
+ MODEKEYCOPY_SEARCHREVERSE,
MODEKEYCOPY_SEARCHUP,
MODEKEYCOPY_STARTOFLINE,
MODEKEYCOPY_STARTSELECTION,
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index f0dd8eb3596..0d150de53c4 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.42 2010/02/06 17:35:01 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.43 2010/02/11 20:39:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -224,6 +224,7 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
struct screen *s = &data->screen;
u_int n;
int keys;
+ enum mode_key_cmd cmd;
if (data->inputtype != WINDOW_COPY_OFF) {
if (window_copy_key_input(wp, key) != 0)
@@ -231,7 +232,8 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
return;
}
- switch (mode_key_lookup(&data->mdata, key)) {
+ cmd = mode_key_lookup(&data->mdata, key);
+ switch (cmd) {
case MODEKEYCOPY_CANCEL:
window_pane_reset_mode(wp);
break;
@@ -367,15 +369,22 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
data->inputprompt = "Search Down";
goto input_on;
case MODEKEYCOPY_SEARCHAGAIN:
+ case MODEKEYCOPY_SEARCHREVERSE:
switch (data->searchtype) {
case WINDOW_COPY_OFF:
case WINDOW_COPY_GOTOLINE:
break;
case WINDOW_COPY_SEARCHUP:
- window_copy_search_up(wp, data->searchstr);
+ if (cmd == MODEKEYCOPY_SEARCHAGAIN)
+ window_copy_search_up(wp, data->searchstr);
+ else
+ window_copy_search_down(wp, data->searchstr);
break;
case WINDOW_COPY_SEARCHDOWN:
- window_copy_search_down(wp, data->searchstr);
+ if (cmd == MODEKEYCOPY_SEARCHAGAIN)
+ window_copy_search_down(wp, data->searchstr);
+ else
+ window_copy_search_up(wp, data->searchstr);
break;
}
break;