diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-11-14 17:56:39 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-11-14 17:56:39 +0000 |
commit | e35f5b35bd9a6a85eb314bfb642998267b2d475d (patch) | |
tree | be325ba507d553b2dbe6d0c8e17441041009071c /cmd-swap-pane.c | |
parent | fc6a835be86461c11fcadfc873cf00853b5a92b8 (diff) | |
download | rtmux-e35f5b35bd9a6a85eb314bfb642998267b2d475d.tar.gz rtmux-e35f5b35bd9a6a85eb314bfb642998267b2d475d.tar.bz2 rtmux-e35f5b35bd9a6a85eb314bfb642998267b2d475d.zip |
Sync OpenBSD patchset 539:
Get rid of the ugly CMD_CHFLAG macro and use a const string (eg "dDU") in the
command entry structs and a couple of functions to check/set the flags.
Diffstat (limited to 'cmd-swap-pane.c')
-rw-r--r-- | cmd-swap-pane.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index d09dc213..eab57367 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -1,4 +1,4 @@ -/* $Id: cmd-swap-pane.c,v 1.13 2009-07-30 21:04:40 tcunha Exp $ */ +/* $Id: cmd-swap-pane.c,v 1.14 2009-11-14 17:56:39 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -32,7 +32,7 @@ int cmd_swap_pane_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_swap_pane_entry = { "swap-pane", "swapp", "[-dDU] " CMD_SRCDST_PANE_USAGE, - 0, CMD_CHFLAG('d')|CMD_CHFLAG('D')|CMD_CHFLAG('U'), + 0, "dDU", cmd_swap_pane_init, cmd_srcdst_parse, cmd_swap_pane_exec, @@ -49,11 +49,12 @@ cmd_swap_pane_init(struct cmd *self, int key) data = self->data; if (key == '{') - data->chflags |= CMD_CHFLAG('U'); + cmd_set_flag(&data->chflags, 'U'); else if (key == '}') - data->chflags |= CMD_CHFLAG('D'); + cmd_set_flag(&data->chflags, 'D'); } + int cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) { @@ -73,11 +74,11 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) if (data->src == NULL) { src_w = dst_w; - if (data->chflags & CMD_CHFLAG('D')) { + if (cmd_check_flag(data->chflags, 'D')) { src_wp = TAILQ_NEXT(dst_wp, entry); if (src_wp == NULL) src_wp = TAILQ_FIRST(&dst_w->panes); - } else if (data->chflags & CMD_CHFLAG('U')) { + } else if (cmd_check_flag(data->chflags, 'U')) { src_wp = TAILQ_PREV(dst_wp, window_panes, entry); if (src_wp == NULL) src_wp = TAILQ_LAST(&dst_w->panes, window_panes); @@ -120,7 +121,7 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_ctx *ctx) dst_wp->xoff = xoff; dst_wp->yoff = yoff; window_pane_resize(dst_wp, sx, sy); - if (!(data->chflags & CMD_CHFLAG('d'))) { + if (!cmd_check_flag(data->chflags, 'd')) { if (src_w != dst_w) { window_set_active_pane(src_w, dst_wp); window_set_active_pane(dst_w, src_wp); |