aboutsummaryrefslogtreecommitdiffhomepage
path: root/input.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-07-06 16:25:10 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-07-06 16:25:59 -0700
commitee8fd21d28c7ac7bc236d61809750fcff41bb240 (patch)
tree594f330b6aad4cde6bf608b64884b64eef9fee22 /input.cpp
parent232ed91ec7537cf28ecb480e49dd7896f0a79d05 (diff)
Don't hang if stdin is closed and we have no bindings
Diffstat (limited to 'input.cpp')
-rw-r--r--input.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/input.cpp b/input.cpp
index d2f8fb34..a90d84a5 100644
--- a/input.cpp
+++ b/input.cpp
@@ -495,18 +495,18 @@ wint_t input_readch()
{
size_t i;
-
+
CHECK_BLOCK( R_NULL );
/*
- Clear the interrupted flag
- */
+ Clear the interrupted flag
+ */
reader_interrupted();
/*
- Search for sequence in mapping tables
- */
-
+ Search for sequence in mapping tables
+ */
+
while( 1 )
{
const input_mapping_t *generic = 0;
@@ -525,27 +525,34 @@ wint_t input_readch()
}
/*
- No matching exact mapping, try to find generic mapping.
- */
-
+ No matching exact mapping, try to find generic mapping.
+ */
+
if( generic )
{
wchar_t arr[2]=
- {
- 0,
- 0
- }
+ {
+ 0,
+ 0
+ }
;
arr[0] = input_common_readch(0);
return input_exec_binding( *generic, arr );
}
-
+
/*
- No action to take on specified character, ignore it
- and move to next one.
- */
- input_common_readch( 0 ); }
+ No action to take on specified character, ignore it
+ and move to next one.
+ */
+ wchar_t c = input_common_readch( 0 );
+
+ /* If it's closed, then just return */
+ if (c == R_EOF)
+ {
+ return WEOF;
+ }
+ }
}
void input_mapping_get_names( wcstring_list_t &lst )