summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-01-25 21:33:40 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-01-25 21:33:40 +0000
commit599a89ee77bd9e44e67fe0e7892a748ab57210ea (patch)
tree28c3be1c09db17c1a7b3aae594d28d8ab1d3767d
parent0917e5415c25f0ec3ec2c16e6328cf387eb8eb3b (diff)
Top/bottom of history mode keys, diff from Micah Cowan, tweaked by me.
-rw-r--r--usr.bin/tmux/mode-key.c12
-rw-r--r--usr.bin/tmux/tmux.18
-rw-r--r--usr.bin/tmux/tmux.h4
-rw-r--r--usr.bin/tmux/window-copy.c16
4 files changed, 32 insertions, 8 deletions
diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c
index a70b3f5e9e8..9efc6ca9db9 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.26 2010/01/23 17:49:21 nicm Exp $ */
+/* $OpenBSD: mode-key.c,v 1.27 2010/01/25 21:33:39 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -84,6 +84,8 @@ struct mode_key_cmdstr mode_key_cmdstr_copy[] = {
{ MODEKEYCOPY_DOWN, "cursor-down" },
{ MODEKEYCOPY_ENDOFLINE, "end-of-line" },
{ MODEKEYCOPY_GOTOLINE, "goto-line" },
+ { MODEKEYCOPY_HISTORYBOTTOM, "history-bottom" },
+ { MODEKEYCOPY_HISTORYTOP, "history-top" },
{ MODEKEYCOPY_LEFT, "cursor-left" },
{ MODEKEYCOPY_MIDDLELINE, "middle-line" },
{ MODEKEYCOPY_NEXTPAGE, "page-down" },
@@ -116,13 +118,13 @@ const struct mode_key_entry mode_key_vi_edit[] = {
{ '$', 1, MODEKEYEDIT_ENDOFLINE },
{ '0', 1, MODEKEYEDIT_STARTOFLINE },
- { 'd', 1, MODEKEYEDIT_DELETELINE },
{ 'D', 1, MODEKEYEDIT_DELETETOENDOFLINE },
{ '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL },
{ '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE },
{ '\r', 1, MODEKEYEDIT_ENTER },
{ '^', 1, MODEKEYEDIT_STARTOFLINE },
{ 'a', 1, MODEKEYEDIT_SWITCHMODEAPPEND },
+ { 'd', 1, MODEKEYEDIT_DELETELINE },
{ 'h', 1, MODEKEYEDIT_CURSORLEFT },
{ 'i', 1, MODEKEYEDIT_SWITCHMODE },
{ 'j', 1, MODEKEYEDIT_HISTORYDOWN },
@@ -164,6 +166,7 @@ const struct mode_key_entry mode_key_vi_copy[] = {
{ '0', 0, MODEKEYCOPY_STARTOFLINE },
{ ':', 0, MODEKEYCOPY_GOTOLINE },
{ '?', 0, MODEKEYCOPY_SEARCHUP },
+ { 'G', 0, MODEKEYCOPY_HISTORYBOTTOM },
{ 'H', 0, MODEKEYCOPY_TOPLINE },
{ 'J', 0, MODEKEYCOPY_SCROLLDOWN },
{ 'K', 0, MODEKEYCOPY_SCROLLUP },
@@ -181,6 +184,7 @@ const struct mode_key_entry mode_key_vi_copy[] = {
{ '\r', 0, MODEKEYCOPY_COPYSELECTION },
{ '^', 0, MODEKEYCOPY_BACKTOINDENTATION },
{ 'b', 0, MODEKEYCOPY_PREVIOUSWORD },
+ { 'g', 0, MODEKEYCOPY_HISTORYTOP },
{ 'h', 0, MODEKEYCOPY_LEFT },
{ 'j', 0, MODEKEYCOPY_DOWN },
{ 'k', 0, MODEKEYCOPY_UP },
@@ -254,6 +258,9 @@ struct mode_key_tree mode_key_tree_emacs_choice;
/* emacs copy mode keys. */
const struct mode_key_entry mode_key_emacs_copy[] = {
{ ' ', 0, MODEKEYCOPY_NEXTPAGE },
+ { '<' | KEYC_ESCAPE,0, MODEKEYCOPY_HISTORYTOP },
+ { '>' | KEYC_ESCAPE, 0, MODEKEYCOPY_HISTORYBOTTOM },
+ { 'R' | KEYC_ESCAPE, 0, MODEKEYCOPY_TOPLINE },
{ '\000' /* C-Space */, 0, MODEKEYCOPY_STARTSELECTION },
{ '\001' /* C-a */, 0, MODEKEYCOPY_STARTOFLINE },
{ '\002' /* C-b */, 0, MODEKEYCOPY_LEFT },
@@ -275,7 +282,6 @@ const struct mode_key_entry mode_key_emacs_copy[] = {
{ 'n', 0, MODEKEYCOPY_SEARCHAGAIN },
{ 'q', 0, MODEKEYCOPY_CANCEL },
{ 'r' | KEYC_ESCAPE, 0, MODEKEYCOPY_MIDDLELINE },
- { 'R' | KEYC_ESCAPE, 0, MODEKEYCOPY_TOPLINE },
{ 'v' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSPAGE },
{ 'w' | KEYC_ESCAPE, 0, MODEKEYCOPY_COPYSELECTION },
{ KEYC_DOWN | KEYC_CTRL,0, MODEKEYCOPY_SCROLLDOWN },
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 1abd28ad101..d9cd0784cc2 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.141 2010/01/23 17:49:21 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.142 2010/01/25 21:33:39 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: January 23 2010 $
+.Dd $Mdocdate: January 25 2010 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -538,6 +538,7 @@ The following keys are supported as appropriate for the mode:
.Bl -column "FunctionXXXXXXXXXXXX" "viXXXXXXXXXX" "emacs" -offset indent
.It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
.It Li "Back to indentation" Ta "^" Ta "M-m"
+.It Li "Bottom of history" Ta "G" Ta "M-<"
.It Li "Clear selection" Ta "Escape" Ta "C-g"
.It Li "Copy selection" Ta "Enter" Ta "M-w"
.It Li "Cursor down" Ta "j" Ta "Down"
@@ -550,7 +551,7 @@ The following keys are supported as appropriate for the mode:
.It Li "Delete entire line" Ta "d" Ta "C-u"
.It Li "Delete to end of line" Ta "D" Ta "C-k"
.It Li "End of line" Ta "$" Ta "C-e"
-.It Li "Goto line" Ta ":" Ta "g"
+.It Li "Go to line" Ta ":" Ta "g"
.It Li "Half page down" Ta "C-d" Ta "M-Down"
.It Li "Half page up" Ta "C-u" Ta "M-Up"
.It Li "Next page" Ta "C-f" Ta "Page down"
@@ -566,6 +567,7 @@ The following keys are supported as appropriate for the mode:
.It Li "Search forward" Ta "/" Ta "C-s"
.It Li "Start of line" Ta "0" Ta "C-a"
.It Li "Start selection" Ta "Space" Ta "C-Space"
+.It Li "Top of history" Ta "g" Ta "M->"
.It Li "Transpose chars" Ta "" Ta "C-t"
.El
.Pp
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 3a4b409031c..ddf1dfd15ae 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.198 2010/01/07 20:52:18 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.199 2010/01/25 21:33:39 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -455,6 +455,8 @@ enum mode_key_cmd {
MODEKEYCOPY_GOTOLINE,
MODEKEYCOPY_HALFPAGEDOWN,
MODEKEYCOPY_HALFPAGEUP,
+ MODEKEYCOPY_HISTORYBOTTOM,
+ MODEKEYCOPY_HISTORYTOP,
MODEKEYCOPY_LEFT,
MODEKEYCOPY_MIDDLELINE,
MODEKEYCOPY_NEXTPAGE,
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 9c0c9a3385c..e48cd14cbb7 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.36 2010/01/24 21:05:12 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.37 2010/01/25 21:33:39 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -296,6 +296,20 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
window_copy_update_selection(wp);
window_copy_redraw_screen(wp);
break;
+ case MODEKEYCOPY_HISTORYTOP:
+ data->cx = 0;
+ data->cy = 0;
+ data->oy = screen_hsize(&wp->base);
+ window_copy_update_selection(wp);
+ window_copy_redraw_screen(wp);
+ break;
+ case MODEKEYCOPY_HISTORYBOTTOM:
+ data->cx = 0;
+ data->cy = screen_size_y(s) - 1;
+ data->oy = 0;
+ window_copy_update_selection(wp);
+ window_copy_redraw_screen(wp);
+ break;
case MODEKEYCOPY_STARTSELECTION:
window_copy_start_selection(wp);
window_copy_redraw_screen(wp);