Multiple window splitting.

This commit is contained in:
Nicholas Marriott
2009-01-14 19:29:32 +00:00
parent e02496f073
commit b4ac8c1342
17 changed files with 458 additions and 334 deletions

View File

@ -1,4 +1,4 @@
/* $Id: screen-redraw.c,v 1.17 2009-01-12 18:22:47 nicm Exp $ */
/* $Id: screen-redraw.c,v 1.18 2009-01-14 19:29:32 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -23,7 +23,7 @@
#include "tmux.h"
void screen_redraw_blankx(struct client *, u_int, u_int);
void screen_redraw_blanky(struct client *, u_int, u_int);
void screen_redraw_blanky(struct client *, u_int, u_int, char);
void screen_redraw_line(struct client *, struct screen *, u_int, u_int);
/* Redraw entire screen.. */
@ -42,38 +42,24 @@ screen_redraw_screen(struct client *c, struct screen *s)
return;
}
/*
* A normal client screen is made up of three parts: a top window, a
* bottom window and a status line. The bottom window may be turned
* off; the status line is always drawn.
*/
status = options_get_number(&c->session->options, "status");
/* Draw the top window. */
wp = w->panes[0];
s = wp->screen;
sy = screen_size_y(s);
if (screen_size_y(s) == c->sy && w->panes[1] == NULL)
sy--;
cx = s->cx;
cy = s->cy;
for (i = 0; i < sy; i++)
screen_redraw_line(c, s, wp->yoff, i);
s->cx = cx;
s->cy = cy;
/* Draw the bottom window. */
if (c->sy > 2 && w->panes[1] != NULL) {
wp = w->panes[1];
/* Draw the panes. */
TAILQ_FOREACH(wp, &w->panes, entry) {
s = wp->screen;
sy = screen_size_y(s);
if (wp->yoff + screen_size_y(s) == s->cy)
if (!status && TAILQ_NEXT(wp, entry) == NULL)
sy--;
cx = s->cx;
cy = s->cy;
for (i = 0; i < sy; i++)
screen_redraw_line(c, s, wp->yoff, i);
if (wp->yoff + sy <= w->sy) {
for (i = 0; i < sy; i++)
screen_redraw_line(c, s, wp->yoff, i);
if (TAILQ_NEXT(wp, entry) != NULL)
screen_redraw_blanky(c, wp->yoff + sy, 1, '-');
}
s->cx = cx;
s->cy = cy;
}
@ -82,12 +68,7 @@ screen_redraw_screen(struct client *c, struct screen *s)
if (w->sx < c->sx)
screen_redraw_blankx(c, w->sx, c->sx - w->sx);
if (w->sy < c->sy - status)
screen_redraw_blanky(c, w->sy, c->sy - w->sy);
/* Draw separator line. */
s = w->panes[0]->screen;
if (c->sy > 1 && screen_size_y(s) != w->sy)
screen_redraw_blanky(c, screen_size_y(s), 1);
screen_redraw_blanky(c, w->sy, c->sy - w->sy, '=');
/* Draw the status line. */
screen_redraw_status(c);
@ -120,7 +101,7 @@ screen_redraw_blankx(struct client *c, u_int ox, u_int nx)
/* Draw blank lines. */
void
screen_redraw_blanky(struct client *c, u_int oy, u_int ny)
screen_redraw_blanky(struct client *c, u_int oy, u_int ny, char ch)
{
u_int i, j;
@ -129,7 +110,7 @@ screen_redraw_blanky(struct client *c, u_int oy, u_int ny)
tty_putcode2(&c->tty, TTYC_CUP, oy + j, 0);
for (i = 0; i < c->sx; i++) {
if (j == 0)
tty_putc(&c->tty, '-');
tty_putc(&c->tty, ch);
else
tty_putc(&c->tty, ' ');
}