-.\" $OpenBSD: tmux.1,v 1.925 2023/08/08 08:08:47 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.926 2023/08/08 08:21:30 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.Xc
Clear the current selection.
.It Xo
-.Ic copy-end-of-line [<prefix>]
+.Ic copy-end-of-line
+.Op Ar prefix
.Xc
Copy from the cursor position to the end of the line.
.Ar prefix
is used to name the new paste buffer.
.It Xo
-.Ic copy-end-of-line-and-cancel [<prefix>]
+.Ic copy-end-of-line-and-cancel
+.Op Ar prefix
.Xc
Copy from the cursor position and exit copy mode.
.It Xo
-.Ic copy-line [<prefix>]
+.Ic copy-line
+.Op Ar prefix
.Xc
Copy the entire line.
.It Xo
-.Ic copy-line-and-cancel [<prefix>]
+.Ic copy-line-and-cancel
+.Op Ar prefix
.Xc
Copy the entire line and exit copy mode.
.It Xo
-.Ic copy-selection [<prefix>]
+.Ic copy-selection
+.Op Ar prefix
.Xc
Copies the current selection.
.It Xo
-.Ic copy-selection-and-cancel [<prefix>]
+.Ic copy-selection-and-cancel
+.Op Ar prefix
(vi: Enter)
(emacs: M-w)
.Xc
.Xc
Move the cursor to the end of the line.
.It Xo
-.Ic goto-line <line>
+.Ic goto-line
+.Ar line
(vi: :)
(emacs: g)
.Xc
.Xc
Repeat the last jump.
.It Xo
-.Ic jump-backward <to>
+.Ic jump-backward
+.Ar to
(vi: F)
(emacs: F)
.Xc
Jump backwards to the specified text.
.It Xo
-.Ic jump-forward <to>
+.Ic jump-forward
+.Ar to
(vi: f)
(emacs: f)
.Xc
Move to the next paragraph.
.It Xo
.Ic next-prompt
+.Op Fl o
.Xc
Move to the next prompt.
.It Xo
Move to the previous paragraph.
.It Xo
.Ic previous-prompt
+.Op Fl o
.Xc
Move to the previous prompt.
.It Xo
.Xc
Repeat the last search.
.It Xo
-.Ic search-backward <for>
+.Ic search-backward
+.Ar text
(vi: ?)
.Xc
Search backwards for the specified text.
.It Xo
-.Ic search-forward <for>
+.Ic search-forward
+.Ar text
(vi: /)
.Xc
Search forward for the specified text.
.Nm
where the prompts are located; if the shell does not do this, these commands
will do nothing.
+The
+.Fl o
+flag jumps to the beginning of the command output instead of the shell prompt.
.Pp
Copy commands may take an optional buffer prefix argument which is used
to generate the buffer name (the default is
-/* $OpenBSD: tmux.h,v 1.1203 2023/08/08 08:08:47 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1204 2023/08/08 08:21:30 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
#define GRID_LINE_EXTENDED 0x2
#define GRID_LINE_DEAD 0x4
#define GRID_LINE_START_PROMPT 0x8
+#define GRID_LINE_START_OUTPUT 0x10
/* Grid string flags. */
#define GRID_STRING_WITH_SEQUENCES 0x1
-/* $OpenBSD: window-copy.c,v 1.341 2023/07/03 16:47:43 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.342 2023/08/08 08:21:30 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
const char *, u_int *, u_int *);
static void window_copy_cursor_previous_word(struct window_mode_entry *,
const char *, int);
-static void window_copy_cursor_prompt(struct window_mode_entry *, int);
+static void window_copy_cursor_prompt(struct window_mode_entry *, int,
+ const char *);
static void window_copy_scroll_up(struct window_mode_entry *, u_int);
static void window_copy_scroll_down(struct window_mode_entry *, u_int);
static void window_copy_rectangle_set(struct window_mode_entry *, int);
window_copy_cmd_next_prompt(struct window_copy_cmd_state *cs)
{
struct window_mode_entry *wme = cs->wme;
+ const char *arg1 = args_string(cs->args, 1);
- window_copy_cursor_prompt(wme, 1);
+ window_copy_cursor_prompt(wme, 1, arg1);
return (WINDOW_COPY_CMD_NOTHING);
}
window_copy_cmd_previous_prompt(struct window_copy_cmd_state *cs)
{
struct window_mode_entry *wme = cs->wme;
+ const char *arg1 = args_string(cs->args, 1);
- window_copy_cursor_prompt(wme, 0);
+ window_copy_cursor_prompt(wme, 0, arg1);
return (WINDOW_COPY_CMD_NOTHING);
}
},
{ .command = "previous-prompt",
.minargs = 0,
- .maxargs = 0,
+ .maxargs = 1,
.clear = WINDOW_COPY_CMD_CLEAR_ALWAYS,
.f = window_copy_cmd_previous_prompt
},
}
static void
-window_copy_cursor_prompt(struct window_mode_entry *wme, int direction)
+window_copy_cursor_prompt(struct window_mode_entry *wme, int direction,
+ const char *args)
{
struct window_copy_mode_data *data = wme->data;
struct screen *s = data->backing;
struct grid *gd = s->grid;
u_int end_line;
u_int line = gd->hsize - data->oy + data->cy;
- int add;
+ int add, line_flag;
+
+ if (args != NULL && strcmp(args, "-o") == 0)
+ line_flag = GRID_LINE_START_OUTPUT;
+ else
+ line_flag = GRID_LINE_START_PROMPT;
if (direction == 0) { /* up */
add = -1;
return;
line += add;
- if (grid_get_line(gd, line)->flags & GRID_LINE_START_PROMPT)
+ if (grid_get_line(gd, line)->flags & line_flag)
break;
}