summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-06-30 22:24:08 +0000
committernicm <nicm@openbsd.org>2017-06-30 22:24:08 +0000
commit367b65a4a4784778aa17ebaa8b1fe513cf97e524 (patch)
tree47faa9fd7499b60ca5dbae7ccf2b7fe433480206 /usr.bin/tmux/screen-write.c
parentImprove reorder_kernel() (diff)
downloadwireguard-openbsd-367b65a4a4784778aa17ebaa8b1fe513cf97e524.tar.xz
wireguard-openbsd-367b65a4a4784778aa17ebaa8b1fe513cf97e524.zip
Try to show a better preview of sessions and windows in tree mode.
Diffstat (limited to 'usr.bin/tmux/screen-write.c')
-rw-r--r--usr.bin/tmux/screen-write.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c
index 4206f343480..083406a730f 100644
--- a/usr.bin/tmux/screen-write.c
+++ b/usr.bin/tmux/screen-write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen-write.c,v 1.128 2017/06/12 10:57:35 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.129 2017/06/30 22:24:08 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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)