mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
Define a constant for function-not-found in input.cpp
Avoids differences in widths of wchar_t, hopefully addressing issue #2284
This commit is contained in:
parent
b615534d8d
commit
e2f16ec20e
@ -455,7 +455,7 @@ static int builtin_commandline(parser_t &parser, wchar_t **argv)
|
|||||||
for (i=w.woptind; i<argc; i++)
|
for (i=w.woptind; i<argc; i++)
|
||||||
{
|
{
|
||||||
wchar_t c = input_function_get_code(argv[i]);
|
wchar_t c = input_function_get_code(argv[i]);
|
||||||
if (c != (wchar_t)(-1))
|
if (c != INPUT_CODE_NONE)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
input_unreadch inserts the specified keypress or
|
input_unreadch inserts the specified keypress or
|
||||||
|
@ -557,7 +557,7 @@ static void input_mapping_execute(const input_mapping_t &m, bool allow_commands)
|
|||||||
|
|
||||||
for (wcstring_list_t::const_iterator it = m.commands.begin(), end = m.commands.end(); it != end; ++it)
|
for (wcstring_list_t::const_iterator it = m.commands.begin(), end = m.commands.end(); it != end; ++it)
|
||||||
{
|
{
|
||||||
if (input_function_get_code(*it) != -1)
|
if (input_function_get_code(*it) != INPUT_CODE_NONE)
|
||||||
has_functions = true;
|
has_functions = true;
|
||||||
else
|
else
|
||||||
has_commands = true;
|
has_commands = true;
|
||||||
@ -1103,14 +1103,12 @@ wcstring_list_t input_function_get_names(void)
|
|||||||
|
|
||||||
wchar_t input_function_get_code(const wcstring &name)
|
wchar_t input_function_get_code(const wcstring &name)
|
||||||
{
|
{
|
||||||
|
for (size_t i=0; i < sizeof code_arr / sizeof *code_arr; i++)
|
||||||
size_t i;
|
|
||||||
for (i = 0; i<(sizeof(code_arr)/sizeof(wchar_t)) ; i++)
|
|
||||||
{
|
{
|
||||||
if (name == name_arr[i])
|
if (name == name_arr[i])
|
||||||
{
|
{
|
||||||
return code_arr[i];
|
return code_arr[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return INPUT_CODE_NONE;
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,7 @@ bool input_terminfo_get_name(const wcstring &seq, wcstring *out_name);
|
|||||||
wcstring_list_t input_terminfo_get_names(bool skip_null);
|
wcstring_list_t input_terminfo_get_names(bool skip_null);
|
||||||
|
|
||||||
/** Returns the input function code for the given input function name. */
|
/** Returns the input function code for the given input function name. */
|
||||||
|
#define INPUT_CODE_NONE (wchar_t(-1))
|
||||||
wchar_t input_function_get_code(const wcstring &name);
|
wchar_t input_function_get_code(const wcstring &name);
|
||||||
|
|
||||||
/** Returns a list of all existing input function names */
|
/** Returns a list of all existing input function names */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user