aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2022-02-03 12:50:49 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2022-02-03 12:50:49 +0000
commit53ee4f0334b61192a4c92a5327d849fb688386e9 (patch)
tree284ecec84f60273fafada76df304140fdfe30f78
parentb46abeb34d775159b9c50618339d8da9fd8c0212 (diff)
parentc0598e2515cd051dcf9771f6edcf9eb953644227 (diff)
downloadrtmux-53ee4f0334b61192a4c92a5327d849fb688386e9.tar.gz
rtmux-53ee4f0334b61192a4c92a5327d849fb688386e9.tar.bz2
rtmux-53ee4f0334b61192a4c92a5327d849fb688386e9.zip
Merge branch 'master' into 3.3-rc
-rw-r--r--key-bindings.c2
-rw-r--r--status.c4
-rw-r--r--tmux.11
-rw-r--r--window-copy.c16
-rw-r--r--window.c1
5 files changed, 22 insertions, 2 deletions
diff --git a/key-bindings.c b/key-bindings.c
index 9f7e734a..95171966 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -492,6 +492,7 @@ key_bindings_init(void)
"bind -Tcopy-mode \\; { send -X jump-again }",
"bind -Tcopy-mode F { command-prompt -1p'(jump backward)' { send -X jump-backward '%%' } }",
"bind -Tcopy-mode N { send -X search-reverse }",
+ "bind -Tcopy-mode P { send -X toggle-position }",
"bind -Tcopy-mode R { send -X rectangle-toggle }",
"bind -Tcopy-mode T { command-prompt -1p'(jump to backward)' { send -X jump-to-backward '%%' } }",
"bind -Tcopy-mode X { send -X set-mark }",
@@ -588,6 +589,7 @@ key_bindings_init(void)
"bind -Tcopy-mode-vi L { send -X bottom-line }",
"bind -Tcopy-mode-vi M { send -X middle-line }",
"bind -Tcopy-mode-vi N { send -X search-reverse }",
+ "bind -Tcopy-mode-vi P { send -X toggle-position }",
"bind -Tcopy-mode-vi T { command-prompt -1p'(jump to backward)' { send -X jump-to-backward '%%' } }",
"bind -Tcopy-mode-vi V { send -X select-line }",
"bind -Tcopy-mode-vi W { send -X next-space }",
diff --git a/status.c b/status.c
index bb57b3d6..79033242 100644
--- a/status.c
+++ b/status.c
@@ -718,7 +718,7 @@ status_prompt_redraw(struct client *c)
memcpy(&cursorgc, &gc, sizeof cursorgc);
cursorgc.attr ^= GRID_ATTR_REVERSE;
- start = screen_write_strlen("%s", c->prompt_string);
+ start = format_width(c->prompt_string);
if (start > c->tty.sx)
start = c->tty.sx;
@@ -728,7 +728,7 @@ status_prompt_redraw(struct client *c)
for (offset = 0; offset < c->tty.sx; offset++)
screen_write_putc(&ctx, &gc, ' ');
screen_write_cursormove(&ctx, 0, lines - 1, 0);
- screen_write_nputs(&ctx, start, &gc, "%s", c->prompt_string);
+ format_draw(&ctx, &gc, start, c->prompt_string, NULL, 0);
screen_write_cursormove(&ctx, start, lines - 1, 0);
left = c->tty.sx - start;
diff --git a/tmux.1 b/tmux.1
index 35377eb1..638c3232 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1776,6 +1776,7 @@ The following commands are supported in copy mode:
.It Li "set-mark" Ta "X" Ta "X"
.It Li "start-of-line" Ta "0" Ta "C-a"
.It Li "stop-selection" Ta "" Ta ""
+.It Li "toggle-position" Ta "P" Ta "P"
.It Li "top-line" Ta "H" Ta "M-R"
.El
.Pp
diff --git a/window-copy.c b/window-copy.c
index 9a0179a4..7c55b0f2 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1273,6 +1273,16 @@ window_copy_cmd_halfpage_up(struct window_copy_cmd_state *cs)
}
static enum window_copy_cmd_action
+window_copy_cmd_toggle_position(struct window_copy_cmd_state *cs)
+{
+ struct window_mode_entry *wme = cs->wme;
+ struct window_copy_mode_data *data = wme->data;
+
+ data->hide_position = !data->hide_position;
+ return (WINDOW_COPY_CMD_REDRAW);
+}
+
+static enum window_copy_cmd_action
window_copy_cmd_history_bottom(struct window_copy_cmd_state *cs)
{
struct window_mode_entry *wme = cs->wme;
@@ -2817,6 +2827,12 @@ static const struct {
.clear = WINDOW_COPY_CMD_CLEAR_ALWAYS,
.f = window_copy_cmd_stop_selection
},
+ { .command = "toggle-position",
+ .minargs = 0,
+ .maxargs = 0,
+ .clear = WINDOW_COPY_CMD_CLEAR_NEVER,
+ .f = window_copy_cmd_toggle_position
+ },
{ .command = "top-line",
.minargs = 0,
.maxargs = 0,
diff --git a/window.c b/window.c
index d3e3f60f..fcc61c2a 100644
--- a/window.c
+++ b/window.c
@@ -761,6 +761,7 @@ window_lost_pane(struct window *w, struct window_pane *wp)
if (w->active != NULL) {
w->active->flags |= PANE_CHANGED;
notify_window("window-pane-changed", w);
+ window_update_focus(w);
}
} else if (wp == w->last)
w->last = NULL;