mirror of
https://github.com/tmux/tmux.git
synced 2026-10-09 11:44:23 +00:00
Add a refresh-now command and change the r binding back to it in copy mode.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: key-bindings.c,v 1.190 2026/07/22 19:23:59 nicm Exp $ */
|
/* $OpenBSD: key-bindings.c,v 1.191 2026/08/05 12:23:25 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -595,7 +595,7 @@ key_bindings_init(void)
|
|||||||
"bind -Tcopy-mode g { command-prompt -P -p'(goto line)' { send -X goto-line -- '%%' } }",
|
"bind -Tcopy-mode g { command-prompt -P -p'(goto line)' { send -X goto-line -- '%%' } }",
|
||||||
"bind -Tcopy-mode n { send -X search-again }",
|
"bind -Tcopy-mode n { send -X search-again }",
|
||||||
"bind -Tcopy-mode q { send -X cancel }",
|
"bind -Tcopy-mode q { send -X cancel }",
|
||||||
"bind -Tcopy-mode r { send -X refresh-toggle }",
|
"bind -Tcopy-mode r { send -X refresh-now }",
|
||||||
"bind -Tcopy-mode t { command-prompt -P -1p'(jump to forward)' { send -X jump-to-forward -- '%%' } }",
|
"bind -Tcopy-mode t { command-prompt -P -1p'(jump to forward)' { send -X jump-to-forward -- '%%' } }",
|
||||||
"bind -Tcopy-mode Home { send -X start-of-line }",
|
"bind -Tcopy-mode Home { send -X start-of-line }",
|
||||||
"bind -Tcopy-mode End { send -X end-of-line }",
|
"bind -Tcopy-mode End { send -X end-of-line }",
|
||||||
@@ -705,7 +705,7 @@ key_bindings_init(void)
|
|||||||
"bind -Tcopy-mode-vi n { send -X search-again }",
|
"bind -Tcopy-mode-vi n { send -X search-again }",
|
||||||
"bind -Tcopy-mode-vi o { send -X other-end }",
|
"bind -Tcopy-mode-vi o { send -X other-end }",
|
||||||
"bind -Tcopy-mode-vi q { send -X cancel }",
|
"bind -Tcopy-mode-vi q { send -X cancel }",
|
||||||
"bind -Tcopy-mode-vi r { send -X refresh-toggle }",
|
"bind -Tcopy-mode-vi r { send -X refresh-now }",
|
||||||
"bind -Tcopy-mode-vi t { command-prompt -P -1p'(jump to forward)' { send -X jump-to-forward -- '%%' } }",
|
"bind -Tcopy-mode-vi t { command-prompt -P -1p'(jump to forward)' { send -X jump-to-forward -- '%%' } }",
|
||||||
"bind -Tcopy-mode-vi v { send -X rectangle-toggle }",
|
"bind -Tcopy-mode-vi v { send -X rectangle-toggle }",
|
||||||
"bind -Tcopy-mode-vi w { send -X next-word }",
|
"bind -Tcopy-mode-vi w { send -X next-word }",
|
||||||
|
|||||||
8
tmux.1
8
tmux.1
@@ -1,4 +1,4 @@
|
|||||||
.\" $OpenBSD: tmux.1,v 1.1153 2026/08/05 07:31:08 nicm Exp $
|
.\" $OpenBSD: tmux.1,v 1.1154 2026/08/05 12:23:25 nicm Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
.\"
|
.\"
|
||||||
@@ -2317,10 +2317,14 @@ the bottom and is paused while a selection is in progress.
|
|||||||
.Xc
|
.Xc
|
||||||
Turn off automatic refresh of the content from the pane.
|
Turn off automatic refresh of the content from the pane.
|
||||||
.It Xo
|
.It Xo
|
||||||
.Ic refresh\-toggle
|
.Ic refresh\-now
|
||||||
(vi: r)
|
(vi: r)
|
||||||
(emacs: r)
|
(emacs: r)
|
||||||
.Xc
|
.Xc
|
||||||
|
Refresh the content from the pane once.
|
||||||
|
.It Xo
|
||||||
|
.Ic refresh\-toggle
|
||||||
|
.Xc
|
||||||
Toggle automatic refresh of the content from the pane.
|
Toggle automatic refresh of the content from the pane.
|
||||||
.It Xo
|
.It Xo
|
||||||
.Ic scroll\-bottom
|
.Ic scroll\-bottom
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: window-copy.c,v 1.424 2026/07/29 17:42:56 nicm Exp $ */
|
/* $OpenBSD: window-copy.c,v 1.425 2026/08/05 12:23:25 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -54,6 +54,7 @@ static void window_copy_redraw_screen(struct window_mode_entry *);
|
|||||||
static void window_copy_do_refresh(struct window_mode_entry *, int);
|
static void window_copy_do_refresh(struct window_mode_entry *, int);
|
||||||
static void window_copy_refresh_timer(int, short, void *);
|
static void window_copy_refresh_timer(int, short, void *);
|
||||||
static void window_copy_refresh_arm(struct window_mode_entry *);
|
static void window_copy_refresh_arm(struct window_mode_entry *);
|
||||||
|
static int window_copy_refresh_allowed(struct window_mode_entry *);
|
||||||
static void window_copy_refresh_start(struct window_mode_entry *);
|
static void window_copy_refresh_start(struct window_mode_entry *);
|
||||||
static void window_copy_refresh_stop(struct window_mode_entry *);
|
static void window_copy_refresh_stop(struct window_mode_entry *);
|
||||||
static void window_copy_style_changed(struct window_mode_entry *);
|
static void window_copy_style_changed(struct window_mode_entry *);
|
||||||
@@ -3036,6 +3037,20 @@ window_copy_refresh_arm(struct window_mode_entry *wme)
|
|||||||
evtimer_add(&data->refresh_timer, &tv);
|
evtimer_add(&data->refresh_timer, &tv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
window_copy_refresh_allowed(struct window_mode_entry *wme)
|
||||||
|
{
|
||||||
|
struct window_copy_mode_data *data = wme->data;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Do not refresh a view of another pane (copy-mode -s): the source may
|
||||||
|
* disappear and changes are not tracked on this pane.
|
||||||
|
*/
|
||||||
|
if (data->viewmode || wme->swp != wme->wp)
|
||||||
|
return (0);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
window_copy_refresh_timer(__unused int fd, __unused short events, void *arg)
|
window_copy_refresh_timer(__unused int fd, __unused short events, void *arg)
|
||||||
{
|
{
|
||||||
@@ -3070,11 +3085,7 @@ window_copy_refresh_start(struct window_mode_entry *wme)
|
|||||||
{
|
{
|
||||||
struct window_copy_mode_data *data = wme->data;
|
struct window_copy_mode_data *data = wme->data;
|
||||||
|
|
||||||
/*
|
if (!window_copy_refresh_allowed(wme) || data->refresh_active)
|
||||||
* Do not refresh a view of another pane (copy-mode -s): the source may
|
|
||||||
* disappear and changes are not tracked on this pane.
|
|
||||||
*/
|
|
||||||
if (data->viewmode || wme->swp != wme->wp || data->refresh_active)
|
|
||||||
return;
|
return;
|
||||||
data->refresh_active = 1;
|
data->refresh_active = 1;
|
||||||
window_copy_refresh_arm(wme);
|
window_copy_refresh_arm(wme);
|
||||||
@@ -3089,6 +3100,25 @@ window_copy_refresh_stop(struct window_mode_entry *wme)
|
|||||||
evtimer_del(&data->refresh_timer);
|
evtimer_del(&data->refresh_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum window_copy_cmd_action
|
||||||
|
window_copy_cmd_refresh_now(struct window_copy_cmd_state *cs)
|
||||||
|
{
|
||||||
|
struct window_mode_entry *wme = cs->wme;
|
||||||
|
struct window_copy_mode_data *data = wme->data;
|
||||||
|
struct window_pane *wp = wme->wp;
|
||||||
|
int follow;
|
||||||
|
|
||||||
|
if (!window_copy_refresh_allowed(wme))
|
||||||
|
return (WINDOW_COPY_CMD_NOTHING);
|
||||||
|
|
||||||
|
follow = (data->oy == 0 &&
|
||||||
|
data->cy == screen_size_y(&data->screen) - 1);
|
||||||
|
window_copy_do_refresh(wme, follow);
|
||||||
|
wp->flags &= ~PANE_UNSEENCHANGES;
|
||||||
|
|
||||||
|
return (WINDOW_COPY_CMD_REDRAW);
|
||||||
|
}
|
||||||
|
|
||||||
static enum window_copy_cmd_action
|
static enum window_copy_cmd_action
|
||||||
window_copy_cmd_refresh_on(struct window_copy_cmd_state *cs)
|
window_copy_cmd_refresh_on(struct window_copy_cmd_state *cs)
|
||||||
{
|
{
|
||||||
@@ -3631,6 +3661,12 @@ static const struct {
|
|||||||
.clear = WINDOW_COPY_CMD_CLEAR_NEVER,
|
.clear = WINDOW_COPY_CMD_CLEAR_NEVER,
|
||||||
.f = window_copy_cmd_refresh_off
|
.f = window_copy_cmd_refresh_off
|
||||||
},
|
},
|
||||||
|
{ .command = "refresh-now",
|
||||||
|
.args = { "", 0, 0, NULL },
|
||||||
|
.flags = WINDOW_COPY_CMD_FLAG_READONLY,
|
||||||
|
.clear = WINDOW_COPY_CMD_CLEAR_NEVER,
|
||||||
|
.f = window_copy_cmd_refresh_now
|
||||||
|
},
|
||||||
{ .command = "refresh-toggle",
|
{ .command = "refresh-toggle",
|
||||||
.args = { "", 0, 0, NULL },
|
.args = { "", 0, 0, NULL },
|
||||||
.flags = WINDOW_COPY_CMD_FLAG_READONLY,
|
.flags = WINDOW_COPY_CMD_FLAG_READONLY,
|
||||||
|
|||||||
Reference in New Issue
Block a user