summaryrefslogtreecommitdiffstats
path: root/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm>2017-06-30 22:24:08 +0000
committernicm <nicm>2017-06-30 22:24:08 +0000
commit7247553c77eb9dae8eab1b7ee12b10fc70cca69c (patch)
tree3df56d87d49f91795a63b421f6cdf3796d1f0f0e /screen-write.c
parent8b0fd63ddb3c71f6b2afa903b5a896a4dd298dee (diff)
Try to show a better preview of sessions and windows in tree mode.
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/screen-write.c b/screen-write.c
index 6f0f6a22..88f03a31 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -387,9 +387,9 @@ screen_write_copy(struct screen_write_ctx *ctx, struct screen *src, u_int px,
}
}
-/* Draw a line on screen. */
+/* Draw a horizontal line on screen. */
void
-screen_write_line(struct screen_write_ctx *ctx, u_int nx, int left, int right)
+screen_write_hline(struct screen_write_ctx *ctx, u_int nx, int left, int right)
{
struct screen *s = ctx->s;
struct grid_cell gc;
@@ -409,6 +409,31 @@ screen_write_line(struct screen_write_ctx *ctx, u_int nx, int left, int right)
screen_write_cursormove(ctx, cx, cy);
}
+/* Draw a horizontal line on screen. */
+void
+screen_write_vline(struct screen_write_ctx *ctx, u_int ny, int top, int bottom)
+{
+ struct screen *s = ctx->s;
+ struct grid_cell gc;
+ u_int cx, cy, i;
+
+ cx = s->cx;
+ cy = s->cy;
+
+ memcpy(&gc, &grid_default_cell, sizeof gc);
+ gc.attr |= GRID_ATTR_CHARSET;
+
+ screen_write_putc(ctx, &gc, top ? 'w' : 'x');
+ for (i = 1; i < ny - 1; i++) {
+ screen_write_cursormove(ctx, cx, cy + i);
+ screen_write_putc(ctx, &gc, 'x');
+ }
+ screen_write_cursormove(ctx, cx, cy + ny);
+ screen_write_putc(ctx, &gc, bottom ? 'v' : 'x');
+
+ screen_write_cursormove(ctx, cx, cy);
+}
+
/* Draw a box on screen. */
void
screen_write_box(struct screen_write_ctx *ctx, u_int nx, u_int ny)