mirror of
https://github.com/tmux/tmux.git
synced 2025-01-13 03:48:51 +00:00
More input compatibility love. Support C0 within escape sequences, and the C0
control character VT (vertical tab, \013), which is treated as LF like VT102. Makes another vttest happy.
This commit is contained in:
parent
b8ec0c713f
commit
c3c14817c9
47
input.c
47
input.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: input.c,v 1.3 2009/06/03 23:30:40 nicm Exp $ */
|
/* $OpenBSD: input.c,v 1.4 2009/06/04 14:15:50 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -394,15 +394,28 @@ input_state_sequence_first(u_char ch, struct input_ctx *ictx)
|
|||||||
ictx->private = '\0';
|
ictx->private = '\0';
|
||||||
ARRAY_CLEAR(&ictx->args);
|
ARRAY_CLEAR(&ictx->args);
|
||||||
|
|
||||||
|
/* Most C0 control are accepted within CSI. */
|
||||||
|
if (INPUT_C0CONTROL(ch)) {
|
||||||
|
if (ch == 0x1b) { /* ESC */
|
||||||
|
/* Abort sequence and begin with new. */
|
||||||
|
input_state(ictx, input_state_escape);
|
||||||
|
} else if (ch != 0x18 && ch != 0x1a) { /* CAN and SUB */
|
||||||
|
/* Handle C0 immediately. */
|
||||||
|
input_handle_c0_control(ch, ictx);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Just come back to this state, in case the next character
|
||||||
|
* is the start of a private sequence.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
input_state(ictx, input_state_sequence_next);
|
input_state(ictx, input_state_sequence_next);
|
||||||
|
|
||||||
if (INPUT_PARAMETER(ch)) {
|
/* Private sequence: always the first character. */
|
||||||
input_new_argument(ictx);
|
if (ch >= 0x3c && ch <= 0x3f) {
|
||||||
if (ch >= 0x3c && ch <= 0x3f) {
|
ictx->private = ch;
|
||||||
/* Private control sequence. */
|
return;
|
||||||
ictx->private = ch;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pass character on directly. */
|
/* Pass character on directly. */
|
||||||
@ -423,6 +436,9 @@ input_state_sequence_next(u_char ch, struct input_ctx *ictx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (INPUT_PARAMETER(ch)) {
|
if (INPUT_PARAMETER(ch)) {
|
||||||
|
if (ARRAY_EMPTY(&ictx->args))
|
||||||
|
input_new_argument(ictx);
|
||||||
|
|
||||||
if (ch == ';') {
|
if (ch == ';') {
|
||||||
if (input_add_argument(ictx, '\0') != 0)
|
if (input_add_argument(ictx, '\0') != 0)
|
||||||
input_state(ictx, input_state_first);
|
input_state(ictx, input_state_first);
|
||||||
@ -443,6 +459,18 @@ input_state_sequence_next(u_char ch, struct input_ctx *ictx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Most C0 control are accepted within CSI. */
|
||||||
|
if (INPUT_C0CONTROL(ch)) {
|
||||||
|
if (ch == 0x1b) { /* ESC */
|
||||||
|
/* Abort sequence and begin with new. */
|
||||||
|
input_state(ictx, input_state_escape);
|
||||||
|
} else if (ch != 0x18 && ch != 0x1a) { /* CAN and SUB */
|
||||||
|
/* Handle C0 immediately. */
|
||||||
|
input_handle_c0_control(ch, ictx);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
input_state(ictx, input_state_first);
|
input_state(ictx, input_state_first);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,6 +640,9 @@ input_handle_c0_control(u_char ch, struct input_ctx *ictx)
|
|||||||
}
|
}
|
||||||
screen_write_cursormove(&ictx->ctx, s->cx, s->cy);
|
screen_write_cursormove(&ictx->ctx, s->cx, s->cy);
|
||||||
break;
|
break;
|
||||||
|
case '\013': /* VT */
|
||||||
|
screen_write_linefeed(&ictx->ctx);
|
||||||
|
break;
|
||||||
case '\016': /* SO */
|
case '\016': /* SO */
|
||||||
ictx->cell.attr |= GRID_ATTR_CHARSET;
|
ictx->cell.attr |= GRID_ATTR_CHARSET;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user