summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-attach-session.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-05-16 15:45:29 +0000
committernicm <nicm@openbsd.org>2020-05-16 15:45:29 +0000
commitcfef6bbb1d77001fc12a65f3a9ab78b561181129 (patch)
tree4583d192ce805d7044b0c86d0e5020048837ef48 /usr.bin/tmux/cmd-attach-session.c
parentOnly redraw popup on the client it belongs to. (diff)
downloadwireguard-openbsd-cfef6bbb1d77001fc12a65f3a9ab78b561181129.tar.xz
wireguard-openbsd-cfef6bbb1d77001fc12a65f3a9ab78b561181129.zip
Change the existing client flags for control mode to apply for any
client, use the same mechanism for the read-only flag and add an ignore-size flag. refresh-client -F has become -f (-F stays for backwards compatibility) and attach-session and switch-client now have -f flags also. A new format "client_flags" lists the flags and is shown by list-clients by default. This separates the read-only flag from "ignore size" behaviour (new ignore-size) flag - both behaviours are useful in different circumstances. attach -r and switchc -r remain and set or toggle both flags together.
Diffstat (limited to 'usr.bin/tmux/cmd-attach-session.c')
-rw-r--r--usr.bin/tmux/cmd-attach-session.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c
index 4fc5bf163d4..638f39d0322 100644
--- a/usr.bin/tmux/cmd-attach-session.c
+++ b/usr.bin/tmux/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-attach-session.c,v 1.83 2020/04/13 14:46:04 nicm Exp $ */
+/* $OpenBSD: cmd-attach-session.c,v 1.84 2020/05/16 15:45:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -37,8 +37,9 @@ const struct cmd_entry cmd_attach_session_entry = {
.name = "attach-session",
.alias = "attach",
- .args = { "c:dErt:x", 0, 0 },
- .usage = "[-dErx] [-c working-directory] " CMD_TARGET_SESSION_USAGE,
+ .args = { "c:dEf:rt:x", 0, 0 },
+ .usage = "[-dErx] [-c working-directory] [-f flags] "
+ CMD_TARGET_SESSION_USAGE,
/* -t is special */
@@ -48,7 +49,7 @@ const struct cmd_entry cmd_attach_session_entry = {
enum cmd_retval
cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
- int xflag, int rflag, const char *cflag, int Eflag)
+ int xflag, int rflag, const char *cflag, int Eflag, const char *fflag)
{
struct cmd_find_state *current = cmdq_get_current(item);
struct cmd_find_state target;
@@ -101,6 +102,10 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
free((void *)s->cwd);
s->cwd = format_single(item, cflag, c, s, wl, wp);
}
+ if (fflag)
+ server_client_set_flags(c, fflag);
+ if (rflag)
+ c->flags |= (CLIENT_READONLY|CLIENT_IGNORESIZE);
c->last_session = c->session;
if (c->session != NULL) {
@@ -135,8 +140,6 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
free(cause);
return (CMD_RETURN_ERROR);
}
- if (rflag)
- c->flags |= CLIENT_READONLY;
if (dflag || xflag) {
if (xflag)
@@ -182,5 +185,5 @@ cmd_attach_session_exec(struct cmd *self, struct cmdq_item *item)
return (cmd_attach_session(item, args_get(args, 't'),
args_has(args, 'd'), args_has(args, 'x'), args_has(args, 'r'),
- args_get(args, 'c'), args_has(args, 'E')));
+ args_get(args, 'c'), args_has(args, 'E'), args_get(args, 'f')));
}