diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-14 16:47:20 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-14 16:47:20 +0000 |
commit | 0f403474aaf0f4aa4475ef6095d1ab420ebfed60 (patch) | |
tree | 2a51f3a931cfa23f39b2f737dd682ddc0e03611a /status.c | |
parent | 62d7ad2690c0f72f06195351aa50e3fe037f456a (diff) |
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 'status.c')
-rw-r--r-- | status.c | 61 |
1 files changed, 11 insertions, 50 deletions
@@ -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); - } -} |