mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-23 08:33:17 +01:00
Sync OpenBSD patchset 260:
vi(1)-style half page scroll in copy and scroll modes. Move the vi full page scroll key to C-b instead of C-u and use C-u/C-d for half page scrolling with vi keys. In emacs mode, half page scrolling is bound to M-Up and M-Down. Suggested by merdely (about a year ago :-)).
This commit is contained in:
parent
98e9e09588
commit
6f9a2ee50a
@ -1,4 +1,4 @@
|
||||
/* $Id: mode-key.c,v 1.23 2009-07-30 21:14:04 tcunha Exp $ */
|
||||
/* $Id: mode-key.c,v 1.24 2009-08-16 19:26:49 tcunha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -149,10 +149,12 @@ const struct mode_key_entry mode_key_vi_copy[] = {
|
||||
{ ' ', 0, MODEKEYCOPY_STARTSELECTION },
|
||||
{ '$', 0, MODEKEYCOPY_ENDOFLINE },
|
||||
{ '0', 0, MODEKEYCOPY_STARTOFLINE },
|
||||
{ '\002' /* C-b */, 0, MODEKEYCOPY_PREVIOUSPAGE },
|
||||
{ '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL },
|
||||
{ '\004' /* C-d */, 0, MODEKEYCOPY_HALFPAGEDOWN },
|
||||
{ '\006' /* C-f */, 0, MODEKEYCOPY_NEXTPAGE },
|
||||
{ '\010' /* C-h */, 0, MODEKEYCOPY_LEFT },
|
||||
{ '\025' /* C-u */, 0, MODEKEYCOPY_PREVIOUSPAGE },
|
||||
{ '\025' /* C-u */, 0, MODEKEYCOPY_HALFPAGEUP },
|
||||
{ '\033' /* Escape */, 0, MODEKEYCOPY_CLEARSELECTION },
|
||||
{ '\r', 0, MODEKEYCOPY_COPYSELECTION },
|
||||
{ '^', 0, MODEKEYCOPY_BACKTOINDENTATION },
|
||||
@ -237,11 +239,13 @@ const struct mode_key_entry mode_key_emacs_copy[] = {
|
||||
{ 'q', 0, MODEKEYCOPY_CANCEL },
|
||||
{ 'v' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSPAGE },
|
||||
{ 'w' | KEYC_ESCAPE, 0, MODEKEYCOPY_COPYSELECTION },
|
||||
{ KEYC_DOWN | KEYC_ESCAPE, 0, MODEKEYCOPY_HALFPAGEDOWN },
|
||||
{ KEYC_DOWN, 0, MODEKEYCOPY_DOWN },
|
||||
{ KEYC_LEFT, 0, MODEKEYCOPY_LEFT },
|
||||
{ KEYC_NPAGE, 0, MODEKEYCOPY_NEXTPAGE },
|
||||
{ KEYC_PPAGE, 0, MODEKEYCOPY_PREVIOUSPAGE },
|
||||
{ KEYC_RIGHT, 0, MODEKEYCOPY_RIGHT },
|
||||
{ KEYC_UP | KEYC_ESCAPE, 0, MODEKEYCOPY_HALFPAGEUP },
|
||||
{ KEYC_UP, 0, MODEKEYCOPY_UP },
|
||||
|
||||
{ 0, -1, 0 }
|
||||
|
6
tmux.h
6
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.417 2009-08-16 19:16:27 tcunha Exp $ */
|
||||
/* $Id: tmux.h,v 1.418 2009-08-16 19:26:49 tcunha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -386,12 +386,14 @@ enum mode_key_cmd {
|
||||
MODEKEYCHOICE_UP,
|
||||
|
||||
/* Copy keys. */
|
||||
MODEKEYCOPY_CANCEL,
|
||||
MODEKEYCOPY_BACKTOINDENTATION,
|
||||
MODEKEYCOPY_CANCEL,
|
||||
MODEKEYCOPY_CLEARSELECTION,
|
||||
MODEKEYCOPY_COPYSELECTION,
|
||||
MODEKEYCOPY_DOWN,
|
||||
MODEKEYCOPY_ENDOFLINE,
|
||||
MODEKEYCOPY_HALFPAGEDOWN,
|
||||
MODEKEYCOPY_HALFPAGEUP,
|
||||
MODEKEYCOPY_LEFT,
|
||||
MODEKEYCOPY_NEXTPAGE,
|
||||
MODEKEYCOPY_NEXTWORD,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: window-copy.c,v 1.78 2009-08-16 19:23:07 tcunha Exp $ */
|
||||
/* $Id: window-copy.c,v 1.79 2009-08-16 19:26:49 tcunha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -203,6 +203,24 @@ 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_HALFPAGEUP:
|
||||
n = screen_size_y(s) / 2;
|
||||
if (data->oy + n > screen_hsize(&wp->base))
|
||||
data->oy = screen_hsize(&wp->base);
|
||||
else
|
||||
data->oy += n;
|
||||
window_copy_update_selection(wp);
|
||||
window_copy_redraw_screen(wp);
|
||||
break;
|
||||
case MODEKEYCOPY_HALFPAGEDOWN:
|
||||
n = screen_size_y(s) / 2;
|
||||
if (data->oy < n)
|
||||
data->oy = 0;
|
||||
else
|
||||
data->oy -= n;
|
||||
window_copy_update_selection(wp);
|
||||
window_copy_redraw_screen(wp);
|
||||
break;
|
||||
case MODEKEYCOPY_STARTSELECTION:
|
||||
window_copy_start_selection(wp);
|
||||
window_copy_redraw_screen(wp);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: window-scroll.c,v 1.39 2009-08-16 19:23:07 tcunha Exp $ */
|
||||
/* $Id: window-scroll.c,v 1.40 2009-08-16 19:26:49 tcunha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -165,6 +165,22 @@ window_scroll_key(struct window_pane *wp, unused struct client *c, int key)
|
||||
data->oy -= n;
|
||||
window_scroll_redraw_screen(wp);
|
||||
break;
|
||||
case MODEKEYCOPY_HALFPAGEUP:
|
||||
n = screen_size_y(s) / 2;
|
||||
if (data->oy + n > screen_hsize(&wp->base))
|
||||
data->oy = screen_hsize(&wp->base);
|
||||
else
|
||||
data->oy += n;
|
||||
window_scroll_redraw_screen(wp);
|
||||
break;
|
||||
case MODEKEYCOPY_HALFPAGEDOWN:
|
||||
n = screen_size_y(s) / 2;
|
||||
if (data->oy < n)
|
||||
data->oy = 0;
|
||||
else
|
||||
data->oy -= n;
|
||||
window_scroll_redraw_screen(wp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user