mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
Merge branch 'master' into death_of_fishd
This commit is contained in:
commit
d554b7da08
6 changed files with 64 additions and 56 deletions
|
@ -2002,6 +2002,7 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
|
||||||
else if (! wcslen(argv[woptind]))
|
else if (! wcslen(argv[woptind]))
|
||||||
{
|
{
|
||||||
append_format(*out_err, _(L"%ls: No function name given\n"), argv[0]);
|
append_format(*out_err, _(L"%ls: No function name given\n"), argv[0]);
|
||||||
|
res=1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
10
configure.ac
10
configure.ac
|
@ -213,6 +213,16 @@ if test `uname` != "Darwin"; then
|
||||||
LDFLAGS_FISH="$LDFLAGS_FISH -rdynamic"
|
LDFLAGS_FISH="$LDFLAGS_FISH -rdynamic"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# On Cygwin, we need to add some flags for ncurses.
|
||||||
|
#
|
||||||
|
case `uname` in
|
||||||
|
CYGWIN*)
|
||||||
|
echo "adding flags for ncurses on Cygwin"
|
||||||
|
CXXFLAGS="$CXXFLAGS -I/usr/include -I/usr/include/ncursesw"
|
||||||
|
LDFLAGS_FISH="$LDFLAGS_FISH -L/usr/lib/ncursesw"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
#
|
#
|
||||||
# If we are compiling against glibc, set some flags to work around
|
# If we are compiling against glibc, set some flags to work around
|
||||||
|
|
|
@ -688,6 +688,9 @@ static void test_parser()
|
||||||
parser_t::principal_parser().eval(L"function recursive1 ; recursive2 ; end ; function recursive2 ; recursive1 ; end ; recursive1; ", io_chain_t(), TOP);
|
parser_t::principal_parser().eval(L"function recursive1 ; recursive2 ; end ; function recursive2 ; recursive1 ; end ; recursive1; ", io_chain_t(), TOP);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
say(L"Testing empty function name");
|
||||||
|
parser_t::principal_parser().eval(L"function '' ; echo fail; exit 42 ; end ; ''", io_chain_t(), TOP);
|
||||||
|
|
||||||
say(L"Testing eval_args");
|
say(L"Testing eval_args");
|
||||||
completion_list_t comps;
|
completion_list_t comps;
|
||||||
parser_t::principal_parser().expand_argument_list(L"alpha 'beta gamma' delta", comps);
|
parser_t::principal_parser().expand_argument_list(L"alpha 'beta gamma' delta", comps);
|
||||||
|
@ -1022,28 +1025,23 @@ static void test_wchar2utf8(const wchar_t *src, size_t slen, const char *dst, si
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
size = wchar_to_utf8(src, slen, mem, dlen, flags);
|
||||||
|
if (res != size)
|
||||||
{
|
{
|
||||||
size = wchar_to_utf8(src, slen, mem, dlen, flags);
|
err(L"w2u: %s: FAILED (rv: %lu, must be %lu)", descr, size, res);
|
||||||
if (res != size)
|
goto finish;
|
||||||
{
|
|
||||||
err(L"w2u: %s: FAILED (rv: %lu, must be %lu)", descr, size, res);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mem == NULL)
|
|
||||||
break; /* OK */
|
|
||||||
|
|
||||||
if (memcmp(mem, dst, size) != 0)
|
|
||||||
{
|
|
||||||
err(L"w2u: %s: BROKEN", descr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
while (0);
|
|
||||||
|
|
||||||
if (mem != NULL);
|
if (mem == NULL)
|
||||||
|
goto finish; /* OK */
|
||||||
|
|
||||||
|
if (memcmp(mem, dst, size) != 0)
|
||||||
|
{
|
||||||
|
err(L"w2u: %s: BROKEN", descr);
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
|
finish:
|
||||||
free(mem);
|
free(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
24
output.cpp
24
output.cpp
|
@ -418,13 +418,6 @@ int writeb(tputs_arg_t b)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int writembs_internal(char *str)
|
|
||||||
{
|
|
||||||
CHECK(str, 1);
|
|
||||||
|
|
||||||
return tputs(str,1,&writeb)==ERR?1:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int writech(wint_t ch)
|
int writech(wint_t ch)
|
||||||
{
|
{
|
||||||
mbstate_t state;
|
mbstate_t state;
|
||||||
|
@ -725,3 +718,20 @@ const wchar_t *output_get_term()
|
||||||
{
|
{
|
||||||
return current_term.empty() ? L"<unknown>" : current_term.c_str();
|
return current_term.empty() ? L"<unknown>" : current_term.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void writembs_check(char *mbs, const char *mbs_name, const char *file, long line)
|
||||||
|
{
|
||||||
|
if (mbs != NULL)
|
||||||
|
{
|
||||||
|
tputs(mbs, 1, &writeb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
debug( 0, _(L"Tried to use terminfo string %s on line %ld of %s, which is undefined in terminal of type \"%ls\". Please report this error to %s"),
|
||||||
|
mbs_name,
|
||||||
|
line,
|
||||||
|
file,
|
||||||
|
output_get_term(),
|
||||||
|
PACKAGE_BUGREPORT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
29
output.h
29
output.h
|
@ -78,33 +78,8 @@ void set_color(rgb_color_t c, rgb_color_t c2);
|
||||||
/**
|
/**
|
||||||
Write specified multibyte string
|
Write specified multibyte string
|
||||||
*/
|
*/
|
||||||
#define writembs( mbs ) \
|
void writembs_check(char *mbs, const char *mbs_name, const char *file, long line);
|
||||||
{ \
|
#define writembs(mbs) writembs_check((mbs), #mbs, __FILE__, __LINE__)
|
||||||
char *tmp = mbs; \
|
|
||||||
if( tmp ) \
|
|
||||||
{ \
|
|
||||||
writembs_internal( tmp ); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
debug( 0, \
|
|
||||||
_(L"Tried to use terminfo string %s on line %d of %s, which is undefined in terminal of type \"%ls\". Please report this error to %s"), \
|
|
||||||
#mbs, \
|
|
||||||
__LINE__, \
|
|
||||||
__FILE__, \
|
|
||||||
output_get_term(), \
|
|
||||||
PACKAGE_BUGREPORT); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Write a char * narrow string to FD 1, needed for the terminfo
|
|
||||||
strings. This is usually just a wrapper aound tputs, using writeb
|
|
||||||
as the sending function. But a weird bug on PPC Linux means that on
|
|
||||||
this platform, write is instead used directly.
|
|
||||||
*/
|
|
||||||
int writembs_internal(char *str);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write a wide character using the output method specified using output_set_writer().
|
Write a wide character using the output method specified using output_set_writer().
|
||||||
|
|
20
screen.cpp
20
screen.cpp
|
@ -638,18 +638,32 @@ static void s_move(screen_t *s, data_buffer_t *b, int new_x, int new_y)
|
||||||
x_steps = 0;
|
x_steps = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *multi_str = NULL;
|
||||||
if (x_steps < 0)
|
if (x_steps < 0)
|
||||||
{
|
{
|
||||||
str = cursor_left;
|
str = cursor_left;
|
||||||
|
multi_str = parm_left_cursor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str = cursor_right;
|
str = cursor_right;
|
||||||
|
multi_str = parm_right_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<abs(x_steps); i++)
|
// Use the bulk ('multi') output for cursor movement if it is supported and it would be shorter
|
||||||
|
// Note that this is required to avoid some visual glitches in iTerm (#1448)
|
||||||
|
bool use_multi = (multi_str != NULL && multi_str[0] != '\0' && abs(x_steps) * strlen(str) > strlen(multi_str));
|
||||||
|
if (use_multi)
|
||||||
{
|
{
|
||||||
writembs(str);
|
char *multi_param = tparm(multi_str, abs(x_steps));
|
||||||
|
writembs(multi_param);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i=0; i<abs(x_steps); i++)
|
||||||
|
{
|
||||||
|
writembs(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue