diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-11-19 16:22:10 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-11-19 16:22:10 +0000 |
commit | 543fb99bc60a82eeb8c1e3fa47cdcb86a1e2fb33 (patch) | |
tree | d786032c6ea64b79aaea5ff7eb3a4b89047aee62 /cmd-set-window-option.c | |
parent | 8b8a2111852e9c2ce0cbc5e867d29ca78d4948a5 (diff) | |
download | rtmux-543fb99bc60a82eeb8c1e3fa47cdcb86a1e2fb33.tar.gz rtmux-543fb99bc60a82eeb8c1e3fa47cdcb86a1e2fb33.tar.bz2 rtmux-543fb99bc60a82eeb8c1e3fa47cdcb86a1e2fb33.zip |
Two new options, window-status-format and window-status-current-format, which
allow the format of each window in the status line window list to be controlled
using similar # sequences as status-left/right.
This diff also moves part of the way towards UTF-8 support in window names but
it isn't quite there yet.
Diffstat (limited to 'cmd-set-window-option.c')
-rw-r--r-- | cmd-set-window-option.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cmd-set-window-option.c b/cmd-set-window-option.c index 1d7b8cc5..0ad1025e 100644 --- a/cmd-set-window-option.c +++ b/cmd-set-window-option.c @@ -71,7 +71,9 @@ const struct set_option_entry set_window_option_table[] = { { "window-status-current-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL }, { "window-status-current-bg", SET_OPTION_COLOUR, 0, 0, NULL }, { "window-status-current-fg", SET_OPTION_COLOUR, 0, 0, NULL }, + { "window-status-current-format", SET_OPTION_STRING, 0, 0, NULL }, { "window-status-fg", SET_OPTION_COLOUR, 0, 0, NULL }, + { "window-status-format", SET_OPTION_STRING, 0, 0, NULL }, { "xterm-keys", SET_OPTION_FLAG, 0, 0, NULL }, { NULL, 0, 0, 0, NULL } }; @@ -84,7 +86,10 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx) struct client *c; struct options *oo; const struct set_option_entry *entry, *opt; + struct jobs *jobs; + struct job *job, *nextjob; u_int i; + int try_again; if (cmd_check_flag(data->chflags, 'g')) oo = &global_w_options; @@ -166,5 +171,34 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx) server_redraw_client(c); } + /* + * Special-case: kill all persistent jobs if window-status-format has + * changed. Persistent jobs are only used by the status line at the + * moment so this works XXX. + */ + if (strcmp(entry->name, "window-status-format") == 0) { + for (i = 0; i < ARRAY_LENGTH(&clients); i++) { + c = ARRAY_ITEM(&clients, i); + if (c == NULL || c->session == NULL) + continue; + + jobs = &c->status_jobs; + do { + try_again = 0; + job = RB_ROOT(jobs); + while (job != NULL) { + nextjob = RB_NEXT(jobs, jobs, job); + if (job->flags & JOB_PERSIST) { + job_remove(jobs, job); + try_again = 1; + break; + } + job = nextjob; + } + } while (try_again); + server_redraw_client(c); + } + } + return (0); } |