summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-10-08 06:29:45 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-10-08 06:29:45 +0000
commit54458cb4ad3570c34135a7d7301fbe74ed38458f (patch)
treeb4cbe4315d6e4266af815bf5a10519ad4d24de44 /usr.bin
parent8e5569195b291520ac69dadb70617919cd9d4735 (diff)
Put the prompt cursor attributes into the status line screen and use
that rather than updating the current screen (since there might not be one).
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/server-client.c50
-rw-r--r--usr.bin/tmux/status.c10
2 files changed, 26 insertions, 34 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 65cf1f9bc52..75c2f1824a1 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.413 2024/10/07 12:58:36 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.414 2024/10/08 06:29:44 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2458,8 +2458,10 @@ server_client_reset_state(struct client *c)
if (c->overlay_draw != NULL) {
if (c->overlay_mode != NULL)
s = c->overlay_mode(c, c->overlay_data, &cx, &cy);
- } else
+ } else if (c->prompt_string == NULL)
s = wp->screen;
+ else
+ s = c->status.active;
if (s != NULL)
mode = s->mode;
if (log_get_level() != 0) {
@@ -2484,37 +2486,21 @@ server_client_reset_state(struct client *c)
cy = tty->sy - n;
}
cx = c->prompt_cursor;
-
- n = options_get_number(oo, "prompt-cursor-colour");
- s->default_ccolour = n;
- n = options_get_number(oo, "prompt-cursor-style");
- screen_set_cursor_style(n, &s->default_cstyle,
- &s->default_mode);
- } else {
- n = options_get_number(wp->options, "cursor-colour");
- s->default_ccolour = n;
- n = options_get_number(wp->options, "cursor-style");
- screen_set_cursor_style(n, &s->default_cstyle,
- &s->default_mode);
-
- if (c->overlay_draw == NULL) {
- cursor = 0;
- tty_window_offset(tty, &ox, &oy, &sx, &sy);
- if (wp->xoff + s->cx >= ox &&
- wp->xoff + s->cx <= ox + sx &&
- wp->yoff + s->cy >= oy &&
- wp->yoff + s->cy <= oy + sy) {
- cursor = 1;
-
- cx = wp->xoff + s->cx - ox;
- cy = wp->yoff + s->cy - oy;
-
- if (status_at_line(c) == 0)
- cy += status_line_size(c);
- }
- if (!cursor)
- mode &= ~MODE_CURSOR;
+ } else if (c->overlay_draw == NULL) {
+ cursor = 0;
+ tty_window_offset(tty, &ox, &oy, &sx, &sy);
+ if (wp->xoff + s->cx >= ox && wp->xoff + s->cx <= ox + sx &&
+ wp->yoff + s->cy >= oy && wp->yoff + s->cy <= oy + sy) {
+ cursor = 1;
+
+ cx = wp->xoff + s->cx - ox;
+ cy = wp->yoff + s->cy - oy;
+
+ if (status_at_line(c) == 0)
+ cy += status_line_size(c);
}
+ if (!cursor)
+ mode &= ~MODE_CURSOR;
}
log_debug("%s: cursor to %u,%u", __func__, cx, cy);
tty_cursor(tty, cx, cy);
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index 5b6483216d1..9a2f3a2126a 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.247 2024/10/07 12:58:36 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.248 2024/10/08 06:29:44 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -736,7 +736,7 @@ status_prompt_redraw(struct client *c)
struct screen_write_ctx ctx;
struct session *s = c->session;
struct screen old_screen;
- u_int i, lines, offset, left, start, width;
+ u_int i, lines, offset, left, start, width, n;
u_int pcursor, pwidth, promptline;
struct grid_cell gc;
struct format_tree *ft;
@@ -750,6 +750,12 @@ status_prompt_redraw(struct client *c)
lines = 1;
screen_init(sl->active, c->tty.sx, lines, 0);
+ n = options_get_number(s->options, "prompt-cursor-colour");
+ sl->active->default_ccolour = n;
+ n = options_get_number(s->options, "prompt-cursor-style");
+ screen_set_cursor_style(n, &sl->active->default_cstyle,
+ &sl->active->default_mode);
+
promptline = status_prompt_line_at(c);
if (promptline > lines - 1)
promptline = lines - 1;