Merge branch 'fix-jump' of git://github.com/cpick/fish-shell into cpick-fix-jump

This commit is contained in:
ridiculousfish 2016-02-02 17:00:27 -08:00
commit b4a44deb7b
3 changed files with 27 additions and 1 deletions

View file

@ -42,6 +42,7 @@
#include "output.h" #include "output.h"
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <deque>
#define DEFAULT_TERM L"ansi" #define DEFAULT_TERM L"ansi"
#define MAX_INPUT_FUNCTION_ARGS 20 #define MAX_INPUT_FUNCTION_ARGS 20
@ -538,10 +539,23 @@ wchar_t input_function_pop_arg()
void input_function_push_args(int code) void input_function_push_args(int code)
{ {
int arity = input_function_arity(code); int arity = input_function_arity(code);
std::deque<wchar_t> skipped;
for (int i = 0; i < arity; i++) 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);
} }
/** /**

View file

@ -37,6 +37,17 @@ expect_prompt -re {\r\nTAXT\r\n} {
puts stderr "Couldn't find expected output 'TAXT'" puts stderr "Couldn't find expected output 'TAXT'"
} }
# Test 't' binding that contains non-zero arity function (forward-jump) followed
# by another function (and) https://github.com/fish-shell/fish-shell/issues/2357
send_line "\033ddiecho TEXT\033hhtTrN"
expect_prompt -re {\r\nTENT\r\n} {
puts "t-binding success"
} -nounmatched -re {\r\nfail} {
puts stderr "t-binding fail"
} unmatched {
puts stderr "Couldn't find expected output 'TENT'"
}
# still in insert mode, switch back to regular key bindings # still in insert mode, switch back to regular key bindings
send_line -h "set -g fish_key_bindings fish_default_key_bindings" send_line -h "set -g fish_key_bindings fish_default_key_bindings"
expect_prompt expect_prompt

View file

@ -1,4 +1,5 @@
success success
success success
replace success replace success
t-binding success
success success