diff options
Diffstat (limited to 'screen-redraw.c')
-rw-r--r-- | screen-redraw.c | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/screen-redraw.c b/screen-redraw.c index 6db1064b..c2b2ece6 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $OpenBSD$ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -275,11 +275,40 @@ void screen_redraw_draw_borders(struct client *c, int status, u_int top) { struct window *w = c->session->curw->window; - struct options *oo = &c->session->options; + struct options *oo = &w->options; struct tty *tty = &c->tty; struct window_pane *wp; - struct grid_cell active_gc, other_gc; - u_int i, j, type; + struct grid_cell active_gc, other_gc, msg_gc; + u_int i, j, type, msgx = 0, msgy = 0; + int small, flags; + char msg[256]; + const char *tmp; + size_t msglen = 0; + + small = (tty->sy - status + top > w->sy) || (tty->sx > w->sx); + if (small) { + flags = w->flags & (WINDOW_FORCEWIDTH|WINDOW_FORCEHEIGHT); + if (flags == (WINDOW_FORCEWIDTH|WINDOW_FORCEHEIGHT)) + tmp = "force-width, force-height"; + else if (flags == WINDOW_FORCEWIDTH) + tmp = "force-width"; + else if (flags == WINDOW_FORCEHEIGHT) + tmp = "force-height"; + else + tmp = "a smaller client"; + xsnprintf(msg, sizeof msg, "(size %ux%u from %s)", + w->sx, w->sy, tmp); + msglen = strlen(msg); + + if (tty->sy - 1 - status + top > w->sy && tty->sx >= msglen) { + msgx = tty->sx - msglen; + msgy = tty->sy - 1 - status + top; + } else if (tty->sx - w->sx > msglen) { + msgx = tty->sx - msglen; + msgy = tty->sy - 1 - status + top; + } else + small = 0; + } style_apply(&other_gc, oo, "pane-border-style"); style_apply(&active_gc, oo, "pane-active-border-style"); @@ -290,6 +319,9 @@ screen_redraw_draw_borders(struct client *c, int status, u_int top) type = screen_redraw_check_cell(c, i, j, &wp); if (type == CELL_INSIDE) continue; + if (type == CELL_OUTSIDE && + small && i > msgx && j == msgy) + continue; if (screen_redraw_check_active(i, j, type, w, wp)) tty_attributes(tty, &active_gc); else @@ -298,6 +330,13 @@ screen_redraw_draw_borders(struct client *c, int status, u_int top) tty_putc(tty, CELL_BORDERS[type]); } } + + if (small) { + memcpy(&msg_gc, &grid_default_cell, sizeof msg_gc); + tty_attributes(tty, &msg_gc); + tty_cursor(tty, msgx, msgy); + tty_puts(tty, msg); + } } /* Draw the panes. */ @@ -381,7 +420,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp) for (j = 0; j < 5; j++) { for (i = px; i < px + 5; i++) { tty_cursor(tty, xoff + i, yoff + py + j); - if (clock_table[idx][j][i - px]) + if (window_clock_table[idx][j][i - px]) tty_putc(tty, ' '); } } |