aboutsummaryrefslogtreecommitdiff
path: root/cmd-attach-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2020-05-05 15:42:20 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2020-05-05 15:42:20 +0100
commit2f89d2e7d816918e152aacfee85fab45ee2057b9 (patch)
tree98f86226f36a6bf5e1a88bef8ca1d6cdb02612b8 /cmd-attach-session.c
parentdeacfedc65e6de6b3f84348d6723ae6f14d097df (diff)
downloadrtmux-2f89d2e7d816918e152aacfee85fab45ee2057b9.tar.gz
rtmux-2f89d2e7d816918e152aacfee85fab45ee2057b9.tar.bz2
rtmux-2f89d2e7d816918e152aacfee85fab45ee2057b9.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 'cmd-attach-session.c')
-rw-r--r--cmd-attach-session.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index 8c30c767..38d9c024 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -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')));
}