show-window-options command.

This commit is contained in:
Nicholas Marriott 2008-06-16 06:10:02 +00:00
parent 557b6b86b0
commit 1d0810547f
7 changed files with 82 additions and 8 deletions

View File

@ -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 $

View File

@ -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

View File

@ -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

4
TODO
View File

@ -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

66
cmd-show-window-options.c Normal file
View File

@ -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 <nicm@users.sourceforge.net>
*
* 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 <sys/types.h>
#include <getopt.h>
#include <stdlib.h>
#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);
}

3
cmd.c
View File

@ -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 <nicm@users.sourceforge.net>
@ -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,

3
tmux.h
View File

@ -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 <nicm@users.sourceforge.net>
@ -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;