diff options
-rw-r--r-- | usr.bin/tmux/cmd-copy-mode.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 12 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 | ||||
-rw-r--r-- | usr.bin/tmux/window-copy.c | 24 |
4 files changed, 31 insertions, 16 deletions
diff --git a/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c index 84b7521c74c..a9110cf87cb 100644 --- a/usr.bin/tmux/cmd-copy-mode.c +++ b/usr.bin/tmux/cmd-copy-mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-copy-mode.c,v 1.47 2021/08/21 10:22:38 nicm Exp $ */ +/* $OpenBSD: cmd-copy-mode.c,v 1.48 2024/08/26 07:09:34 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -30,8 +30,8 @@ const struct cmd_entry cmd_copy_mode_entry = { .name = "copy-mode", .alias = NULL, - .args = { "eHMs:t:uq", 0, 0, NULL }, - .usage = "[-eHMuq] [-s src-pane] " CMD_TARGET_PANE_USAGE, + .args = { "deHMs:t:uq", 0, 0, NULL }, + .usage = "[-deHMuq] [-s src-pane] " CMD_TARGET_PANE_USAGE, .source = { 's', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 }, @@ -91,6 +91,8 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item) } if (args_has(args, 'u')) window_copy_pageup(wp, 0); + if (args_has(args, 'd')) + window_copy_pagedown(wp, 0, args_has(args, 'e')); return (CMD_RETURN_NORMAL); } diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 0890ffafbc1..2a905aae602 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.951 2024/08/22 09:05:51 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.952 2024/08/26 07:09:34 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" @@ -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: August 22 2024 $ +.Dd $Mdocdate: August 26 2024 $ .Dt TMUX 1 .Os .Sh NAME @@ -2108,14 +2108,15 @@ The synopsis for the command is: .Bl -tag -width Ds .It Xo Ic copy-mode -.Op Fl eHMqu +.Op Fl deHMqu .Op Fl s Ar src-pane .Op Fl t Ar target-pane .Xc Enter copy mode. -The .Fl u -option scrolls one page up. +also scrolls one page up after entering and +.Fl d +one page down if already in copy mode. .Fl M begins a mouse drag (only valid if bound to a mouse key binding, see .Sx MOUSE SUPPORT ) . @@ -2138,6 +2139,7 @@ This is intended to allow fast scrolling through a pane's history, for example with: .Bd -literal -offset indent bind PageUp copy-mode -eu +bind PageDown copy-mode -ed .Ed .El .Pp diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 2faaf53fd55..44c7cec986d 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1222 2024/08/23 13:25:39 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1223 2024/08/26 07:09:34 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -3218,6 +3218,7 @@ void printflike(3, 4) window_copy_add(struct window_pane *, int, const char *, void printflike(3, 0) window_copy_vadd(struct window_pane *, int, const char *, va_list); void window_copy_pageup(struct window_pane *, int); +void window_copy_pagedown(struct window_pane *, int, int); void window_copy_start_drag(struct client *, struct mouse_event *); char *window_copy_get_word(struct window_pane *, u_int, u_int); char *window_copy_get_line(struct window_pane *, u_int); diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index cacf9f1f178..8d0ab752408 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.350 2024/05/14 09:32:37 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.351 2024/08/26 07:09:34 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -41,7 +41,7 @@ static void window_copy_resize(struct window_mode_entry *, u_int, u_int); static void window_copy_formats(struct window_mode_entry *, struct format_tree *); static void window_copy_pageup1(struct window_mode_entry *, int); -static int window_copy_pagedown(struct window_mode_entry *, int, int); +static int window_copy_pagedown1(struct window_mode_entry *, int, int); static void window_copy_next_paragraph(struct window_mode_entry *); static void window_copy_previous_paragraph(struct window_mode_entry *); static void window_copy_redraw_selection(struct window_mode_entry *, u_int); @@ -646,8 +646,18 @@ window_copy_pageup1(struct window_mode_entry *wme, int half_page) window_copy_redraw_screen(wme); } +void +window_copy_pagedown(struct window_pane *wp, int half_page, int scroll_exit) +{ + if (window_copy_pagedown1(TAILQ_FIRST(&wp->modes), half_page, + scroll_exit)) { + window_pane_reset_mode(wp); + return; + } +} + static int -window_copy_pagedown(struct window_mode_entry *wme, int half_page, +window_copy_pagedown1(struct window_mode_entry *wme, int half_page, int scroll_exit) { struct window_copy_mode_data *data = wme->data; @@ -1347,7 +1357,7 @@ window_copy_cmd_halfpage_down(struct window_copy_cmd_state *cs) u_int np = wme->prefix; for (; np != 0; np--) { - if (window_copy_pagedown(wme, 1, data->scroll_exit)) + if (window_copy_pagedown1(wme, 1, data->scroll_exit)) return (WINDOW_COPY_CMD_CANCEL); } return (WINDOW_COPY_CMD_NOTHING); @@ -1361,7 +1371,7 @@ window_copy_cmd_halfpage_down_and_cancel(struct window_copy_cmd_state *cs) u_int np = wme->prefix; for (; np != 0; np--) { - if (window_copy_pagedown(wme, 1, 1)) + if (window_copy_pagedown1(wme, 1, 1)) return (WINDOW_COPY_CMD_CANCEL); } return (WINDOW_COPY_CMD_NOTHING); @@ -1789,7 +1799,7 @@ window_copy_cmd_page_down(struct window_copy_cmd_state *cs) u_int np = wme->prefix; for (; np != 0; np--) { - if (window_copy_pagedown(wme, 0, data->scroll_exit)) + if (window_copy_pagedown1(wme, 0, data->scroll_exit)) return (WINDOW_COPY_CMD_CANCEL); } return (WINDOW_COPY_CMD_NOTHING); @@ -1802,7 +1812,7 @@ window_copy_cmd_page_down_and_cancel(struct window_copy_cmd_state *cs) u_int np = wme->prefix; for (; np != 0; np--) { - if (window_copy_pagedown(wme, 0, 1)) + if (window_copy_pagedown1(wme, 0, 1)) return (WINDOW_COPY_CMD_CANCEL); } return (WINDOW_COPY_CMD_NOTHING); |