From 8299cfcd178e595f87fe50def56e55c049aada83 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 27 Dec 2023 20:23:59 +0000 Subject: [PATCH] Remove flags from the prefix before comparing with the received key so that modifier keys with flags work correctly, GitHub issue 3764. --- usr.bin/tmux/server-client.c | 10 ++++++---- usr.bin/tmux/tmux.1 | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index fb9f27ad311..e94bd708fa1 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.402 2023/09/02 20:03:10 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.403 2023/12/27 20:23:59 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -1867,7 +1867,7 @@ server_client_key_callback(struct cmdq_item *item, void *data) struct key_binding *bd; int xtimeout, flags; struct cmd_find_state fs; - key_code key0; + key_code key0, prefix, prefix2; /* Check the client is good to accept input. */ if (s == NULL || (c->flags & CLIENT_UNATTACHEDFLAGS)) @@ -1939,9 +1939,11 @@ table_changed: * The prefix always takes precedence and forces a switch to the prefix * table, unless we are already there. */ + prefix = (key_code)options_get_number(s->options, "prefix"); + prefix2 = (key_code)options_get_number(s->options, "prefix2"); key0 = (key & (KEYC_MASK_KEY|KEYC_MASK_MODIFIERS)); - if ((key0 == (key_code)options_get_number(s->options, "prefix") || - key0 == (key_code)options_get_number(s->options, "prefix2")) && + if ((key0 == (prefix & (KEYC_MASK_KEY|KEYC_MASK_MODIFIERS)) || + key0 == (prefix2 & (KEYC_MASK_KEY|KEYC_MASK_MODIFIERS))) && strcmp(table->name, "prefix") != 0) { server_client_set_key_table(c, "prefix"); server_status_client(c); diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index f938cc563fd..bb690cbd5d7 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.934 2023/12/27 20:20:50 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.935 2023/12/27 20:23:59 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -590,8 +590,8 @@ line (the \e and the newline are completely removed). This is called line continuation and applies both inside and outside quoted strings and in comments, but not inside braces. .Pp -Command arguments may be specified as strings surrounded by single (\[aq]) quotes, -double quotes (\[dq]) or braces ({}). +Command arguments may be specified as strings surrounded by single (\[aq]) +quotes, double quotes (\[dq]) or braces ({}). .\" " This is required when the argument contains any special character. Single and double quoted strings cannot span multiple lines except with line -- 2.20.1