Sync OpenBSD patchset 617:

Top/bottom of history mode keys, diff from Micah Cowan, tweaked by me.
This commit is contained in:
Tiago Cunha 2010-01-28 22:41:45 +00:00
parent 0b05e6d8cb
commit c153a43299
4 changed files with 32 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $Id: mode-key.c,v 1.37 2010-01-25 17:11:42 tcunha Exp $ */
/* $Id: mode-key.c,v 1.38 2010-01-28 22:41:45 tcunha 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 },

6
tmux.1
View File

@ -1,4 +1,4 @@
.\" $Id: tmux.1,v 1.223 2010-01-25 17:11:42 tcunha Exp $
.\" $Id: tmux.1,v 1.224 2010-01-28 22:41:45 tcunha 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"
@ -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

4
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.536 2010-01-08 16:31:35 tcunha Exp $ */
/* $Id: tmux.h,v 1.537 2010-01-28 22:41:45 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -454,6 +454,8 @@ enum mode_key_cmd {
MODEKEYCOPY_GOTOLINE,
MODEKEYCOPY_HALFPAGEDOWN,
MODEKEYCOPY_HALFPAGEUP,
MODEKEYCOPY_HISTORYBOTTOM,
MODEKEYCOPY_HISTORYTOP,
MODEKEYCOPY_LEFT,
MODEKEYCOPY_MIDDLELINE,
MODEKEYCOPY_NEXTPAGE,

View File

@ -1,4 +1,4 @@
/* $Id: window-copy.c,v 1.95 2010-01-25 17:14:42 tcunha Exp $ */
/* $Id: window-copy.c,v 1.96 2010-01-28 22:41:45 tcunha 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);