1
0
mirror of https://github.com/tmux/tmux.git synced 2025-03-24 14:58:47 +00:00

Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2025-02-20 16:01:14 +00:00
commit 251a87e2d2
5 changed files with 43 additions and 13 deletions

View File

@ -39,8 +39,8 @@ const struct cmd_entry cmd_capture_pane_entry = {
.name = "capture-pane",
.alias = "capturep",
.args = { "ab:CeE:JNpPqS:Tt:", 0, 0, NULL },
.usage = "[-aCeJNpPqT] " CMD_BUFFER_USAGE " [-E end-line] "
.args = { "ab:CeE:JMNpPqS:Tt:", 0, 0, NULL },
.usage = "[-aCeJMNpPqT] " CMD_BUFFER_USAGE " [-E end-line] "
"[-S start-line] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
@ -107,14 +107,16 @@ static char *
cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
struct window_pane *wp, size_t *len)
{
struct grid *gd;
const struct grid_line *gl;
struct grid_cell *gc = NULL;
int n, join_lines, flags = 0;
u_int i, sx, top, bottom, tmp;
char *cause, *buf, *line;
const char *Sflag, *Eflag;
size_t linelen;
struct grid *gd;
const struct grid_line *gl;
struct screen *s;
struct grid_cell *gc = NULL;
struct window_mode_entry *wme;
int n, join_lines, flags = 0;
u_int i, sx, top, bottom, tmp;
char *cause, *buf, *line;
const char *Sflag, *Eflag;
size_t linelen;
sx = screen_size_x(&wp->base);
if (args_has(args, 'a')) {
@ -126,8 +128,20 @@ cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
}
return (xstrdup(""));
}
} else
s = &wp->base;
} else if (args_has(args, 'M')) {
wme = TAILQ_FIRST(&wp->modes);
if (wme != NULL && wme->mode->get_screen != NULL) {
s = wme->mode->get_screen (wme);
gd = s->grid;
} else {
s = &wp->base;
gd = wp->base.grid;
}
} else {
s = &wp->base;
gd = wp->base.grid;
}
Sflag = args_get(args, 'S');
if (Sflag != NULL && strcmp(Sflag, "-") == 0)
@ -181,7 +195,7 @@ cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
buf = NULL;
for (i = top; i <= bottom; i++) {
line = grid_string_cells(gd, 0, i, sx, &gc, flags, wp->screen);
line = grid_string_cells(gd, 0, i, sx, &gc, flags, s);
linelen = strlen(line);
buf = cmd_capture_pane_append(buf, len, line, linelen);

View File

@ -152,6 +152,7 @@ server_client_clear_overlay(struct client *c)
c->overlay_draw = NULL;
c->overlay_key = NULL;
c->overlay_free = NULL;
c->overlay_resize = NULL;
c->overlay_data = NULL;
c->tty.flags &= ~(TTY_FREEZE|TTY_NOCURSOR);

5
tmux.1
View File

@ -2556,7 +2556,7 @@ but a different format may be specified with
.Fl F .
.Tg capturep
.It Xo Ic capture-pane
.Op Fl aAepPqCJN
.Op Fl aepPqCJMN
.Op Fl b Ar buffer-name
.Op Fl E Ar end-line
.Op Fl S Ar start-line
@ -2575,6 +2575,9 @@ is given, the alternate screen is used, and the history is not accessible.
If no alternate screen exists, an error will be returned unless
.Fl q
is given.
Similarly, if the pane is in a mode,
.Fl M
uses the screen for the mode.
If
.Fl e
is given, the output includes escape sequences for text and background

1
tmux.h
View File

@ -1090,6 +1090,7 @@ struct window_mode {
struct mouse_event *);
void (*formats)(struct window_mode_entry *,
struct format_tree *);
struct screen *(*get_screen)(struct window_mode_entry *);
};
/* Active window mode. */

View File

@ -40,6 +40,7 @@ static void window_copy_free(struct window_mode_entry *);
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 struct screen *window_copy_get_screen(struct window_mode_entry *);
static void window_copy_scroll1(struct window_mode_entry *,
struct window_pane *wp, int, u_int, int);
static void window_copy_pageup1(struct window_mode_entry *, int);
@ -160,6 +161,7 @@ const struct window_mode window_copy_mode = {
.key_table = window_copy_key_table,
.command = window_copy_command,
.formats = window_copy_formats,
.get_screen = window_copy_get_screen
};
const struct window_mode window_view_mode = {
@ -171,6 +173,7 @@ const struct window_mode window_view_mode = {
.key_table = window_copy_key_table,
.command = window_copy_command,
.formats = window_copy_formats,
.get_screen = window_copy_get_screen
};
enum {
@ -972,6 +975,14 @@ window_copy_formats(struct window_mode_entry *wme, struct format_tree *ft)
window_copy_cursor_hyperlink_cb);
}
static struct screen *
window_copy_get_screen(struct window_mode_entry *wme)
{
struct window_copy_mode_data *data = wme->data;
return (data->backing);
}
static void
window_copy_size_changed(struct window_mode_entry *wme)
{