aboutsummaryrefslogtreecommitdiff
path: root/cmd-set-window-option.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-14 16:47:20 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-14 16:47:20 +0000
commit0f403474aaf0f4aa4475ef6095d1ab420ebfed60 (patch)
tree2a51f3a931cfa23f39b2f737dd682ddc0e03611a /cmd-set-window-option.c
parent62d7ad2690c0f72f06195351aa50e3fe037f456a (diff)
downloadrtmux-0f403474aaf0f4aa4475ef6095d1ab420ebfed60.tar.gz
rtmux-0f403474aaf0f4aa4475ef6095d1ab420ebfed60.tar.bz2
rtmux-0f403474aaf0f4aa4475ef6095d1ab420ebfed60.zip
New window options: force-width and force-height. This will force a window to
an arbitrary width and height (0 for the default unlimited). This is neat for emacs which doesn't have a sensible way to force hard wrapping at 80 columns. Also, don't try to be clever and use clr_eol when redrawing the whole screen, it causes trouble since the redraw functions are used to draw the blank areas too.
Diffstat (limited to 'cmd-set-window-option.c')
-rw-r--r--cmd-set-window-option.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/cmd-set-window-option.c b/cmd-set-window-option.c
index 70fdeff6..c92deac3 100644
--- a/cmd-set-window-option.c
+++ b/cmd-set-window-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-window-option.c,v 1.6 2008-06-06 20:02:27 nicm Exp $ */
+/* $Id: cmd-set-window-option.c,v 1.7 2008-06-14 16:47:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -166,6 +166,34 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
}
recalculate_sizes();
+ } else if (strcmp(data->option, "force-width") == 0) {
+ if (data->value == NULL || number == -1) {
+ ctx->error(ctx, "invalid value");
+ return;
+ }
+ if (errstr != NULL) {
+ ctx->error(ctx, "force-width %s", errstr);
+ return;
+ }
+ if (number == 0)
+ wl->window->limitx = UINT_MAX;
+ else
+ wl->window->limitx = number;
+ recalculate_sizes();
+ } else if (strcmp(data->option, "force-height") == 0) {
+ if (data->value == NULL || number == -1) {
+ ctx->error(ctx, "invalid value");
+ return;
+ }
+ if (errstr != NULL) {
+ ctx->error(ctx, "force-height %s", errstr);
+ return;
+ }
+ if (number == 0)
+ wl->window->limity = UINT_MAX;
+ else
+ wl->window->limity = number;
+ recalculate_sizes();
} else {
ctx->error(ctx, "unknown option: %s", data->option);
return;