mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Copy ACS characters as UTF-8, from Balazs Kezes.
This commit is contained in:
parent
045d0c3b9f
commit
2f19df09b1
@ -990,6 +990,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
memcpy(&tmp_gc, &s->sel.cell, sizeof tmp_gc);
|
memcpy(&tmp_gc, &s->sel.cell, sizeof tmp_gc);
|
||||||
grid_cell_get(gc, &ud);
|
grid_cell_get(gc, &ud);
|
||||||
grid_cell_set(&tmp_gc, &ud);
|
grid_cell_set(&tmp_gc, &ud);
|
||||||
|
tmp_gc.attr = tmp_gc.attr & ~GRID_ATTR_CHARSET;
|
||||||
|
tmp_gc.attr |= gc->attr & GRID_ATTR_CHARSET;
|
||||||
tmp_gc.flags = gc->flags & ~(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
tmp_gc.flags = gc->flags & ~(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
||||||
tmp_gc.flags |= s->sel.cell.flags &
|
tmp_gc.flags |= s->sel.cell.flags &
|
||||||
(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
(GRID_FLAG_FG256|GRID_FLAG_BG256);
|
||||||
|
@ -81,7 +81,7 @@ tty_acs_get(struct tty *tty, u_char ch)
|
|||||||
struct tty_acs_entry *entry;
|
struct tty_acs_entry *entry;
|
||||||
|
|
||||||
/* If not a UTF-8 terminal, use the ACS set. */
|
/* If not a UTF-8 terminal, use the ACS set. */
|
||||||
if (!(tty->flags & TTY_UTF8)) {
|
if (tty != NULL && !(tty->flags & TTY_UTF8)) {
|
||||||
if (tty->term->acs[ch][0] == '\0')
|
if (tty->term->acs[ch][0] == '\0')
|
||||||
return (NULL);
|
return (NULL);
|
||||||
return (&tty->term->acs[ch][0]);
|
return (&tty->term->acs[ch][0]);
|
||||||
|
@ -1552,6 +1552,7 @@ window_copy_copy_line(struct window_pane *wp,
|
|||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
struct utf8_data ud;
|
struct utf8_data ud;
|
||||||
u_int i, xx, wrapped = 0;
|
u_int i, xx, wrapped = 0;
|
||||||
|
const char *s;
|
||||||
|
|
||||||
if (sx > ex)
|
if (sx > ex)
|
||||||
return;
|
return;
|
||||||
@ -1580,6 +1581,13 @@ window_copy_copy_line(struct window_pane *wp,
|
|||||||
if (gc->flags & GRID_FLAG_PADDING)
|
if (gc->flags & GRID_FLAG_PADDING)
|
||||||
continue;
|
continue;
|
||||||
grid_cell_get(gc, &ud);
|
grid_cell_get(gc, &ud);
|
||||||
|
if (ud.size == 1 && (gc->attr & GRID_ATTR_CHARSET)) {
|
||||||
|
s = tty_acs_get(NULL, ud.data[0]);
|
||||||
|
if (s != NULL && strlen(s) <= sizeof ud.data) {
|
||||||
|
ud.size = strlen(s);
|
||||||
|
memcpy (ud.data, s, ud.size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*buf = xrealloc(*buf, 1, (*off) + ud.size);
|
*buf = xrealloc(*buf, 1, (*off) + ud.size);
|
||||||
memcpy(*buf + *off, ud.data, ud.size);
|
memcpy(*buf + *off, ud.data, ud.size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user