diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-06-18 10:58:45 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-06-18 10:58:45 +0000 |
commit | 5bf025682c95034836dd45240ba210e6521af98d (patch) | |
tree | 3c620d31eb2dac1f5472bc0e25f5b49c378d4d1b | |
parent | 633ee1c47ecd6f4278368d2be9f5159f745aef0b (diff) |
Tidy up bell code, from Thomas Adam.
-rw-r--r-- | usr.bin/tmux/server-window.c | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/usr.bin/tmux/server-window.c b/usr.bin/tmux/server-window.c index 0fff4375598..2e7a650bebc 100644 --- a/usr.bin/tmux/server-window.c +++ b/usr.bin/tmux/server-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-window.c,v 1.23 2012/01/21 06:13:16 nicm Exp $ */ +/* $OpenBSD: server-window.c,v 1.24 2012/06/18 10:58:44 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -76,46 +76,25 @@ server_window_check_bell(struct session *s, struct winlink *wl) return (0); if (s->curw != wl || s->flags & SESSION_UNATTACHED) wl->flags |= WINLINK_BELL; + if (s->flags & SESSION_UNATTACHED) + return (1); + visual = options_get_number(&s->options, "visual-bell"); action = options_get_number(&s->options, "bell-action"); - switch (action) { - case BELL_ANY: - if (s->flags & SESSION_UNATTACHED) - break; - visual = options_get_number(&s->options, "visual-bell"); - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - c = ARRAY_ITEM(&clients, i); - if (c == NULL || c->session != s) - continue; - if (!visual) { - tty_bell(&c->tty); - continue; - } - if (c->session->curw->window == w) { - status_message_set(c, "Bell in current window"); - continue; - } - status_message_set(c, "Bell in window %u", - winlink_find_by_window(&s->windows, w)->idx); + for (i = 0; i < ARRAY_LENGTH(&clients); i++) { + c = ARRAY_ITEM(&clients, i); + if (c == NULL || c->session != s) + continue; + if (!visual) { + tty_bell(&c->tty); + continue; } - break; - case BELL_CURRENT: - if (s->flags & SESSION_UNATTACHED) - break; - visual = options_get_number(&s->options, "visual-bell"); - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - c = ARRAY_ITEM(&clients, i); - if (c == NULL || c->session != s) - continue; - if (c->session->curw->window != w) - continue; - if (!visual) { - tty_bell(&c->tty); - continue; - } + if (c->session->curw->window == w) status_message_set(c, "Bell in current window"); + else if (action == BELL_ANY) { + status_message_set(c, "Bell in window %u", + winlink_find_by_window(&s->windows, w)->idx); } - break; } return (1); |