mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
tty_cmd_raw is only used once, for raw UTF-8 output, so rename it to
tty_cmd_utf8character and eliminate the size argument.
This commit is contained in:
parent
e43b6a2dd2
commit
5bd72ec629
@ -700,7 +700,6 @@ screen_write_cell(
|
|||||||
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;
|
||||||
size_t size;
|
|
||||||
int insert = 0;
|
int insert = 0;
|
||||||
|
|
||||||
/* Ignore padding. */
|
/* Ignore padding. */
|
||||||
@ -737,11 +736,7 @@ screen_write_cell(
|
|||||||
memcpy(tmp_gu->data + i, udata, UTF8_SIZE - i);
|
memcpy(tmp_gu->data + i, udata, UTF8_SIZE - i);
|
||||||
|
|
||||||
/* Assume the previous character has just been input. */
|
/* Assume the previous character has just been input. */
|
||||||
for (size = 0; size < UTF8_SIZE; size++) {
|
tty_write_cmd(ctx->wp, TTY_UTF8CHARACTER, udata);
|
||||||
if (udata[size] == 0xff)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
tty_write_cmd(ctx->wp, TTY_RAW, udata, size);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
tmux.h
2
tmux.h
@ -288,7 +288,7 @@ enum tty_cmd {
|
|||||||
TTY_INSERTCHARACTER,
|
TTY_INSERTCHARACTER,
|
||||||
TTY_INSERTLINE,
|
TTY_INSERTLINE,
|
||||||
TTY_LINEFEED,
|
TTY_LINEFEED,
|
||||||
TTY_RAW,
|
TTY_UTF8CHARACTER,
|
||||||
TTY_REVERSEINDEX,
|
TTY_REVERSEINDEX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
17
tty.c
17
tty.c
@ -51,7 +51,7 @@ void tty_cmd_deleteline(struct tty *, struct window_pane *, va_list);
|
|||||||
void tty_cmd_insertcharacter(struct tty *, struct window_pane *, va_list);
|
void tty_cmd_insertcharacter(struct tty *, struct window_pane *, va_list);
|
||||||
void tty_cmd_insertline(struct tty *, struct window_pane *, va_list);
|
void tty_cmd_insertline(struct tty *, struct window_pane *, va_list);
|
||||||
void tty_cmd_linefeed(struct tty *, struct window_pane *, va_list);
|
void tty_cmd_linefeed(struct tty *, struct window_pane *, va_list);
|
||||||
void tty_cmd_raw(struct tty *, struct window_pane *, va_list);
|
void tty_cmd_utf8character(struct tty *, struct window_pane *, va_list);
|
||||||
void tty_cmd_reverseindex(struct tty *, struct window_pane *, va_list);
|
void tty_cmd_reverseindex(struct tty *, struct window_pane *, va_list);
|
||||||
|
|
||||||
void (*tty_cmds[])(struct tty *, struct window_pane *, va_list) = {
|
void (*tty_cmds[])(struct tty *, struct window_pane *, va_list) = {
|
||||||
@ -68,7 +68,7 @@ void (*tty_cmds[])(struct tty *, struct window_pane *, va_list) = {
|
|||||||
tty_cmd_insertcharacter,
|
tty_cmd_insertcharacter,
|
||||||
tty_cmd_insertline,
|
tty_cmd_insertline,
|
||||||
tty_cmd_linefeed,
|
tty_cmd_linefeed,
|
||||||
tty_cmd_raw,
|
tty_cmd_utf8character,
|
||||||
tty_cmd_reverseindex,
|
tty_cmd_reverseindex,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -869,16 +869,19 @@ tty_cmd_cell(struct tty *tty, struct window_pane *wp, va_list ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tty_cmd_raw(struct tty *tty, unused struct window_pane *wp, va_list ap)
|
tty_cmd_utf8character(
|
||||||
|
struct tty *tty, unused struct window_pane *wp, va_list ap)
|
||||||
{
|
{
|
||||||
u_char *buf;
|
u_char *buf;
|
||||||
size_t i, len;
|
size_t i;
|
||||||
|
|
||||||
buf = va_arg(ap, u_char *);
|
buf = va_arg(ap, u_char *);
|
||||||
len = va_arg(ap, size_t);
|
|
||||||
|
for (i = 0; i < UTF8_SIZE; i++) {
|
||||||
for (i = 0; i < len; i++)
|
if (buf[i] == 0xff)
|
||||||
|
break;
|
||||||
tty_putc(tty, buf[i]);
|
tty_putc(tty, buf[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user