diff options
-rw-r--r-- | CHANGES | 10 | ||||
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | cmd-set-window-option.c | 30 | ||||
-rw-r--r-- | resize.c | 7 | ||||
-rw-r--r-- | screen-redraw.c | 23 | ||||
-rw-r--r-- | server-fn.c | 4 | ||||
-rw-r--r-- | server.c | 31 | ||||
-rw-r--r-- | status.c | 61 | ||||
-rw-r--r-- | tmux.h | 10 | ||||
-rw-r--r-- | window.c | 3 |
10 files changed, 94 insertions, 90 deletions
@@ -1,5 +1,13 @@ 14 June 2008 +* 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. +* Clear the blank area below windows properly when they are smaller than client, + also add an indicator line to show the vertical limit. * Don't die on empty strings in config file, reported by Will Maier. 08 June 2008 @@ -464,4 +472,4 @@ (including mutt, emacs). No status bar yet and no key remapping or other customisation. -$Id: CHANGES,v 1.118 2008-06-14 08:11:16 nicm Exp $ +$Id: CHANGES,v 1.119 2008-06-14 16:47:20 nicm Exp $ @@ -75,4 +75,7 @@ - test and fix wsvt25 - activity/bell should be per-window not per-link? what if it is cur win in session not being watched? -- empty strings in config causes crash (lt_kije) +- man page: + set-window-option + explanation of -t format + config file 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; @@ -1,4 +1,4 @@ -/* $Id: resize.c,v 1.14 2008-06-14 12:05:06 nicm Exp $ */ +/* $Id: resize.c,v 1.15 2008-06-14 16:47:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -114,6 +114,11 @@ recalculate_sizes(void) } w->flags &= ~WINDOW_HIDDEN; + if (ssx > w->limitx) + ssx = w->limitx; + if (ssy > w->limity) + ssy = w->limity; + if (screen_size_x(&w->base) == ssx && screen_size_y(&w->base) == ssy) continue; diff --git a/screen-redraw.c b/screen-redraw.c index 6d6f328e..2c44b13d 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -1,4 +1,4 @@ -/* $Id: screen-redraw.c,v 1.5 2008-06-14 12:05:06 nicm Exp $ */ +/* $Id: screen-redraw.c,v 1.6 2008-06-14 16:47:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -181,19 +181,12 @@ screen_redraw_area( void screen_redraw_lines(struct screen_redraw_ctx *ctx, u_int py, u_int ny) { - u_int i, cx, sx; + screen_redraw_area(ctx, 0, py, screen_size_x(ctx->s), py + ny); +} - sx = screen_size_x(ctx->s); - for (i = py; i < py + ny; i++) { - cx = ctx->s->grid_size[screen_y(ctx->s, i)]; - if (ctx->s->sel.flag || sx < 5 || cx >= sx - 5) { - screen_redraw_area(ctx, 0, i, screen_size_x(ctx->s), 1); - continue; - } - screen_redraw_area(ctx, 0, i, cx, 1); - screen_redraw_move_cursor(ctx, cx, i); - screen_redraw_set_attributes( - ctx, SCREEN_DEFATTR, SCREEN_DEFCOLR); - ctx->write(ctx->data, TTY_CLEARENDOFLINE); - } +/* Draw set of columns. */ +void +screen_redraw_columns(struct screen_redraw_ctx *ctx, u_int px, u_int nx) +{ + screen_redraw_area(ctx, px, 0, px + nx, screen_size_y(ctx->s)); } diff --git a/server-fn.c b/server-fn.c index 4df9aee5..59813f65 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.40 2008-06-07 07:13:08 nicm Exp $ */ +/* $Id: server-fn.c,v 1.41 2008-06-14 16:47:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -183,6 +183,6 @@ server_write_message(struct client *c, const char *fmt, ...) screen_redraw_stop(&ctx); } else { screen_redraw_stop(&ctx); - status_write_client(c); + server_status_client(c); } } @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.62 2008-06-14 12:05:06 nicm Exp $ */ +/* $Id: server.c,v 1.63 2008-06-14 16:47:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -312,31 +312,34 @@ server_check_redraw(struct client *c) if (c->flags & CLIENT_REDRAW) { sx = screen_size_x(c->session->curw->window->screen); sy = screen_size_y(c->session->curw->window->screen); - if (sy < yy) { + if (sx < xx || sy < yy) { /* - * Fake up a blank(ish) screen and use it. NOTE: because - * this uses tty_write_client but doesn't write the - * client's screen, this can't use anything which - * relies on cursor position. This is icky and might - * break if we try to optimise redrawing later :-/. + * Fake up a blank(ish) screen and use it to draw the + * empty regions. NOTE: because this uses + * tty_write_client but doesn't write the client's + * screen, this can't use anything which relies on + * cursor position. */ screen_create(&screen, xx, yy, 0); - screen_fill_area(&screen, 0, 0, xx, yy, ' ', 0, 0x70); - screen_fill_area(&screen, 0, sy, sx, 1, '-', 0, 0x70); - screen_redraw_start(&ctx, &screen, tty_write_client, c); - screen_redraw_lines(&ctx, sy, yy - sy); + if (sx < xx) + screen_redraw_columns(&ctx, sx, xx - sx); + if (sy < yy) { + screen_fill_area(&screen, + 0, sy, xx, 1, '-', 0, 0x70); + screen_redraw_lines(&ctx, sy, yy - sy); + } screen_redraw_stop(&ctx); - screen_destroy(&screen); } screen_redraw_start_client(&ctx, c); screen_redraw_lines(&ctx, 0, screen_size_y(ctx.s)); screen_redraw_stop(&ctx); - status_write_client(c); + + status_redraw(c); } else if (c->flags & CLIENT_STATUS) - status_write_client(c); + status_redraw(c); c->flags &= ~(CLIENT_CLEAR|CLIENT_REDRAW|CLIENT_STATUS); } @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.24 2008-06-07 07:27:28 nicm Exp $ */ +/* $Id: status.c,v 1.25 2008-06-14 16:47:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -24,18 +24,17 @@ #include "tmux.h" -void printflike3 status_print(struct buffer *, size_t *, const char *, ...); - +/* Draw status for client on the last lines of given context. */ void -status_write_client(struct client *c) +status_redraw(struct client *c) { struct screen_redraw_ctx ctx; - struct winlink *wl; - char flag, *left, *right; - char lbuf[BUFSIZ], rbuf[BUFSIZ]; + struct winlink *wl; + char flag, *left, *right; + char lbuf[BUFSIZ], rbuf[BUFSIZ]; size_t llen, rlen; - u_char scolour; - u_int slines; + u_char scolour; + u_int slines; scolour = options_get_number(&c->session->options, "status-colour"); slines = options_get_number(&c->session->options, "status-lines"); @@ -78,10 +77,10 @@ status_write_client(struct client *c) screen_redraw_set_attributes(&ctx, 0, scolour); screen_redraw_write_string(&ctx, " "); - if (ctx.s->cx > screen_size_x(ctx.s) - rlen) + if (ctx.s->cx > c->sx - rlen) break; } - while (ctx.s->cx < screen_size_x(ctx.s) - rlen) { + while (ctx.s->cx < c->sx - rlen) { ctx.write(ctx.data, TTY_CHARACTER, ' '); ctx.s->cx++; } @@ -89,46 +88,8 @@ status_write_client(struct client *c) screen_redraw_move_cursor(&ctx, 0, c->sy - slines); screen_redraw_write_string(&ctx, "%s ", lbuf); - screen_redraw_move_cursor( - &ctx, screen_size_x(ctx.s) - rlen, c->sy - slines); + screen_redraw_move_cursor(&ctx, c->sx - rlen, c->sy - slines); screen_redraw_write_string(&ctx, " %s", rbuf); screen_redraw_stop(&ctx); } - -void -status_write_window(struct window *w) -{ - struct client *c; - u_int i; - - if (w->flags & WINDOW_HIDDEN) - return; - - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - c = ARRAY_ITEM(&clients, i); - if (c == NULL || c->session == NULL) - continue; - if (c->session->curw->window != w) - continue; - - status_write_client(c); - } -} - -void -status_write_session(struct session *s) -{ - struct client *c; - u_int i; - - if (s->flags & SESSION_UNATTACHED) - return; - - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - c = ARRAY_ITEM(&clients, i); - if (c == NULL || c->session != s) - continue; - status_write_client(c); - } -} @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.140 2008-06-14 12:05:06 nicm Exp $ */ +/* $Id: tmux.h,v 1.141 2008-06-14 16:47:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -529,6 +529,9 @@ struct window { #define WINDOW_MONITOR 0x8 #define WINDOW_AGGRESSIVE 0x10 + u_int limitx; + u_int limity; + struct screen *screen; struct screen base; @@ -918,9 +921,7 @@ void server_status_window(struct window *); void printflike2 server_write_message(struct client *, const char *, ...); /* status.c */ -void status_write_client(struct client *); -void status_write_session(struct session *); -void status_write_window(struct window *); +void status_redraw(struct client *c); /* resize.c */ void recalculate_sizes(void); @@ -1005,6 +1006,7 @@ void screen_redraw_cell(struct screen_redraw_ctx *, u_int, u_int); void screen_redraw_area( struct screen_redraw_ctx *, u_int, u_int, u_int, u_int); void screen_redraw_lines(struct screen_redraw_ctx *, u_int, u_int); +void screen_redraw_columns(struct screen_redraw_ctx *, u_int, u_int); /* screen.c */ const char *screen_colourstring(u_char); @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.40 2008-06-04 20:17:25 nicm Exp $ */ +/* $Id: window.c,v 1.41 2008-06-14 16:47:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -202,6 +202,7 @@ window_create(const char *name, w->out = buffer_create(BUFSIZ); w->mode = NULL; w->flags = 0; + w->limitx = w->limity = UINT_MAX; screen_create(&w->base, sx, sy, hlimit); w->screen = &w->base; input_init(w); |