summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2016-10-12 13:24:07 +0000
committernicm <nicm@openbsd.org>2016-10-12 13:24:07 +0000
commit8ab25c4028ffa0c33e5fc92dbbeab972cc42af34 (patch)
treeaa324a37c543bd8340cf5319fe8168df0bec41b0 /usr.bin/tmux
parentMention that netstat -P needs kmem access. (diff)
downloadwireguard-openbsd-8ab25c4028ffa0c33e5fc92dbbeab972cc42af34.tar.xz
wireguard-openbsd-8ab25c4028ffa0c33e5fc92dbbeab972cc42af34.zip
Redraw selection in tty_draw_line, so it appears when redrawing whole
pane. Reported by Theo Buehler.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/screen-write.c8
-rw-r--r--usr.bin/tmux/screen.c18
-rw-r--r--usr.bin/tmux/tmux.h4
-rw-r--r--usr.bin/tmux/tty.c10
4 files changed, 29 insertions, 11 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c
index 538b0c0b88d..71871b6eda8 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.96 2016/10/05 22:00:29 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.97 2016/10/12 13:24:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1141,12 +1141,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* Write to the screen. */
if (selected) {
- memcpy(&tmp_gc, &s->sel.cell, sizeof tmp_gc);
- utf8_copy(&tmp_gc.data, &gc->data);
- tmp_gc.attr = tmp_gc.attr & ~GRID_ATTR_CHARSET;
- tmp_gc.attr |= gc->attr & GRID_ATTR_CHARSET;
- tmp_gc.flags = gc->flags;
screen_write_flush(ctx);
+ screen_select_cell(s, &tmp_gc, gc);
ttyctx.cell = &tmp_gc;
tty_write(tty_cmd_cell, &ttyctx);
ctx->written++;
diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c
index f715ecb4426..7fd8f71f0be 100644
--- a/usr.bin/tmux/screen.c
+++ b/usr.bin/tmux/screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen.c,v 1.42 2016/10/11 13:21:59 nicm Exp $ */
+/* $OpenBSD: screen.c,v 1.43 2016/10/12 13:24:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -371,6 +371,22 @@ screen_check_selection(struct screen *s, u_int px, u_int py)
return (1);
}
+/* Get selected grid cell. */
+void
+screen_select_cell(struct screen *s, struct grid_cell *dst,
+ const struct grid_cell *src)
+{
+ if (!s->sel.flag)
+ return;
+
+ memcpy(dst, &s->sel.cell, sizeof *dst);
+
+ utf8_copy(&dst->data, &src->data);
+ dst->attr = dst->attr & ~GRID_ATTR_CHARSET;
+ dst->attr |= src->attr & GRID_ATTR_CHARSET;
+ dst->flags = src->flags;
+}
+
/* Reflow wrapped lines. */
static void
screen_reflow(struct screen *s, u_int new_x)
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 057c8f2ac2f..ea313365334 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.656 2016/10/12 13:03:27 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.657 2016/10/12 13:24:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2060,6 +2060,8 @@ void screen_set_selection(struct screen *,
u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
void screen_clear_selection(struct screen *);
int screen_check_selection(struct screen *, u_int, u_int);
+void screen_select_cell(struct screen *, struct grid_cell *,
+ const struct grid_cell *);
/* window.c */
extern struct windows windows;
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 40dc0c47394..3ae5d3ad802 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.208 2016/10/11 13:21:59 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.209 2016/10/12 13:24:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -658,7 +658,7 @@ void
tty_draw_line(struct tty *tty, const struct window_pane *wp,
struct screen *s, u_int py, u_int ox, u_int oy)
{
- struct grid_cell gc;
+ struct grid_cell gc, tmp_gc;
struct grid_line *gl;
u_int i, sx;
int flags;
@@ -687,7 +687,11 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
for (i = 0; i < sx; i++) {
grid_view_get_cell(s->grid, i, py, &gc);
- tty_cell(tty, &gc, wp);
+ if (gc.flags & GRID_FLAG_SELECTED) {
+ screen_select_cell(s, &tmp_gc, &gc);
+ tty_cell(tty, &tmp_gc, wp);
+ } else
+ tty_cell(tty, &gc, wp);
}
if (sx < tty->sx) {