mirror of
https://github.com/zoriya/vim.git
synced 2025-12-31 03:18:25 +00:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e85d3d432 | ||
|
|
dee2e315d7 | ||
|
|
ede3e6383d | ||
|
|
6f1404f8a8 | ||
|
|
841fbd2907 | ||
|
|
c4b99e0be7 | ||
|
|
141be8a585 | ||
|
|
c476e52fca | ||
|
|
0bd80ccd85 | ||
|
|
808c2bc8bf | ||
|
|
389a1793f4 | ||
|
|
6c85e7f3be | ||
|
|
3dbcd0c7ad | ||
|
|
fe70acb376 | ||
|
|
d73895ec00 | ||
|
|
22f93c700f | ||
|
|
a6cc03101e | ||
|
|
db250526bb | ||
|
|
a0c85c7ae1 | ||
|
|
555d2a8340 | ||
|
|
d79862599d | ||
|
|
6324c3b920 | ||
|
|
06ae70d07c | ||
|
|
01b626c26e | ||
|
|
8c0e322f18 | ||
|
|
6949eea7cc | ||
|
|
5246cd7a9b | ||
|
|
03e114b0f2 | ||
|
|
70baa405f2 | ||
|
|
427d51c23f | ||
|
|
a50d02d983 | ||
|
|
5ab9d98b9a | ||
|
|
926b5d3b30 | ||
|
|
d69497413f | ||
|
|
4ce239b0b1 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -53,3 +53,4 @@ src/testdir/lua.vim
|
||||
src/testdir/small.vim
|
||||
src/testdir/tiny.vim
|
||||
src/testdir/test*.out
|
||||
src/testdir/test.log
|
||||
|
||||
27
src/Makefile
27
src/Makefile
@@ -1655,6 +1655,11 @@ tools: $(TOOLS)
|
||||
# sure configure is run when it's needed.
|
||||
#
|
||||
config auto/config.mk: auto/configure config.mk.in config.h.in
|
||||
if test -f auto/config.cache && \
|
||||
grep '^ac_cv_env_CFLAGS_value=' auto/config.cache > /dev/null && \
|
||||
! grep -x -F 'ac_cv_env_CFLAGS_value=$(CFLAGS)' auto/config.cache > /dev/null; then \
|
||||
rm auto/config.cache; \
|
||||
fi
|
||||
GUI_INC_LOC="$(GUI_INC_LOC)" GUI_LIB_LOC="$(GUI_LIB_LOC)" \
|
||||
CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
|
||||
LDFLAGS="$(LDFLAGS)" $(CONF_SHELL) srcdir="$(srcdir)" \
|
||||
@@ -1862,16 +1867,16 @@ unittest unittests: $(UNITTEST_TARGETS)
|
||||
done
|
||||
|
||||
# Run individual test, assuming that Vim was already compiled.
|
||||
test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 \
|
||||
test11 test12 test13 test14 test15 test16 test17 test18 test19 \
|
||||
test21 test22 test23 test24 test25 test26 test27 test28 test29 \
|
||||
test31 test32 test33 test34 test35 test36 test37 test38 test39 \
|
||||
test41 test42 test43 test44 test45 test46 test47 test48 test49 \
|
||||
test51 test52 test53 test54 test55 test56 test57 test58 test59 \
|
||||
test61 test62 test63 test64 test65 test66 test67 test68 test69 \
|
||||
test71 test72 test73 test74 test75 test76 test77 test78 test79 \
|
||||
test81 test82 test83 test84 test85 test86 test87 test88 test89 \
|
||||
test91 test92 test93 test94 test95 test96 test97 test98 test99:
|
||||
test1 test2 test3 test4 test5 test6 test7 test8 test9 \
|
||||
test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
|
||||
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
|
||||
test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \
|
||||
test40 test41 test42 test43 test44 test45 test46 test47 test48 test49 \
|
||||
test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \
|
||||
test60 test61 test62 test63 test64 test65 test66 test67 test68 test69 \
|
||||
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
|
||||
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
|
||||
test90 test91 test92 test93 test94 test95 test96 test97 test98 test99:
|
||||
cd testdir; rm $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET)
|
||||
|
||||
testclean:
|
||||
@@ -2311,7 +2316,7 @@ uninstall_runtime:
|
||||
-rm -rf $(DEST_COMP)
|
||||
-rm -f $(DEST_PRINT)/*.ps
|
||||
-rmdir $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND)
|
||||
-rm -rf $(DEST_FTP)/*.vim $(DEST_FTP)/README.txt
|
||||
-rm -rf $(DEST_FTP)/*.vim $(DEST_FTP)/README.txt $(DEST_FTP)/logtalk.dict
|
||||
-rm -f $(DEST_AUTO)/*.vim $(DEST_AUTO)/README.txt $(DEST_AUTO)/xml/*.vim
|
||||
-rm -f $(DEST_PLUG)/*.vim $(DEST_PLUG)/README.txt
|
||||
-rmdir $(DEST_FTP) $(DEST_AUTO)/xml $(DEST_AUTO) $(DEST_PLUG) $(DEST_RT)
|
||||
|
||||
21
src/auto/configure
vendored
21
src/auto/configure
vendored
@@ -5133,6 +5133,7 @@ $as_echo_n "checking if compile and link flags for Perl are sane... " >&6; }
|
||||
ldflags_save=$LDFLAGS
|
||||
CFLAGS="$CFLAGS $perlcppflags"
|
||||
LIBS="$LIBS $perllibs"
|
||||
perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'`
|
||||
LDFLAGS="$perlldflags $LDFLAGS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
@@ -5162,7 +5163,9 @@ rm -f core conftest.err conftest.$ac_objext \
|
||||
PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[^ ]*//'`
|
||||
fi
|
||||
if test "X$perlldflags" != "X"; then
|
||||
LDFLAGS="$perlldflags $LDFLAGS"
|
||||
if test "X`echo \"$LDFLAGS\" | grep -F -e \"$perlldflags\"`" = "X"; then
|
||||
LDFLAGS="$perlldflags $LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
PERL_LIBS=$perllibs
|
||||
PERL_SRC="auto/if_perl.c if_perlsfio.c"
|
||||
@@ -6454,7 +6457,9 @@ $as_echo "$rubyhdrdir" >&6; }
|
||||
if test "X$rubyldflags" != "X"; then
|
||||
rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
|
||||
if test "X$rubyldflags" != "X"; then
|
||||
LDFLAGS="$rubyldflags $LDFLAGS"
|
||||
if test "X`echo \"$LDFLAGS\" | grep -F -e \"$rubyldflags\"`" = "X"; then
|
||||
LDFLAGS="$rubyldflags $LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
RUBY_SRC="if_ruby.c"
|
||||
@@ -8346,9 +8351,9 @@ $as_echo "no" >&6; }
|
||||
|
||||
GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of Motif GUI libs" >&5
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of Motif GUI libs" >&5
|
||||
$as_echo_n "checking for location of Motif GUI libs... " >&6; }
|
||||
gui_libs="`echo $x_libraries|sed 's%/^/^/*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
|
||||
gui_libs="`echo $x_libraries|sed 's%/^/^/*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
|
||||
GUI_LIB_LOC=
|
||||
for try in $gui_libs; do
|
||||
for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
|
||||
@@ -8358,7 +8363,9 @@ $as_echo_n "checking for location of Motif GUI libs... " >&6; }
|
||||
done
|
||||
done
|
||||
if test -n "$GUI_LIB_LOC"; then
|
||||
if test "$GUI_LIB_LOC" = /usr/lib; then
|
||||
if test "$GUI_LIB_LOC" = /usr/lib \
|
||||
-o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \
|
||||
-o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then
|
||||
GUI_LIB_LOC=
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: in default path" >&5
|
||||
$as_echo "in default path" >&6; }
|
||||
@@ -12688,7 +12695,7 @@ $as_echo "no" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_FORTIFY_SOURCE=1" >&5
|
||||
$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
|
||||
if test "$gccmajor" -gt "3"; then
|
||||
CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/-D_FORTIFY_SOURCE=.//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
|
||||
CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
@@ -12703,7 +12710,7 @@ $as_echo_n "checking linker --as-needed support... " >&6; }
|
||||
LINK_AS_NEEDED=
|
||||
# Check if linker supports --as-needed and --no-as-needed options
|
||||
if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
|
||||
LDFLAGS="$LDFLAGS -Wl,--as-needed"
|
||||
LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'`
|
||||
LINK_AS_NEEDED=yes
|
||||
fi
|
||||
if test "$LINK_AS_NEEDED" = yes; then
|
||||
|
||||
@@ -984,6 +984,10 @@ do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit)
|
||||
|
||||
return errormsg;
|
||||
}
|
||||
#endif /* FEAT_LISTCMDS */
|
||||
|
||||
#if defined(FEAT_LISTCMDS) || defined(FEAT_PYTHON) \
|
||||
|| defined(FEAT_PYTHON3) || defined(PROTO)
|
||||
|
||||
/*
|
||||
* Implementation of the commands for the buffer list.
|
||||
@@ -1364,8 +1368,7 @@ do_buffer(action, start, dir, count, forceit)
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* FEAT_LISTCMDS */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set current buffer to "buf". Executes autocommands and closes current
|
||||
|
||||
@@ -776,6 +776,7 @@ if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
|
||||
ldflags_save=$LDFLAGS
|
||||
CFLAGS="$CFLAGS $perlcppflags"
|
||||
LIBS="$LIBS $perllibs"
|
||||
perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'`
|
||||
LDFLAGS="$perlldflags $LDFLAGS"
|
||||
AC_TRY_LINK(,[ ],
|
||||
AC_MSG_RESULT(yes); perl_ok=yes,
|
||||
@@ -789,7 +790,9 @@ if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
|
||||
PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
|
||||
fi
|
||||
if test "X$perlldflags" != "X"; then
|
||||
LDFLAGS="$perlldflags $LDFLAGS"
|
||||
if test "X`echo \"$LDFLAGS\" | grep -F -e \"$perlldflags\"`" = "X"; then
|
||||
LDFLAGS="$perlldflags $LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
PERL_LIBS=$perllibs
|
||||
PERL_SRC="auto/if_perl.c if_perlsfio.c"
|
||||
@@ -1546,7 +1549,9 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
|
||||
dnl configure, so strip these flags first (if present)
|
||||
rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
|
||||
if test "X$rubyldflags" != "X"; then
|
||||
LDFLAGS="$rubyldflags $LDFLAGS"
|
||||
if test "X`echo \"$LDFLAGS\" | grep -F -e \"$rubyldflags\"`" = "X"; then
|
||||
LDFLAGS="$rubyldflags $LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
RUBY_SRC="if_ruby.c"
|
||||
@@ -2277,8 +2282,10 @@ if test -z "$SKIP_MOTIF"; then
|
||||
dnl Remove "-L" from before $GUI_LIB_LOC if it's there
|
||||
GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
|
||||
|
||||
dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere. The
|
||||
dnl linker will figure out which one to use, we only check if one exists.
|
||||
AC_MSG_CHECKING(for location of Motif GUI libs)
|
||||
gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
|
||||
gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
|
||||
GUI_LIB_LOC=
|
||||
for try in $gui_libs; do
|
||||
for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
|
||||
@@ -2289,7 +2296,9 @@ if test -z "$SKIP_MOTIF"; then
|
||||
done
|
||||
if test -n "$GUI_LIB_LOC"; then
|
||||
dnl Remove /usr/lib, it causes trouble on some systems
|
||||
if test "$GUI_LIB_LOC" = /usr/lib; then
|
||||
if test "$GUI_LIB_LOC" = /usr/lib \
|
||||
-o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \
|
||||
-o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then
|
||||
GUI_LIB_LOC=
|
||||
AC_MSG_RESULT(in default path)
|
||||
else
|
||||
@@ -3715,7 +3724,7 @@ if test "$GCC" = yes; then
|
||||
dnl And undefine it first to avoid a warning.
|
||||
AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
|
||||
if test "$gccmajor" -gt "3"; then
|
||||
CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/-D_FORTIFY_SOURCE=.//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
|
||||
CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
@@ -3730,7 +3739,7 @@ AC_MSG_CHECKING(linker --as-needed support)
|
||||
LINK_AS_NEEDED=
|
||||
# Check if linker supports --as-needed and --no-as-needed options
|
||||
if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
|
||||
LDFLAGS="$LDFLAGS -Wl,--as-needed"
|
||||
LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'`
|
||||
LINK_AS_NEEDED=yes
|
||||
fi
|
||||
if test "$LINK_AS_NEEDED" = yes; then
|
||||
|
||||
35
src/eval.c
35
src/eval.c
@@ -112,7 +112,9 @@ static char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary");
|
||||
static char *e_letwrong = N_("E734: Wrong variable type for %s=");
|
||||
static char *e_nofunc = N_("E130: Unknown function: %s");
|
||||
static char *e_illvar = N_("E461: Illegal variable name: %s");
|
||||
#ifdef FEAT_FLOAT
|
||||
static char *e_float_as_string = N_("E806: using Float as a String");
|
||||
#endif
|
||||
|
||||
static dictitem_T globvars_var; /* variable used for g: */
|
||||
#define globvarht globvardict.dv_hashtab
|
||||
@@ -3226,7 +3228,7 @@ next_for_item(fi_void, arg)
|
||||
void *fi_void;
|
||||
char_u *arg;
|
||||
{
|
||||
forinfo_T *fi = (forinfo_T *)fi_void;
|
||||
forinfo_T *fi = (forinfo_T *)fi_void;
|
||||
int result;
|
||||
listitem_T *item;
|
||||
|
||||
@@ -11882,7 +11884,7 @@ f_getwinposy(argvars, rettv)
|
||||
static win_T *
|
||||
find_win_by_nr(vp, tp)
|
||||
typval_T *vp;
|
||||
tabpage_T *tp; /* NULL for current tab page */
|
||||
tabpage_T *tp UNUSED; /* NULL for current tab page */
|
||||
{
|
||||
#ifdef FEAT_WINDOWS
|
||||
win_T *wp;
|
||||
@@ -11932,7 +11934,8 @@ getwinvar(argvars, rettv, off)
|
||||
win_T *win, *oldcurwin;
|
||||
char_u *varname;
|
||||
dictitem_T *v;
|
||||
tabpage_T *tp, *oldtabpage;
|
||||
tabpage_T *tp = NULL;
|
||||
tabpage_T *oldtabpage;
|
||||
int done = FALSE;
|
||||
|
||||
#ifdef FEAT_WINDOWS
|
||||
@@ -11952,7 +11955,7 @@ getwinvar(argvars, rettv, off)
|
||||
{
|
||||
/* Set curwin to be our win, temporarily. Also set the tabpage,
|
||||
* otherwise the window is not valid. */
|
||||
switch_win(&oldcurwin, &oldtabpage, win, tp);
|
||||
switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE);
|
||||
|
||||
if (*varname == '&') /* window-local-option */
|
||||
{
|
||||
@@ -11972,7 +11975,7 @@ getwinvar(argvars, rettv, off)
|
||||
}
|
||||
|
||||
/* restore previous notion of curwin */
|
||||
restore_win(oldcurwin, oldtabpage);
|
||||
restore_win(oldcurwin, oldtabpage, TRUE);
|
||||
}
|
||||
|
||||
if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)
|
||||
@@ -16683,24 +16686,34 @@ f_settabvar(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
#ifdef FEAT_WINDOWS
|
||||
tabpage_T *save_curtab;
|
||||
tabpage_T *tp;
|
||||
#endif
|
||||
char_u *varname, *tabvarname;
|
||||
typval_T *varp;
|
||||
tabpage_T *tp;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
|
||||
if (check_restricted() || check_secure())
|
||||
return;
|
||||
|
||||
#ifdef FEAT_WINDOWS
|
||||
tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL));
|
||||
#endif
|
||||
varname = get_tv_string_chk(&argvars[1]);
|
||||
varp = &argvars[2];
|
||||
|
||||
if (tp != NULL && varname != NULL && varp != NULL)
|
||||
if (varname != NULL && varp != NULL
|
||||
#ifdef FEAT_WINDOWS
|
||||
&& tp != NULL
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef FEAT_WINDOWS
|
||||
save_curtab = curtab;
|
||||
goto_tabpage_tp(tp, FALSE, FALSE);
|
||||
#endif
|
||||
|
||||
tabvarname = alloc((unsigned)STRLEN(varname) + 3);
|
||||
if (tabvarname != NULL)
|
||||
@@ -16711,9 +16724,11 @@ f_settabvar(argvars, rettv)
|
||||
vim_free(tabvarname);
|
||||
}
|
||||
|
||||
#ifdef FEAT_WINDOWS
|
||||
/* Restore current tabpage */
|
||||
if (valid_tabpage(save_curtab))
|
||||
goto_tabpage_tp(save_curtab, FALSE, FALSE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16757,7 +16772,7 @@ setwinvar(argvars, rettv, off)
|
||||
char_u *varname, *winvarname;
|
||||
typval_T *varp;
|
||||
char_u nbuf[NUMBUFLEN];
|
||||
tabpage_T *tp;
|
||||
tabpage_T *tp = NULL;
|
||||
|
||||
if (check_restricted() || check_secure())
|
||||
return;
|
||||
@@ -16775,7 +16790,7 @@ setwinvar(argvars, rettv, off)
|
||||
if (win != NULL && varname != NULL && varp != NULL)
|
||||
{
|
||||
#ifdef FEAT_WINDOWS
|
||||
if (switch_win(&save_curwin, &save_curtab, win, tp) == FAIL)
|
||||
if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == FAIL)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -16804,7 +16819,7 @@ setwinvar(argvars, rettv, off)
|
||||
}
|
||||
|
||||
#ifdef FEAT_WINDOWS
|
||||
restore_win(save_curwin, save_curtab);
|
||||
restore_win(save_curwin, save_curtab, TRUE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3603,6 +3603,7 @@ set_one_cmd_context(xp, buff)
|
||||
case CMD_sandbox:
|
||||
case CMD_silent:
|
||||
case CMD_tab:
|
||||
case CMD_tabdo:
|
||||
case CMD_topleft:
|
||||
case CMD_verbose:
|
||||
case CMD_vertical:
|
||||
|
||||
@@ -1700,13 +1700,13 @@ getcmdline(firstc, count, indent)
|
||||
* We come here if we have a normal character.
|
||||
*/
|
||||
|
||||
if (do_abbr && (IS_SPECIAL(c) || !vim_iswordc(c)) && ccheck_abbr(
|
||||
if (do_abbr && (IS_SPECIAL(c) || !vim_iswordc(c)) && (ccheck_abbr(
|
||||
#ifdef FEAT_MBYTE
|
||||
/* Add ABBR_OFF for characters above 0x100, this is
|
||||
* what check_abbr() expects. */
|
||||
(has_mbyte && c >= 0x100) ? (c + ABBR_OFF) :
|
||||
#endif
|
||||
c))
|
||||
c) || c == Ctrl_RSB))
|
||||
goto cmdline_changed;
|
||||
|
||||
/*
|
||||
|
||||
37
src/gui.c
37
src/gui.c
@@ -410,6 +410,14 @@ gui_init_check()
|
||||
gui.fontset = NOFONTSET;
|
||||
# endif
|
||||
#endif
|
||||
#ifdef FEAT_MBYTE
|
||||
gui.wide_font = NOFONT;
|
||||
# ifndef FEAT_GUI_GTK
|
||||
gui.wide_bold_font = NOFONT;
|
||||
gui.wide_ital_font = NOFONT;
|
||||
gui.wide_boldital_font = NOFONT;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_MENU
|
||||
# ifndef FEAT_GUI_GTK
|
||||
@@ -1012,6 +1020,11 @@ gui_get_wide_font()
|
||||
gui.wide_font = font;
|
||||
# ifdef FEAT_GUI_MSWIN
|
||||
gui_mch_wide_font_changed();
|
||||
# else
|
||||
/*
|
||||
* TODO: setup wide_bold_font, wide_ital_font and wide_boldital_font to
|
||||
* support those fonts for 'guifontwide'.
|
||||
*/
|
||||
# endif
|
||||
return OK;
|
||||
}
|
||||
@@ -2180,6 +2193,9 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
||||
guicolor_T sp_color;
|
||||
#if !defined(MSWIN16_FASTTEXT) && !defined(FEAT_GUI_GTK)
|
||||
GuiFont font = NOFONT;
|
||||
# ifdef FEAT_MBYTE
|
||||
GuiFont wide_font = NOFONT;
|
||||
# endif
|
||||
# ifdef FEAT_XFONTSET
|
||||
GuiFontset fontset = NOFONTSET;
|
||||
# endif
|
||||
@@ -2269,6 +2285,23 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
||||
}
|
||||
else
|
||||
font = gui.norm_font;
|
||||
|
||||
# ifdef FEAT_MBYTE
|
||||
/*
|
||||
* Choose correct wide_font by font. wide_font should be set with font
|
||||
* at same time in above block. But it will make many "ifdef" nasty
|
||||
* blocks. So we do it here.
|
||||
*/
|
||||
if (font == gui.boldital_font && gui.wide_boldital_font)
|
||||
wide_font = gui.wide_boldital_font;
|
||||
else if (font == gui.bold_font && gui.wide_bold_font)
|
||||
wide_font = gui.wide_bold_font;
|
||||
else if (font == gui.ital_font && gui.wide_ital_font)
|
||||
wide_font = gui.wide_ital_font;
|
||||
else if (font == gui.norm_font && gui.wide_font)
|
||||
wide_font = gui.wide_font;
|
||||
# endif
|
||||
|
||||
}
|
||||
# ifdef FEAT_XFONTSET
|
||||
if (fontset != NOFONTSET)
|
||||
@@ -2407,7 +2440,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
||||
# ifdef FEAT_XFONTSET
|
||||
&& fontset == NOFONTSET
|
||||
# endif
|
||||
&& gui.wide_font != NOFONT)
|
||||
&& wide_font != NOFONT)
|
||||
curr_wide = TRUE;
|
||||
else
|
||||
curr_wide = FALSE;
|
||||
@@ -2441,7 +2474,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
||||
if (thislen > 0)
|
||||
{
|
||||
if (prev_wide)
|
||||
gui_mch_set_font(gui.wide_font);
|
||||
gui_mch_set_font(wide_font);
|
||||
gui_mch_draw_string(gui.row, scol, s + start, thislen,
|
||||
draw_flags);
|
||||
if (prev_wide)
|
||||
|
||||
@@ -311,7 +311,12 @@ typedef struct Gui
|
||||
# endif
|
||||
#endif
|
||||
#ifdef FEAT_MBYTE
|
||||
GuiFont wide_font; /* 'guifontwide' font */
|
||||
GuiFont wide_font; /* Normal 'guifontwide' font */
|
||||
# ifndef FEAT_GUI_GTK
|
||||
GuiFont wide_bold_font; /* Bold 'guifontwide' font */
|
||||
GuiFont wide_ital_font; /* Italic 'guifontwide' font */
|
||||
GuiFont wide_boldital_font; /* Bold-Italic 'guifontwide' font */
|
||||
# endif
|
||||
#endif
|
||||
#ifdef FEAT_XFONTSET
|
||||
GuiFontset fontset; /* set of fonts for multi-byte chars */
|
||||
|
||||
@@ -3653,7 +3653,7 @@ find_replace_keypress(w, frdp, event)
|
||||
static void
|
||||
set_label(w, label)
|
||||
Widget w;
|
||||
char_u *label;
|
||||
char *label;
|
||||
{
|
||||
XmString str;
|
||||
char_u *p, *next;
|
||||
@@ -3662,7 +3662,7 @@ set_label(w, label)
|
||||
if (!w)
|
||||
return;
|
||||
|
||||
p = vim_strsave(label);
|
||||
p = vim_strsave((char_u *)label);
|
||||
if (p == NULL)
|
||||
return;
|
||||
for (next = p; *next; ++next)
|
||||
|
||||
@@ -3123,9 +3123,43 @@ update_im_font()
|
||||
void
|
||||
gui_mch_wide_font_changed()
|
||||
{
|
||||
# ifndef MSWIN16_FASTTEXT
|
||||
LOGFONT lf;
|
||||
# endif
|
||||
|
||||
# ifdef FEAT_MBYTE_IME
|
||||
update_im_font();
|
||||
# endif
|
||||
|
||||
# ifndef MSWIN16_FASTTEXT
|
||||
gui_mch_free_font(gui.wide_ital_font);
|
||||
gui.wide_ital_font = NOFONT;
|
||||
gui_mch_free_font(gui.wide_bold_font);
|
||||
gui.wide_bold_font = NOFONT;
|
||||
gui_mch_free_font(gui.wide_boldital_font);
|
||||
gui.wide_boldital_font = NOFONT;
|
||||
|
||||
if (gui.wide_font
|
||||
&& GetObject((HFONT)gui.wide_font, sizeof(lf), &lf))
|
||||
{
|
||||
if (!lf.lfItalic)
|
||||
{
|
||||
lf.lfItalic = TRUE;
|
||||
gui.wide_ital_font = get_font_handle(&lf);
|
||||
lf.lfItalic = FALSE;
|
||||
}
|
||||
if (lf.lfWeight < FW_BOLD)
|
||||
{
|
||||
lf.lfWeight = FW_BOLD;
|
||||
gui.wide_bold_font = get_font_handle(&lf);
|
||||
if (!lf.lfItalic)
|
||||
{
|
||||
lf.lfItalic = TRUE;
|
||||
gui.wide_boldital_font = get_font_handle(&lf);
|
||||
}
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
1193
src/if_py_both.h
1193
src/if_py_both.h
File diff suppressed because it is too large
Load Diff
@@ -68,12 +68,9 @@
|
||||
#undef main /* Defined in python.h - aargh */
|
||||
#undef HAVE_FCNTL_H /* Clash with os_win32.h */
|
||||
|
||||
#define PyBytes_FromString PyString_FromString
|
||||
#define PyBytes_Check PyString_Check
|
||||
|
||||
/* No-op conversion functions, use with care! */
|
||||
#define PyString_AsBytes(obj) (obj)
|
||||
#define PyString_FreeBytes(obj)
|
||||
#define PyBytes_FromString PyString_FromString
|
||||
#define PyBytes_Check PyString_Check
|
||||
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
|
||||
|
||||
#if !defined(FEAT_PYTHON) && defined(PROTO)
|
||||
/* Use this to be able to generate prototypes without python being used. */
|
||||
@@ -163,6 +160,7 @@ struct PyMethodDef { Py_ssize_t a; };
|
||||
# define PyErr_BadArgument dll_PyErr_BadArgument
|
||||
# define PyErr_NewException dll_PyErr_NewException
|
||||
# define PyErr_Clear dll_PyErr_Clear
|
||||
# define PyErr_Format dll_PyErr_Format
|
||||
# define PyErr_PrintEx dll_PyErr_PrintEx
|
||||
# define PyErr_NoMemory dll_PyErr_NoMemory
|
||||
# define PyErr_Occurred dll_PyErr_Occurred
|
||||
@@ -222,6 +220,7 @@ struct PyMethodDef { Py_ssize_t a; };
|
||||
# define PyObject_CallFunctionObjArgs dll_PyObject_CallFunctionObjArgs
|
||||
# define PyObject_CallFunction dll_PyObject_CallFunction
|
||||
# define PyObject_Call dll_PyObject_Call
|
||||
# define PyObject_Repr dll_PyObject_Repr
|
||||
# define PyString_AsString dll_PyString_AsString
|
||||
# define PyString_AsStringAndSize dll_PyString_AsStringAndSize
|
||||
# define PyString_FromString dll_PyString_FromString
|
||||
@@ -235,6 +234,8 @@ struct PyMethodDef { Py_ssize_t a; };
|
||||
# define PyFloat_AsDouble dll_PyFloat_AsDouble
|
||||
# define PyFloat_FromDouble dll_PyFloat_FromDouble
|
||||
# define PyFloat_Type (*dll_PyFloat_Type)
|
||||
# define PyNumber_Check dll_PyNumber_Check
|
||||
# define PyNumber_Long dll_PyNumber_Long
|
||||
# define PyImport_AddModule (*dll_PyImport_AddModule)
|
||||
# define PySys_SetObject dll_PySys_SetObject
|
||||
# define PySys_GetObject dll_PySys_GetObject
|
||||
@@ -304,6 +305,7 @@ static int(*dll_PyDict_SetItemString)(PyObject *dp, char *key, PyObject *item);
|
||||
static int(*dll_PyErr_BadArgument)(void);
|
||||
static PyObject *(*dll_PyErr_NewException)(char *, PyObject *, PyObject *);
|
||||
static void(*dll_PyErr_Clear)(void);
|
||||
static PyObject*(*dll_PyErr_Format)(PyObject *, const char *, ...);
|
||||
static void(*dll_PyErr_PrintEx)(int);
|
||||
static PyObject*(*dll_PyErr_NoMemory)(void);
|
||||
static PyObject*(*dll_PyErr_Occurred)(void);
|
||||
@@ -361,6 +363,7 @@ static PyObject* (*dll_PyObject_SetAttrString)(PyObject *, const char *, PyObjec
|
||||
static PyObject* (*dll_PyObject_CallFunctionObjArgs)(PyObject *, ...);
|
||||
static PyObject* (*dll_PyObject_CallFunction)(PyObject *, char *, ...);
|
||||
static PyObject* (*dll_PyObject_Call)(PyObject *, PyObject *, PyObject *);
|
||||
static PyObject* (*dll_PyObject_Repr)(PyObject *);
|
||||
static char*(*dll_PyString_AsString)(PyObject *);
|
||||
static int(*dll_PyString_AsStringAndSize)(PyObject *, char **, int *);
|
||||
static PyObject*(*dll_PyString_FromString)(const char *);
|
||||
@@ -373,6 +376,8 @@ static PyObject *(*py_PyUnicode_AsEncodedString)(PyObject *, char *, char *);
|
||||
static double(*dll_PyFloat_AsDouble)(PyObject *);
|
||||
static PyObject*(*dll_PyFloat_FromDouble)(double);
|
||||
static PyTypeObject* dll_PyFloat_Type;
|
||||
static int(*dll_PyNumber_Check)(PyObject *);
|
||||
static PyObject*(*dll_PyNumber_Long)(PyObject *);
|
||||
static int(*dll_PySys_SetObject)(char *, PyObject *);
|
||||
static PyObject *(*dll_PySys_GetObject)(char *);
|
||||
static int(*dll_PySys_SetArgv)(int, char **);
|
||||
@@ -441,6 +446,7 @@ static PyObject *imp_PyExc_TypeError;
|
||||
static PyObject *imp_PyExc_ValueError;
|
||||
static PyObject *imp_PyExc_RuntimeError;
|
||||
static PyObject *imp_PyExc_ImportError;
|
||||
static PyObject *imp_PyExc_OverflowError;
|
||||
|
||||
# define PyExc_AttributeError imp_PyExc_AttributeError
|
||||
# define PyExc_IndexError imp_PyExc_IndexError
|
||||
@@ -450,6 +456,7 @@ static PyObject *imp_PyExc_ImportError;
|
||||
# define PyExc_ValueError imp_PyExc_ValueError
|
||||
# define PyExc_RuntimeError imp_PyExc_RuntimeError
|
||||
# define PyExc_ImportError imp_PyExc_ImportError
|
||||
# define PyExc_OverflowError imp_PyExc_OverflowError
|
||||
|
||||
/*
|
||||
* Table of name to function pointer of python.
|
||||
@@ -476,6 +483,7 @@ static struct
|
||||
{"PyErr_BadArgument", (PYTHON_PROC*)&dll_PyErr_BadArgument},
|
||||
{"PyErr_NewException", (PYTHON_PROC*)&dll_PyErr_NewException},
|
||||
{"PyErr_Clear", (PYTHON_PROC*)&dll_PyErr_Clear},
|
||||
{"PyErr_Format", (PYTHON_PROC*)&dll_PyErr_Format},
|
||||
{"PyErr_PrintEx", (PYTHON_PROC*)&dll_PyErr_PrintEx},
|
||||
{"PyErr_NoMemory", (PYTHON_PROC*)&dll_PyErr_NoMemory},
|
||||
{"PyErr_Occurred", (PYTHON_PROC*)&dll_PyErr_Occurred},
|
||||
@@ -533,6 +541,7 @@ static struct
|
||||
{"PyObject_CallFunctionObjArgs", (PYTHON_PROC*)&dll_PyObject_CallFunctionObjArgs},
|
||||
{"PyObject_CallFunction", (PYTHON_PROC*)&dll_PyObject_CallFunction},
|
||||
{"PyObject_Call", (PYTHON_PROC*)&dll_PyObject_Call},
|
||||
{"PyObject_Repr", (PYTHON_PROC*)&dll_PyObject_Repr},
|
||||
{"PyString_AsString", (PYTHON_PROC*)&dll_PyString_AsString},
|
||||
{"PyString_AsStringAndSize", (PYTHON_PROC*)&dll_PyString_AsStringAndSize},
|
||||
{"PyString_FromString", (PYTHON_PROC*)&dll_PyString_FromString},
|
||||
@@ -545,6 +554,8 @@ static struct
|
||||
{"PyFloat_AsDouble", (PYTHON_PROC*)&dll_PyFloat_AsDouble},
|
||||
{"PyFloat_FromDouble", (PYTHON_PROC*)&dll_PyFloat_FromDouble},
|
||||
{"PyImport_AddModule", (PYTHON_PROC*)&dll_PyImport_AddModule},
|
||||
{"PyNumber_Check", (PYTHON_PROC*)&dll_PyNumber_Check},
|
||||
{"PyNumber_Long", (PYTHON_PROC*)&dll_PyNumber_Long},
|
||||
{"PySys_SetObject", (PYTHON_PROC*)&dll_PySys_SetObject},
|
||||
{"PySys_GetObject", (PYTHON_PROC*)&dll_PySys_GetObject},
|
||||
{"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv},
|
||||
@@ -722,6 +733,7 @@ get_exceptions(void)
|
||||
imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
|
||||
imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
|
||||
imp_PyExc_ImportError = PyDict_GetItemString(exdict, "ImportError");
|
||||
imp_PyExc_OverflowError = PyDict_GetItemString(exdict, "OverflowError");
|
||||
Py_XINCREF(imp_PyExc_AttributeError);
|
||||
Py_XINCREF(imp_PyExc_IndexError);
|
||||
Py_XINCREF(imp_PyExc_KeyError);
|
||||
@@ -730,6 +742,7 @@ get_exceptions(void)
|
||||
Py_XINCREF(imp_PyExc_ValueError);
|
||||
Py_XINCREF(imp_PyExc_RuntimeError);
|
||||
Py_XINCREF(imp_PyExc_ImportError);
|
||||
Py_XINCREF(imp_PyExc_OverflowError);
|
||||
Py_XDECREF(exmod);
|
||||
}
|
||||
#endif /* DYNAMIC_PYTHON */
|
||||
@@ -1391,8 +1404,7 @@ PythonMod_Init(void)
|
||||
vim_module = Py_InitModule4("vim", VimMethods, (char *)NULL,
|
||||
(PyObject *)NULL, PYTHON_API_VERSION);
|
||||
|
||||
if (populate_module(vim_module, PyModule_AddObject,
|
||||
PyObject_GetAttrString))
|
||||
if (populate_module(vim_module))
|
||||
return -1;
|
||||
|
||||
if (init_sys_path())
|
||||
|
||||
@@ -84,13 +84,8 @@
|
||||
|
||||
#define PyInt Py_ssize_t
|
||||
#define PyString_Check(obj) PyUnicode_Check(obj)
|
||||
#define PyString_AsBytes(obj) PyUnicode_AsEncodedString(obj, (char *)ENC_OPT, CODEC_ERROR_HANDLER)
|
||||
#define PyString_FreeBytes(obj) Py_XDECREF(bytes)
|
||||
#define PyString_AsString(obj) PyBytes_AsString(obj)
|
||||
#define PyString_Size(obj) PyBytes_GET_SIZE(bytes)
|
||||
#define PyString_FromString(repr) PyUnicode_FromString(repr)
|
||||
#define PyString_FromFormat PyUnicode_FromFormat
|
||||
#define PyString_AsStringAndSize(obj, buffer, len) PyBytes_AsStringAndSize(obj, buffer, len)
|
||||
#define PyInt_Check(obj) PyLong_Check(obj)
|
||||
#define PyInt_FromLong(i) PyLong_FromLong(i)
|
||||
#define PyInt_AsLong(obj) PyLong_AsLong(obj)
|
||||
@@ -127,6 +122,7 @@
|
||||
# define PyDict_SetItemString py3_PyDict_SetItemString
|
||||
# define PyErr_BadArgument py3_PyErr_BadArgument
|
||||
# define PyErr_Clear py3_PyErr_Clear
|
||||
# define PyErr_Format py3_PyErr_Format
|
||||
# define PyErr_PrintEx py3_PyErr_PrintEx
|
||||
# define PyErr_NoMemory py3_PyErr_NoMemory
|
||||
# define PyErr_Occurred py3_PyErr_Occurred
|
||||
@@ -164,6 +160,7 @@
|
||||
# define PyMapping_Keys py3_PyMapping_Keys
|
||||
# define PyIter_Next py3_PyIter_Next
|
||||
# define PyObject_GetIter py3_PyObject_GetIter
|
||||
# define PyObject_Repr py3_PyObject_Repr
|
||||
# define PyObject_GetItem py3_PyObject_GetItem
|
||||
# define PyObject_IsTrue py3_PyObject_IsTrue
|
||||
# define PyModule_GetDict py3_PyModule_GetDict
|
||||
@@ -215,6 +212,8 @@
|
||||
# define PyType_Type (*py3_PyType_Type)
|
||||
# define PySlice_Type (*py3_PySlice_Type)
|
||||
# define PyFloat_Type (*py3_PyFloat_Type)
|
||||
# define PyNumber_Check (*py3_PyNumber_Check)
|
||||
# define PyNumber_Long (*py3_PyNumber_Long)
|
||||
# define PyBool_Type (*py3_PyBool_Type)
|
||||
# define PyErr_NewException py3_PyErr_NewException
|
||||
# ifdef Py_DEBUG
|
||||
@@ -314,6 +313,7 @@ static PyObject* (*py3_PyLong_FromLong)(long);
|
||||
static PyObject* (*py3_PyDict_New)(void);
|
||||
static PyObject* (*py3_PyIter_Next)(PyObject *);
|
||||
static PyObject* (*py3_PyObject_GetIter)(PyObject *);
|
||||
static PyObject* (*py3_PyObject_Repr)(PyObject *);
|
||||
static PyObject* (*py3_PyObject_GetItem)(PyObject *, PyObject *);
|
||||
static int (*py3_PyObject_IsTrue)(PyObject *);
|
||||
static PyObject* (*py3_Py_BuildValue)(char *, ...);
|
||||
@@ -342,6 +342,7 @@ static int (*py3_PyMem_Free)(void *);
|
||||
static void* (*py3_PyMem_Malloc)(size_t);
|
||||
static int (*py3_Py_IsInitialized)(void);
|
||||
static void (*py3_PyErr_Clear)(void);
|
||||
static PyObject* (*py3_PyErr_Format)(PyObject *, const char *, ...);
|
||||
static void (*py3_PyErr_PrintEx)(int);
|
||||
static PyObject*(*py3__PyObject_Init)(PyObject *, PyTypeObject *);
|
||||
static iternextfunc py3__PyObject_NextNotImplemented;
|
||||
@@ -357,7 +358,7 @@ static char* (*py3__PyUnicode_AsString)(PyObject *unicode);
|
||||
# endif
|
||||
static PyObject* (*py3_PyUnicode_AsEncodedString)(PyObject *unicode, const char* encoding, const char* errors);
|
||||
static char* (*py3_PyBytes_AsString)(PyObject *bytes);
|
||||
static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, int *length);
|
||||
static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, Py_ssize_t *length);
|
||||
static PyObject* (*py3_PyBytes_FromString)(char *str);
|
||||
static PyObject* (*py3_PyFloat_FromDouble)(double num);
|
||||
static double (*py3_PyFloat_AsDouble)(PyObject *);
|
||||
@@ -368,6 +369,8 @@ static PyTypeObject* py3_PyType_Type;
|
||||
static PyTypeObject* py3_PySlice_Type;
|
||||
static PyTypeObject* py3_PyFloat_Type;
|
||||
static PyTypeObject* py3_PyBool_Type;
|
||||
static int (*py3_PyNumber_Check)(PyObject *);
|
||||
static PyObject* (*py3_PyNumber_Long)(PyObject *);
|
||||
static PyObject* (*py3_PyErr_NewException)(char *name, PyObject *base, PyObject *dict);
|
||||
static PyObject* (*py3_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
|
||||
static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *);
|
||||
@@ -402,6 +405,7 @@ static PyObject *p3imp_PyExc_TypeError;
|
||||
static PyObject *p3imp_PyExc_ValueError;
|
||||
static PyObject *p3imp_PyExc_RuntimeError;
|
||||
static PyObject *p3imp_PyExc_ImportError;
|
||||
static PyObject *p3imp_PyExc_OverflowError;
|
||||
|
||||
# define PyExc_AttributeError p3imp_PyExc_AttributeError
|
||||
# define PyExc_IndexError p3imp_PyExc_IndexError
|
||||
@@ -411,6 +415,7 @@ static PyObject *p3imp_PyExc_ImportError;
|
||||
# define PyExc_ValueError p3imp_PyExc_ValueError
|
||||
# define PyExc_RuntimeError p3imp_PyExc_RuntimeError
|
||||
# define PyExc_ImportError p3imp_PyExc_ImportError
|
||||
# define PyExc_OverflowError p3imp_PyExc_OverflowError
|
||||
|
||||
/*
|
||||
* Table of name to function pointer of python.
|
||||
@@ -472,6 +477,7 @@ static struct
|
||||
{"PyMapping_Keys", (PYTHON_PROC*)&py3_PyMapping_Keys},
|
||||
{"PyIter_Next", (PYTHON_PROC*)&py3_PyIter_Next},
|
||||
{"PyObject_GetIter", (PYTHON_PROC*)&py3_PyObject_GetIter},
|
||||
{"PyObject_Repr", (PYTHON_PROC*)&py3_PyObject_Repr},
|
||||
{"PyObject_GetItem", (PYTHON_PROC*)&py3_PyObject_GetItem},
|
||||
{"PyObject_IsTrue", (PYTHON_PROC*)&py3_PyObject_IsTrue},
|
||||
{"PyLong_FromLong", (PYTHON_PROC*)&py3_PyLong_FromLong},
|
||||
@@ -490,6 +496,7 @@ static struct
|
||||
{"_Py_FalseStruct", (PYTHON_PROC*)&py3__Py_FalseStruct},
|
||||
{"_Py_TrueStruct", (PYTHON_PROC*)&py3__Py_TrueStruct},
|
||||
{"PyErr_Clear", (PYTHON_PROC*)&py3_PyErr_Clear},
|
||||
{"PyErr_Format", (PYTHON_PROC*)&py3_PyErr_Format},
|
||||
{"PyErr_PrintEx", (PYTHON_PROC*)&py3_PyErr_PrintEx},
|
||||
{"PyObject_Init", (PYTHON_PROC*)&py3__PyObject_Init},
|
||||
{"PyModule_AddObject", (PYTHON_PROC*)&py3_PyModule_AddObject},
|
||||
@@ -520,6 +527,8 @@ static struct
|
||||
{"PySlice_Type", (PYTHON_PROC*)&py3_PySlice_Type},
|
||||
{"PyFloat_Type", (PYTHON_PROC*)&py3_PyFloat_Type},
|
||||
{"PyBool_Type", (PYTHON_PROC*)&py3_PyBool_Type},
|
||||
{"PyNumber_Check", (PYTHON_PROC*)&py3_PyNumber_Check},
|
||||
{"PyNumber_Long", (PYTHON_PROC*)&py3_PyNumber_Long},
|
||||
{"PyErr_NewException", (PYTHON_PROC*)&py3_PyErr_NewException},
|
||||
# ifdef Py_DEBUG
|
||||
{"_Py_NegativeRefcount", (PYTHON_PROC*)&py3__Py_NegativeRefcount},
|
||||
@@ -674,6 +683,7 @@ get_py3_exceptions()
|
||||
p3imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
|
||||
p3imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
|
||||
p3imp_PyExc_ImportError = PyDict_GetItemString(exdict, "ImportError");
|
||||
p3imp_PyExc_OverflowError = PyDict_GetItemString(exdict, "OverflowError");
|
||||
Py_XINCREF(p3imp_PyExc_AttributeError);
|
||||
Py_XINCREF(p3imp_PyExc_IndexError);
|
||||
Py_XINCREF(p3imp_PyExc_KeyError);
|
||||
@@ -682,6 +692,7 @@ get_py3_exceptions()
|
||||
Py_XINCREF(p3imp_PyExc_ValueError);
|
||||
Py_XINCREF(p3imp_PyExc_RuntimeError);
|
||||
Py_XINCREF(p3imp_PyExc_ImportError);
|
||||
Py_XINCREF(p3imp_PyExc_OverflowError);
|
||||
Py_XDECREF(exmod);
|
||||
}
|
||||
#endif /* DYNAMIC_PYTHON3 */
|
||||
@@ -1174,7 +1185,7 @@ BufferSubscript(PyObject *self, PyObject* idx)
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
|
||||
RAISE_INVALID_INDEX_TYPE(idx);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1208,7 +1219,7 @@ BufferAsSubscript(PyObject *self, PyObject* idx, PyObject* val)
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
|
||||
RAISE_INVALID_INDEX_TYPE(idx);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1290,7 +1301,7 @@ RangeSubscript(PyObject *self, PyObject* idx)
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
|
||||
RAISE_INVALID_INDEX_TYPE(idx);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1317,7 +1328,7 @@ RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val)
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
|
||||
RAISE_INVALID_INDEX_TYPE(idx);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1496,7 +1507,7 @@ ListSubscript(PyObject *self, PyObject* idx)
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
|
||||
RAISE_INVALID_INDEX_TYPE(idx);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1520,7 +1531,7 @@ ListAsSubscript(PyObject *self, PyObject *idx, PyObject *obj)
|
||||
}
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
|
||||
RAISE_INVALID_INDEX_TYPE(idx);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1612,7 +1623,7 @@ Py3Init_vim(void)
|
||||
if ((vim_module = PyModule_Create(&vimmodule)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if (populate_module(vim_module, PyModule_AddObject, PyObject_GetAttrString))
|
||||
if (populate_module(vim_module))
|
||||
return NULL;
|
||||
|
||||
if (init_sys_path())
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
static char_u *vim_version_dir __ARGS((char_u *vimdir));
|
||||
static char_u *remove_tail __ARGS((char_u *p, char_u *pend, char_u *name));
|
||||
#if defined(FEAT_CMDL_COMPL)
|
||||
static void init_users __ARGS((void));
|
||||
#endif
|
||||
static int copy_indent __ARGS((int size, char_u *src));
|
||||
|
||||
/* All user names (for ~user completion as done by shell). */
|
||||
@@ -4487,7 +4490,8 @@ get_env_name(xp, idx)
|
||||
* Done only once and then cached.
|
||||
*/
|
||||
static void
|
||||
init_users() {
|
||||
init_users()
|
||||
{
|
||||
static int lazy_init_done = FALSE;
|
||||
|
||||
if (lazy_init_done)
|
||||
|
||||
@@ -3181,7 +3181,7 @@ set_init_1()
|
||||
if (opt_idx >= 0)
|
||||
{
|
||||
#if !defined(HAVE_AVAIL_MEM) && !defined(HAVE_TOTAL_MEM)
|
||||
if ((long)options[opt_idx].def_val[VI_DEFAULT] > n
|
||||
if ((long)options[opt_idx].def_val[VI_DEFAULT] > (long)n
|
||||
|| (long)options[opt_idx].def_val[VI_DEFAULT] == 0L)
|
||||
#endif
|
||||
options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n;
|
||||
|
||||
@@ -1045,6 +1045,29 @@ static char_u *prt_name = NULL;
|
||||
#define IDC_PRINTTEXT2 402
|
||||
#define IDC_PROGRESS 403
|
||||
|
||||
#if !defined(FEAT_MBYTE) || defined(WIN16)
|
||||
# define vimSetDlgItemText(h, i, s) SetDlgItemText(h, i, s)
|
||||
#else
|
||||
static BOOL
|
||||
vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s)
|
||||
{
|
||||
WCHAR *wp = NULL;
|
||||
BOOL ret;
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
wp = enc_to_utf16(s, NULL);
|
||||
}
|
||||
if (wp != NULL)
|
||||
{
|
||||
ret = SetDlgItemTextW(hDlg, nIDDlgItem, wp);
|
||||
vim_free(wp);
|
||||
return ret;
|
||||
}
|
||||
return SetDlgItemText(hDlg, nIDDlgItem, s);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Convert BGR to RGB for Windows GDI calls
|
||||
*/
|
||||
@@ -1096,18 +1119,18 @@ PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1);
|
||||
if (GetDlgItemText(hDlg,i, buff, sizeof(buff)))
|
||||
SetDlgItemText(hDlg,i, _(buff));
|
||||
vimSetDlgItemText(hDlg,i, _(buff));
|
||||
}
|
||||
SendDlgItemMessage(hDlg, IDCANCEL,
|
||||
WM_SETFONT, (WPARAM)hfont, 1);
|
||||
if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff)))
|
||||
SetDlgItemText(hDlg,IDCANCEL, _(buff));
|
||||
vimSetDlgItemText(hDlg,IDCANCEL, _(buff));
|
||||
}
|
||||
#endif
|
||||
SetWindowText(hDlg, szAppName);
|
||||
if (prt_name != NULL)
|
||||
{
|
||||
SetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name);
|
||||
vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name);
|
||||
vim_free(prt_name);
|
||||
prt_name = NULL;
|
||||
}
|
||||
@@ -1565,7 +1588,7 @@ mch_print_begin(prt_settings_T *psettings)
|
||||
SetAbortProc(prt_dlg.hDC, AbortProc);
|
||||
#endif
|
||||
wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname));
|
||||
SetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer);
|
||||
vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer);
|
||||
|
||||
vim_memset(&di, 0, sizeof(DOCINFO));
|
||||
di.cbSize = sizeof(DOCINFO);
|
||||
@@ -1599,7 +1622,7 @@ mch_print_end_page(void)
|
||||
mch_print_begin_page(char_u *msg)
|
||||
{
|
||||
if (msg != NULL)
|
||||
SetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg);
|
||||
vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg);
|
||||
return (StartPage(prt_dlg.hDC) > 0);
|
||||
}
|
||||
|
||||
@@ -1628,10 +1651,41 @@ mch_print_start_line(margin, page_line)
|
||||
int
|
||||
mch_print_text_out(char_u *p, int len)
|
||||
{
|
||||
#ifdef FEAT_PROPORTIONAL_FONTS
|
||||
#if defined(FEAT_PROPORTIONAL_FONTS) || (defined(FEAT_MBYTE) && !defined(WIN16))
|
||||
SIZE sz;
|
||||
#endif
|
||||
#if defined(FEAT_MBYTE) && !defined(WIN16)
|
||||
WCHAR *wp = NULL;
|
||||
int wlen = len;
|
||||
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
wp = enc_to_utf16(p, &wlen);
|
||||
}
|
||||
if (wp != NULL)
|
||||
{
|
||||
int ret = FALSE;
|
||||
|
||||
TextOutW(prt_dlg.hDC, prt_pos_x + prt_left_margin,
|
||||
prt_pos_y + prt_top_margin, wp, wlen);
|
||||
GetTextExtentPoint32W(prt_dlg.hDC, wp, wlen, &sz);
|
||||
vim_free(wp);
|
||||
prt_pos_x += (sz.cx - prt_tm.tmOverhang);
|
||||
/* This is wrong when printing spaces for a TAB. */
|
||||
if (p[len] != NUL)
|
||||
{
|
||||
wlen = MB_PTR2LEN(p + len);
|
||||
wp = enc_to_utf16(p + len, &wlen);
|
||||
if (wp != NULL)
|
||||
{
|
||||
GetTextExtentPoint32W(prt_dlg.hDC, wp, 1, &sz);
|
||||
ret = (prt_pos_x + prt_left_margin + sz.cx > prt_right_margin);
|
||||
vim_free(wp);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin,
|
||||
prt_pos_y + prt_top_margin, p, len);
|
||||
#ifndef FEAT_PROPORTIONAL_FONTS
|
||||
@@ -1897,7 +1951,6 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
HWND sender = (HWND)wParam;
|
||||
COPYDATASTRUCT reply;
|
||||
char_u *res;
|
||||
char_u winstr[30];
|
||||
int retval;
|
||||
char_u *str;
|
||||
char_u *tofree;
|
||||
@@ -1948,8 +2001,8 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
reply.cbData = (DWORD)STRLEN(res) + 1;
|
||||
|
||||
serverSendEnc(sender);
|
||||
retval = (int)SendMessage(sender, WM_COPYDATA, (WPARAM)message_window,
|
||||
(LPARAM)(&reply));
|
||||
retval = (int)SendMessage(sender, WM_COPYDATA,
|
||||
(WPARAM)message_window, (LPARAM)(&reply));
|
||||
vim_free(res);
|
||||
return retval;
|
||||
|
||||
@@ -1970,6 +2023,8 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef FEAT_AUTOCMD
|
||||
else if (data->dwData == COPYDATA_REPLY)
|
||||
{
|
||||
char_u winstr[30];
|
||||
|
||||
sprintf((char *)winstr, PRINTF_HEX_LONG_U, (long_u)sender);
|
||||
apply_autocmds(EVENT_REMOTEREPLY, winstr, str,
|
||||
TRUE, curbuf);
|
||||
|
||||
@@ -2789,14 +2789,16 @@ mch_is_symbolic_link(char_u *fname)
|
||||
reparseTag = findDataW.dwReserved0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
hFind = FindFirstFile(fname, &findDataA);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
fileFlags = findDataA.dwFileAttributes;
|
||||
reparseTag = findDataA.dwReserved0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
hFind = FindFirstFile(fname, &findDataA);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
fileFlags = findDataA.dwFileAttributes;
|
||||
reparseTag = findDataA.dwReserved0;
|
||||
}
|
||||
}
|
||||
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
FindClose(hFind);
|
||||
|
||||
@@ -70,8 +70,8 @@ int only_one_window __ARGS((void));
|
||||
void check_lnums __ARGS((int do_curwin));
|
||||
void make_snapshot __ARGS((int idx));
|
||||
void restore_snapshot __ARGS((int idx, int close_curwin));
|
||||
int switch_win __ARGS((win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp));
|
||||
void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab));
|
||||
int switch_win __ARGS((win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display));
|
||||
void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab, int no_display));
|
||||
void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
|
||||
void restore_buffer __ARGS((buf_T *save_curbuf));
|
||||
int win_hasvertsplit __ARGS((void));
|
||||
|
||||
@@ -273,6 +273,7 @@ static int nfa_regcomp_start __ARGS((char_u *expr, int re_flags));
|
||||
static int nfa_get_reganch __ARGS((nfa_state_T *start, int depth));
|
||||
static int nfa_get_regstart __ARGS((nfa_state_T *start, int depth));
|
||||
static char_u *nfa_get_match_text __ARGS((nfa_state_T *start));
|
||||
static int realloc_post_list __ARGS((void));
|
||||
static int nfa_recognize_char_class __ARGS((char_u *start, char_u *end, int extra_newl));
|
||||
static int nfa_emit_equi_class __ARGS((int c));
|
||||
static int nfa_regatom __ARGS((void));
|
||||
@@ -1149,13 +1150,16 @@ nfa_regatom()
|
||||
int n;
|
||||
|
||||
/* \%[abc] */
|
||||
for (n = 0; (c = getchr()) != ']'; ++n)
|
||||
for (n = 0; (c = peekchr()) != ']'; ++n)
|
||||
{
|
||||
if (c == NUL)
|
||||
EMSG2_RET_FAIL(_(e_missing_sb),
|
||||
reg_magic == MAGIC_ALL);
|
||||
EMIT(c);
|
||||
/* recursive call! */
|
||||
if (nfa_regatom() == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
getchr(); /* get the ] */
|
||||
if (n == 0)
|
||||
EMSG2_RET_FAIL(_(e_empty_sb),
|
||||
reg_magic == MAGIC_ALL);
|
||||
@@ -2607,7 +2611,7 @@ nfa_max_width(startstate, depth)
|
||||
if (depth > 4)
|
||||
return -1;
|
||||
|
||||
for (;;)
|
||||
while (state != NULL)
|
||||
{
|
||||
switch (state->c)
|
||||
{
|
||||
@@ -2806,7 +2810,7 @@ nfa_max_width(startstate, depth)
|
||||
state = state->out;
|
||||
}
|
||||
|
||||
/* unrecognized */
|
||||
/* unrecognized, "cannot happen" */
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -4210,6 +4214,8 @@ addstate_here(l, state, subs, pim, ip)
|
||||
|
||||
/* re-order to put the new state at the current position */
|
||||
count = l->n - tlen;
|
||||
if (count == 0)
|
||||
return; /* no state got added */
|
||||
if (count == 1)
|
||||
{
|
||||
/* overwrite the current state */
|
||||
|
||||
@@ -1637,6 +1637,10 @@ win_update(wp)
|
||||
&& hasAnyFolding(wp)) ||
|
||||
# endif
|
||||
syntax_check_changed(lnum)))
|
||||
#endif
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
/* match in fixed position might need redraw */
|
||||
|| wp->w_match_head != NULL
|
||||
#endif
|
||||
)))))
|
||||
{
|
||||
|
||||
@@ -40,25 +40,28 @@ SCRIPTS_GUI = test16.out
|
||||
|
||||
.SUFFIXES: .in .out
|
||||
|
||||
nongui: fixff $(SCRIPTS16) $(SCRIPTS)
|
||||
echo ALL DONE
|
||||
nongui: fixff $(SCRIPTS16) $(SCRIPTS) report
|
||||
|
||||
small:
|
||||
echo ALL DONE
|
||||
small: report
|
||||
|
||||
gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
|
||||
echo ALL DONE
|
||||
gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) report
|
||||
|
||||
win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
|
||||
echo ALL DONE
|
||||
win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) report
|
||||
|
||||
fixff:
|
||||
-$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
|
||||
-$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=unix|upd" +q \
|
||||
dotest.in test60.ok test71.ok test74.ok
|
||||
|
||||
report:
|
||||
@echo ""
|
||||
@echo Test results:
|
||||
@IF EXIST test.log ( type test.log & echo TEST FAILURE & exit /b 1 ) \
|
||||
ELSE ( ECHO ALL DONE )
|
||||
|
||||
clean:
|
||||
-del *.out
|
||||
-del *.failed
|
||||
-if exist test.ok del test.ok
|
||||
-if exist small.vim del small.vim
|
||||
-if exist tiny.vim del tiny.vim
|
||||
@@ -66,16 +69,23 @@ clean:
|
||||
-if exist mzscheme.vim del mzscheme.vim
|
||||
-if exist lua.vim del lua.vim
|
||||
-del X*
|
||||
-if exist Xdir1 rd /s /q Xdir1
|
||||
-if exist Xfind rd /s /q Xfind
|
||||
-if exist viminfo del viminfo
|
||||
-del test.log
|
||||
|
||||
.in.out:
|
||||
-if exist $*.failed del $*.failed
|
||||
copy $*.ok test.ok
|
||||
$(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
|
||||
diff test.out $*.ok
|
||||
-if exist $*.out del $*.out
|
||||
rename test.out $*.out
|
||||
@diff test.out $*.ok & if errorlevel 1 \
|
||||
( move /y test.out $*.failed & echo $* FAILED >> test.log ) \
|
||||
else ( move /y test.out $*.out )
|
||||
-del X*
|
||||
-del X*.*
|
||||
-del test.ok
|
||||
-rd /s /q Xfind
|
||||
-if exist Xdir1 rd /s /q Xdir1
|
||||
-if exist Xfind rd /s /q Xfind
|
||||
-if exist viminfo del viminfo
|
||||
|
||||
nolog:
|
||||
-del test.log
|
||||
|
||||
1
src/testdir/pythonx/failing.py
Normal file
1
src/testdir/pythonx/failing.py
Normal file
@@ -0,0 +1 @@
|
||||
raise NotImplementedError
|
||||
1
src/testdir/pythonx/failing_import.py
Normal file
1
src/testdir/pythonx/failing_import.py
Normal file
@@ -0,0 +1 @@
|
||||
raise ImportError
|
||||
1
src/testdir/pythonx/topmodule/__init__.py
Normal file
1
src/testdir/pythonx/topmodule/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
#
|
||||
1
src/testdir/pythonx/topmodule/submodule/__init__.py
Normal file
1
src/testdir/pythonx/topmodule/submodule/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
#
|
||||
@@ -0,0 +1 @@
|
||||
#
|
||||
@@ -0,0 +1 @@
|
||||
#
|
||||
@@ -9,6 +9,13 @@ STARTTEST
|
||||
:else
|
||||
: set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,}
|
||||
:endif
|
||||
:function! DeleteDirectory(dir)
|
||||
: if has("win16") || has("win32") || has("win64") || has("dos16") || has("dos32")
|
||||
: exec "silent !rmdir /Q /S " . a:dir
|
||||
: else
|
||||
: exec "silent !rm -rf " . a:dir
|
||||
: endif
|
||||
:endfun
|
||||
:if has("unix")
|
||||
:let $CDIR = "."
|
||||
/CDIR
|
||||
@@ -20,6 +27,11 @@ STARTTEST
|
||||
:endif
|
||||
/TDIR
|
||||
:endif
|
||||
:" Dummy writing for making that sure gf doesn't fail even if the current
|
||||
:" file is modified. It can be occurred when executing the following command
|
||||
:" directly on Windows without fixing the 'fileformat':
|
||||
:" > nmake -f Make_dos.mak test17.out
|
||||
:w! test.out
|
||||
gf
|
||||
:w! test.out
|
||||
:brewind
|
||||
@@ -31,10 +43,11 @@ ENDTEST
|
||||
STARTTEST
|
||||
:" check for 'include' without \zs or \ze
|
||||
:lang C
|
||||
:!rm -f ./Xbase.a
|
||||
:!rm -rf ./Xdir1
|
||||
:!mkdir -p Xdir1/dir2
|
||||
:e Xdir1/dir2/foo.a
|
||||
:call delete("./Xbase.a")
|
||||
:call DeleteDirectory("Xdir1")
|
||||
:!mkdir Xdir1
|
||||
:!mkdir "Xdir1/dir2"
|
||||
:e! Xdir1/dir2/foo.a
|
||||
i#include "bar.a"
|
||||
:w
|
||||
:e Xdir1/dir2/bar.a
|
||||
@@ -55,15 +68,16 @@ ENDTEST
|
||||
|
||||
STARTTEST
|
||||
:" check for 'include' with \zs and \ze
|
||||
:!rm -f ./Xbase.b
|
||||
:!rm -rf ./Xdir1
|
||||
:!mkdir -p Xdir1/dir2
|
||||
:call delete("./Xbase.b")
|
||||
:call DeleteDirectory("Xdir1")
|
||||
:!mkdir Xdir1
|
||||
:!mkdir "Xdir1/dir2"
|
||||
:let &include='^\s*%inc\s*/\zs[^/]\+\ze'
|
||||
:function! DotsToSlashes()
|
||||
: return substitute(v:fname, '\.', '/', 'g') . '.b'
|
||||
:endfunction
|
||||
:let &includeexpr='DotsToSlashes()'
|
||||
:e Xdir1/dir2/foo.b
|
||||
:e! Xdir1/dir2/foo.b
|
||||
i%inc /bar/
|
||||
:w
|
||||
:e Xdir1/dir2/bar.b
|
||||
@@ -84,9 +98,10 @@ ENDTEST
|
||||
|
||||
STARTTEST
|
||||
:" check for 'include' with \zs and no \ze
|
||||
:!rm -f ./Xbase.c
|
||||
:!rm -rf ./Xdir1
|
||||
:!mkdir -p Xdir1/dir2
|
||||
:call delete("./Xbase.c")
|
||||
:call DeleteDirectory("Xdir1")
|
||||
:!mkdir Xdir1
|
||||
:!mkdir "Xdir1/dir2"
|
||||
:let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze'
|
||||
:function! StripNewlineChar()
|
||||
: if v:fname =~ '\n$'
|
||||
@@ -95,7 +110,7 @@ STARTTEST
|
||||
: return v:fname
|
||||
:endfunction
|
||||
:let &includeexpr='StripNewlineChar()'
|
||||
:e Xdir1/dir2/foo.c
|
||||
:e! Xdir1/dir2/foo.c
|
||||
i%inc bar.c
|
||||
:w
|
||||
:e Xdir1/dir2/bar.c
|
||||
@@ -115,6 +130,10 @@ i%inc FALSE.c foo.c
|
||||
:checkpath!
|
||||
:redir END
|
||||
:brewind
|
||||
:" replace "\" to "/" for Windows
|
||||
:e test.out
|
||||
:%s#\\#/#g
|
||||
:w
|
||||
:q
|
||||
ENDTEST
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ endfun
|
||||
" This could change for CygWin to //cygdrive/c
|
||||
let dir1='c:/x.x.y'
|
||||
if filereadable(dir1) || isdirectory(dir1)
|
||||
call confirm( "'".dir1."' exists, cannot run test" )
|
||||
echo "FATAL: '".dir1."' exists, cannot run test"
|
||||
return
|
||||
endif
|
||||
let file1=dir1.'/zz.y.txt'
|
||||
@@ -41,13 +41,18 @@ endfun
|
||||
let dir2=dir1.'/VimIsTheGreatestSinceSlicedBread'
|
||||
let file2=dir2.'/z.txt'
|
||||
let nofile2=dir2.'/zz.txt'
|
||||
let resdir1='c:/XX2235~1.Y'
|
||||
call MakeDir( dir1 )
|
||||
let resdir1 = substitute(fnamemodify(dir1, ':p:8'), '\\$', '', '')
|
||||
if resdir1 !~ '\V\^c:/XX\x\x\x\x~1.Y\$'
|
||||
echo "FATAL: unexpected short name: " . resdir1
|
||||
echo "INFO: please report your OS to vim-dev"
|
||||
return
|
||||
endif
|
||||
let resfile1=resdir1.'/ZZY~1.TXT'
|
||||
let resnofile1=resdir1.'/z.y.txt'
|
||||
let resdir2=resdir1.'/VIMIST~1'
|
||||
let resfile2=resdir2.'/z.txt'
|
||||
let resnofile2=resdir2.'/zz.txt'
|
||||
call MakeDir( dir1 )
|
||||
call MakeDir( dir2 )
|
||||
call MakeFile( file1 )
|
||||
call MakeFile( file2 )
|
||||
|
||||
@@ -366,6 +366,8 @@ STARTTEST
|
||||
:call add(tl, [2, '\%[bar]x', 'barxx', 'barx'])
|
||||
:call add(tl, [2, '\%[bar]x', 'bxx', 'bx'])
|
||||
:call add(tl, [2, '\%[bar]x', 'xxx', 'x'])
|
||||
:call add(tl, [2, 'b\%[[ao]r]', 'bar bor', 'bar'])
|
||||
:call add(tl, [2, 'b\%[[]]r]', 'b]r bor', 'b]r'])
|
||||
:"
|
||||
:"""" Alternatives, must use first longest match
|
||||
:call add(tl, [2, 'goo\|go', 'google', 'goo'])
|
||||
@@ -408,6 +410,8 @@ STARTTEST
|
||||
:"""" Requiring lots of states.
|
||||
:call add(tl, [2, '[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}', " 12345678-1234-1234-1234-123456789012 ", "12345678-1234-1234-1234-123456789012", "1234-"])
|
||||
:"
|
||||
:"""" Skip adding state twice
|
||||
:call add(tl, [2, '^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=', "#if FOO", "#if", ' FOO'])
|
||||
:"
|
||||
:"""" Run the tests
|
||||
:"
|
||||
|
||||
@@ -836,6 +836,12 @@ OK 2 - \%[bar]x
|
||||
OK 0 - \%[bar]x
|
||||
OK 1 - \%[bar]x
|
||||
OK 2 - \%[bar]x
|
||||
OK 0 - b\%[[ao]r]
|
||||
OK 1 - b\%[[ao]r]
|
||||
OK 2 - b\%[[ao]r]
|
||||
OK 0 - b\%[[]]r]
|
||||
OK 1 - b\%[[]]r]
|
||||
OK 2 - b\%[[]]r]
|
||||
OK 0 - goo\|go
|
||||
OK 1 - goo\|go
|
||||
OK 2 - goo\|go
|
||||
@@ -913,6 +919,9 @@ OK 2 - \_[^a]\+
|
||||
OK 0 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}
|
||||
OK 1 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}
|
||||
OK 2 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}
|
||||
OK 0 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=
|
||||
OK 1 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=
|
||||
OK 2 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=
|
||||
multi-line tests
|
||||
OK 0 - ^.\(.\).\_..\1.
|
||||
OK 1 - ^.\(.\).\_..\1.
|
||||
|
||||
@@ -8,7 +8,7 @@ STARTTEST
|
||||
:let cm0_bytes = getline('.', '.')
|
||||
:/^start of cm=blowfish bytes/+1
|
||||
:let cm1_bytes = getline('.', '.')
|
||||
:bwipe
|
||||
:bwipe!
|
||||
:call append(0, text_lines)
|
||||
:$d
|
||||
:X
|
||||
|
||||
@@ -23,6 +23,7 @@ ggdd
|
||||
:w! Xtest
|
||||
:r !cksum Xtest
|
||||
:s/\s/ /g
|
||||
:set fileformat&
|
||||
:.w! test.out
|
||||
:qa!
|
||||
ENDTEST
|
||||
|
||||
@@ -11,8 +11,8 @@ STARTTEST
|
||||
:set noswapfile
|
||||
:if !has('python') | e! test.ok | wq! test.out | endif
|
||||
:lang C
|
||||
:py import vim
|
||||
:fun Test()
|
||||
:py import vim
|
||||
:let l = []
|
||||
:py l=vim.bindeval('l')
|
||||
:py f=vim.bindeval('function("strlen")')
|
||||
@@ -58,6 +58,9 @@ EOF
|
||||
: $put =string(key) . ' : ' . string(Val)
|
||||
: unlet key Val
|
||||
:endfor
|
||||
:py del dk
|
||||
:py del di
|
||||
:py del dv
|
||||
:"
|
||||
:" removing items with del
|
||||
:py del l[2]
|
||||
@@ -176,12 +179,12 @@ EOF
|
||||
:unlockvar! l
|
||||
:"
|
||||
:" Function calls
|
||||
:function New(...)
|
||||
:return ['NewStart']+a:000+['NewEnd']
|
||||
:endfunction
|
||||
:function DictNew(...) dict
|
||||
:return ['DictNewStart']+a:000+['DictNewEnd', self]
|
||||
:endfunction
|
||||
:fun New(...)
|
||||
: return ['NewStart']+a:000+['NewEnd']
|
||||
:endfun
|
||||
:fun DictNew(...) dict
|
||||
: return ['DictNewStart']+a:000+['DictNewEnd', self]
|
||||
:endfun
|
||||
:let l=[function('New'), function('DictNew')]
|
||||
:py l=vim.bindeval('l')
|
||||
:py l.extend(list(l[0](1, 2, 3)))
|
||||
@@ -211,7 +214,9 @@ EOF
|
||||
: $put ='[0.0, 0.0]'
|
||||
:endif
|
||||
:let messages=[]
|
||||
:delfunction DictNew
|
||||
py <<EOF
|
||||
import sys
|
||||
d=vim.bindeval('{}')
|
||||
m=vim.bindeval('messages')
|
||||
def em(expr, g=globals(), l=locals()):
|
||||
@@ -220,15 +225,17 @@ def em(expr, g=globals(), l=locals()):
|
||||
except:
|
||||
m.extend([sys.exc_type.__name__])
|
||||
|
||||
em('d["abc"]')
|
||||
em('d["abc"]="\\0"')
|
||||
em('d["abc"]=vim')
|
||||
em('d["abc1"]')
|
||||
em('d["abc1"]="\\0"')
|
||||
em('d["abc1"]=vim')
|
||||
em('d[""]=1')
|
||||
em('d["a\\0b"]=1')
|
||||
em('d[u"a\\0b"]=1')
|
||||
|
||||
em('d.pop("abc")')
|
||||
em('d.pop("abc1")')
|
||||
em('d.popitem()')
|
||||
del em
|
||||
del m
|
||||
EOF
|
||||
:$put =messages
|
||||
:unlet messages
|
||||
@@ -240,8 +247,8 @@ EOF
|
||||
: let toput=s.' : '.join(map(['locked', 'scope'], 'v:val.":".pyeval(name.".".v:val)'), ';')
|
||||
: $put =toput
|
||||
:endfor
|
||||
:silent! let d.abc=1
|
||||
:silent! let dl.abc=1
|
||||
:silent! let d.abc2=1
|
||||
:silent! let dl.abc3=1
|
||||
:py d.locked=True
|
||||
:py dl.locked=False
|
||||
:silent! let d.def=1
|
||||
@@ -291,7 +298,7 @@ EOF
|
||||
:" threading
|
||||
:let l = [0]
|
||||
:py l=vim.bindeval('l')
|
||||
:py <<EOF
|
||||
py <<EOF
|
||||
import threading
|
||||
import time
|
||||
|
||||
@@ -307,18 +314,21 @@ class T(threading.Thread):
|
||||
time.sleep(0.1)
|
||||
|
||||
t = T()
|
||||
del T
|
||||
t.start()
|
||||
EOF
|
||||
:sleep 1
|
||||
:py t.running = False
|
||||
:py t.join()
|
||||
:py l[0] = t.t > 8 # check if the background thread is working
|
||||
:py del time
|
||||
:py del threading
|
||||
:$put =string(l)
|
||||
:"
|
||||
:" settrace
|
||||
:let l = []
|
||||
:py l=vim.bindeval('l')
|
||||
:py <<EOF
|
||||
py <<EOF
|
||||
import sys
|
||||
|
||||
def traceit(frame, event, arg):
|
||||
@@ -334,6 +344,8 @@ EOF
|
||||
:py sys.settrace(traceit)
|
||||
:py trace_main()
|
||||
:py sys.settrace(None)
|
||||
:py del traceit
|
||||
:py del trace_main
|
||||
:$put =string(l)
|
||||
:"
|
||||
:" Slice
|
||||
@@ -363,7 +375,7 @@ EOF
|
||||
:"
|
||||
:" Vars
|
||||
:let g:foo = 'bac'
|
||||
:let w:abc = 'def'
|
||||
:let w:abc3 = 'def'
|
||||
:let b:baz = 'bar'
|
||||
:let t:bar = 'jkl'
|
||||
:try
|
||||
@@ -372,7 +384,7 @@ EOF
|
||||
: put =pyeval('vim.vvars[''exception'']')
|
||||
:endtry
|
||||
:put =pyeval('vim.vars[''foo'']')
|
||||
:put =pyeval('vim.current.window.vars[''abc'']')
|
||||
:put =pyeval('vim.current.window.vars[''abc3'']')
|
||||
:put =pyeval('vim.current.buffer.vars[''baz'']')
|
||||
:put =pyeval('vim.current.tabpage.vars[''bar'']')
|
||||
:"
|
||||
@@ -420,16 +432,16 @@ def ev(s, g=globals(), l=locals()):
|
||||
vim.command('let exc=' + repr(sys.exc_type.__name__))
|
||||
return 0
|
||||
EOF
|
||||
:function E(s)
|
||||
:fun E(s)
|
||||
: python e(vim.eval('a:s'))
|
||||
:endfunction
|
||||
:function Ev(s)
|
||||
:endfun
|
||||
:fun Ev(s)
|
||||
: let r=pyeval('ev(vim.eval("a:s"))')
|
||||
: if exists('exc')
|
||||
: throw exc
|
||||
: endif
|
||||
: return r
|
||||
:endfunction
|
||||
:endfun
|
||||
:py gopts1=vim.options
|
||||
:py wopts1=vim.windows[2].options
|
||||
:py wopts2=vim.windows[0].options
|
||||
@@ -444,7 +456,7 @@ EOF
|
||||
:let lst+=[['operatorfunc', 'A', 'B', 'C', 2, 0, 1, 0 ]]
|
||||
:let lst+=[['number', 0, 1, 1, 0, 1, 0, 1 ]]
|
||||
:let lst+=[['numberwidth', 2, 3, 5, -100, 0, 0, 1 ]]
|
||||
:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc', 0, 0, 1 ]]
|
||||
:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc4', 0, 0, 1 ]]
|
||||
:let lst+=[['statusline', '1', '2', '4', 0, 0, 1, 1 ]]
|
||||
:let lst+=[['autoindent', 0, 1, 1, 2, 1, 0, 2 ]]
|
||||
:let lst+=[['shiftwidth', 0, 2, 1, 3, 0, 0, 2 ]]
|
||||
@@ -494,10 +506,27 @@ EOF
|
||||
: endfor
|
||||
: call RecVars(oname)
|
||||
:endfor
|
||||
:delfunction RecVars
|
||||
:delfunction E
|
||||
:delfunction Ev
|
||||
:py del ev
|
||||
:py del e
|
||||
:only
|
||||
:for buf in g:bufs[1:]
|
||||
: execute 'bwipeout!' buf
|
||||
:endfor
|
||||
:py del gopts1
|
||||
:py del wopts1
|
||||
:py del wopts2
|
||||
:py del wopts3
|
||||
:py del bopts1
|
||||
:py del bopts2
|
||||
:py del bopts3
|
||||
:py del oval1
|
||||
:py del oval2
|
||||
:py del oval3
|
||||
:py del oname
|
||||
:py del invval
|
||||
:"
|
||||
:" Test buffer object
|
||||
:vnew
|
||||
@@ -517,7 +546,7 @@ cb = vim.current.buffer
|
||||
# Tests BufferAppend and BufferItem
|
||||
cb.append(b[0])
|
||||
# Tests BufferSlice and BufferAssSlice
|
||||
cb.append('abc') # Will be overwritten
|
||||
cb.append('abc5') # Will be overwritten
|
||||
cb[-1:] = b[:-2]
|
||||
# Test BufferLength and BufferAssSlice
|
||||
cb.append('def') # Will not be overwritten
|
||||
@@ -541,13 +570,14 @@ b.name = 'bar'
|
||||
cb.append(b.name[-11:].replace(os.path.sep, '/'))
|
||||
cb.name = old_name
|
||||
cb.append(cb.name[-17:].replace(os.path.sep, '/'))
|
||||
del old_name
|
||||
# Test CheckBuffer
|
||||
for _b in vim.buffers:
|
||||
if _b is not cb:
|
||||
vim.command('bwipeout! ' + str(_b.number))
|
||||
del _b
|
||||
cb.append('valid: b:%s, cb:%s' % (repr(b.valid), repr(cb.valid)))
|
||||
for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")', 'b.name = "!"'):
|
||||
for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc6")', 'b.name = "!"'):
|
||||
try:
|
||||
exec(expr)
|
||||
except vim.error:
|
||||
@@ -557,6 +587,7 @@ for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")', 'b.name = "!"'
|
||||
# Should not happen in any case
|
||||
cb.append('No exception for ' + expr)
|
||||
vim.command('cd .')
|
||||
del b
|
||||
EOF
|
||||
:augroup BUFS
|
||||
: autocmd!
|
||||
@@ -598,6 +629,7 @@ for b in vim.buffers:
|
||||
# Check indexing: vim.buffers[number].number == number
|
||||
cb.append(str(b.number) + ':' + repr(vim.buffers[b.number]) + '=' + repr(b))
|
||||
prevnum = b.number
|
||||
del prevnum
|
||||
|
||||
cb.append(str(len(vim.buffers)))
|
||||
|
||||
@@ -621,6 +653,8 @@ try:
|
||||
next(i4)
|
||||
except StopIteration:
|
||||
cb.append('StopIteration')
|
||||
del i4
|
||||
del bnums
|
||||
EOF
|
||||
:"
|
||||
:" Test vim.{tabpage,window}list and vim.{tabpage,window} objects
|
||||
@@ -663,7 +697,11 @@ for t in vim.tabpages:
|
||||
raise ValueError
|
||||
except Exception:
|
||||
cb.append('!!!!!! Error while getting attribute ' + attr + ': ' + sys.exc_type.__name__)
|
||||
del aval
|
||||
del attr
|
||||
w.cursor = (len(w.buffer), 0)
|
||||
del W
|
||||
del Cursor
|
||||
cb.append('Number of windows in current tab page: ' + str(len(vim.windows)))
|
||||
if list(vim.windows) != list(vim.current.tabpage.windows):
|
||||
cb.append('!!!!!! Windows differ')
|
||||
@@ -676,6 +714,7 @@ def H(o):
|
||||
cb.append('Current tab page: ' + repr(vim.current.tabpage))
|
||||
cb.append('Current window: ' + repr(vim.current.window) + ': ' + H(vim.current.window) + ' is ' + H(vim.current.tabpage.window))
|
||||
cb.append('Current buffer: ' + repr(vim.current.buffer) + ': ' + H(vim.current.buffer) + ' is ' + H(vim.current.window.buffer)+ ' is ' + H(vim.current.tabpage.window.buffer))
|
||||
del H
|
||||
# Assigning: fails
|
||||
try:
|
||||
vim.current.window = vim.tabpages[0].window
|
||||
@@ -687,6 +726,7 @@ for attr in ('window', 'tabpage', 'buffer'):
|
||||
setattr(vim.current, attr, None)
|
||||
except TypeError:
|
||||
cb.append('Type error at assigning None to vim.current.' + attr)
|
||||
del attr
|
||||
|
||||
# Assigning: success
|
||||
vim.current.tabpage = vim.tabpages[-2]
|
||||
@@ -702,8 +742,13 @@ ts = list(vim.tabpages)
|
||||
for b in vim.buffers:
|
||||
if b is not cb:
|
||||
vim.command('bwipeout! ' + str(b.number))
|
||||
del b
|
||||
cb.append('w.valid: ' + repr([w.valid for w in ws]))
|
||||
cb.append('t.valid: ' + repr([t.valid for t in ts]))
|
||||
del w
|
||||
del t
|
||||
del ts
|
||||
del ws
|
||||
EOF
|
||||
:tabonly!
|
||||
:only!
|
||||
@@ -722,6 +767,8 @@ for expr, attr in (
|
||||
('vim.current.tabpage', 'TabPage'),
|
||||
):
|
||||
cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr)))
|
||||
del expr
|
||||
del attr
|
||||
EOF
|
||||
:"
|
||||
:" Test __dir__() method
|
||||
@@ -747,15 +794,15 @@ EOF
|
||||
:$put =string(pyeval('vim.Dictionary(a=1)'))
|
||||
:$put =string(pyeval('vim.Dictionary(((''a'', 1),))'))
|
||||
:$put =string(pyeval('vim.List()'))
|
||||
:$put =string(pyeval('vim.List(iter(''abc''))'))
|
||||
:$put =string(pyeval('vim.List(iter(''abc7''))'))
|
||||
:$put =string(pyeval('vim.Function(''tr'')'))
|
||||
:"
|
||||
:" Test stdout/stderr
|
||||
:redir => messages
|
||||
:py sys.stdout.write('abc') ; sys.stdout.write('def')
|
||||
:py sys.stderr.write('abc') ; sys.stderr.write('def')
|
||||
:py sys.stdout.writelines(iter('abc'))
|
||||
:py sys.stderr.writelines(iter('abc'))
|
||||
:py sys.stdout.write('abc8') ; sys.stdout.write('def')
|
||||
:py sys.stderr.write('abc9') ; sys.stderr.write('def')
|
||||
:py sys.stdout.writelines(iter('abcA'))
|
||||
:py sys.stderr.writelines(iter('abcB'))
|
||||
:redir END
|
||||
:$put =string(substitute(messages, '\d\+', '', 'g'))
|
||||
:" Test subclassing
|
||||
@@ -776,7 +823,7 @@ class DupList(vim.List):
|
||||
return [super(DupList, self).__getitem__(idx)] * 2
|
||||
|
||||
dl = DupList()
|
||||
dl2 = DupList(iter('abc'))
|
||||
dl2 = DupList(iter('abcC'))
|
||||
dl.extend(dl2[0])
|
||||
|
||||
class DupFun(vim.Function):
|
||||
@@ -789,6 +836,19 @@ EOF
|
||||
:$put =string(pyeval('dl'))
|
||||
:$put =string(pyeval('dl2'))
|
||||
:$put =string(pyeval('df(2)'))
|
||||
:$put =string(pyeval('dl') is# pyeval('dl'))
|
||||
:$put =string(pyeval('dd') is# pyeval('dd'))
|
||||
:$put =string(pyeval('df'))
|
||||
:delfunction Put
|
||||
py << EOF
|
||||
del DupDict
|
||||
del DupList
|
||||
del DupFun
|
||||
del dd
|
||||
del dl
|
||||
del dl2
|
||||
del df
|
||||
EOF
|
||||
:"
|
||||
:" Test chdir
|
||||
py << EOF
|
||||
@@ -802,6 +862,7 @@ cb.append(vim.eval('@%').replace(os.path.sep, '/'))
|
||||
os.chdir('testdir')
|
||||
cb.append(fnamemodify('.', ':p:h:t'))
|
||||
cb.append(vim.eval('@%'))
|
||||
del fnamemodify
|
||||
EOF
|
||||
:"
|
||||
:" Test errors
|
||||
@@ -820,19 +881,25 @@ def ee(expr, g=globals(), l=locals()):
|
||||
if expr.find('None') > -1:
|
||||
msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
|
||||
'TypeError:("\'NoneType\' object is not iterable",)')
|
||||
if expr.find('FailingNumber') > -1:
|
||||
msg = msg.replace(', not \'FailingNumber\'', '').replace('"', '\'')
|
||||
msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
|
||||
'TypeError:("\'FailingNumber\' object is not iterable",)')
|
||||
if msg.find('(\'\'') > -1 or msg.find('(\'can\'t') > -1:
|
||||
msg = msg.replace('(\'', '("').replace('\',)', '",)')
|
||||
if expr == 'fd(self=[])':
|
||||
# HACK: PyMapping_Check changed meaning
|
||||
msg = msg.replace('AttributeError:(\'keys\',)',
|
||||
'TypeError:(\'unable to convert object to vim dictionary\',)')
|
||||
'TypeError:(\'unable to convert list to vim dictionary\',)')
|
||||
cb.append(expr + ':' + msg)
|
||||
else:
|
||||
cb.append(expr + ':NOT FAILED')
|
||||
d = vim.Dictionary()
|
||||
ned = vim.Dictionary(foo='bar', baz='abc')
|
||||
ned = vim.Dictionary(foo='bar', baz='abcD')
|
||||
dl = vim.Dictionary(a=1)
|
||||
dl.locked = True
|
||||
l = vim.List()
|
||||
ll = vim.List('abc')
|
||||
ll = vim.List('abcE')
|
||||
ll.locked = True
|
||||
f = vim.Function('string')
|
||||
fd = vim.Function('F')
|
||||
@@ -869,11 +936,11 @@ def convertfrompyobject_test(expr, recurse=True):
|
||||
# pydict_to_tv
|
||||
stringtochars_test(expr % '{%s : 1}')
|
||||
if recurse:
|
||||
convertfrompyobject_test(expr % '{"abc" : %s}', False)
|
||||
convertfrompyobject_test(expr % '{"abcF" : %s}', False)
|
||||
# pymap_to_tv
|
||||
stringtochars_test(expr % 'Mapping({%s : 1})')
|
||||
if recurse:
|
||||
convertfrompyobject_test(expr % 'Mapping({"abc" : %s})', False)
|
||||
convertfrompyobject_test(expr % 'Mapping({"abcG" : %s})', False)
|
||||
# pyseq_to_tv
|
||||
iter_test(expr)
|
||||
return subexpr_test(expr, 'ConvertFromPyObject', (
|
||||
@@ -882,6 +949,7 @@ def convertfrompyobject_test(expr, recurse=True):
|
||||
'{u"": 1}', # Same, but with unicode object
|
||||
'FailingMapping()', #
|
||||
'FailingMappingKey()', #
|
||||
'FailingNumber()', #
|
||||
))
|
||||
|
||||
def convertfrompymapping_test(expr):
|
||||
@@ -896,69 +964,107 @@ def iter_test(expr):
|
||||
'FailingIterNext()',
|
||||
))
|
||||
|
||||
def number_test(expr, natural=False, unsigned=False):
|
||||
if natural:
|
||||
unsigned = True
|
||||
return subexpr_test(expr, 'NumberToLong', (
|
||||
'[]',
|
||||
'None',
|
||||
) + (unsigned and ('-1',) or ())
|
||||
+ (natural and ('0',) or ()))
|
||||
|
||||
class FailingTrue(object):
|
||||
def __nonzero__(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('bool')
|
||||
|
||||
class FailingIter(object):
|
||||
def __iter__(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('iter')
|
||||
|
||||
class FailingIterNext(object):
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def next(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('next')
|
||||
|
||||
class FailingMappingKey(object):
|
||||
def __getitem__(self, item):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('getitem:mappingkey')
|
||||
|
||||
def keys(self):
|
||||
return list("abc")
|
||||
return list("abcH")
|
||||
|
||||
class FailingMapping(object):
|
||||
def __getitem__(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('getitem:mapping')
|
||||
|
||||
def keys(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('keys')
|
||||
|
||||
class FailingList(list):
|
||||
def __getitem__(self, idx):
|
||||
if i == 2:
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('getitem:list')
|
||||
else:
|
||||
return super(FailingList, self).__getitem__(idx)
|
||||
|
||||
class NoArgsCall(object):
|
||||
def __call__(self):
|
||||
pass
|
||||
|
||||
class FailingCall(object):
|
||||
def __call__(self, path):
|
||||
raise NotImplementedError('call')
|
||||
|
||||
class FailingNumber(object):
|
||||
def __int__(self):
|
||||
raise NotImplementedError('int')
|
||||
|
||||
cb.append("> Output")
|
||||
cb.append(">> OutputSetattr")
|
||||
ee('del sys.stdout.softspace')
|
||||
ee('sys.stdout.softspace = []')
|
||||
number_test('sys.stdout.softspace = %s', unsigned=True)
|
||||
number_test('sys.stderr.softspace = %s', unsigned=True)
|
||||
ee('sys.stdout.attr = None')
|
||||
cb.append(">> OutputWrite")
|
||||
ee('sys.stdout.write(None)')
|
||||
cb.append(">> OutputWriteLines")
|
||||
ee('sys.stdout.writelines(None)')
|
||||
ee('sys.stdout.writelines([1])')
|
||||
#iter_test('sys.stdout.writelines(%s)')
|
||||
iter_test('sys.stdout.writelines(%s)')
|
||||
cb.append("> VimCommand")
|
||||
ee('vim.command(1)')
|
||||
stringtochars_test('vim.command(%s)')
|
||||
ee('vim.command("", 2)')
|
||||
#! Not checked: vim->python exceptions translating: checked later
|
||||
cb.append("> VimToPython")
|
||||
#! Not checked: everything: needs errors in internal python functions
|
||||
cb.append("> VimEval")
|
||||
ee('vim.eval(1)')
|
||||
stringtochars_test('vim.eval(%s)')
|
||||
ee('vim.eval("", FailingTrue())')
|
||||
#! Not checked: everything: needs errors in internal python functions
|
||||
cb.append("> VimEvalPy")
|
||||
ee('vim.bindeval(1)')
|
||||
stringtochars_test('vim.bindeval(%s)')
|
||||
ee('vim.eval("", 2)')
|
||||
#! Not checked: vim->python exceptions translating: checked later
|
||||
cb.append("> VimStrwidth")
|
||||
ee('vim.strwidth(1)')
|
||||
stringtochars_test('vim.strwidth(%s)')
|
||||
cb.append("> VimForeachRTP")
|
||||
ee('vim.foreach_rtp(None)')
|
||||
ee('vim.foreach_rtp(NoArgsCall())')
|
||||
ee('vim.foreach_rtp(FailingCall())')
|
||||
ee('vim.foreach_rtp(int, 2)')
|
||||
cb.append('> import')
|
||||
old_rtp = vim.options['rtp']
|
||||
vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
|
||||
ee('import xxx_no_such_module_xxx')
|
||||
ee('import failing_import')
|
||||
ee('import failing')
|
||||
vim.options['rtp'] = old_rtp
|
||||
del old_rtp
|
||||
cb.append("> Dictionary")
|
||||
cb.append(">> DictionaryConstructor")
|
||||
ee('vim.Dictionary("abc")')
|
||||
ee('vim.Dictionary("abcI")')
|
||||
##! Not checked: py_dict_alloc failure
|
||||
cb.append(">> DictionarySetattr")
|
||||
ee('del d.locked')
|
||||
@@ -973,6 +1079,7 @@ ee('d.pop("a")')
|
||||
ee('dl.pop("a")')
|
||||
cb.append(">> DictionaryIterNext")
|
||||
ee('for i in ned: ned["a"] = 1')
|
||||
del i
|
||||
cb.append(">> DictionaryAssItem")
|
||||
ee('dl["b"] = 1')
|
||||
stringtochars_test('d[%s] = 1')
|
||||
@@ -982,7 +1089,7 @@ cb.append(">>> kwargs")
|
||||
cb.append(">>> iter")
|
||||
ee('d.update(FailingMapping())')
|
||||
ee('d.update([FailingIterNext()])')
|
||||
#iter_test('d.update(%s)')
|
||||
iter_test('d.update(%s)')
|
||||
convertfrompyobject_test('d.update(%s)')
|
||||
stringtochars_test('d.update(((%s, 0),))')
|
||||
convertfrompyobject_test('d.update((("a", %s),))')
|
||||
@@ -994,7 +1101,7 @@ cb.append("> List")
|
||||
cb.append(">> ListConstructor")
|
||||
ee('vim.List(1, 2)')
|
||||
ee('vim.List(a=1)')
|
||||
#iter_test('vim.List(%s)')
|
||||
iter_test('vim.List(%s)')
|
||||
convertfrompyobject_test('vim.List([%s])')
|
||||
cb.append(">> ListItem")
|
||||
ee('l[1000]')
|
||||
@@ -1002,11 +1109,11 @@ cb.append(">> ListAssItem")
|
||||
ee('ll[1] = 2')
|
||||
ee('l[1000] = 3')
|
||||
cb.append(">> ListAssSlice")
|
||||
ee('ll[1:100] = "abc"')
|
||||
#iter_test('l[:] = %s')
|
||||
ee('ll[1:100] = "abcJ"')
|
||||
iter_test('l[:] = %s')
|
||||
convertfrompyobject_test('l[:] = [%s]')
|
||||
cb.append(">> ListConcatInPlace")
|
||||
#iter_test('l.extend(%s)')
|
||||
iter_test('l.extend(%s)')
|
||||
convertfrompyobject_test('l.extend([%s])')
|
||||
cb.append(">> ListSetattr")
|
||||
ee('del l.locked')
|
||||
@@ -1033,18 +1140,19 @@ cb.append(">> WindowSetattr")
|
||||
ee('vim.current.window.buffer = 0')
|
||||
ee('vim.current.window.cursor = (100000000, 100000000)')
|
||||
ee('vim.current.window.cursor = True')
|
||||
ee('vim.current.window.height = "abc"')
|
||||
ee('vim.current.window.width = "abc"')
|
||||
number_test('vim.current.window.height = %s', unsigned=True)
|
||||
number_test('vim.current.window.width = %s', unsigned=True)
|
||||
ee('vim.current.window.xxxxxx = True')
|
||||
cb.append("> WinList")
|
||||
cb.append(">> WinListItem")
|
||||
ee('vim.windows[1000]')
|
||||
cb.append("> Buffer")
|
||||
cb.append(">> StringToLine (indirect)")
|
||||
ee('vim.current.buffer[0] = u"\\na"')
|
||||
ee('vim.current.buffer[0] = "\\na"')
|
||||
cb.append(">> SetBufferLine (indirect)")
|
||||
ee('vim.current.buffer[0] = True')
|
||||
cb.append(">> SetBufferLines (indirect)")
|
||||
cb.append(">> SetBufferLineList (indirect)")
|
||||
ee('vim.current.buffer[:] = True')
|
||||
ee('vim.current.buffer[:] = ["\\na", "bc"]')
|
||||
cb.append(">> InsertBufferLines (indirect)")
|
||||
@@ -1062,14 +1170,14 @@ ee('vim.current.buffer.name = True')
|
||||
ee('vim.current.buffer.xxx = True')
|
||||
cb.append(">> BufferMark")
|
||||
ee('vim.current.buffer.mark(0)')
|
||||
ee('vim.current.buffer.mark("abc")')
|
||||
ee('vim.current.buffer.mark("abcM")')
|
||||
ee('vim.current.buffer.mark("!")')
|
||||
cb.append(">> BufferRange")
|
||||
ee('vim.current.buffer.range(1, 2, 3)')
|
||||
cb.append("> BufMap")
|
||||
cb.append(">> BufMapItem")
|
||||
ee('vim.buffers[None]')
|
||||
ee('vim.buffers[100000000]')
|
||||
number_test('vim.buffers[%s]', natural=True)
|
||||
cb.append("> Current")
|
||||
cb.append(">> CurrentGetattr")
|
||||
ee('vim.current.xxx')
|
||||
@@ -1079,13 +1187,48 @@ ee('vim.current.buffer = True')
|
||||
ee('vim.current.window = True')
|
||||
ee('vim.current.tabpage = True')
|
||||
ee('vim.current.xxx = True')
|
||||
del d
|
||||
del ned
|
||||
del dl
|
||||
del l
|
||||
del ll
|
||||
del f
|
||||
del fd
|
||||
del fdel
|
||||
del subexpr_test
|
||||
del stringtochars_test
|
||||
del Mapping
|
||||
del convertfrompyobject_test
|
||||
del convertfrompymapping_test
|
||||
del iter_test
|
||||
del number_test
|
||||
del FailingTrue
|
||||
del FailingIter
|
||||
del FailingIterNext
|
||||
del FailingMapping
|
||||
del FailingMappingKey
|
||||
del FailingList
|
||||
del NoArgsCall
|
||||
del FailingCall
|
||||
del FailingNumber
|
||||
EOF
|
||||
:delfunction F
|
||||
:"
|
||||
:" Test import
|
||||
py << EOF
|
||||
sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
|
||||
sys.path.append(os.path.join(os.getcwd(), 'python_after'))
|
||||
vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
|
||||
l = []
|
||||
def callback(path):
|
||||
l.append(path[-len('/testdir'):])
|
||||
vim.foreach_rtp(callback)
|
||||
cb.append(repr(l))
|
||||
del l
|
||||
def callback(path):
|
||||
return path[-len('/testdir'):]
|
||||
cb.append(repr(vim.foreach_rtp(callback)))
|
||||
del callback
|
||||
from module import dir as d
|
||||
from modulex import ddir
|
||||
cb.append(d + ',' + ddir)
|
||||
@@ -1093,6 +1236,19 @@ import before
|
||||
cb.append(before.dir)
|
||||
import after
|
||||
cb.append(after.dir)
|
||||
import topmodule as tm
|
||||
import topmodule.submodule as tms
|
||||
import topmodule.submodule.subsubmodule.subsubsubmodule as tmsss
|
||||
cb.append(tm.__file__.replace('.pyc', '.py')[-len('modulex/topmodule/__init__.py'):])
|
||||
cb.append(tms.__file__.replace('.pyc', '.py')[-len('modulex/topmodule/submodule/__init__.py'):])
|
||||
cb.append(tmsss.__file__.replace('.pyc', '.py')[-len('modulex/topmodule/submodule/subsubmodule/subsubsubmodule.py'):])
|
||||
del before
|
||||
del after
|
||||
del d
|
||||
del ddir
|
||||
del tm
|
||||
del tms
|
||||
del tmsss
|
||||
EOF
|
||||
:"
|
||||
:" Test exceptions
|
||||
@@ -1101,21 +1257,52 @@ EOF
|
||||
:endfun
|
||||
py << EOF
|
||||
Exe = vim.bindeval('function("Exe")')
|
||||
ee('vim.command("throw \'abc\'")')
|
||||
ee('vim.command("throw \'abcN\'")')
|
||||
ee('Exe("throw \'def\'")')
|
||||
ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")')
|
||||
ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")')
|
||||
ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")')
|
||||
ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")')
|
||||
del Exe
|
||||
EOF
|
||||
:delfunction Exe
|
||||
:"
|
||||
:" Cleanup
|
||||
py << EOF
|
||||
del cb
|
||||
del ee
|
||||
del sys
|
||||
del os
|
||||
del vim
|
||||
EOF
|
||||
:endfun
|
||||
:"
|
||||
:call Test()
|
||||
:fun RunTest()
|
||||
:let checkrefs = !empty($PYTHONDUMPREFS)
|
||||
:let start = getline(1, '$')
|
||||
:for i in range(checkrefs ? 10 : 1)
|
||||
: if i != 0
|
||||
: %d _
|
||||
: call setline(1, start)
|
||||
: endif
|
||||
: call Test()
|
||||
: if i == 0
|
||||
: let result = getline(1, '$')
|
||||
: endif
|
||||
:endfor
|
||||
:if checkrefs
|
||||
: %d _
|
||||
: call setline(1, result)
|
||||
:endif
|
||||
:endfun
|
||||
:"
|
||||
:delfunc Test
|
||||
:call RunTest()
|
||||
:delfunction RunTest
|
||||
:delfunction Test
|
||||
:call garbagecollect(1)
|
||||
:"
|
||||
:/^start:/,$wq! test.out
|
||||
:" vim: et ts=4 isk-=\:
|
||||
:call getchar()
|
||||
ENDTEST
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,8 +5,8 @@ STARTTEST
|
||||
:set noswapfile
|
||||
:if !has('python3') | e! test.ok | wq! test.out | endif
|
||||
:lang C
|
||||
:py3 import vim
|
||||
:fun Test()
|
||||
:py3 import vim
|
||||
:let l = []
|
||||
:py3 l=vim.bindeval('l')
|
||||
:py3 f=vim.bindeval('function("strlen")')
|
||||
@@ -51,6 +51,9 @@ EOF
|
||||
: $put =string(key) . ' : ' . string(Val)
|
||||
: unlet key Val
|
||||
:endfor
|
||||
:py3 del dk
|
||||
:py3 del di
|
||||
:py3 del dv
|
||||
:"
|
||||
:" removing items with del
|
||||
:py3 del l[2]
|
||||
@@ -169,12 +172,12 @@ EOF
|
||||
:unlockvar! l
|
||||
:"
|
||||
:" Function calls
|
||||
:function New(...)
|
||||
:return ['NewStart']+a:000+['NewEnd']
|
||||
:endfunction
|
||||
:function DictNew(...) dict
|
||||
:return ['DictNewStart']+a:000+['DictNewEnd', self]
|
||||
:endfunction
|
||||
:fun New(...)
|
||||
: return ['NewStart']+a:000+['NewEnd']
|
||||
:endfun
|
||||
:fun DictNew(...) dict
|
||||
: return ['DictNewStart']+a:000+['DictNewEnd', self]
|
||||
:endfun
|
||||
:let l=[function('New'), function('DictNew')]
|
||||
:py3 l=vim.bindeval('l')
|
||||
:py3 l.extend(list(l[0](1, 2, 3)))
|
||||
@@ -204,7 +207,8 @@ EOF
|
||||
: $put ='[0.0, 0.0]'
|
||||
:endif
|
||||
:let messages=[]
|
||||
:py3 <<EOF
|
||||
:delfunction DictNew
|
||||
py3 <<EOF
|
||||
d=vim.bindeval('{}')
|
||||
m=vim.bindeval('messages')
|
||||
def em(expr, g=globals(), l=locals()):
|
||||
@@ -213,15 +217,17 @@ def em(expr, g=globals(), l=locals()):
|
||||
except Exception as e:
|
||||
m.extend([e.__class__.__name__])
|
||||
|
||||
em('d["abc"]')
|
||||
em('d["abc"]="\\0"')
|
||||
em('d["abc"]=vim')
|
||||
em('d["abc1"]')
|
||||
em('d["abc1"]="\\0"')
|
||||
em('d["abc1"]=vim')
|
||||
em('d[""]=1')
|
||||
em('d["a\\0b"]=1')
|
||||
em('d[b"a\\0b"]=1')
|
||||
|
||||
em('d.pop("abc")')
|
||||
em('d.pop("abc1")')
|
||||
em('d.popitem()')
|
||||
del em
|
||||
del m
|
||||
EOF
|
||||
:$put =messages
|
||||
:unlet messages
|
||||
@@ -233,8 +239,8 @@ EOF
|
||||
: let toput=s.' : '.join(map(['locked', 'scope'], 'v:val.":".py3eval(name.".".v:val)'), ';')
|
||||
: $put =toput
|
||||
:endfor
|
||||
:silent! let d.abc=1
|
||||
:silent! let dl.abc=1
|
||||
:silent! let d.abc2=1
|
||||
:silent! let dl.abc3=1
|
||||
:py3 d.locked=True
|
||||
:py3 dl.locked=False
|
||||
:silent! let d.def=1
|
||||
@@ -284,7 +290,7 @@ EOF
|
||||
:" threading
|
||||
:let l = [0]
|
||||
:py3 l=vim.bindeval('l')
|
||||
:py3 <<EOF
|
||||
py3 <<EOF
|
||||
import threading
|
||||
import time
|
||||
|
||||
@@ -300,18 +306,21 @@ class T(threading.Thread):
|
||||
time.sleep(0.1)
|
||||
|
||||
t = T()
|
||||
del T
|
||||
t.start()
|
||||
EOF
|
||||
:sleep 1
|
||||
:py3 t.running = False
|
||||
:py3 t.join()
|
||||
:py3 l[0] = t.t > 8 # check if the background thread is working
|
||||
:py3 del time
|
||||
:py3 del threading
|
||||
:$put =string(l)
|
||||
:"
|
||||
:" settrace
|
||||
:let l = []
|
||||
:py3 l=vim.bindeval('l')
|
||||
:py3 <<EOF
|
||||
py3 <<EOF
|
||||
import sys
|
||||
|
||||
def traceit(frame, event, arg):
|
||||
@@ -327,11 +336,13 @@ EOF
|
||||
:py3 sys.settrace(traceit)
|
||||
:py3 trace_main()
|
||||
:py3 sys.settrace(None)
|
||||
:py3 del traceit
|
||||
:py3 del trace_main
|
||||
:$put =string(l)
|
||||
:"
|
||||
:" Vars
|
||||
:let g:foo = 'bac'
|
||||
:let w:abc = 'def'
|
||||
:let w:abc3 = 'def'
|
||||
:let b:baz = 'bar'
|
||||
:let t:bar = 'jkl'
|
||||
:try
|
||||
@@ -340,7 +351,7 @@ EOF
|
||||
: put =py3eval('vim.vvars[''exception'']')
|
||||
:endtry
|
||||
:put =py3eval('vim.vars[''foo'']')
|
||||
:put =py3eval('vim.current.window.vars[''abc'']')
|
||||
:put =py3eval('vim.current.window.vars[''abc3'']')
|
||||
:put =py3eval('vim.current.buffer.vars[''baz'']')
|
||||
:put =py3eval('vim.current.tabpage.vars[''bar'']')
|
||||
:"
|
||||
@@ -388,16 +399,16 @@ def ev(s, g=globals(), l=locals()):
|
||||
vim.command('let exc=' + repr(e.__class__.__name__))
|
||||
return 0
|
||||
EOF
|
||||
:function E(s)
|
||||
:fun E(s)
|
||||
: python3 e(vim.eval('a:s'))
|
||||
:endfunction
|
||||
:function Ev(s)
|
||||
:endfun
|
||||
:fun Ev(s)
|
||||
: let r=py3eval('ev(vim.eval("a:s"))')
|
||||
: if exists('exc')
|
||||
: throw exc
|
||||
: endif
|
||||
: return r
|
||||
:endfunction
|
||||
:endfun
|
||||
:py3 gopts1=vim.options
|
||||
:py3 wopts1=vim.windows[2].options
|
||||
:py3 wopts2=vim.windows[0].options
|
||||
@@ -412,7 +423,7 @@ EOF
|
||||
:let lst+=[['operatorfunc', 'A', 'B', 'C', 2, 0, 1, 0 ]]
|
||||
:let lst+=[['number', 0, 1, 1, 0, 1, 0, 1 ]]
|
||||
:let lst+=[['numberwidth', 2, 3, 5, -100, 0, 0, 1 ]]
|
||||
:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc', 0, 0, 1 ]]
|
||||
:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc4', 0, 0, 1 ]]
|
||||
:let lst+=[['statusline', '1', '2', '4', 0, 0, 1, 1 ]]
|
||||
:let lst+=[['autoindent', 0, 1, 1, 2, 1, 0, 2 ]]
|
||||
:let lst+=[['shiftwidth', 0, 2, 1, 3, 0, 0, 2 ]]
|
||||
@@ -462,10 +473,27 @@ EOF
|
||||
: endfor
|
||||
: call RecVars(oname)
|
||||
:endfor
|
||||
:delfunction RecVars
|
||||
:delfunction E
|
||||
:delfunction Ev
|
||||
:py3 del ev
|
||||
:py3 del e
|
||||
:only
|
||||
:for buf in g:bufs[1:]
|
||||
: execute 'bwipeout!' buf
|
||||
:endfor
|
||||
:py3 del gopts1
|
||||
:py3 del wopts1
|
||||
:py3 del wopts2
|
||||
:py3 del wopts3
|
||||
:py3 del bopts1
|
||||
:py3 del bopts2
|
||||
:py3 del bopts3
|
||||
:py3 del oval1
|
||||
:py3 del oval2
|
||||
:py3 del oval3
|
||||
:py3 del oname
|
||||
:py3 del invval
|
||||
:"
|
||||
:" Test buffer object
|
||||
:vnew
|
||||
@@ -485,7 +513,7 @@ cb = vim.current.buffer
|
||||
# Tests BufferAppend and BufferItem
|
||||
cb.append(b[0])
|
||||
# Tests BufferSlice and BufferAssSlice
|
||||
cb.append('abc') # Will be overwritten
|
||||
cb.append('abc5') # Will be overwritten
|
||||
cb[-1:] = b[:-2]
|
||||
# Test BufferLength and BufferAssSlice
|
||||
cb.append('def') # Will not be overwritten
|
||||
@@ -509,13 +537,14 @@ b.name = 'bar'
|
||||
cb.append(b.name[-11:].replace(os.path.sep, '/'))
|
||||
cb.name = old_name
|
||||
cb.append(cb.name[-17:].replace(os.path.sep, '/'))
|
||||
del old_name
|
||||
# Test CheckBuffer
|
||||
for _b in vim.buffers:
|
||||
if _b is not cb:
|
||||
vim.command('bwipeout! ' + str(_b.number))
|
||||
del _b
|
||||
cb.append('valid: b:%s, cb:%s' % (repr(b.valid), repr(cb.valid)))
|
||||
for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'):
|
||||
for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc6")'):
|
||||
try:
|
||||
exec(expr)
|
||||
except vim.error:
|
||||
@@ -525,6 +554,7 @@ for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'):
|
||||
# Should not happen in any case
|
||||
cb.append('No exception for ' + expr)
|
||||
vim.command('cd .')
|
||||
del b
|
||||
EOF
|
||||
:"
|
||||
:" Test vim.buffers object
|
||||
@@ -558,6 +588,7 @@ for b in vim.buffers:
|
||||
# Check indexing: vim.buffers[number].number == number
|
||||
cb.append(str(b.number) + ':' + repr(vim.buffers[b.number]) + '=' + repr(b))
|
||||
prevnum = b.number
|
||||
del prevnum
|
||||
|
||||
cb.append(str(len(vim.buffers)))
|
||||
|
||||
@@ -581,6 +612,8 @@ try:
|
||||
next(i4)
|
||||
except StopIteration:
|
||||
cb.append('StopIteration')
|
||||
del i4
|
||||
del bnums
|
||||
EOF
|
||||
:"
|
||||
:" Test vim.{tabpage,window}list and vim.{tabpage,window} objects
|
||||
@@ -622,7 +655,11 @@ for t in vim.tabpages:
|
||||
raise ValueError
|
||||
except Exception as e:
|
||||
cb.append('!!!!!! Error while getting attribute ' + attr + ': ' + e.__class__.__name__)
|
||||
del aval
|
||||
del attr
|
||||
w.cursor = (len(w.buffer), 0)
|
||||
del W
|
||||
del Cursor
|
||||
cb.append('Number of windows in current tab page: ' + str(len(vim.windows)))
|
||||
if list(vim.windows) != list(vim.current.tabpage.windows):
|
||||
cb.append('!!!!!! Windows differ')
|
||||
@@ -635,6 +672,7 @@ def H(o):
|
||||
cb.append('Current tab page: ' + repr(vim.current.tabpage))
|
||||
cb.append('Current window: ' + repr(vim.current.window) + ': ' + H(vim.current.window) + ' is ' + H(vim.current.tabpage.window))
|
||||
cb.append('Current buffer: ' + repr(vim.current.buffer) + ': ' + H(vim.current.buffer) + ' is ' + H(vim.current.window.buffer)+ ' is ' + H(vim.current.tabpage.window.buffer))
|
||||
del H
|
||||
# Assigning: fails
|
||||
try:
|
||||
vim.current.window = vim.tabpages[0].window
|
||||
@@ -646,6 +684,7 @@ for attr in ('window', 'tabpage', 'buffer'):
|
||||
setattr(vim.current, attr, None)
|
||||
except TypeError:
|
||||
cb.append('Type error at assigning None to vim.current.' + attr)
|
||||
del attr
|
||||
|
||||
# Assigning: success
|
||||
vim.current.tabpage = vim.tabpages[-2]
|
||||
@@ -661,8 +700,13 @@ ts = list(vim.tabpages)
|
||||
for b in vim.buffers:
|
||||
if b is not cb:
|
||||
vim.command('bwipeout! ' + str(b.number))
|
||||
del b
|
||||
cb.append('w.valid: ' + repr([w.valid for w in ws]))
|
||||
cb.append('t.valid: ' + repr([t.valid for t in ts]))
|
||||
del w
|
||||
del t
|
||||
del ts
|
||||
del ws
|
||||
EOF
|
||||
:tabonly!
|
||||
:only!
|
||||
@@ -681,6 +725,8 @@ for expr, attr in (
|
||||
('vim.current.tabpage', 'TabPage'),
|
||||
):
|
||||
cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr)))
|
||||
del expr
|
||||
del attr
|
||||
EOF
|
||||
:"
|
||||
:" Test __dir__() method
|
||||
@@ -706,15 +752,15 @@ EOF
|
||||
:$put =string(py3eval('vim.Dictionary(a=1)'))
|
||||
:$put =string(py3eval('vim.Dictionary(((''a'', 1),))'))
|
||||
:$put =string(py3eval('vim.List()'))
|
||||
:$put =string(py3eval('vim.List(iter(''abc''))'))
|
||||
:$put =string(py3eval('vim.List(iter(''abc7''))'))
|
||||
:$put =string(py3eval('vim.Function(''tr'')'))
|
||||
:"
|
||||
:" Test stdout/stderr
|
||||
:redir => messages
|
||||
:py3 sys.stdout.write('abc') ; sys.stdout.write('def')
|
||||
:py3 sys.stderr.write('abc') ; sys.stderr.write('def')
|
||||
:py3 sys.stdout.writelines(iter('abc'))
|
||||
:py3 sys.stderr.writelines(iter('abc'))
|
||||
:py3 sys.stdout.write('abc8') ; sys.stdout.write('def')
|
||||
:py3 sys.stderr.write('abc9') ; sys.stderr.write('def')
|
||||
:py3 sys.stdout.writelines(iter('abcA'))
|
||||
:py3 sys.stderr.writelines(iter('abcB'))
|
||||
:redir END
|
||||
:$put =string(substitute(messages, '\d\+', '', 'g'))
|
||||
:" Test subclassing
|
||||
@@ -735,7 +781,7 @@ class DupList(vim.List):
|
||||
return [super(DupList, self).__getitem__(idx)] * 2
|
||||
|
||||
dl = DupList()
|
||||
dl2 = DupList(iter('abc'))
|
||||
dl2 = DupList(iter('abcC'))
|
||||
dl.extend(dl2[0])
|
||||
|
||||
class DupFun(vim.Function):
|
||||
@@ -748,6 +794,19 @@ EOF
|
||||
:$put =string(py3eval('dl'))
|
||||
:$put =string(py3eval('dl2'))
|
||||
:$put =string(py3eval('df(2)'))
|
||||
:$put =string(py3eval('dl') is# py3eval('dl'))
|
||||
:$put =string(py3eval('dd') is# py3eval('dd'))
|
||||
:$put =string(py3eval('df'))
|
||||
:delfunction Put
|
||||
py3 << EOF
|
||||
del DupDict
|
||||
del DupList
|
||||
del DupFun
|
||||
del dd
|
||||
del dl
|
||||
del dl2
|
||||
del df
|
||||
EOF
|
||||
:"
|
||||
:" Test chdir
|
||||
py3 << EOF
|
||||
@@ -761,6 +820,7 @@ cb.append(vim.eval('@%').replace(os.path.sep, '/'))
|
||||
os.chdir('testdir')
|
||||
cb.append(str(fnamemodify('.', ':p:h:t')))
|
||||
cb.append(vim.eval('@%'))
|
||||
del fnamemodify
|
||||
EOF
|
||||
:"
|
||||
:" Test errors
|
||||
@@ -784,11 +844,11 @@ def ee(expr, g=globals(), l=locals()):
|
||||
cb.append(expr + '::' + repr((e.__class__, e)))
|
||||
|
||||
d = vim.Dictionary()
|
||||
ned = vim.Dictionary(foo='bar', baz='abc')
|
||||
ned = vim.Dictionary(foo='bar', baz='abcD')
|
||||
dl = vim.Dictionary(a=1)
|
||||
dl.locked = True
|
||||
l = vim.List()
|
||||
ll = vim.List('abc')
|
||||
ll = vim.List('abcE')
|
||||
ll.locked = True
|
||||
f = vim.Function('string')
|
||||
fd = vim.Function('F')
|
||||
@@ -825,11 +885,11 @@ def convertfrompyobject_test(expr, recurse=True):
|
||||
# pydict_to_tv
|
||||
stringtochars_test(expr % '{%s : 1}')
|
||||
if recurse:
|
||||
convertfrompyobject_test(expr % '{"abc" : %s}', False)
|
||||
convertfrompyobject_test(expr % '{"abcF" : %s}', False)
|
||||
# pymap_to_tv
|
||||
stringtochars_test(expr % 'Mapping({%s : 1})')
|
||||
if recurse:
|
||||
convertfrompyobject_test(expr % 'Mapping({"abc" : %s})', False)
|
||||
convertfrompyobject_test(expr % 'Mapping({"abcG" : %s})', False)
|
||||
# pyseq_to_tv
|
||||
iter_test(expr)
|
||||
return subexpr_test(expr, 'ConvertFromPyObject', (
|
||||
@@ -838,6 +898,7 @@ def convertfrompyobject_test(expr, recurse=True):
|
||||
'{"": 1}', # Same, but with unicode object
|
||||
'FailingMapping()', #
|
||||
'FailingMappingKey()', #
|
||||
'FailingNumber()', #
|
||||
))
|
||||
|
||||
def convertfrompymapping_test(expr):
|
||||
@@ -852,46 +913,68 @@ def iter_test(expr):
|
||||
'FailingIterNext()',
|
||||
))
|
||||
|
||||
def number_test(expr, natural=False, unsigned=False):
|
||||
if natural:
|
||||
unsigned = True
|
||||
return subexpr_test(expr, 'NumberToLong', (
|
||||
'[]',
|
||||
'None',
|
||||
) + (('-1',) if unsigned else ())
|
||||
+ (('0',) if natural else ()))
|
||||
|
||||
class FailingTrue(object):
|
||||
def __bool__(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('bool')
|
||||
|
||||
class FailingIter(object):
|
||||
def __iter__(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('iter')
|
||||
|
||||
class FailingIterNext(object):
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __next__(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('next')
|
||||
|
||||
class FailingMappingKey(object):
|
||||
def __getitem__(self, item):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('getitem:mappingkey')
|
||||
|
||||
def keys(self):
|
||||
return list("abc")
|
||||
return list("abcH")
|
||||
|
||||
class FailingMapping(object):
|
||||
def __getitem__(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('getitem:mapping')
|
||||
|
||||
def keys(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('keys')
|
||||
|
||||
class FailingList(list):
|
||||
def __getitem__(self, idx):
|
||||
if i == 2:
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError('getitem:list')
|
||||
else:
|
||||
return super(FailingList, self).__getitem__(idx)
|
||||
|
||||
class NoArgsCall(object):
|
||||
def __call__(self):
|
||||
pass
|
||||
|
||||
class FailingCall(object):
|
||||
def __call__(self, path):
|
||||
raise NotImplementedError('call')
|
||||
|
||||
class FailingNumber(object):
|
||||
def __int__(self):
|
||||
raise NotImplementedError('int')
|
||||
|
||||
cb.append("> Output")
|
||||
cb.append(">> OutputSetattr")
|
||||
ee('del sys.stdout.softspace')
|
||||
ee('sys.stdout.softspace = []')
|
||||
number_test('sys.stdout.softspace = %s', unsigned=True)
|
||||
number_test('sys.stderr.softspace = %s', unsigned=True)
|
||||
ee('sys.stdout.attr = None')
|
||||
cb.append(">> OutputWrite")
|
||||
ee('sys.stdout.write(None)')
|
||||
@@ -900,21 +983,37 @@ ee('sys.stdout.writelines(None)')
|
||||
ee('sys.stdout.writelines([1])')
|
||||
iter_test('sys.stdout.writelines(%s)')
|
||||
cb.append("> VimCommand")
|
||||
ee('vim.command(1)')
|
||||
stringtochars_test('vim.command(%s)')
|
||||
ee('vim.command("", 2)')
|
||||
#! Not checked: vim->python exceptions translating: checked later
|
||||
cb.append("> VimToPython")
|
||||
#! Not checked: everything: needs errors in internal python functions
|
||||
cb.append("> VimEval")
|
||||
ee('vim.eval(1)')
|
||||
stringtochars_test('vim.eval(%s)')
|
||||
ee('vim.eval("", FailingTrue())')
|
||||
#! Not checked: everything: needs errors in internal python functions
|
||||
cb.append("> VimEvalPy")
|
||||
ee('vim.bindeval(1)')
|
||||
stringtochars_test('vim.bindeval(%s)')
|
||||
ee('vim.eval("", 2)')
|
||||
#! Not checked: vim->python exceptions translating: checked later
|
||||
cb.append("> VimStrwidth")
|
||||
ee('vim.strwidth(1)')
|
||||
stringtochars_test('vim.strwidth(%s)')
|
||||
cb.append("> VimForeachRTP")
|
||||
ee('vim.foreach_rtp(None)')
|
||||
ee('vim.foreach_rtp(NoArgsCall())')
|
||||
ee('vim.foreach_rtp(FailingCall())')
|
||||
ee('vim.foreach_rtp(int, 2)')
|
||||
cb.append('> import')
|
||||
old_rtp = vim.options['rtp']
|
||||
vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
|
||||
ee('import xxx_no_such_module_xxx')
|
||||
ee('import failing_import')
|
||||
ee('import failing')
|
||||
vim.options['rtp'] = old_rtp
|
||||
del old_rtp
|
||||
cb.append("> Dictionary")
|
||||
cb.append(">> DictionaryConstructor")
|
||||
ee('vim.Dictionary("abc")')
|
||||
ee('vim.Dictionary("abcI")')
|
||||
##! Not checked: py_dict_alloc failure
|
||||
cb.append(">> DictionarySetattr")
|
||||
ee('del d.locked')
|
||||
@@ -929,6 +1028,7 @@ ee('d.pop("a")')
|
||||
ee('dl.pop("a")')
|
||||
cb.append(">> DictionaryIterNext")
|
||||
ee('for i in ned: ned["a"] = 1')
|
||||
del i
|
||||
cb.append(">> DictionaryAssItem")
|
||||
ee('dl["b"] = 1')
|
||||
stringtochars_test('d[%s] = 1')
|
||||
@@ -958,7 +1058,7 @@ cb.append(">> ListAssItem")
|
||||
ee('ll[1] = 2')
|
||||
ee('l[1000] = 3')
|
||||
cb.append(">> ListAssSlice")
|
||||
ee('ll[1:100] = "abc"')
|
||||
ee('ll[1:100] = "abcJ"')
|
||||
iter_test('l[:] = %s')
|
||||
convertfrompyobject_test('l[:] = [%s]')
|
||||
cb.append(">> ListConcatInPlace")
|
||||
@@ -989,8 +1089,8 @@ cb.append(">> WindowSetattr")
|
||||
ee('vim.current.window.buffer = 0')
|
||||
ee('vim.current.window.cursor = (100000000, 100000000)')
|
||||
ee('vim.current.window.cursor = True')
|
||||
ee('vim.current.window.height = "abc"')
|
||||
ee('vim.current.window.width = "abc"')
|
||||
number_test('vim.current.window.height = %s', unsigned=True)
|
||||
number_test('vim.current.window.width = %s', unsigned=True)
|
||||
ee('vim.current.window.xxxxxx = True')
|
||||
cb.append("> WinList")
|
||||
cb.append(">> WinListItem")
|
||||
@@ -998,9 +1098,10 @@ ee('vim.windows[1000]')
|
||||
cb.append("> Buffer")
|
||||
cb.append(">> StringToLine (indirect)")
|
||||
ee('vim.current.buffer[0] = "\\na"')
|
||||
ee('vim.current.buffer[0] = b"\\na"')
|
||||
cb.append(">> SetBufferLine (indirect)")
|
||||
ee('vim.current.buffer[0] = True')
|
||||
cb.append(">> SetBufferLines (indirect)")
|
||||
cb.append(">> SetBufferLineList (indirect)")
|
||||
ee('vim.current.buffer[:] = True')
|
||||
ee('vim.current.buffer[:] = ["\\na", "bc"]')
|
||||
cb.append(">> InsertBufferLines (indirect)")
|
||||
@@ -1018,14 +1119,14 @@ ee('vim.current.buffer.name = True')
|
||||
ee('vim.current.buffer.xxx = True')
|
||||
cb.append(">> BufferMark")
|
||||
ee('vim.current.buffer.mark(0)')
|
||||
ee('vim.current.buffer.mark("abc")')
|
||||
ee('vim.current.buffer.mark("abcM")')
|
||||
ee('vim.current.buffer.mark("!")')
|
||||
cb.append(">> BufferRange")
|
||||
ee('vim.current.buffer.range(1, 2, 3)')
|
||||
cb.append("> BufMap")
|
||||
cb.append(">> BufMapItem")
|
||||
ee('vim.buffers[None]')
|
||||
ee('vim.buffers[100000000]')
|
||||
number_test('vim.buffers[%s]', natural=True)
|
||||
cb.append("> Current")
|
||||
cb.append(">> CurrentGetattr")
|
||||
ee('vim.current.xxx')
|
||||
@@ -1035,13 +1136,48 @@ ee('vim.current.buffer = True')
|
||||
ee('vim.current.window = True')
|
||||
ee('vim.current.tabpage = True')
|
||||
ee('vim.current.xxx = True')
|
||||
del d
|
||||
del ned
|
||||
del dl
|
||||
del l
|
||||
del ll
|
||||
del f
|
||||
del fd
|
||||
del fdel
|
||||
del subexpr_test
|
||||
del stringtochars_test
|
||||
del Mapping
|
||||
del convertfrompyobject_test
|
||||
del convertfrompymapping_test
|
||||
del iter_test
|
||||
del number_test
|
||||
del FailingTrue
|
||||
del FailingIter
|
||||
del FailingIterNext
|
||||
del FailingMapping
|
||||
del FailingMappingKey
|
||||
del FailingList
|
||||
del NoArgsCall
|
||||
del FailingCall
|
||||
del FailingNumber
|
||||
EOF
|
||||
:delfunction F
|
||||
:"
|
||||
:" Test import
|
||||
py3 << EOF
|
||||
sys.path.insert(0, os.path.join(os.getcwd(), 'python_before'))
|
||||
sys.path.append(os.path.join(os.getcwd(), 'python_after'))
|
||||
vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\')
|
||||
l = []
|
||||
def callback(path):
|
||||
l.append(os.path.relpath(path))
|
||||
vim.foreach_rtp(callback)
|
||||
cb.append(repr(l))
|
||||
del l
|
||||
def callback(path):
|
||||
return os.path.relpath(path)
|
||||
cb.append(repr(vim.foreach_rtp(callback)))
|
||||
del callback
|
||||
from module import dir as d
|
||||
from modulex import ddir
|
||||
cb.append(d + ',' + ddir)
|
||||
@@ -1049,6 +1185,19 @@ import before
|
||||
cb.append(before.dir)
|
||||
import after
|
||||
cb.append(after.dir)
|
||||
import topmodule as tm
|
||||
import topmodule.submodule as tms
|
||||
import topmodule.submodule.subsubmodule.subsubsubmodule as tmsss
|
||||
cb.append(tm.__file__[-len('modulex/topmodule/__init__.py'):])
|
||||
cb.append(tms.__file__[-len('modulex/topmodule/submodule/__init__.py'):])
|
||||
cb.append(tmsss.__file__[-len('modulex/topmodule/submodule/subsubmodule/subsubsubmodule.py'):])
|
||||
del before
|
||||
del after
|
||||
del d
|
||||
del ddir
|
||||
del tm
|
||||
del tms
|
||||
del tmsss
|
||||
EOF
|
||||
:"
|
||||
:" Test exceptions
|
||||
@@ -1057,21 +1206,52 @@ EOF
|
||||
:endfun
|
||||
py3 << EOF
|
||||
Exe = vim.bindeval('function("Exe")')
|
||||
ee('vim.command("throw \'abc\'")')
|
||||
ee('vim.command("throw \'abcN\'")')
|
||||
ee('Exe("throw \'def\'")')
|
||||
ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")')
|
||||
ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")')
|
||||
ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")')
|
||||
ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")')
|
||||
del Exe
|
||||
EOF
|
||||
:delfunction Exe
|
||||
:"
|
||||
:" Cleanup
|
||||
py3 << EOF
|
||||
del cb
|
||||
del ee
|
||||
del sys
|
||||
del os
|
||||
del vim
|
||||
EOF
|
||||
:endfun
|
||||
:"
|
||||
:call Test()
|
||||
:fun RunTest()
|
||||
:let checkrefs = !empty($PYTHONDUMPREFS)
|
||||
:let start = getline(1, '$')
|
||||
:for i in range(checkrefs ? 10 : 1)
|
||||
: if i != 0
|
||||
: %d _
|
||||
: call setline(1, start)
|
||||
: endif
|
||||
: call Test()
|
||||
: if i == 0
|
||||
: let result = getline(1, '$')
|
||||
: endif
|
||||
:endfor
|
||||
:if checkrefs
|
||||
: %d _
|
||||
: call setline(1, result)
|
||||
:endif
|
||||
:endfun
|
||||
:"
|
||||
:delfunc Test
|
||||
:call RunTest()
|
||||
:delfunction RunTest
|
||||
:delfunction Test
|
||||
:call garbagecollect(1)
|
||||
:"
|
||||
:/^start:/,$wq! test.out
|
||||
:" vim: et ts=4 isk-=\:
|
||||
:call getchar()
|
||||
ENDTEST
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -728,6 +728,76 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1237,
|
||||
/**/
|
||||
1236,
|
||||
/**/
|
||||
1235,
|
||||
/**/
|
||||
1234,
|
||||
/**/
|
||||
1233,
|
||||
/**/
|
||||
1232,
|
||||
/**/
|
||||
1231,
|
||||
/**/
|
||||
1230,
|
||||
/**/
|
||||
1229,
|
||||
/**/
|
||||
1228,
|
||||
/**/
|
||||
1227,
|
||||
/**/
|
||||
1226,
|
||||
/**/
|
||||
1225,
|
||||
/**/
|
||||
1224,
|
||||
/**/
|
||||
1223,
|
||||
/**/
|
||||
1222,
|
||||
/**/
|
||||
1221,
|
||||
/**/
|
||||
1220,
|
||||
/**/
|
||||
1219,
|
||||
/**/
|
||||
1218,
|
||||
/**/
|
||||
1217,
|
||||
/**/
|
||||
1216,
|
||||
/**/
|
||||
1215,
|
||||
/**/
|
||||
1214,
|
||||
/**/
|
||||
1213,
|
||||
/**/
|
||||
1212,
|
||||
/**/
|
||||
1211,
|
||||
/**/
|
||||
1210,
|
||||
/**/
|
||||
1209,
|
||||
/**/
|
||||
1208,
|
||||
/**/
|
||||
1207,
|
||||
/**/
|
||||
1206,
|
||||
/**/
|
||||
1205,
|
||||
/**/
|
||||
1204,
|
||||
/**/
|
||||
1203,
|
||||
/**/
|
||||
1202,
|
||||
/**/
|
||||
|
||||
@@ -116,8 +116,8 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
FONT 8, "Helv"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Cancel", IDCANCEL, 85, 60, 40, 14
|
||||
CTEXT "Printing",IDC_PRINTTEXT1,23,15,157,8
|
||||
CTEXT " ",IDC_PRINTTEXT2,23,25,157,8
|
||||
CTEXT "Initializing...",IDC_PROGRESS,24,38,157,8
|
||||
CTEXT "Printing",IDC_PRINTTEXT1,23,15,157,9
|
||||
CTEXT " ",IDC_PRINTTEXT2,23,25,157,9
|
||||
CTEXT "Initializing...",IDC_PROGRESS,24,38,157,9
|
||||
GROUPBOX "",IDC_BOX1,19,9,170,47
|
||||
END
|
||||
|
||||
53
src/window.c
53
src/window.c
@@ -3774,7 +3774,8 @@ enter_tabpage(tp, old_curbuf, trigger_enter_autocmds, trigger_leave_autocmds)
|
||||
/* We would like doing the TabEnter event first, but we don't have a
|
||||
* valid current window yet, which may break some commands.
|
||||
* This triggers autocommands, thus may make "tp" invalid. */
|
||||
win_enter_ext(tp->tp_curwin, FALSE, TRUE, trigger_enter_autocmds, trigger_leave_autocmds);
|
||||
win_enter_ext(tp->tp_curwin, FALSE, TRUE,
|
||||
trigger_enter_autocmds, trigger_leave_autocmds);
|
||||
prevwin = next_prevwin;
|
||||
|
||||
last_status(FALSE); /* status line may appear or disappear */
|
||||
@@ -6575,14 +6576,17 @@ restore_snapshot_rec(sn, fr)
|
||||
* Set "win" to be the curwin and "tp" to be the current tab page.
|
||||
* restore_win() MUST be called to undo.
|
||||
* No autocommands will be executed.
|
||||
* When "no_display" is TRUE the display won't be affected, no redraw is
|
||||
* triggered, another tabpage access is limited.
|
||||
* Returns FAIL if switching to "win" failed.
|
||||
*/
|
||||
int
|
||||
switch_win(save_curwin, save_curtab, win, tp)
|
||||
win_T **save_curwin;
|
||||
tabpage_T **save_curtab;
|
||||
win_T *win;
|
||||
tabpage_T *tp;
|
||||
switch_win(save_curwin, save_curtab, win, tp, no_display)
|
||||
win_T **save_curwin UNUSED;
|
||||
tabpage_T **save_curtab UNUSED;
|
||||
win_T *win UNUSED;
|
||||
tabpage_T *tp UNUSED;
|
||||
int no_display UNUSED;
|
||||
{
|
||||
# ifdef FEAT_AUTOCMD
|
||||
block_autocmds();
|
||||
@@ -6592,7 +6596,16 @@ switch_win(save_curwin, save_curtab, win, tp)
|
||||
if (tp != NULL)
|
||||
{
|
||||
*save_curtab = curtab;
|
||||
goto_tabpage_tp(tp, FALSE, FALSE);
|
||||
if (no_display)
|
||||
{
|
||||
curtab->tp_firstwin = firstwin;
|
||||
curtab->tp_lastwin = lastwin;
|
||||
curtab = tp;
|
||||
firstwin = curtab->tp_firstwin;
|
||||
lastwin = curtab->tp_lastwin;
|
||||
}
|
||||
else
|
||||
goto_tabpage_tp(tp, FALSE, FALSE);
|
||||
}
|
||||
if (!win_valid(win))
|
||||
{
|
||||
@@ -6609,15 +6622,29 @@ switch_win(save_curwin, save_curtab, win, tp)
|
||||
|
||||
/*
|
||||
* Restore current tabpage and window saved by switch_win(), if still valid.
|
||||
* When "no_display" is TRUE the display won't be affected, no redraw is
|
||||
* triggered.
|
||||
*/
|
||||
void
|
||||
restore_win(save_curwin, save_curtab)
|
||||
win_T *save_curwin;
|
||||
tabpage_T *save_curtab;
|
||||
restore_win(save_curwin, save_curtab, no_display)
|
||||
win_T *save_curwin UNUSED;
|
||||
tabpage_T *save_curtab UNUSED;
|
||||
int no_display UNUSED;
|
||||
{
|
||||
# ifdef FEAT_WINDOWS
|
||||
if (save_curtab != NULL && valid_tabpage(save_curtab))
|
||||
goto_tabpage_tp(save_curtab, FALSE, FALSE);
|
||||
{
|
||||
if (no_display)
|
||||
{
|
||||
curtab->tp_firstwin = firstwin;
|
||||
curtab->tp_lastwin = lastwin;
|
||||
curtab = save_curtab;
|
||||
firstwin = curtab->tp_firstwin;
|
||||
lastwin = curtab->tp_lastwin;
|
||||
}
|
||||
else
|
||||
goto_tabpage_tp(save_curtab, FALSE, FALSE);
|
||||
}
|
||||
if (win_valid(save_curwin))
|
||||
{
|
||||
curwin = save_curwin;
|
||||
@@ -6879,9 +6906,10 @@ get_win_number(win_T *wp, win_T *first_win)
|
||||
}
|
||||
|
||||
int
|
||||
get_tab_number(tabpage_T *tp)
|
||||
get_tab_number(tabpage_T *tp UNUSED)
|
||||
{
|
||||
int i = 1;
|
||||
# ifdef FEAT_WINDOWS
|
||||
tabpage_T *t;
|
||||
|
||||
for (t = first_tabpage; t != NULL && t != tp; t = t->tp_next)
|
||||
@@ -6890,6 +6918,7 @@ get_tab_number(tabpage_T *tp)
|
||||
if (t == NULL)
|
||||
return 0;
|
||||
else
|
||||
# endif
|
||||
return i;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -722,7 +722,7 @@ main(argc, argv)
|
||||
while ((length < 0 || p < length) && (c = getc(fp)) != EOF)
|
||||
{
|
||||
if (fprintf(fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X",
|
||||
(p % cols) ? ", " : ",\n "+2*!p, c) < 0)
|
||||
(p % cols) ? ", " : &",\n "[2*!p], c) < 0)
|
||||
die(3);
|
||||
p++;
|
||||
}
|
||||
@@ -731,7 +731,7 @@ main(argc, argv)
|
||||
|
||||
if (p && fputs("\n", fpo) == EOF)
|
||||
die(3);
|
||||
if (fputs("};\n" + 3 * (fp == stdin), fpo) == EOF)
|
||||
if (fputs(&"};\n"[3 * (fp == stdin)], fpo) == EOF)
|
||||
die(3);
|
||||
|
||||
if (fp != stdin)
|
||||
|
||||
Reference in New Issue
Block a user