Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2025-11-26 22:01:08 +00:00
4 changed files with 22 additions and 13 deletions

View File

@@ -2901,8 +2901,8 @@ server_client_reset_state(struct client *c)
struct window_pane *wp = server_client_get_pane(c), *loop; struct window_pane *wp = server_client_get_pane(c), *loop;
struct screen *s = NULL; struct screen *s = NULL;
struct options *oo = c->session->options; struct options *oo = c->session->options;
int mode = 0, cursor, flags, n; int mode = 0, cursor, flags;
u_int cx = 0, cy = 0, ox, oy, sx, sy; u_int cx = 0, cy = 0, ox, oy, sx, sy, n;
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
return; return;
@@ -2934,13 +2934,13 @@ server_client_reset_state(struct client *c)
if (c->prompt_string != NULL) { if (c->prompt_string != NULL) {
n = options_get_number(oo, "status-position"); n = options_get_number(oo, "status-position");
if (n == 0) if (n == 0)
cy = 0; cy = status_prompt_line_at(c);
else { else {
n = status_line_size(c); n = status_line_size(c) - status_prompt_line_at(c);
if (n == 0) if (n <= tty->sy)
cy = tty->sy - 1;
else
cy = tty->sy - n; cy = tty->sy - n;
else
cy = tty->sy - 1;
} }
cx = c->prompt_cursor; cx = c->prompt_cursor;
} else if (c->overlay_draw == NULL) { } else if (c->overlay_draw == NULL) {

View File

@@ -264,14 +264,19 @@ status_line_size(struct client *c)
} }
/* Get the prompt line number for client's session. 1 means at the bottom. */ /* Get the prompt line number for client's session. 1 means at the bottom. */
static u_int u_int
status_prompt_line_at(struct client *c) status_prompt_line_at(struct client *c)
{ {
struct session *s = c->session; struct session *s = c->session;
u_int line, lines;
if (c->flags & (CLIENT_STATUSOFF|CLIENT_CONTROL)) lines = status_line_size(c);
return (1); if (lines == 0)
return (options_get_number(s->options, "message-line")); return (0);
line = options_get_number(s->options, "message-line");
if (line >= lines)
return (lines - 1);
return (line);
} }
/* Get window at window list position. */ /* Get window at window list position. */

1
tmux.h
View File

@@ -2943,6 +2943,7 @@ extern u_int status_prompt_hsize[];
void status_timer_start(struct client *); void status_timer_start(struct client *);
void status_timer_start_all(void); void status_timer_start_all(void);
void status_update_cache(struct session *); void status_update_cache(struct session *);
u_int status_prompt_line_at(struct client *);
int status_at_line(struct client *); int status_at_line(struct client *);
u_int status_line_size(struct client *); u_int status_line_size(struct client *);
struct style_range *status_get_range(struct client *, u_int, u_int); struct style_range *status_get_range(struct client *, u_int, u_int);

7
tty.c
View File

@@ -35,6 +35,8 @@
static int tty_log_fd = -1; static int tty_log_fd = -1;
static void tty_start_timer_callback(int, short, void *);
static void tty_clipboard_query_callback(int, short, void *);
static void tty_set_italics(struct tty *); static void tty_set_italics(struct tty *);
static int tty_try_colour(struct tty *, int, const char *); static int tty_try_colour(struct tty *, int, const char *);
static void tty_force_cursor_colour(struct tty *, int); static void tty_force_cursor_colour(struct tty *, int);
@@ -296,6 +298,8 @@ tty_open(struct tty *tty, char **cause)
if (tty->out == NULL) if (tty->out == NULL)
fatal("out of memory"); fatal("out of memory");
evtimer_set(&tty->clipboard_timer, tty_clipboard_query_callback, tty);
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
evtimer_set(&tty->timer, tty_timer_callback, tty); evtimer_set(&tty->timer, tty_timer_callback, tty);
tty_start_tty(tty); tty_start_tty(tty);
@@ -327,7 +331,6 @@ tty_start_start_timer(struct tty *tty)
log_debug("%s: start timer started", c->name); log_debug("%s: start timer started", c->name);
evtimer_del(&tty->start_timer); evtimer_del(&tty->start_timer);
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
evtimer_add(&tty->start_timer, &tv); evtimer_add(&tty->start_timer, &tv);
} }
@@ -445,6 +448,7 @@ tty_stop_tty(struct tty *tty)
tty->flags &= ~TTY_STARTED; tty->flags &= ~TTY_STARTED;
evtimer_del(&tty->start_timer); evtimer_del(&tty->start_timer);
evtimer_del(&tty->clipboard_timer);
event_del(&tty->timer); event_del(&tty->timer);
tty->flags &= ~TTY_BLOCK; tty->flags &= ~TTY_BLOCK;
@@ -3228,6 +3232,5 @@ tty_clipboard_query(struct tty *tty)
tty_putcode_ss(tty, TTYC_MS, "", "?"); tty_putcode_ss(tty, TTYC_MS, "", "?");
tty->flags |= TTY_OSC52QUERY; tty->flags |= TTY_OSC52QUERY;
evtimer_set(&tty->clipboard_timer, tty_clipboard_query_callback, tty);
evtimer_add(&tty->clipboard_timer, &tv); evtimer_add(&tty->clipboard_timer, &tv);
} }