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.
This commit is contained in:
Nicholas Marriott
2008-06-14 16:47:20 +00:00
parent 62d7ad2690
commit 0f403474aa
10 changed files with 95 additions and 91 deletions

View File

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