summaryrefslogtreecommitdiffstats
path: root/input.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-06-04 14:42:14 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-06-04 14:42:14 +0000
commitd6015824ddcd2b0373232e528ade8b40e12c1a0a (patch)
tree455590e27e81bf3c66a89bd9c7714dac063692ce /input.c
parent6c1f03578d7a616f96b04eccd5095d4f9463edb2 (diff)
Okay, so I screwed up when testing this, doh. Unbreak so that CAN/SUB actually
do cancel the sequence, and tweak to make the code more clear.
Diffstat (limited to 'input.c')
-rw-r--r--input.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/input.c b/input.c
index f7980c25..61de9a4d 100644
--- a/input.c
+++ b/input.c
@@ -399,13 +399,16 @@ input_state_sequence_first(u_char ch, struct input_ctx *ictx)
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 */
+ return;
+ } else if (ch == 0x18 || ch == 0x1a) { /* CAN and SUB */
/* Abort sequence. */
input_state(ictx, input_state_first);
- } else {
- /* Handle C0 immediately. */
- input_handle_c0_control(ch, ictx);
+ return;
}
+
+ /* 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.
@@ -467,13 +470,16 @@ input_state_sequence_next(u_char ch, struct input_ctx *ictx)
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 */
+ return;
+ } else if (ch == 0x18 || ch == 0x1a) { /* CAN and SUB */
/* Abort sequence. */
input_state(ictx, input_state_first);
- } else {
- /* Handle C0 immediately. */
- input_handle_c0_control(ch, ictx);
+ return;
}
+
+ /* Handle C0 immediately. */
+ input_handle_c0_control(ch, ictx);
+
return;
}