diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2016-02-02 17:00:27 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2016-02-02 17:00:27 -0800 |
commit | b4a44deb7b7e5df9ec929f312600dd9e46acd047 (patch) | |
tree | 94efaa8efdd76daafe90f34db999cabcaee3d69d /src | |
parent | 60a477a30365c90a0f4de34527914b14de31a953 (diff) | |
parent | 8cc154bc48f730db2303a6bfa91532775fc7ea5b (diff) |
Merge branch 'fix-jump' of git://github.com/cpick/fish-shell into cpick-fix-jump
Diffstat (limited to 'src')
-rw-r--r-- | src/input.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/input.cpp b/src/input.cpp index bc64889e..c2499d1a 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -42,6 +42,7 @@ #include "output.h" #include <vector> #include <algorithm> +#include <deque> #define DEFAULT_TERM L"ansi" #define MAX_INPUT_FUNCTION_ARGS 20 @@ -538,10 +539,23 @@ wchar_t input_function_pop_arg() void input_function_push_args(int code) { int arity = input_function_arity(code); + std::deque<wchar_t> skipped; + for (int i = 0; i < arity; i++) { - input_function_push_arg(input_common_readch(0)); + wchar_t arg; + + // skip and queue up any function codes + while(((arg = input_common_readch(0)) >= R_MIN) && (arg <= R_MAX)) + { + skipped.push_front(arg); + } + + input_function_push_arg(arg); } + + // push the function codes back into the input stream + std::for_each(skipped.begin(), skipped.end(), input_common_next_ch); } /** |