From 1d0810547fd192bb17769e099722b7331466b602 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 16 Jun 2008 06:10:02 +0000 Subject: [PATCH] show-window-options command. --- CHANGES | 8 +++-- GNUmakefile | 3 +- Makefile | 3 +- TODO | 4 +-- cmd-show-window-options.c | 66 +++++++++++++++++++++++++++++++++++++++ cmd.c | 3 +- tmux.h | 3 +- 7 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 cmd-show-window-options.c diff --git a/CHANGES b/CHANGES index d69986f9..6202b345 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ +16 June 2008 + +* show-window-options (showw) command. + 15 June 2008 -* show-options command to show one or all options. +* show-options (show) command to show one or all options. 14 June 2008 @@ -476,4 +480,4 @@ (including mutt, emacs). No status bar yet and no key remapping or other customisation. -$Id: CHANGES,v 1.120 2008-06-15 08:01:54 nicm Exp $ +$Id: CHANGES,v 1.121 2008-06-16 06:10:02 nicm Exp $ diff --git a/GNUmakefile b/GNUmakefile index 1373e7db..f86836b3 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,4 +1,4 @@ -# $Id: GNUmakefile,v 1.18 2008-06-15 08:01:54 nicm Exp $ +# $Id: GNUmakefile,v 1.19 2008-06-16 06:10:02 nicm Exp $ .PHONY: clean @@ -25,6 +25,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \ cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \ cmd-paste-buffer.c cmd-new-session.c cmd-start-server.c \ cmd-kill-server.c cmd-set-window-option.c cmd-show-options.c \ + cmd-show-window-options.c \ window-scroll.c window-more.c window-copy.c options.c \ tty.c tty-keys.c tty-write.c screen-write.c screen-redraw.c diff --git a/Makefile b/Makefile index a8c7eec7..6d2e9b72 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.60 2008-06-15 08:01:54 nicm Exp $ +# $Id: Makefile,v 1.61 2008-06-16 06:10:02 nicm Exp $ .SUFFIXES: .c .o .y .h .PHONY: clean update-index.html upload-index.html @@ -29,6 +29,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \ cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \ cmd-paste-buffer.c cmd-new-session.c cmd-start-server.c \ cmd-kill-server.c cmd-set-window-option.c cmd-show-options.c \ + cmd-show-window-options.c \ window-scroll.c window-more.c window-copy.c options.c \ tty.c tty-keys.c tty-write.c screen-write.c screen-redraw.c diff --git a/TODO b/TODO index cfa96c56..b85b5850 100644 --- a/TODO +++ b/TODO @@ -22,7 +22,6 @@ kill-window to limit accidental presses - status-fg/status-bg should be able to set attributes: bold, etc - save/restore (DECSC/DECRC) are ugly. maybe a struct screen_attr and memcpy -- force maximum terminal size (centred?) - per-session toolbar state, other options - force-default option: assume terminal supports default colours even if AX is missing (like, eg, xterm-color in an aterm) @@ -66,6 +65,7 @@ - better mode features: search, back word, forward word, etc - status bar customisation variables, show-activity, show-last-window - figure out Linux tcsetattr problem, remove header bodge if unnecessary +- flags to centre screen in window -- For 0.3 -------------------------------------------------------------------- - clear EOL etc CANNOT rely on term using the current colour/attr and probably @@ -74,9 +74,9 @@ - test and fix wsvt25 - activity/bell should be per-window not per-link? what if it is cur win in session not being watched? -- show-window-options - man page: show-options set-window-option + show-window-options explanation of -t format config file diff --git a/cmd-show-window-options.c b/cmd-show-window-options.c new file mode 100644 index 00000000..1f4db81a --- /dev/null +++ b/cmd-show-window-options.c @@ -0,0 +1,66 @@ +/* $Id: cmd-show-window-options.c,v 1.1 2008-06-16 06:10:02 nicm Exp $ */ + +/* + * Copyright (c) 2007 Nicholas Marriott + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +#include +#include + +#include "tmux.h" + +/* + * Show window options. + */ + +void cmd_show_window_options_exec(struct cmd *, struct cmd_ctx *); + +const struct cmd_entry cmd_show_window_options_entry = { + "show-window-options", "showw", + CMD_TARGET_WINDOW_USAGE, + 0, + cmd_target_init, + cmd_target_parse, + cmd_show_window_options_exec, + cmd_target_send, + cmd_target_recv, + cmd_target_free, + cmd_target_print +}; + +void +cmd_show_window_options_exec(struct cmd *self, struct cmd_ctx *ctx) +{ + struct cmd_target_data *data = self->data; + struct winlink *wl; + struct session *s; + + if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL) + return; + + if (wl->window->flags & WINDOW_AGGRESSIVE) + ctx->print(ctx, "aggressive-resize"); + if (wl->window->limitx != UINT_MAX) + ctx->print(ctx, "force-width %u", wl->window->limitx); + if (wl->window->limity != UINT_MAX) + ctx->print(ctx, "force-height %u", wl->window->limity); + if (wl->window->flags & WINDOW_MONITOR) + ctx->print(ctx, "monitor-activity"); + + if (ctx->cmdclient != NULL) + server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0); +} diff --git a/cmd.c b/cmd.c index 73772719..0add444c 100644 --- a/cmd.c +++ b/cmd.c @@ -1,4 +1,4 @@ -/* $Id: cmd.c,v 1.45 2008-06-15 08:01:54 nicm Exp $ */ +/* $Id: cmd.c,v 1.46 2008-06-16 06:10:02 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -56,6 +56,7 @@ const struct cmd_entry *cmd_table[] = { &cmd_set_option_entry, &cmd_set_window_option_entry, &cmd_show_options_entry, + &cmd_show_window_options_entry, &cmd_start_server_entry, &cmd_swap_window_entry, &cmd_switch_client_entry, diff --git a/tmux.h b/tmux.h index 69479a05..4ae6dc3d 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.142 2008-06-15 08:01:54 nicm Exp $ */ +/* $Id: tmux.h,v 1.143 2008-06-16 06:10:02 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -851,6 +851,7 @@ extern const struct cmd_entry cmd_send_prefix_entry; extern const struct cmd_entry cmd_set_option_entry; extern const struct cmd_entry cmd_set_window_option_entry; extern const struct cmd_entry cmd_show_options_entry; +extern const struct cmd_entry cmd_show_window_options_entry; extern const struct cmd_entry cmd_start_server_entry; extern const struct cmd_entry cmd_swap_window_entry; extern const struct cmd_entry cmd_switch_client_entry;