summaryrefslogtreecommitdiffstats
path: root/input.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-06-25 15:54:03 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-06-25 15:54:03 +0000
commitcd71a13a14912feac991f496e57f7b71d8d26d17 (patch)
treebbbb1172a644809f615d31e14e33fd5098e3207c /input.c
parent4eed190649f97b37bcf5681444a9cc45e3426a5c (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.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/input.c b/input.c
index d5bf0900..4c0195b7 100644
--- a/input.c
+++ b/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.5 2009/06/04 14:24:49 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.6 2009/06/04 14:42:14 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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;
}