mirror of
https://github.com/tmux/tmux.git
synced 2025-01-13 03:48:51 +00:00
Sync OpenBSD patchset 186:
Draw UTF-8 characters under the selection correctly.
This commit is contained in:
parent
2a146852ef
commit
7562781c9d
@ -1,4 +1,4 @@
|
|||||||
/* $Id: screen-write.c,v 1.64 2009-07-23 12:48:18 tcunha Exp $ */
|
/* $Id: screen-write.c,v 1.65 2009-07-28 22:41:38 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -723,7 +723,7 @@ screen_write_cell(
|
|||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
struct grid_utf8 gu, *tmp_gu;
|
struct grid_utf8 gu, *tmp_gu;
|
||||||
u_int width, xx, i;
|
u_int width, xx, i;
|
||||||
struct grid_cell tmp_gc, *tmp_gc2;
|
struct grid_cell tmp_gc, tmp_gc2, *tmp_gcp;
|
||||||
int insert = 0;
|
int insert = 0;
|
||||||
|
|
||||||
/* Ignore padding. */
|
/* Ignore padding. */
|
||||||
@ -743,11 +743,11 @@ screen_write_cell(
|
|||||||
if (width == 0) {
|
if (width == 0) {
|
||||||
if (s->cx == 0)
|
if (s->cx == 0)
|
||||||
return;
|
return;
|
||||||
tmp_gc2 = grid_view_get_cell(gd, s->cx - 1, s->cy);
|
tmp_gcp = grid_view_get_cell(gd, s->cx - 1, s->cy);
|
||||||
if (!(tmp_gc2->flags & GRID_FLAG_UTF8)) {
|
if (!(tmp_gcp->flags & GRID_FLAG_UTF8)) {
|
||||||
tmp_gc2->flags |= GRID_FLAG_UTF8;
|
tmp_gcp->flags |= GRID_FLAG_UTF8;
|
||||||
memset(&gu.data, 0xff, sizeof gu.data);
|
memset(&gu.data, 0xff, sizeof gu.data);
|
||||||
*gu.data = tmp_gc2->data;
|
*gu.data = tmp_gcp->data;
|
||||||
gu.width = 1;
|
gu.width = 1;
|
||||||
grid_view_set_utf8(gd, s->cx - 1, s->cy, &gu);
|
grid_view_set_utf8(gd, s->cx - 1, s->cy, &gu);
|
||||||
}
|
}
|
||||||
@ -799,9 +799,9 @@ screen_write_cell(
|
|||||||
* already ensured there is enough room.
|
* already ensured there is enough room.
|
||||||
*/
|
*/
|
||||||
for (xx = s->cx + 1; xx < s->cx + width; xx++) {
|
for (xx = s->cx + 1; xx < s->cx + width; xx++) {
|
||||||
tmp_gc2 = grid_view_get_cell(gd, xx, s->cy);
|
tmp_gcp = grid_view_get_cell(gd, xx, s->cy);
|
||||||
if (tmp_gc2 != NULL)
|
if (tmp_gcp != NULL)
|
||||||
tmp_gc2->flags |= GRID_FLAG_PADDING;
|
tmp_gcp->flags |= GRID_FLAG_PADDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the cell. */
|
/* Set the cell. */
|
||||||
@ -820,8 +820,10 @@ screen_write_cell(
|
|||||||
}
|
}
|
||||||
ttyctx.utf8 = &gu;
|
ttyctx.utf8 = &gu;
|
||||||
if (screen_check_selection(s, s->cx - width, s->cy)) {
|
if (screen_check_selection(s, s->cx - width, s->cy)) {
|
||||||
s->sel.cell.data = gc->data;
|
memcpy(&tmp_gc2, &s->sel.cell, sizeof tmp_gc2);
|
||||||
ttyctx.cell = &s->sel.cell;
|
tmp_gc2.data = gc->data;
|
||||||
|
tmp_gc2.flags = gc->flags;
|
||||||
|
ttyctx.cell = &tmp_gc2;
|
||||||
tty_write(tty_cmd_cell, &ttyctx);
|
tty_write(tty_cmd_cell, &ttyctx);
|
||||||
} else {
|
} else {
|
||||||
ttyctx.cell = gc;
|
ttyctx.cell = gc;
|
||||||
|
9
tty.c
9
tty.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tty.c,v 1.118 2009-07-23 12:57:45 tcunha Exp $ */
|
/* $Id: tty.c,v 1.119 2009-07-28 22:41:38 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -490,6 +490,7 @@ void
|
|||||||
tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
|
tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
|
||||||
{
|
{
|
||||||
const struct grid_cell *gc;
|
const struct grid_cell *gc;
|
||||||
|
struct grid_cell tmpgc;
|
||||||
const struct grid_utf8 *gu;
|
const struct grid_utf8 *gu;
|
||||||
u_int i, sx;
|
u_int i, sx;
|
||||||
|
|
||||||
@ -508,8 +509,10 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy)
|
|||||||
gu = grid_view_peek_utf8(s->grid, i, py);
|
gu = grid_view_peek_utf8(s->grid, i, py);
|
||||||
|
|
||||||
if (screen_check_selection(s, i, py)) {
|
if (screen_check_selection(s, i, py)) {
|
||||||
s->sel.cell.data = gc->data;
|
memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc);
|
||||||
tty_cell(tty, &s->sel.cell, gu);
|
tmpgc.data = gc->data;
|
||||||
|
tmpgc.flags = gc->flags;
|
||||||
|
tty_cell(tty, &tmpgc, gu);
|
||||||
} else
|
} else
|
||||||
tty_cell(tty, gc, gu);
|
tty_cell(tty, gc, gu);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user