mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 18:38:48 +00:00
Sync OpenBSD patchset 259:
Scroll by two less than the number of lines in the screen, like emacs, rather than by the entire screen, to make it easier to pull things out from under the line indicator. Suggested by claudio.
This commit is contained in:
parent
9541471f87
commit
98e9e09588
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window-copy.c,v 1.77 2009-08-16 19:12:07 tcunha Exp $ */
|
/* $Id: window-copy.c,v 1.78 2009-08-16 19:23:07 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -130,11 +130,15 @@ window_copy_pageup(struct window_pane *wp)
|
|||||||
{
|
{
|
||||||
struct window_copy_mode_data *data = wp->modedata;
|
struct window_copy_mode_data *data = wp->modedata;
|
||||||
struct screen *s = &data->screen;
|
struct screen *s = &data->screen;
|
||||||
|
u_int n;
|
||||||
|
|
||||||
if (data->oy + screen_size_y(s) > screen_hsize(&wp->base))
|
n = 1;
|
||||||
|
if (screen_size_y(s) > 2)
|
||||||
|
n = screen_size_y(s) - 2;
|
||||||
|
if (data->oy + n > screen_hsize(&wp->base))
|
||||||
data->oy = screen_hsize(&wp->base);
|
data->oy = screen_hsize(&wp->base);
|
||||||
else
|
else
|
||||||
data->oy += screen_size_y(s);
|
data->oy += n;
|
||||||
window_copy_update_selection(wp);
|
window_copy_update_selection(wp);
|
||||||
window_copy_redraw_screen(wp);
|
window_copy_redraw_screen(wp);
|
||||||
}
|
}
|
||||||
@ -167,6 +171,7 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
|
|||||||
{
|
{
|
||||||
struct window_copy_mode_data *data = wp->modedata;
|
struct window_copy_mode_data *data = wp->modedata;
|
||||||
struct screen *s = &data->screen;
|
struct screen *s = &data->screen;
|
||||||
|
u_int n;
|
||||||
|
|
||||||
switch (mode_key_lookup(&data->mdata, key)) {
|
switch (mode_key_lookup(&data->mdata, key)) {
|
||||||
case MODEKEYCOPY_CANCEL:
|
case MODEKEYCOPY_CANCEL:
|
||||||
@ -188,10 +193,13 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
|
|||||||
window_copy_pageup(wp);
|
window_copy_pageup(wp);
|
||||||
break;
|
break;
|
||||||
case MODEKEYCOPY_NEXTPAGE:
|
case MODEKEYCOPY_NEXTPAGE:
|
||||||
if (data->oy < screen_size_y(s))
|
n = 1;
|
||||||
|
if (screen_size_y(s) > 2)
|
||||||
|
n = screen_size_y(s) - 2;
|
||||||
|
if (data->oy < n)
|
||||||
data->oy = 0;
|
data->oy = 0;
|
||||||
else
|
else
|
||||||
data->oy -= screen_size_y(s);
|
data->oy -= n;
|
||||||
window_copy_update_selection(wp);
|
window_copy_update_selection(wp);
|
||||||
window_copy_redraw_screen(wp);
|
window_copy_redraw_screen(wp);
|
||||||
break;
|
break;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window-scroll.c,v 1.38 2009-08-09 16:50:57 tcunha Exp $ */
|
/* $Id: window-scroll.c,v 1.39 2009-08-16 19:23:07 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -101,11 +101,15 @@ window_scroll_pageup(struct window_pane *wp)
|
|||||||
{
|
{
|
||||||
struct window_scroll_mode_data *data = wp->modedata;
|
struct window_scroll_mode_data *data = wp->modedata;
|
||||||
struct screen *s = &data->screen;
|
struct screen *s = &data->screen;
|
||||||
|
u_int n;
|
||||||
|
|
||||||
if (data->oy + screen_size_y(s) > screen_hsize(&wp->base))
|
n = 1;
|
||||||
|
if (screen_size_y(s) > 2)
|
||||||
|
n = screen_size_y(s) - 2;
|
||||||
|
if (data->oy + n > screen_hsize(&wp->base))
|
||||||
data->oy = screen_hsize(&wp->base);
|
data->oy = screen_hsize(&wp->base);
|
||||||
else
|
else
|
||||||
data->oy += screen_size_y(s);
|
data->oy += n;
|
||||||
|
|
||||||
window_scroll_redraw_screen(wp);
|
window_scroll_redraw_screen(wp);
|
||||||
}
|
}
|
||||||
@ -130,6 +134,7 @@ window_scroll_key(struct window_pane *wp, unused struct client *c, int key)
|
|||||||
{
|
{
|
||||||
struct window_scroll_mode_data *data = wp->modedata;
|
struct window_scroll_mode_data *data = wp->modedata;
|
||||||
struct screen *s = &data->screen;
|
struct screen *s = &data->screen;
|
||||||
|
u_int n;
|
||||||
|
|
||||||
switch (mode_key_lookup(&data->mdata, key)) {
|
switch (mode_key_lookup(&data->mdata, key)) {
|
||||||
case MODEKEYCOPY_CANCEL:
|
case MODEKEYCOPY_CANCEL:
|
||||||
@ -151,10 +156,13 @@ window_scroll_key(struct window_pane *wp, unused struct client *c, int key)
|
|||||||
window_scroll_pageup(wp);
|
window_scroll_pageup(wp);
|
||||||
break;
|
break;
|
||||||
case MODEKEYCOPY_NEXTPAGE:
|
case MODEKEYCOPY_NEXTPAGE:
|
||||||
if (data->oy < screen_size_y(s))
|
n = 1;
|
||||||
|
if (screen_size_y(s) > 2)
|
||||||
|
n = screen_size_y(s) - 2;
|
||||||
|
if (data->oy < n)
|
||||||
data->oy = 0;
|
data->oy = 0;
|
||||||
else
|
else
|
||||||
data->oy -= screen_size_y(s);
|
data->oy -= n;
|
||||||
window_scroll_redraw_screen(wp);
|
window_scroll_redraw_screen(wp);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user