from Michael Grant.
-/* $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>
.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 },
}
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);
}
-.\" $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>
.\"
.\" 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
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 ) .
example with:
.Bd -literal -offset indent
bind PageUp copy-mode -eu
+bind PageDown copy-mode -ed
.Ed
.El
.Pp
-/* $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>
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);
-/* $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>
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);
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;
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);
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);
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);
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);