Merge branch 'master' into floating_panes

This commit is contained in:
Dane Jensen
2026-06-12 12:07:41 -07:00
7 changed files with 105 additions and 22 deletions

View File

@@ -1164,11 +1164,11 @@ server_client_repeat_time(struct client *c, struct key_binding *bd)
static enum cmd_retval
server_client_key_callback(struct cmdq_item *item, void *data)
{
struct client *c = cmdq_get_client(item);
struct key_event *event = data;
struct client *c, *ec = event->client;
key_code key = event->key;
struct mouse_event *m = &event->m;
struct session *s = c->session;
struct session *s;
struct winlink *wl;
struct window_pane *wp;
struct window_mode_entry *wme;
@@ -1180,6 +1180,12 @@ server_client_key_callback(struct cmdq_item *item, void *data)
struct cmd_find_state fs;
key_code key0, prefix, prefix2;
if (ec != NULL)
c = ec;
else
c = cmdq_get_client(item);
s = c->session;
/* Check the client is good to accept input. */
if (s == NULL || (c->flags & CLIENT_UNATTACHEDFLAGS))
goto out;
@@ -1426,14 +1432,17 @@ paste_key:
out:
if (s != NULL && key != KEYC_FOCUS_OUT)
server_client_update_latest(c);
if (ec != NULL)
server_client_unref(ec);
free(event->buf);
free(event);
return (CMD_RETURN_NORMAL);
}
/* Handle a key event. */
int
server_client_handle_key(struct client *c, struct key_event *event)
static int
server_client_handle_key0(struct client *c, struct key_event *event,
struct cmdq_item *after, struct cmdq_item **next)
{
struct session *s = c->session;
struct cmdq_item *item;
@@ -1487,10 +1496,31 @@ server_client_handle_key(struct client *c, struct key_event *event)
* previous keys.
*/
item = cmdq_get_callback(server_client_key_callback, event);
if (after != NULL) {
event->client = c;
c->references++;
item = cmdq_insert_after(after, item);
if (next != NULL)
*next = item;
return (1);
}
cmdq_append(c, item);
return (1);
}
int
server_client_handle_key(struct client *c, struct key_event *event)
{
return (server_client_handle_key0(c, event, NULL, NULL));
}
int
server_client_handle_key_after(struct client *c, struct key_event *event,
struct cmdq_item *after, struct cmdq_item **next)
{
return (server_client_handle_key0(c, event, after, next));
}
/* Client functions that need to happen every loop. */
void
server_client_loop(void)
@@ -1782,7 +1812,7 @@ server_client_reset_state(struct client *c)
struct window_pane *wp = server_client_get_pane(c), *loop;
struct screen *s = NULL;
struct options *oo = c->session->options;
int mode = 0, cursor, flags;
int mode = 0, cursor, flags, pane_mode = 0;
u_int cx = 0, cy = 0, ox, oy, sx, sy, n;
struct visible_ranges *r;
@@ -1827,6 +1857,8 @@ server_client_reset_state(struct client *c)
cx = c->prompt_cursor;
} else if (wp != NULL && c->overlay_draw == NULL) {
cursor = 0;
pane_mode = wp->base.mode;
tty_window_offset(tty, &ox, &oy, &sx, &sy);
if (wp->xoff + (int)s->cx >= (int)ox &&
wp->xoff + (int)s->cx <= (int)ox + (int)sx &&
@@ -1845,13 +1877,14 @@ server_client_reset_state(struct client *c)
cy += status_line_size(c);
}
if (!cursor)
if ((pane_mode & MODE_SYNC) || !cursor)
mode &= ~MODE_CURSOR;
} else if (c->overlay_mode == NULL || s == NULL)
mode &= ~MODE_CURSOR;
log_debug("%s: cursor to %u,%u", __func__, cx, cy);
tty_cursor(tty, cx, cy);
if (~pane_mode & MODE_SYNC) {
log_debug("%s: cursor to %u,%u", __func__, cx, cy);
tty_cursor(tty, cx, cy);
}
/*
* Set mouse mode if requested. To support dragging, always use button