Compare commits

...

21 Commits

Author SHA1 Message Date
Bram Moolenaar
88b1ba151a updated for version 7.3.573
Problem:    Using array index before bounds checking.
Solution:   Swap the parts of the condition. (Dominique Pelle)
2012-06-29 13:34:19 +02:00
Bram Moolenaar
a53c60d33c updated for version 7.3.572
Problem:    Duplicate statement in if and else. (Dominique Pelle)
Solution:   Remove the condition and add a TODO.
2012-06-29 13:19:27 +02:00
Bram Moolenaar
f6a2b08c54 updated for version 7.3.571
Problem:    Duplicated condition.
Solution:   Remove one. (Dominique Pelle)
2012-06-29 13:14:03 +02:00
Bram Moolenaar
8f5c6f003a updated for version 7.3.570
Problem:    ":vimgrep" does not obey 'wildignore'.
Solution:   Apply 'wildignore' and 'suffixes' to ":vimgrep". (Ingo Karkat)
2012-06-29 12:57:06 +02:00
Bram Moolenaar
db91395312 updated for version 7.3.569
Problem:    Evaluating Vim expression in Python is insufficient.
Solution:   Add vim.bindeval().  Also add pyeval() and py3eval(). (ZyX)
2012-06-29 12:54:53 +02:00
Bram Moolenaar
a7014df975 updated for version 7.3.568
Problem:    Bad indents for #ifdefs.
Solution:   Add and remove spaces. (Elias Diem)
2012-06-29 12:35:44 +02:00
Bram Moolenaar
002850940e updated for version 7.3.567
Problem:    Missing copyright notice.
Solution:   Add Vim copyright notice. (Taro Muraoka)
2012-06-29 11:46:33 +02:00
Bram Moolenaar
22189a4bd6 updated for version 7.3.566
Problem:    Redo after completion does not work correctly when refresh: always
            is not used. (Raymond Ko)
Solution:   Check the compl_opt_refresh_always flag. (Christian Brabandt)
2012-06-20 22:56:02 +02:00
Bram Moolenaar
3943156034 updated for version 7.3.565
Problem:    Can't generate proto file for Python 3.
Solution:   Add PYTHON3_CFLAGS to LINT_CFLAGS.
2012-06-20 18:39:15 +02:00
Bram Moolenaar
d12f811816 updated for version 7.3.564
Problem:    Warning for pointer conversion.
Solution:   Add type cast.
2012-06-20 17:56:09 +02:00
Bram Moolenaar
50a12b4078 updated for version 7.3.563
Problem:    Can't build with tiny features.
Solution:   Add #ifdef.
2012-06-20 17:54:38 +02:00
Bram Moolenaar
38bdbd6c6f updated for version 7.3.562
Problem:    ":profdel" should not work when the +profile feature is disabled.
Solution:   Call ex_ni(). (Yasuhiro Matsumoto)
2012-06-20 15:48:57 +02:00
Bram Moolenaar
5e1a0a9a65 updated for version 7.3.561
Problem:    Using refresh: always in a complete function breaks the "."
            command. (Val Markovic)
Solution:   Add match leader to the redo buffer. (Yasuhiro Matsumoto)
2012-06-20 14:26:35 +02:00
Bram Moolenaar
ed46560bf0 updated for version 7.3.560
Problem:    Get an error for a locked argument in extend().
Solution:   Initialize the lock flag for a dictionary. (Yukihiro Nakadaira)
2012-06-20 14:13:06 +02:00
Bram Moolenaar
9158f9e423 updated for version 7.3.559
Problem:    home_replace() does not work with 8.3 filename.
Solution:   Make ":p" expand 8.3 name to full path. (Yasuhiro Matsumoto)
2012-06-20 14:02:27 +02:00
Bram Moolenaar
dc7e85ee5d updated for version 7.3.558
Problem:    Memory access error. (Gary Johnson)
Solution:   Allocate one more byte. (Dominique Pelle)
2012-06-20 12:40:08 +02:00
Bram Moolenaar
9e931224db updated for version 7.3.557
Problem:    Crash when an autocommand wipes out a buffer when it is hidden.
Solution:   Restore the current window when needed. (Christian Brabandt)
2012-06-20 11:55:01 +02:00
Bram Moolenaar
36105782d2 updated for version 7.3.556
Problem:    Compiler warnings on 64 bit Windows.
Solution:   Add type casts. (Mike Williams)
2012-06-14 20:59:25 +02:00
Bram Moolenaar
77c193579b updated for version 7.3.555
Problem:    Building on IBM z/OS fails.
Solution:   Adjust configure. Use the QUOTESED value from config.mk instead of
            the hard coded one in Makefile. (Stephen Bovy)
2012-06-13 19:19:41 +02:00
Bram Moolenaar
795ec43112 updated for version 7.3.554
Problem:    Compiler warning for unused argument.
Solution:   Add UNUSED.
2012-06-13 18:15:19 +02:00
Bram Moolenaar
5641f38d41 updated for version 7.3.553
Problem:    With double-width characters and 'listchars' containing "precedes"
            the text is displayed one cell off.
Solution:   Check for double-width character being overwritten by the
            "precedes" character. (Yasuhiro Matsumoto)
2012-06-13 18:06:36 +02:00
35 changed files with 2629 additions and 306 deletions

View File

@@ -875,6 +875,10 @@ LINT_OPTIONS = -beprxzF
#CFLAGS = -O -Qtarget=m88110compat
#EXTRA_LIBS = -lgen
# The value of QUOTESED comes from auto/config.mk.
# Uncomment the next line to use the default value.
# QUOTESED = sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$$/";/'
##################### end of system specific lines ################### }}}
### Names of the programs and targets {{{1
@@ -1335,7 +1339,7 @@ ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(LEAK_CFLAGS) $(POST_DEFS)
# with "-E".
OSDEF_CFLAGS = $(PRE_DEFS) $(POST_DEFS)
LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(RUBY_CFLAGS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(RUBY_CFLAGS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(PYTHON3_CFLAGS) -Dinline= -D__extension__= -Dalloca=alloca
LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)="
@@ -2411,7 +2415,6 @@ auto/if_perl.c: if_perl.xs
auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in
CC="$(CC) $(OSDEF_CFLAGS)" srcdir=$(srcdir) sh $(srcdir)/osdef.sh
QUOTESED = sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$$/";/'
auto/pathdef.c: Makefile auto/config.mk
-@echo creating $@
-@echo '/* pathdef.c */' > $@

25
src/auto/configure vendored
View File

@@ -4426,15 +4426,18 @@ case `uname` in
echo ""
echo "------------------------------------------"
echo " On z/OS Unix, the environment variable"
echo " __CC_${ccn}MODE must be set to \"1\"!"
echo " _CC_${ccn}MODE must be set to \"1\"!"
echo " Do:"
echo " export _CC_${ccn}MODE=1"
echo " and then call configure again."
echo "------------------------------------------"
exit 1
fi
CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
# Set CFLAGS for configure process.
# This will be reset later for config.mk.
# Use haltonmsg to force error for missing H files.
CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
;;
@@ -8697,8 +8700,13 @@ fi
if test -z "$SKIP_MOTIF"; then
cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
for ac_header in Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h \
Xm/UnhighlightT.h Xm/Notebook.h
if test "$zOSUnix" = "yes"; then
xmheader="Xm/Xm.h"
else
xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h
Xm/UnhighlightT.h Xm/Notebook.h"
fi
for ac_header in $xmheader
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -8713,7 +8721,7 @@ fi
done
if test $ac_cv_header_Xm_XpmP_h = yes; then
if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmAttributes_21 in Xm/XpmP.h" >&5
$as_echo_n "checking for XpmAttributes_21 in Xm/XpmP.h... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12590,6 +12598,11 @@ $as_echo "no" >&6; }
fi
# IBM z/OS reset CFLAGS for config.mk
if test "$zOSUnix" = "yes"; then
CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
fi
ac_config_files="$ac_config_files auto/config.mk:config.mk.in"
cat >confcache <<\_ACEOF

View File

@@ -1363,6 +1363,9 @@ set_curbuf(buf, action)
int action;
{
buf_T *prevbuf;
#ifdef FEAT_WINDOWS
win_T *prevwin;
#endif
int unload = (action == DOBUF_UNLOAD || action == DOBUF_DEL
|| action == DOBUF_WIPE);
@@ -1402,22 +1405,34 @@ set_curbuf(buf, action)
if (buf_valid(prevbuf))
#endif
{
#ifdef FEAT_WINDOWS
prevwin = curwin;
#endif
if (prevbuf == curbuf)
u_sync(FALSE);
close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf,
unload ? action : (action == DOBUF_GOTO
&& !P_HID(prevbuf)
&& !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0, FALSE);
#ifdef FEAT_WINDOWS
if (curwin != prevwin && win_valid(prevwin))
/* autocommands changed curwin, Grr! */
curwin = prevwin;
#endif
}
}
#ifdef FEAT_AUTOCMD
/* An autocommand may have deleted "buf", already entered it (e.g., when
* it did ":bunload") or aborted the script processing! */
* it did ":bunload") or aborted the script processing!
* If curwin->w_buffer is null, enter_buffer() will make it valid again */
if ((buf_valid(buf) && buf != curbuf
# ifdef FEAT_EVAL
if (buf_valid(buf) && buf != curbuf && !aborting())
# else
if (buf_valid(buf) && buf != curbuf)
&& !aborting()
# endif
# ifdef FEAT_WINDOWS
) || curwin->w_buffer == NULL
# endif
)
#endif
enter_buffer(buf);
}

View File

@@ -329,15 +329,18 @@ case `uname` in
echo ""
echo "------------------------------------------"
echo " On z/OS Unix, the environment variable"
echo " __CC_${ccn}MODE must be set to \"1\"!"
echo " _CC_${ccn}MODE must be set to \"1\"!"
echo " Do:"
echo " export _CC_${ccn}MODE=1"
echo " and then call configure again."
echo "------------------------------------------"
exit 1
fi
CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float\\(IEEE\\)";
LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
# Set CFLAGS for configure process.
# This will be reset later for config.mk.
# Use haltonmsg to force error for missing H files.
CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
AC_MSG_RESULT(yes)
;;
*) zOSUnix="no";
@@ -2378,10 +2381,15 @@ dnl Only use the Xm directory when compiling Motif, don't use it for Athena
if test -z "$SKIP_MOTIF"; then
cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_CHECK_HEADERS(Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h \
Xm/UnhighlightT.h Xm/Notebook.h)
if test "$zOSUnix" = "yes"; then
xmheader="Xm/Xm.h"
else
xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h
Xm/UnhighlightT.h Xm/Notebook.h"
fi
AC_CHECK_HEADERS($xmheader)
if test $ac_cv_header_Xm_XpmP_h = yes; then
if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then
dnl Solaris uses XpmAttributes_21, very annoying.
AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
@@ -3642,6 +3650,11 @@ else
fi
AC_SUBST(LINK_AS_NEEDED)
# IBM z/OS reset CFLAGS for config.mk
if test "$zOSUnix" = "yes"; then
CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
fi
dnl write output files
AC_OUTPUT(auto/config.mk:config.mk.in)

View File

@@ -1,7 +1,10 @@
# Python script to get both the data and resource fork from a BinHex encoded
# file.
# Author: Taro Muraoka
# Last Change: 2003 Oct 25
# Author: MURAOKA Taro <koron.kaoriya@gmail.com>
# Last Change: 2012 Jun 29
#
# Copyright (C) 2003,12 MURAOKA Taro <koron.kaoriya@gmail.com>
# THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
import sys
import binhex

View File

@@ -3467,17 +3467,23 @@ ins_compl_addleader(c)
(*mb_char2bytes)(c, buf);
buf[cc] = NUL;
ins_char_bytes(buf, cc);
if (compl_opt_refresh_always)
AppendToRedobuff(buf);
}
else
#endif
{
ins_char(c);
if (compl_opt_refresh_always)
AppendCharToRedobuff(c);
}
/* If we didn't complete finding matches we must search again. */
if (ins_compl_need_restart())
ins_compl_restart();
/* When 'always' is set, don't reset compl_leader. While completing,
* cursor don't point original position, changing compl_leader would
* cursor doesn't point original position, changing compl_leader would
* break redo. */
if (!compl_opt_refresh_always)
{

View File

@@ -424,30 +424,21 @@ static int get_string_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
static int get_lit_string_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
static int get_list_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
static int rettv_list_alloc __ARGS((typval_T *rettv));
static listitem_T *listitem_alloc __ARGS((void));
static void listitem_free __ARGS((listitem_T *item));
static void listitem_remove __ARGS((list_T *l, listitem_T *item));
static long list_len __ARGS((list_T *l));
static int list_equal __ARGS((list_T *l1, list_T *l2, int ic, int recursive));
static int dict_equal __ARGS((dict_T *d1, dict_T *d2, int ic, int recursive));
static int tv_equal __ARGS((typval_T *tv1, typval_T *tv2, int ic, int recursive));
static listitem_T *list_find __ARGS((list_T *l, long n));
static long list_find_nr __ARGS((list_T *l, long idx, int *errorp));
static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
static void list_append __ARGS((list_T *l, listitem_T *item));
static int list_append_number __ARGS((list_T *l, varnumber_T n));
static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef));
static int list_concat __ARGS((list_T *l1, list_T *l2, typval_T *tv));
static list_T *list_copy __ARGS((list_T *orig, int deep, int copyID));
static void list_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2));
static char_u *list2string __ARGS((typval_T *tv, int copyID));
static int list_join_inner __ARGS((garray_T *gap, list_T *l, char_u *sep, int echo_style, int copyID, garray_T *join_gap));
static int list_join __ARGS((garray_T *gap, list_T *l, char_u *sep, int echo, int copyID));
static int free_unref_items __ARGS((int copyID));
static void set_ref_in_ht __ARGS((hashtab_T *ht, int copyID));
static void set_ref_in_list __ARGS((list_T *l, int copyID));
static void set_ref_in_item __ARGS((typval_T *tv, int copyID));
static int rettv_dict_alloc __ARGS((typval_T *rettv));
static void dict_free __ARGS((dict_T *d, int recurse));
static dictitem_T *dictitem_copy __ARGS((dictitem_T *org));
@@ -654,6 +645,12 @@ static void f_pow __ARGS((typval_T *argvars, typval_T *rettv));
static void f_prevnonblank __ARGS((typval_T *argvars, typval_T *rettv));
static void f_printf __ARGS((typval_T *argvars, typval_T *rettv));
static void f_pumvisible __ARGS((typval_T *argvars, typval_T *rettv));
#ifdef FEAT_PYTHON3
static void f_py3eval __ARGS((typval_T *argvars, typval_T *rettv));
#endif
#ifdef FEAT_PYTHON
static void f_pyeval __ARGS((typval_T *argvars, typval_T *rettv));
#endif
static void f_range __ARGS((typval_T *argvars, typval_T *rettv));
static void f_readfile __ARGS((typval_T *argvars, typval_T *rettv));
static void f_reltime __ARGS((typval_T *argvars, typval_T *rettv));
@@ -824,8 +821,6 @@ static int script_autoload __ARGS((char_u *name, int reload));
static char_u *autoload_name __ARGS((char_u *name));
static void cat_func_name __ARGS((char_u *buf, ufunc_T *fp));
static void func_free __ARGS((ufunc_T *fp));
static void func_unref __ARGS((char_u *name));
static void func_ref __ARGS((char_u *name));
static void call_user_func __ARGS((ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, linenr_T firstline, linenr_T lastline, dict_T *selfdict));
static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ;
static void free_funccal __ARGS((funccall_T *fc, int free_val));
@@ -5927,7 +5922,7 @@ list_free(l, recurse)
/*
* Allocate a list item.
*/
static listitem_T *
listitem_T *
listitem_alloc()
{
return (listitem_T *)alloc(sizeof(listitem_T));
@@ -5947,7 +5942,7 @@ listitem_free(item)
/*
* Remove a list item from a List and free it. Also clears the value.
*/
static void
void
listitem_remove(l, item)
list_T *l;
listitem_T *item;
@@ -6123,7 +6118,7 @@ tv_equal(tv1, tv2, ic, recursive)
* A negative index is counted from the end; -1 is the last item.
* Returns NULL when "n" is out of range.
*/
static listitem_T *
listitem_T *
list_find(l, n)
list_T *l;
long n;
@@ -6265,7 +6260,7 @@ list_idx_of_item(l, item)
/*
* Append item "item" to the end of list "l".
*/
static void
void
list_append(l, item)
list_T *l;
listitem_T *item;
@@ -6378,7 +6373,7 @@ list_append_number(l, n)
* If "item" is NULL append at the end.
* Return FAIL when out of memory.
*/
static int
int
list_insert_tv(l, tv, item)
list_T *l;
typval_T *tv;
@@ -6523,7 +6518,7 @@ list_copy(orig, deep, copyID)
* Remove items "item" to "item2" from list "l".
* Does not free the listitem or the value!
*/
static void
void
list_remove(l, item, item2)
list_T *l;
listitem_T *item;
@@ -6785,6 +6780,14 @@ garbage_collect()
set_ref_in_lua(copyID);
#endif
#ifdef FEAT_PYTHON
set_ref_in_python(copyID);
#endif
#ifdef FEAT_PYTHON3
set_ref_in_python3(copyID);
#endif
/*
* 2. Free lists and dictionaries that are not referenced.
*/
@@ -6870,7 +6873,7 @@ free_unref_items(copyID)
/*
* Mark all lists and dicts referenced through hashtab "ht" with "copyID".
*/
static void
void
set_ref_in_ht(ht, copyID)
hashtab_T *ht;
int copyID;
@@ -6890,7 +6893,7 @@ set_ref_in_ht(ht, copyID)
/*
* Mark all lists and dicts referenced through list "l" with "copyID".
*/
static void
void
set_ref_in_list(l, copyID)
list_T *l;
int copyID;
@@ -6904,7 +6907,7 @@ set_ref_in_list(l, copyID)
/*
* Mark all lists and dicts referenced through typval "tv" with "copyID".
*/
static void
void
set_ref_in_item(tv, copyID)
typval_T *tv;
int copyID;
@@ -7986,6 +7989,12 @@ static struct fst
{"prevnonblank", 1, 1, f_prevnonblank},
{"printf", 2, 19, f_printf},
{"pumvisible", 0, 0, f_pumvisible},
#ifdef FEAT_PYTHON3
{"py3eval", 1, 1, f_py3eval},
#endif
#ifdef FEAT_PYTHON
{"pyeval", 1, 1, f_pyeval},
#endif
{"range", 1, 3, f_range},
{"readfile", 1, 3, f_readfile},
{"reltime", 0, 2, f_reltime},
@@ -9150,6 +9159,45 @@ f_byteidx(argvars, rettv)
#endif
}
int
func_call(name, args, selfdict, rettv)
char_u *name;
typval_T *args;
dict_T *selfdict;
typval_T *rettv;
{
listitem_T *item;
typval_T argv[MAX_FUNC_ARGS + 1];
int argc = 0;
int dummy;
int r = 0;
for (item = args->vval.v_list->lv_first; item != NULL;
item = item->li_next)
{
if (argc == MAX_FUNC_ARGS)
{
EMSG(_("E699: Too many arguments"));
break;
}
/* Make a copy of each argument. This is needed to be able to set
* v_lock to VAR_FIXED in the copy without changing the original list.
*/
copy_tv(&item->li_tv, &argv[argc++]);
}
if (item == NULL)
r = call_func(name, (int)STRLEN(name), rettv, argc, argv,
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
&dummy, TRUE, selfdict);
/* Free the arguments. */
while (argc > 0)
clear_tv(&argv[--argc]);
return r;
}
/*
* "call(func, arglist)" function
*/
@@ -9159,10 +9207,6 @@ f_call(argvars, rettv)
typval_T *rettv;
{
char_u *func;
typval_T argv[MAX_FUNC_ARGS + 1];
int argc = 0;
listitem_T *item;
int dummy;
dict_T *selfdict = NULL;
if (argvars[1].v_type != VAR_LIST)
@@ -9190,28 +9234,7 @@ f_call(argvars, rettv)
selfdict = argvars[2].vval.v_dict;
}
for (item = argvars[1].vval.v_list->lv_first; item != NULL;
item = item->li_next)
{
if (argc == MAX_FUNC_ARGS)
{
EMSG(_("E699: Too many arguments"));
break;
}
/* Make a copy of each argument. This is needed to be able to set
* v_lock to VAR_FIXED in the copy without changing the original list.
*/
copy_tv(&item->li_tv, &argv[argc++]);
}
if (item == NULL)
(void)call_func(func, (int)STRLEN(func), rettv, argc, argv,
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
&dummy, TRUE, selfdict);
/* Free the arguments. */
while (argc > 0)
clear_tv(&argv[--argc]);
(void)func_call(func, &argvars[1], selfdict, rettv);
}
#ifdef FEAT_FLOAT
@@ -14424,6 +14447,40 @@ f_pumvisible(argvars, rettv)
#endif
}
#ifdef FEAT_PYTHON3
/*
* "py3eval()" function
*/
static void
f_py3eval(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
char_u *str;
char_u buf[NUMBUFLEN];
str = get_tv_string_buf(&argvars[0], buf);
do_py3eval(str, rettv);
}
#endif
#ifdef FEAT_PYTHON
/*
* "pyeval()" function
*/
static void
f_pyeval(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
char_u *str;
char_u buf[NUMBUFLEN];
str = get_tv_string_buf(&argvars[0], buf);
do_pyeval(str, rettv);
}
#endif
/*
* "range()" function
*/
@@ -19981,6 +20038,7 @@ init_var_dict(dict, dict_var)
dictitem_T *dict_var;
{
hash_init(&dict->dv_hashtab);
dict->dv_lock = 0;
dict->dv_refcount = DO_NOT_FREE_CNT;
dict->dv_copyID = 0;
dict_var->di_tv.vval.v_dict = dict;
@@ -22138,7 +22196,7 @@ func_free(fp)
* Unreference a Function: decrement the reference count and free it when it
* becomes zero. Only for numbered functions.
*/
static void
void
func_unref(name)
char_u *name;
{
@@ -22162,7 +22220,7 @@ func_unref(name)
/*
* Count a reference to a Function.
*/
static void
void
func_ref(name)
char_u *name;
{
@@ -23554,6 +23612,27 @@ repeat:
return -1;
}
#ifdef WIN3264
# if _WIN32_WINNT >= 0x0500
if (vim_strchr(*fnamep, '~') != NULL)
{
/* Expand 8.3 filename to full path. Needed to make sure the same
* file does not have two different names.
* Note: problem does not occur if _WIN32_WINNT < 0x0500. */
p = alloc(_MAX_PATH + 1);
if (p != NULL)
{
if (GetLongPathName(*fnamep, p, MAXPATHL))
{
vim_free(*bufp);
*bufp = *fnamep = p;
}
else
vim_free(p);
}
}
# endif
#endif
/* Append a path separator to a directory. */
if (mch_isdir(*fnamep))
{

View File

@@ -596,10 +596,15 @@ ex_breakdel(eap)
garray_T *gap;
gap = &dbg_breakp;
#ifdef FEAT_PROFILE
if (eap->cmdidx == CMD_profdel)
{
#ifdef FEAT_PROFILE
gap = &prof_ga;
#else
ex_ni(eap);
return;
#endif
}
if (vim_isdigit(*eap->arg))
{
@@ -1845,22 +1850,28 @@ get_arglist(gap, str)
#if defined(FEAT_QUICKFIX) || defined(FEAT_SYN_HL) || defined(PROTO)
/*
* Parse a list of arguments (file names), expand them and return in
* "fnames[fcountp]".
* "fnames[fcountp]". When "wig" is TRUE, removes files matching 'wildignore'.
* Return FAIL or OK.
*/
int
get_arglist_exp(str, fcountp, fnamesp)
get_arglist_exp(str, fcountp, fnamesp, wig)
char_u *str;
int *fcountp;
char_u ***fnamesp;
int wig;
{
garray_T ga;
int i;
if (get_arglist(&ga, str) == FAIL)
return FAIL;
i = gen_expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
fcountp, fnamesp, EW_FILE|EW_NOTFOUND);
if (wig == TRUE)
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
fcountp, fnamesp, EW_FILE|EW_NOTFOUND);
else
i = gen_expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
fcountp, fnamesp, EW_FILE|EW_NOTFOUND);
ga_clear(&ga);
return i;
}

View File

@@ -513,8 +513,8 @@ EXTERN VimClipboard clip_plus; /* CLIPBOARD selection in X11 */
# define ONE_CLIPBOARD
# endif
#define CLIP_UNNAMED 1
#define CLIP_UNNAMED_PLUS 2
# define CLIP_UNNAMED 1
# define CLIP_UNNAMED_PLUS 2
EXTERN int clip_unnamed INIT(= 0); /* above two values or'ed */
EXTERN int clip_autoselect INIT(= FALSE);
@@ -737,9 +737,9 @@ EXTERN int can_si_back INIT(= FALSE);
#endif
EXTERN pos_T saved_cursor /* w_cursor before formatting text. */
# ifdef DO_INIT
#ifdef DO_INIT
= INIT_POS_T(0, 0, 0)
# endif
#endif
;
/*
@@ -807,9 +807,9 @@ EXTERN int enc_latin9 INIT(= FALSE); /* 'encoding' is latin9 */
# endif
EXTERN int has_mbyte INIT(= 0); /* any multi-byte encoding */
#if defined(WIN3264) && defined(FEAT_MBYTE)
# if defined(WIN3264) && defined(FEAT_MBYTE)
EXTERN int wide_WindowProc INIT(= FALSE); /* use wide WindowProc() */
#endif
# endif
/*
* To speed up BYTELEN() we fill a table with the byte lengths whenever
@@ -1099,8 +1099,8 @@ EXTERN char_u langmap_mapchar[256]; /* mapping for language keys */
EXTERN int save_p_ls INIT(= -1); /* Save 'laststatus' setting */
EXTERN int save_p_wmh INIT(= -1); /* Save 'winminheight' setting */
EXTERN int wild_menu_showing INIT(= 0);
#define WM_SHOWN 1 /* wildmenu showing */
#define WM_SCROLLED 2 /* wildmenu showing with scroll */
# define WM_SHOWN 1 /* wildmenu showing */
# define WM_SCROLLED 2 /* wildmenu showing with scroll */
#endif
#ifdef MSWIN
@@ -1310,9 +1310,9 @@ EXTERN Window clientWindow INIT(= None);
EXTERN Atom commProperty INIT(= None);
EXTERN char_u *serverDelayedStartName INIT(= NULL);
# else
# ifdef PROTO
# ifdef PROTO
typedef int HWND;
# endif
# endif
EXTERN HWND clientWindow INIT(= 0);
# endif
#endif

View File

@@ -375,11 +375,8 @@ set_pixmap(XmEnhancedButtonWidget eb)
XGetGeometry(dpy, pix, &root, &x, &y, &width, &height, &border, &depth);
if (eb->enhancedbutton.label_location == (int)XmTOP
|| eb->enhancedbutton.label_location == (int)XmBOTTOM)
shift = eb->primitive.shadow_thickness / 2;
else
shift = eb->primitive.shadow_thickness / 2;
/* TODO: does the shift depend on label_location somehow? */
shift = eb->primitive.shadow_thickness / 2;
if (shift < 1)
shift = 1;

View File

@@ -199,9 +199,9 @@ int (*dll_lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
lua_Number (*dll_lua_tonumberx) (lua_State *L, int idx, int *isnum);
lua_Integer (*dll_lua_tointegerx) (lua_State *L, int idx, int *isnum);
void (*dll_lua_callk) (lua_State *L, int nargs, int nresults, int ctx,
lua_CFunction k);
lua_CFunction k);
int (*dll_lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
int ctx, lua_CFunction k);
int ctx, lua_CFunction k);
void (*dll_lua_getglobal) (lua_State *L, const char *var);
void (*dll_lua_setglobal) (lua_State *L, const char *var);
#endif
@@ -394,7 +394,7 @@ lua_enabled(int verbose)
luaL_typeerror (lua_State *L, int narg, const char *tname)
{
const char *msg = lua_pushfstring(L, "%s expected, got %s",
tname, luaL_typename(L, narg));
tname, luaL_typename(L, narg));
return luaL_argerror(L, narg, msg);
}
#endif
@@ -646,141 +646,6 @@ luaV_msgfunc(lua_State *L, msgfunc_T mf)
return 1; \
}
/* adapted from eval.c */
#define listitem_alloc() (listitem_T *)alloc(sizeof(listitem_T))
static listitem_T *
list_find (list_T *l, long n)
{
listitem_T *li;
if (l == NULL || n < -l->lv_len || n >= l->lv_len)
return NULL;
if (n < 0) /* search backward? */
for (li = l->lv_last; n < -1; li = li->li_prev)
n++;
else /* search forward */
for (li = l->lv_first; n > 0; li = li->li_next)
n--;
return li;
}
static void
list_remove (list_T *l, listitem_T *li)
{
listwatch_T *lw;
--l->lv_len;
/* fix watchers */
for (lw = l->lv_watch; lw != NULL; lw = lw->lw_next)
if (lw->lw_item == li)
lw->lw_item = li->li_next;
/* fix list pointers */
if (li->li_next == NULL) /* last? */
l->lv_last = li->li_prev;
else
li->li_next->li_prev = li->li_prev;
if (li->li_prev == NULL) /* first? */
l->lv_first = li->li_next;
else
li->li_prev->li_next = li->li_next;
l->lv_idx_item = NULL;
}
static void
list_append(list_T *l, listitem_T *item)
{
if (l->lv_last == NULL) /* empty list? */
l->lv_first = item;
else
l->lv_last->li_next = item;
item->li_prev = l->lv_last;
item->li_next = NULL;
l->lv_last = item;
++l->lv_len;
}
static int
list_insert_tv(list_T *l, typval_T *tv, listitem_T *item)
{
listitem_T *ni = listitem_alloc();
if (ni == NULL)
return FAIL;
copy_tv(tv, &ni->li_tv);
if (item == NULL)
list_append(l, ni);
else
{
ni->li_prev = item->li_prev;
ni->li_next = item;
if (item->li_prev == NULL)
{
l->lv_first = ni;
++l->lv_idx;
}
else
{
item->li_prev->li_next = ni;
l->lv_idx_item = NULL;
}
item->li_prev = ni;
++l->lv_len;
}
return OK;
}
/* set references */
static void set_ref_in_tv (typval_T *tv, int copyID);
static void
set_ref_in_dict(dict_T *d, int copyID)
{
hashtab_T *ht = &d->dv_hashtab;
int n = ht->ht_used;
hashitem_T *hi;
for (hi = ht->ht_array; n > 0; ++hi)
if (!HASHITEM_EMPTY(hi))
{
dictitem_T *di = dict_lookup(hi);
set_ref_in_tv(&di->di_tv, copyID);
--n;
}
}
static void
set_ref_in_list(list_T *l, int copyID)
{
listitem_T *li;
for (li = l->lv_first; li != NULL; li = li->li_next)
set_ref_in_tv(&li->li_tv, copyID);
}
static void
set_ref_in_tv(typval_T *tv, int copyID)
{
if (tv->v_type == VAR_LIST)
{
list_T *l = tv->vval.v_list;
if (l != NULL && l->lv_copyID != copyID)
{
l->lv_copyID = copyID;
set_ref_in_list(l, copyID);
}
}
else if (tv->v_type == VAR_DICT)
{
dict_T *d = tv->vval.v_dict;
if (d != NULL && d->dv_copyID != copyID)
{
d->dv_copyID = copyID;
set_ref_in_dict(d, copyID);
}
}
}
/* ======= List type ======= */
static luaV_List *
@@ -876,7 +741,7 @@ luaV_list_newindex (lua_State *L)
if (li == NULL) return 0;
if (lua_isnil(L, 3)) /* remove? */
{
list_remove(l, li);
list_remove(l, li, li);
clear_tv(&li->li_tv);
vim_free(li);
}
@@ -904,8 +769,7 @@ luaV_list_add (lua_State *L)
typval_T v;
lua_settop(L, 2);
luaV_totypval(L, 2, &v);
copy_tv(&v, &li->li_tv);
list_append(l, li);
list_append_tv(l, &v);
}
lua_settop(L, 1);
return 1;
@@ -1682,7 +1546,7 @@ luaV_setref (lua_State *L)
tv.vval.v_dict = (dict_T *) lua_touserdata(L, 4); /* key */
}
lua_pop(L, 2); /* metatable and value */
set_ref_in_tv(&tv, copyID);
set_ref_in_item(&tv, copyID);
}
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* vi:set ts=8 sts=4 sw=4:
/* vi:set ts=8 sts=4 sw=4 noet:
*
* VIM - Vi IMproved by Bram Moolenaar
*
@@ -56,6 +56,8 @@
static void init_structs(void);
#define PyBytes_FromString PyString_FromString
/* No-op conversion functions, use with care! */
#define PyString_AsBytes(obj) (obj)
#define PyString_FreeBytes(obj)
@@ -122,11 +124,13 @@ struct PyMethodDef { Py_ssize_t a; };
/* This makes if_python.c compile without warnings against Python 2.5
* on Win32 and Win64. */
# undef PyRun_SimpleString
# undef PyRun_String
# undef PyArg_Parse
# undef PyArg_ParseTuple
# undef Py_BuildValue
# undef Py_InitModule4
# undef Py_InitModule4_64
# undef PyObject_CallMethod
/*
* Wrapper defines
@@ -134,6 +138,7 @@ struct PyMethodDef { Py_ssize_t a; };
# define PyArg_Parse dll_PyArg_Parse
# define PyArg_ParseTuple dll_PyArg_ParseTuple
# define PyMem_Free dll_PyMem_Free
# define PyMem_Malloc dll_PyMem_Malloc
# define PyDict_SetItemString dll_PyDict_SetItemString
# define PyErr_BadArgument dll_PyErr_BadArgument
# define PyErr_Clear dll_PyErr_Clear
@@ -150,23 +155,48 @@ struct PyMethodDef { Py_ssize_t a; };
# endif
# define PyInt_AsLong dll_PyInt_AsLong
# define PyInt_FromLong dll_PyInt_FromLong
# define PyLong_AsLong dll_PyLong_AsLong
# define PyLong_FromLong dll_PyLong_FromLong
# define PyInt_Type (*dll_PyInt_Type)
# define PyLong_Type (*dll_PyLong_Type)
# define PyList_GetItem dll_PyList_GetItem
# define PyList_Append dll_PyList_Append
# define PyList_New dll_PyList_New
# define PyList_SetItem dll_PyList_SetItem
# define PyList_Size dll_PyList_Size
# define PyList_Type (*dll_PyList_Type)
# define PySequence_Check dll_PySequence_Check
# define PySequence_Size dll_PySequence_Size
# define PySequence_GetItem dll_PySequence_GetItem
# define PyTuple_Size dll_PyTuple_Size
# define PyTuple_GetItem dll_PyTuple_GetItem
# define PyTuple_Type (*dll_PyTuple_Type)
# define PyImport_ImportModule dll_PyImport_ImportModule
# define PyDict_New dll_PyDict_New
# define PyDict_GetItemString dll_PyDict_GetItemString
# define PyDict_Next dll_PyDict_Next
# ifdef PyMapping_Items
# define PY_NO_MAPPING_ITEMS
# else
# define PyMapping_Items dll_PyMapping_Items
# endif
# define PyObject_CallMethod dll_PyObject_CallMethod
# define PyMapping_Check dll_PyMapping_Check
# define PyIter_Next dll_PyIter_Next
# define PyModule_GetDict dll_PyModule_GetDict
# define PyRun_SimpleString dll_PyRun_SimpleString
# define PyRun_String dll_PyRun_String
# define PyString_AsString dll_PyString_AsString
# define PyString_FromString dll_PyString_FromString
# define PyString_FromStringAndSize dll_PyString_FromStringAndSize
# define PyString_Size dll_PyString_Size
# define PyString_Type (*dll_PyString_Type)
# define PyUnicode_Type (*dll_PyUnicode_Type)
# define PyUnicodeUCS4_AsEncodedString (*dll_PyUnicodeUCS4_AsEncodedString)
# define PyFloat_AsDouble dll_PyFloat_AsDouble
# define PyFloat_FromDouble dll_PyFloat_FromDouble
# define PyFloat_Type (*dll_PyFloat_Type)
# define PyImport_AddModule (*dll_PyImport_AddModule)
# define PySys_SetObject dll_PySys_SetObject
# define PySys_SetArgv dll_PySys_SetArgv
# define PyType_Type (*dll_PyType_Type)
@@ -179,8 +209,10 @@ struct PyMethodDef { Py_ssize_t a; };
# define Py_Finalize dll_Py_Finalize
# define Py_IsInitialized dll_Py_IsInitialized
# define _PyObject_New dll__PyObject_New
# define _PyObject_NextNotImplemented (*dll__PyObject_NextNotImplemented)
# define _Py_NoneStruct (*dll__Py_NoneStruct)
# define PyObject_Init dll__PyObject_Init
# define PyObject_GetIter dll_PyObject_GetIter
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
# define PyType_IsSubtype dll_PyType_IsSubtype
# endif
@@ -188,6 +220,8 @@ struct PyMethodDef { Py_ssize_t a; };
# define PyObject_Malloc dll_PyObject_Malloc
# define PyObject_Free dll_PyObject_Free
# endif
# define PyCapsule_New dll_PyCapsule_New
# define PyCapsule_GetPointer dll_PyCapsule_GetPointer
/*
* Pointers for dynamic link
@@ -195,6 +229,7 @@ struct PyMethodDef { Py_ssize_t a; };
static int(*dll_PyArg_Parse)(PyObject *, char *, ...);
static int(*dll_PyArg_ParseTuple)(PyObject *, char *, ...);
static int(*dll_PyMem_Free)(void *);
static void* (*dll_PyMem_Malloc)(size_t);
static int(*dll_PyDict_SetItemString)(PyObject *dp, char *key, PyObject *item);
static int(*dll_PyErr_BadArgument)(void);
static void(*dll_PyErr_Clear)(void);
@@ -208,26 +243,48 @@ static PyThreadState*(*dll_PyEval_SaveThread)(void);
# ifdef PY_CAN_RECURSE
static PyGILState_STATE (*dll_PyGILState_Ensure)(void);
static void (*dll_PyGILState_Release)(PyGILState_STATE);
#endif
# endif
static long(*dll_PyInt_AsLong)(PyObject *);
static PyObject*(*dll_PyInt_FromLong)(long);
static long(*dll_PyLong_AsLong)(PyObject *);
static PyObject*(*dll_PyLong_FromLong)(long);
static PyTypeObject* dll_PyInt_Type;
static PyTypeObject* dll_PyLong_Type;
static PyObject*(*dll_PyList_GetItem)(PyObject *, PyInt);
static PyObject*(*dll_PyList_Append)(PyObject *, PyObject *);
static PyObject*(*dll_PyList_New)(PyInt size);
static int(*dll_PyList_SetItem)(PyObject *, PyInt, PyObject *);
static PyInt(*dll_PyList_Size)(PyObject *);
static PyTypeObject* dll_PyList_Type;
static int (*dll_PySequence_Check)(PyObject *);
static PyInt(*dll_PySequence_Size)(PyObject *);
static PyObject*(*dll_PySequence_GetItem)(PyObject *, PyInt);
static PyInt(*dll_PyTuple_Size)(PyObject *);
static PyObject*(*dll_PyTuple_GetItem)(PyObject *, PyInt);
static PyTypeObject* dll_PyTuple_Type;
static PyObject*(*dll_PyImport_ImportModule)(const char *);
static PyObject*(*dll_PyDict_New)(void);
static PyObject*(*dll_PyDict_GetItemString)(PyObject *, const char *);
static int (*dll_PyDict_Next)(PyObject *, Py_ssize_t *, PyObject **, PyObject **);
# ifndef PY_NO_MAPPING_ITEMS
static PyObject* (*dll_PyMapping_Items)(PyObject *);
# endif
static PyObject* (*dll_PyObject_CallMethod)(PyObject *, char *, PyObject *);
static int (*dll_PyMapping_Check)(PyObject *);
static PyObject* (*dll_PyIter_Next)(PyObject *);
static PyObject*(*dll_PyModule_GetDict)(PyObject *);
static int(*dll_PyRun_SimpleString)(char *);
static PyObject *(*dll_PyRun_String)(char *, int, PyObject *, PyObject *);
static char*(*dll_PyString_AsString)(PyObject *);
static PyObject*(*dll_PyString_FromString)(const char *);
static PyObject*(*dll_PyString_FromStringAndSize)(const char *, PyInt);
static PyInt(*dll_PyString_Size)(PyObject *);
static PyTypeObject* dll_PyString_Type;
static PyTypeObject* dll_PyUnicode_Type;
static PyObject *(*PyUnicodeUCS4_AsEncodedString)(PyObject *, char *, char *);
static double(*dll_PyFloat_AsDouble)(PyObject *);
static PyObject*(*dll_PyFloat_FromDouble)(double);
static PyTypeObject* dll_PyFloat_Type;
static int(*dll_PySys_SetObject)(char *, PyObject *);
static int(*dll_PySys_SetArgv)(int, char **);
static PyTypeObject* dll_PyType_Type;
@@ -235,12 +292,15 @@ static int (*dll_PyType_Ready)(PyTypeObject *type);
static PyObject*(*dll_Py_BuildValue)(char *, ...);
static PyObject*(*dll_Py_FindMethod)(struct PyMethodDef[], PyObject *, char *);
static PyObject*(*dll_Py_InitModule4)(char *, struct PyMethodDef *, char *, PyObject *, int);
static PyObject*(*dll_PyImport_AddModule)(char *);
static void(*dll_Py_SetPythonHome)(char *home);
static void(*dll_Py_Initialize)(void);
static void(*dll_Py_Finalize)(void);
static int(*dll_Py_IsInitialized)(void);
static PyObject*(*dll__PyObject_New)(PyTypeObject *, PyObject *);
static PyObject*(*dll__PyObject_Init)(PyObject *, PyTypeObject *);
static PyObject* (*dll_PyObject_GetIter)(PyObject *);
static iternextfunc dll__PyObject_NextNotImplemented;
static PyObject* dll__Py_NoneStruct;
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
static int (*dll_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *);
@@ -249,6 +309,8 @@ static int (*dll_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *);
static void* (*dll_PyObject_Malloc)(size_t);
static void (*dll_PyObject_Free)(void*);
# endif
static PyObject* (*dll_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
static void* (*dll_PyCapsule_GetPointer)(PyObject *, char *);
static HINSTANCE hinstPython = 0; /* Instance of python.dll */
@@ -278,6 +340,7 @@ static struct
{"PyArg_Parse", (PYTHON_PROC*)&dll_PyArg_Parse},
{"PyArg_ParseTuple", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
{"PyMem_Free", (PYTHON_PROC*)&dll_PyMem_Free},
{"PyMem_Malloc", (PYTHON_PROC*)&dll_PyMem_Malloc},
{"PyDict_SetItemString", (PYTHON_PROC*)&dll_PyDict_SetItemString},
{"PyErr_BadArgument", (PYTHON_PROC*)&dll_PyErr_BadArgument},
{"PyErr_Clear", (PYTHON_PROC*)&dll_PyErr_Clear},
@@ -294,23 +357,46 @@ static struct
# endif
{"PyInt_AsLong", (PYTHON_PROC*)&dll_PyInt_AsLong},
{"PyInt_FromLong", (PYTHON_PROC*)&dll_PyInt_FromLong},
{"PyLong_AsLong", (PYTHON_PROC*)&dll_PyLong_AsLong},
{"PyLong_FromLong", (PYTHON_PROC*)&dll_PyLong_FromLong},
{"PyInt_Type", (PYTHON_PROC*)&dll_PyInt_Type},
{"PyLong_Type", (PYTHON_PROC*)&dll_PyLong_Type},
{"PyList_GetItem", (PYTHON_PROC*)&dll_PyList_GetItem},
{"PyList_Append", (PYTHON_PROC*)&dll_PyList_Append},
{"PyList_New", (PYTHON_PROC*)&dll_PyList_New},
{"PyList_SetItem", (PYTHON_PROC*)&dll_PyList_SetItem},
{"PyList_Size", (PYTHON_PROC*)&dll_PyList_Size},
{"PyList_Type", (PYTHON_PROC*)&dll_PyList_Type},
{"PySequence_GetItem", (PYTHON_PROC*)&dll_PySequence_GetItem},
{"PySequence_Size", (PYTHON_PROC*)&dll_PySequence_Size},
{"PySequence_Check", (PYTHON_PROC*)&dll_PySequence_Check},
{"PyTuple_GetItem", (PYTHON_PROC*)&dll_PyTuple_GetItem},
{"PyTuple_Size", (PYTHON_PROC*)&dll_PyTuple_Size},
{"PyTuple_Type", (PYTHON_PROC*)&dll_PyTuple_Type},
{"PyImport_ImportModule", (PYTHON_PROC*)&dll_PyImport_ImportModule},
{"PyDict_GetItemString", (PYTHON_PROC*)&dll_PyDict_GetItemString},
{"PyDict_Next", (PYTHON_PROC*)&dll_PyDict_Next},
{"PyDict_New", (PYTHON_PROC*)&dll_PyDict_New},
# ifndef PY_NO_MAPPING_ITEMS
{"PyMapping_Items", (PYTHON_PROC*)&dll_PyMapping_Items},
# endif
{"PyObject_CallMethod", (PYTHON_PROC*)&dll_PyObject_CallMethod},
{"PyMapping_Check", (PYTHON_PROC*)&dll_PyMapping_Check},
{"PyIter_Next", (PYTHON_PROC*)&dll_PyIter_Next},
{"PyModule_GetDict", (PYTHON_PROC*)&dll_PyModule_GetDict},
{"PyRun_SimpleString", (PYTHON_PROC*)&dll_PyRun_SimpleString},
{"PyRun_String", (PYTHON_PROC*)&dll_PyRun_String},
{"PyString_AsString", (PYTHON_PROC*)&dll_PyString_AsString},
{"PyString_FromString", (PYTHON_PROC*)&dll_PyString_FromString},
{"PyString_FromStringAndSize", (PYTHON_PROC*)&dll_PyString_FromStringAndSize},
{"PyString_Size", (PYTHON_PROC*)&dll_PyString_Size},
{"PyString_Type", (PYTHON_PROC*)&dll_PyString_Type},
{"PyUnicode_Type", (PYTHON_PROC*)&dll_PyUnicode_Type},
{"PyUnicodeUCS4_AsEncodedString", (PYTHON_PROC*)&dll_PyUnicodeUCS4_AsEncodedString},
{"PyFloat_Type", (PYTHON_PROC*)&dll_PyFloat_Type},
{"PyFloat_AsDouble", (PYTHON_PROC*)&dll_PyFloat_AsDouble},
{"PyFloat_FromDouble", (PYTHON_PROC*)&dll_PyFloat_FromDouble},
{"PyImport_AddModule", (PYTHON_PROC*)&dll_PyImport_AddModule},
{"PySys_SetObject", (PYTHON_PROC*)&dll_PySys_SetObject},
{"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv},
{"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type},
@@ -328,6 +414,8 @@ static struct
{"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized},
{"_PyObject_New", (PYTHON_PROC*)&dll__PyObject_New},
{"PyObject_Init", (PYTHON_PROC*)&dll__PyObject_Init},
{"PyObject_GetIter", (PYTHON_PROC*)&dll_PyObject_GetIter},
{"_PyObject_NextNotImplemented", (PYTHON_PROC*)&dll__PyObject_NextNotImplemented},
{"_Py_NoneStruct", (PYTHON_PROC*)&dll__Py_NoneStruct},
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02020000
{"PyType_IsSubtype", (PYTHON_PROC*)&dll_PyType_IsSubtype},
@@ -336,6 +424,8 @@ static struct
{"PyObject_Malloc", (PYTHON_PROC*)&dll_PyObject_Malloc},
{"PyObject_Free", (PYTHON_PROC*)&dll_PyObject_Free},
# endif
{"PyCapsule_New", (PYTHON_PROC*)&dll_PyCapsule_New},
{"PyCapsule_GetPointer", (PYTHON_PROC*)&dll_PyCapsule_GetPointer},
{"", NULL},
};
@@ -434,10 +524,25 @@ get_exceptions(void)
static PyObject *BufferNew (buf_T *);
static PyObject *WindowNew(win_T *);
static PyObject *DictionaryNew(dict_T *);
static PyObject *LineToString(const char *);
static PyTypeObject RangeType;
static int initialised = 0;
#define PYINITIALISED initialised
/* Add conversion from PyInt? */
#define DICTKEY_GET(err) \
if (!PyString_Check(keyObject)) \
{ \
PyErr_SetString(PyExc_TypeError, _("only string keys are allowed")); \
return err; \
} \
key = (char_u *) PyString_AsString(keyObject);
#define DICTKEY_UNREF
#define DICTKEY_DECL
/*
* Include the code shared with if_python3.c
*/
@@ -451,6 +556,8 @@ static PyTypeObject RangeType;
static PyInt RangeStart;
static PyInt RangeEnd;
static PyObject *globals;
static void PythonIO_Flush(void);
static int PythonIO_Init(void);
static int PythonMod_Init(void);
@@ -466,8 +573,6 @@ static int SetBufferLineList(buf_T *, PyInt, PyInt, PyObject *, PyInt *);
* 1. Python interpreter main program.
*/
static int initialised = 0;
#if PYTHON_API_VERSION < 1007 /* Python 1.4 */
typedef PyObject PyThreadState;
#endif
@@ -581,6 +686,8 @@ Python_Init(void)
if (PythonMod_Init())
goto fail;
globals = PyModule_GetDict(PyImport_AddModule("__main__"));
/* Remove the element from sys.path that was added because of our
* argv[0] value in PythonMod_Init(). Previously we used an empty
* string, but dependinding on the OS we then get an empty entry or
@@ -609,7 +716,7 @@ fail:
* External interface
*/
static void
DoPythonCommand(exarg_T *eap, const char *cmd)
DoPythonCommand(exarg_T *eap, const char *cmd, typval_T *rettv)
{
#ifndef PY_CAN_RECURSE
static int recursive = 0;
@@ -639,8 +746,16 @@ DoPythonCommand(exarg_T *eap, const char *cmd)
if (Python_Init())
goto theend;
RangeStart = eap->line1;
RangeEnd = eap->line2;
if (rettv == NULL)
{
RangeStart = eap->line1;
RangeEnd = eap->line2;
}
else
{
RangeStart = (PyInt) curwin->w_cursor.lnum;
RangeEnd = RangeStart;
}
Python_Release_Vim(); /* leave vim */
#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
@@ -658,7 +773,23 @@ DoPythonCommand(exarg_T *eap, const char *cmd)
Python_RestoreThread(); /* enter python */
PyRun_SimpleString((char *)(cmd));
if (rettv == NULL)
PyRun_SimpleString((char *)(cmd));
else
{
PyObject *r;
r = PyRun_String((char *)(cmd), Py_eval_input, globals, globals);
if (r == NULL)
EMSG(_("E858: Eval did not return a valid python object"));
else
{
if (ConvertFromPyObject(r, rettv) == -1)
EMSG(_("E859: Failed to convert returned python object to vim value"));
Py_DECREF(r);
}
PyErr_Clear();
}
Python_SaveThread(); /* leave python */
@@ -680,7 +811,7 @@ theend:
#ifndef PY_CAN_RECURSE
--recursive;
#endif
return; /* keeps lint happy */
return;
}
/*
@@ -695,9 +826,9 @@ ex_python(exarg_T *eap)
if (!eap->skip)
{
if (script == NULL)
DoPythonCommand(eap, (char *)eap->arg);
DoPythonCommand(eap, (char *)eap->arg, NULL);
else
DoPythonCommand(eap, (char *)script);
DoPythonCommand(eap, (char *)script, NULL);
}
vim_free(script);
}
@@ -743,7 +874,7 @@ ex_pyfile(exarg_T *eap)
*p++ = '\0';
/* Execute the file */
DoPythonCommand(eap, buffer);
DoPythonCommand(eap, buffer, NULL);
}
/******************************************************
@@ -765,14 +896,16 @@ OutputGetattr(PyObject *self, char *name)
static int
OutputSetattr(PyObject *self, char *name, PyObject *val)
{
if (val == NULL) {
if (val == NULL)
{
PyErr_SetString(PyExc_AttributeError, _("can't delete OutputObject attributes"));
return -1;
}
if (strcmp(name, "softspace") == 0)
{
if (!PyInt_Check(val)) {
if (!PyInt_Check(val))
{
PyErr_SetString(PyExc_TypeError, _("softspace must be an integer"));
return -1;
}
@@ -800,6 +933,9 @@ PythonIO_Init(void)
* 3. Implementation of the Vim module for Python
*/
static PyObject *ConvertToPyObject(typval_T *);
static int ConvertFromPyObject(PyObject *, typval_T *);
/* Window type - Implementation functions
* --------------------------------------
*/
@@ -1441,6 +1577,172 @@ LineToString(const char *str)
return result;
}
static void DictionaryDestructor(PyObject *);
static PyObject *DictionaryGetattr(PyObject *, char*);
static PyMappingMethods DictionaryAsMapping = {
(PyInquiry) DictionaryLength,
(binaryfunc) DictionaryItem,
(objobjargproc) DictionaryAssItem,
};
static PyTypeObject DictionaryType = {
PyObject_HEAD_INIT(0)
0,
"vimdictionary",
sizeof(DictionaryObject),
0,
(destructor) DictionaryDestructor,
(printfunc) 0,
(getattrfunc) DictionaryGetattr,
(setattrfunc) 0,
(cmpfunc) 0,
(reprfunc) 0,
0, /* as number */
0, /* as sequence */
&DictionaryAsMapping, /* as mapping */
(hashfunc) 0,
(ternaryfunc) 0,
(reprfunc) 0,
};
static void
DictionaryDestructor(PyObject *self)
{
DictionaryObject *this = ((DictionaryObject *) (self));
pyll_remove(&this->ref, &lastdict);
dict_unref(this->dict);
Py_DECREF(self);
}
static PyObject *
DictionaryGetattr(PyObject *self, char *name)
{
return Py_FindMethod(DictionaryMethods, self, name);
}
static void ListDestructor(PyObject *);
static PyObject *ListGetattr(PyObject *, char *);
static PySequenceMethods ListAsSeq = {
(PyInquiry) ListLength,
(binaryfunc) 0,
(PyIntArgFunc) 0,
(PyIntArgFunc) ListItem,
(PyIntIntArgFunc) ListSlice,
(PyIntObjArgProc) ListAssItem,
(PyIntIntObjArgProc) ListAssSlice,
(objobjproc) 0,
#if PY_MAJOR_VERSION >= 2
(binaryfunc) ListConcatInPlace,
0,
#endif
};
static PyTypeObject ListType = {
PyObject_HEAD_INIT(0)
0,
"vimlist",
sizeof(ListObject),
0,
(destructor) ListDestructor,
(printfunc) 0,
(getattrfunc) ListGetattr,
(setattrfunc) 0,
(cmpfunc) 0,
(reprfunc) 0,
0, /* as number */
&ListAsSeq, /* as sequence */
0, /* as mapping */
(hashfunc) 0,
(ternaryfunc) 0,
(reprfunc) 0,
};
static void
ListDestructor(PyObject *self)
{
ListObject *this = ((ListObject *) (self));
pyll_remove(&this->ref, &lastlist);
list_unref(this->list);
Py_DECREF(self);
}
static PyObject *
ListGetattr(PyObject *self, char *name)
{
return Py_FindMethod(ListMethods, self, name);
}
static void FunctionDestructor(PyObject *);
static PyObject *FunctionGetattr(PyObject *, char *);
static PyTypeObject FunctionType = {
PyObject_HEAD_INIT(0)
0,
"vimfunction",
sizeof(FunctionObject),
0,
(destructor) FunctionDestructor,
(printfunc) 0,
(getattrfunc) FunctionGetattr,
(setattrfunc) 0,
(cmpfunc) 0,
(reprfunc) 0,
0, /* as number */
0, /* as sequence */
0, /* as mapping */
(hashfunc) 0,
(ternaryfunc) FunctionCall,
(reprfunc) 0,
};
static void
FunctionDestructor(PyObject *self)
{
FunctionObject *this = (FunctionObject *) (self);
func_unref(this->name);
PyMem_Del(this->name);
Py_DECREF(self);
}
static PyObject *
FunctionGetattr(PyObject *self, char *name)
{
FunctionObject *this = (FunctionObject *)(self);
if (strcmp(name, "name") == 0)
return PyString_FromString((char *)(this->name));
else
return Py_FindMethod(FunctionMethods, self, name);
}
void
do_pyeval (char_u *str, typval_T *rettv)
{
DoPythonCommand(NULL, (char *) str, rettv);
switch(rettv->v_type)
{
case VAR_DICT: ++rettv->vval.v_dict->dv_refcount; break;
case VAR_LIST: ++rettv->vval.v_list->lv_refcount; break;
case VAR_FUNC: func_ref(rettv->vval.v_string); break;
}
}
/* Don't generate a prototype for the next function, it generates an error on
* newer Python versions. */
@@ -1453,6 +1755,12 @@ Py_GetProgramName(void)
}
#endif /* Python 1.4 */
void
set_ref_in_python (int copyID)
{
set_ref_in_py(copyID);
}
static void
init_structs(void)
{

View File

@@ -77,7 +77,7 @@ static void init_structs(void);
#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_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)
@@ -109,6 +109,7 @@ static void init_structs(void);
# undef PyArg_ParseTuple
# define PyArg_ParseTuple py3_PyArg_ParseTuple
# define PyMem_Free py3_PyMem_Free
# define PyMem_Malloc py3_PyMem_Malloc
# define PyDict_SetItemString py3_PyDict_SetItemString
# define PyErr_BadArgument py3_PyErr_BadArgument
# define PyErr_Clear py3_PyErr_Clear
@@ -128,14 +129,27 @@ static void init_structs(void);
# define PyList_New py3_PyList_New
# define PyList_SetItem py3_PyList_SetItem
# define PyList_Size py3_PyList_Size
# define PySequence_Check py3_PySequence_Check
# define PySequence_Size py3_PySequence_Size
# define PySequence_GetItem py3_PySequence_GetItem
# define PyTuple_Size py3_PyTuple_Size
# define PyTuple_GetItem py3_PyTuple_GetItem
# define PySlice_GetIndicesEx py3_PySlice_GetIndicesEx
# define PyImport_ImportModule py3_PyImport_ImportModule
# define PyImport_AddModule py3_PyImport_AddModule
# define PyObject_Init py3__PyObject_Init
# define PyDict_New py3_PyDict_New
# define PyDict_GetItemString py3_PyDict_GetItemString
# define PyDict_Next py3_PyDict_Next
# define PyMapping_Check py3_PyMapping_Check
# define PyMapping_Items py3_PyMapping_Items
# define PyIter_Next py3_PyIter_Next
# define PyObject_GetIter py3_PyObject_GetIter
# define PyModule_GetDict py3_PyModule_GetDict
#undef PyRun_SimpleString
# define PyRun_SimpleString py3_PyRun_SimpleString
#undef PyRun_String
# define PyRun_String py3_PyRun_String
# define PySys_SetObject py3_PySys_SetObject
# define PySys_SetArgv py3_PySys_SetArgv
# define PyType_Type (*py3_PyType_Type)
@@ -147,6 +161,7 @@ static void init_structs(void);
# define Py_Finalize py3_Py_Finalize
# define Py_IsInitialized py3_Py_IsInitialized
# define _Py_NoneStruct (*py3__Py_NoneStruct)
# define _PyObject_NextNotImplemented (*py3__PyObject_NextNotImplemented)
# define PyModule_AddObject py3_PyModule_AddObject
# define PyImport_AppendInittab py3_PyImport_AppendInittab
# define _PyUnicode_AsString py3__PyUnicode_AsString
@@ -154,8 +169,13 @@ static void init_structs(void);
# define PyUnicode_AsEncodedString py3_PyUnicode_AsEncodedString
# undef PyBytes_AsString
# define PyBytes_AsString py3_PyBytes_AsString
# undef PyBytes_FromString
# define PyBytes_FromString py3_PyBytes_FromString
# define PyFloat_FromDouble py3_PyFloat_FromDouble
# define PyFloat_AsDouble py3_PyFloat_AsDouble
# define PyObject_GenericGetAttr py3_PyObject_GenericGetAttr
# define PySlice_Type (*py3_PySlice_Type)
# define PyFloat_Type (*py3_PyFloat_Type)
# define PyErr_NewException py3_PyErr_NewException
# ifdef Py_DEBUG
# define _Py_NegativeRefcount py3__Py_NegativeRefcount
@@ -174,6 +194,9 @@ static void init_structs(void);
# define PyUnicode_FromString py3_PyUnicode_FromString
# undef PyUnicode_Decode
# define PyUnicode_Decode py3_PyUnicode_Decode
# define PyType_IsSubtype py3_PyType_IsSubtype
# define PyCapsule_New py3_PyCapsule_New
# define PyCapsule_GetPointer py3_PyCapsule_GetPointer
# ifdef Py_DEBUG
# undef PyObject_NEW
@@ -194,22 +217,34 @@ static void (*py3_PyGILState_Release)(PyGILState_STATE);
static int (*py3_PySys_SetObject)(char *, PyObject *);
static PyObject* (*py3_PyList_Append)(PyObject *, PyObject *);
static Py_ssize_t (*py3_PyList_Size)(PyObject *);
static int (*py3_PySequence_Check)(PyObject *);
static Py_ssize_t (*py3_PySequence_Size)(PyObject *);
static PyObject* (*py3_PySequence_GetItem)(PyObject *, Py_ssize_t);
static Py_ssize_t (*py3_PyTuple_Size)(PyObject *);
static PyObject* (*py3_PyTuple_GetItem)(PyObject *, Py_ssize_t);
static int (*py3_PyMapping_Check)(PyObject *);
static PyObject* (*py3_PyMapping_Items)(PyObject *);
static int (*py3_PySlice_GetIndicesEx)(PyObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength);
static PyObject* (*py3_PyErr_NoMemory)(void);
static void (*py3_Py_Finalize)(void);
static void (*py3_PyErr_SetString)(PyObject *, const char *);
static int (*py3_PyRun_SimpleString)(char *);
static PyObject* (*py3_PyRun_String)(char *, int, PyObject *, PyObject *);
static PyObject* (*py3_PyList_GetItem)(PyObject *, Py_ssize_t);
static PyObject* (*py3_PyImport_ImportModule)(const char *);
static PyObject* (*py3_PyImport_AddModule)(const char *);
static int (*py3_PyErr_BadArgument)(void);
static PyTypeObject* py3_PyType_Type;
static PyObject* (*py3_PyErr_Occurred)(void);
static PyObject* (*py3_PyModule_GetDict)(PyObject *);
static int (*py3_PyList_SetItem)(PyObject *, Py_ssize_t, PyObject *);
static PyObject* (*py3_PyDict_GetItemString)(PyObject *, const char *);
static int (*py3_PyDict_Next)(PyObject *, Py_ssize_t *, PyObject **, PyObject **);
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_Py_BuildValue)(char *, ...);
static int (*py3_PyType_Ready)(PyTypeObject *type);
static int (*py3_PyDict_SetItemString)(PyObject *dp, char *key, PyObject *item);
@@ -224,21 +259,29 @@ static PyThreadState*(*py3_PyEval_SaveThread)(void);
static int (*py3_PyArg_Parse)(PyObject *, char *, ...);
static int (*py3_PyArg_ParseTuple)(PyObject *, char *, ...);
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__PyObject_Init)(PyObject *, PyTypeObject *);
static iternextfunc py3__PyObject_NextNotImplemented;
static PyObject* py3__Py_NoneStruct;
static int (*py3_PyModule_AddObject)(PyObject *m, const char *name, PyObject *o);
static int (*py3_PyImport_AppendInittab)(const char *name, PyObject* (*initfunc)(void));
static char* (*py3__PyUnicode_AsString)(PyObject *unicode);
static PyObject* (*py3_PyUnicode_AsEncodedString)(PyObject *unicode, const char* encoding, const char* errors);
static char* (*py3_PyBytes_AsString)(PyObject *bytes);
static PyObject* (*py3_PyBytes_FromString)(char *str);
static PyObject* (*py3_PyFloat_FromDouble)(double num);
static double (*py3_PyFloat_AsDouble)(PyObject *);
static PyObject* (*py3_PyObject_GenericGetAttr)(PyObject *obj, PyObject *name);
static PyObject* (*py3_PyModule_Create2)(struct PyModuleDef* module, int module_api_version);
static PyObject* (*py3_PyType_GenericAlloc)(PyTypeObject *type, Py_ssize_t nitems);
static PyObject* (*py3_PyType_GenericNew)(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyTypeObject* py3_PySlice_Type;
static PyTypeObject* py3_PyFloat_Type;
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 *);
# ifdef Py_DEBUG
static void (*py3__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
static Py_ssize_t* py3__Py_RefTotal;
@@ -249,6 +292,7 @@ static PyObject* (*py3_PyErr_NewException)(char *name, PyObject *base, PyObject
static void (*py3_PyObject_Free)(void*);
static void* (*py3_PyObject_Malloc)(size_t);
# endif
static int (*py3_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *);
static HINSTANCE hinstPy3 = 0; /* Instance of python.dll */
@@ -280,25 +324,38 @@ static struct
{"Py_Initialize", (PYTHON_PROC*)&py3_Py_Initialize},
{"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple},
{"PyMem_Free", (PYTHON_PROC*)&py3_PyMem_Free},
{"PyMem_Malloc", (PYTHON_PROC*)&py3_PyMem_Malloc},
{"PyList_New", (PYTHON_PROC*)&py3_PyList_New},
{"PyGILState_Ensure", (PYTHON_PROC*)&py3_PyGILState_Ensure},
{"PyGILState_Release", (PYTHON_PROC*)&py3_PyGILState_Release},
{"PySys_SetObject", (PYTHON_PROC*)&py3_PySys_SetObject},
{"PyList_Append", (PYTHON_PROC*)&py3_PyList_Append},
{"PyList_Size", (PYTHON_PROC*)&py3_PyList_Size},
{"PySequence_Check", (PYTHON_PROC*)&py3_PySequence_Check},
{"PySequence_Size", (PYTHON_PROC*)&py3_PySequence_Size},
{"PySequence_GetItem", (PYTHON_PROC*)&py3_PySequence_GetItem},
{"PyTuple_Size", (PYTHON_PROC*)&py3_PyTuple_Size},
{"PyTuple_GetItem", (PYTHON_PROC*)&py3_PyTuple_GetItem},
{"PySlice_GetIndicesEx", (PYTHON_PROC*)&py3_PySlice_GetIndicesEx},
{"PyErr_NoMemory", (PYTHON_PROC*)&py3_PyErr_NoMemory},
{"Py_Finalize", (PYTHON_PROC*)&py3_Py_Finalize},
{"PyErr_SetString", (PYTHON_PROC*)&py3_PyErr_SetString},
{"PyRun_SimpleString", (PYTHON_PROC*)&py3_PyRun_SimpleString},
{"PyRun_String", (PYTHON_PROC*)&py3_PyRun_String},
{"PyList_GetItem", (PYTHON_PROC*)&py3_PyList_GetItem},
{"PyImport_ImportModule", (PYTHON_PROC*)&py3_PyImport_ImportModule},
{"PyImport_AddModule", (PYTHON_PROC*)&py3_PyImport_AddModule},
{"PyErr_BadArgument", (PYTHON_PROC*)&py3_PyErr_BadArgument},
{"PyType_Type", (PYTHON_PROC*)&py3_PyType_Type},
{"PyErr_Occurred", (PYTHON_PROC*)&py3_PyErr_Occurred},
{"PyModule_GetDict", (PYTHON_PROC*)&py3_PyModule_GetDict},
{"PyList_SetItem", (PYTHON_PROC*)&py3_PyList_SetItem},
{"PyDict_GetItemString", (PYTHON_PROC*)&py3_PyDict_GetItemString},
{"PyDict_Next", (PYTHON_PROC*)&py3_PyDict_Next},
{"PyMapping_Check", (PYTHON_PROC*)&py3_PyMapping_Check},
{"PyMapping_Items", (PYTHON_PROC*)&py3_PyMapping_Items},
{"PyIter_Next", (PYTHON_PROC*)&py3_PyIter_Next},
{"PyObject_GetIter", (PYTHON_PROC*)&py3_PyObject_GetIter},
{"PyLong_FromLong", (PYTHON_PROC*)&py3_PyLong_FromLong},
{"PyDict_New", (PYTHON_PROC*)&py3_PyDict_New},
{"Py_BuildValue", (PYTHON_PROC*)&py3_Py_BuildValue},
@@ -311,6 +368,7 @@ static struct
{"PyEval_SaveThread", (PYTHON_PROC*)&py3_PyEval_SaveThread},
{"PyArg_Parse", (PYTHON_PROC*)&py3_PyArg_Parse},
{"Py_IsInitialized", (PYTHON_PROC*)&py3_Py_IsInitialized},
{"_PyObject_NextNotImplemented", (PYTHON_PROC*)&py3__PyObject_NextNotImplemented},
{"_Py_NoneStruct", (PYTHON_PROC*)&py3__Py_NoneStruct},
{"PyErr_Clear", (PYTHON_PROC*)&py3_PyErr_Clear},
{"PyObject_Init", (PYTHON_PROC*)&py3__PyObject_Init},
@@ -318,11 +376,15 @@ static struct
{"PyImport_AppendInittab", (PYTHON_PROC*)&py3_PyImport_AppendInittab},
{"_PyUnicode_AsString", (PYTHON_PROC*)&py3__PyUnicode_AsString},
{"PyBytes_AsString", (PYTHON_PROC*)&py3_PyBytes_AsString},
{"PyBytes_FromString", (PYTHON_PROC*)&py3_PyBytes_FromString},
{"PyFloat_FromDouble", (PYTHON_PROC*)&py3_PyFloat_FromDouble},
{"PyFloat_AsDouble", (PYTHON_PROC*)&py3_PyFloat_AsDouble},
{"PyObject_GenericGetAttr", (PYTHON_PROC*)&py3_PyObject_GenericGetAttr},
{"PyModule_Create2", (PYTHON_PROC*)&py3_PyModule_Create2},
{"PyType_GenericAlloc", (PYTHON_PROC*)&py3_PyType_GenericAlloc},
{"PyType_GenericNew", (PYTHON_PROC*)&py3_PyType_GenericNew},
{"PySlice_Type", (PYTHON_PROC*)&py3_PySlice_Type},
{"PyFloat_Type", (PYTHON_PROC*)&py3_PyFloat_Type},
{"PyErr_NewException", (PYTHON_PROC*)&py3_PyErr_NewException},
# ifdef Py_DEBUG
{"_Py_NegativeRefcount", (PYTHON_PROC*)&py3__Py_NegativeRefcount},
@@ -334,6 +396,9 @@ static struct
{"PyObject_Malloc", (PYTHON_PROC*)&py3_PyObject_Malloc},
{"PyObject_Free", (PYTHON_PROC*)&py3_PyObject_Free},
# endif
{"PyType_IsSubtype", (PYTHON_PROC*)&py3_PyType_IsSubtype},
{"PyCapsule_New", (PYTHON_PROC*)&py3_PyCapsule_New},
{"PyCapsule_GetPointer", (PYTHON_PROC*)&py3_PyCapsule_GetPointer},
{"", NULL},
};
@@ -472,11 +537,41 @@ static PyObject *BufferDir(PyObject *, PyObject *);
static PyTypeObject RangeType;
static int py3initialised = 0;
#define PYINITIALISED py3initialised
/* Add conversion from PyInt? */
#define DICTKEY_GET(err) \
if (PyBytes_Check(keyObject)) \
key = (char_u *) PyBytes_AsString(keyObject); \
else if (PyUnicode_Check(keyObject)) \
{ \
bytes = PyString_AsBytes(keyObject); \
if (bytes == NULL) \
return err; \
key = (char_u *) PyBytes_AsString(bytes); \
if (key == NULL) \
return err; \
} \
else \
{ \
PyErr_SetString(PyExc_TypeError, _("only string keys are allowed")); \
return err; \
}
#define DICTKEY_UNREF \
if (bytes != NULL) \
Py_XDECREF(bytes);
#define DICTKEY_DECL PyObject *bytes = NULL;
/*
* Include the code shared with if_python.c
*/
#include "if_py_both.h"
#define PY3OBJ_DELETED(obj) (obj->ob_base.ob_refcnt<=0)
static void
call_PyObject_Free(void *p)
{
@@ -506,6 +601,8 @@ call_PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
static Py_ssize_t RangeStart;
static Py_ssize_t RangeEnd;
static PyObject *globals;
static int PythonIO_Init(void);
static void PythonIO_Fini(void);
PyMODINIT_FUNC Py3Init_vim(void);
@@ -514,8 +611,6 @@ PyMODINIT_FUNC Py3Init_vim(void);
* 1. Python interpreter main program.
*/
static int py3initialised = 0;
static PyGILState_STATE pygilstate = PyGILState_UNLOCKED;
void
@@ -593,6 +688,8 @@ Python3_Init(void)
PyImport_AppendInittab("vim", Py3Init_vim);
globals = PyModule_GetDict(PyImport_AddModule("__main__"));
/* Remove the element from sys.path that was added because of our
* argv[0] value in Py3Init_vim(). Previously we used an empty
* string, but dependinding on the OS we then get an empty entry or
@@ -629,7 +726,7 @@ fail:
* External interface
*/
static void
DoPy3Command(exarg_T *eap, const char *cmd)
DoPy3Command(exarg_T *eap, const char *cmd, typval_T *rettv)
{
#if defined(MACOS) && !defined(MACOS_X_UNIX)
GrafPtr oldPort;
@@ -649,8 +746,16 @@ DoPy3Command(exarg_T *eap, const char *cmd)
if (Python3_Init())
goto theend;
RangeStart = eap->line1;
RangeEnd = eap->line2;
if (rettv == NULL)
{
RangeStart = eap->line1;
RangeEnd = eap->line2;
}
else
{
RangeStart = (PyInt) curwin->w_cursor.lnum;
RangeEnd = RangeStart;
}
Python_Release_Vim(); /* leave vim */
#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
@@ -674,7 +779,24 @@ DoPy3Command(exarg_T *eap, const char *cmd)
(char *)ENC_OPT, CODEC_ERROR_HANDLER);
cmdbytes = PyUnicode_AsEncodedString(cmdstr, "utf-8", CODEC_ERROR_HANDLER);
Py_XDECREF(cmdstr);
PyRun_SimpleString(PyBytes_AsString(cmdbytes));
if (rettv == NULL)
PyRun_SimpleString(PyBytes_AsString(cmdbytes));
else
{
PyObject *r;
r = PyRun_String(PyBytes_AsString(cmdbytes), Py_eval_input,
globals, globals);
if (r == NULL)
EMSG(_("E860: Eval did not return a valid python 3 object"));
else
{
if (ConvertFromPyObject(r, rettv) == -1)
EMSG(_("E861: Failed to convert returned python 3 object to vim value"));
Py_DECREF(r);
}
PyErr_Clear();
}
Py_XDECREF(cmdbytes);
PyGILState_Release(pygilstate);
@@ -709,9 +831,9 @@ ex_py3(exarg_T *eap)
if (!eap->skip)
{
if (script == NULL)
DoPy3Command(eap, (char *)eap->arg);
DoPy3Command(eap, (char *)eap->arg, NULL);
else
DoPy3Command(eap, (char *)script);
DoPy3Command(eap, (char *)script, NULL);
}
vim_free(script);
}
@@ -772,7 +894,7 @@ ex_py3file(exarg_T *eap)
/* Execute the file */
DoPy3Command(eap, buffer);
DoPy3Command(eap, buffer, NULL);
}
/******************************************************
@@ -802,14 +924,16 @@ OutputSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
if (PyUnicode_Check(nameobj))
name = _PyUnicode_AsString(nameobj);
if (val == NULL) {
if (val == NULL)
{
PyErr_SetString(PyExc_AttributeError, _("can't delete OutputObject attributes"));
return -1;
}
if (strcmp(name, "softspace") == 0)
{
if (!PyLong_Check(val)) {
if (!PyLong_Check(val))
{
PyErr_SetString(PyExc_TypeError, _("softspace must be an integer"));
return -1;
}
@@ -1030,20 +1154,25 @@ BufferSlice(PyObject *self, Py_ssize_t lo, Py_ssize_t hi)
static PyObject *
BufferSubscript(PyObject *self, PyObject* idx)
{
if (PyLong_Check(idx)) {
if (PyLong_Check(idx))
{
long _idx = PyLong_AsLong(idx);
return BufferItem(self,_idx);
} else if (PySlice_Check(idx)) {
} else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx((PyObject *)idx,
(Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count+1,
&start, &stop,
&step, &slicelen) < 0) {
&step, &slicelen) < 0)
{
return NULL;
}
return BufferSlice(self, start, stop);
} else {
}
else
{
PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
return NULL;
}
@@ -1052,24 +1181,29 @@ BufferSubscript(PyObject *self, PyObject* idx)
static Py_ssize_t
BufferAsSubscript(PyObject *self, PyObject* idx, PyObject* val)
{
if (PyLong_Check(idx)) {
if (PyLong_Check(idx))
{
long n = PyLong_AsLong(idx);
return RBAsItem((BufferObject *)(self), n, val, 1,
(Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
NULL);
} else if (PySlice_Check(idx)) {
} else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx((PyObject *)idx,
(Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count+1,
&start, &stop,
&step, &slicelen) < 0) {
&step, &slicelen) < 0)
{
return -1;
}
return RBAsSlice((BufferObject *)(self), start, stop, val, 1,
(PyInt)((BufferObject *)(self))->buf->b_ml.ml_line_count,
NULL);
} else {
}
else
{
PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
return -1;
}
@@ -1142,20 +1276,25 @@ RangeAsSlice(PyObject *self, Py_ssize_t lo, Py_ssize_t hi, PyObject *val)
static PyObject *
RangeSubscript(PyObject *self, PyObject* idx)
{
if (PyLong_Check(idx)) {
if (PyLong_Check(idx))
{
long _idx = PyLong_AsLong(idx);
return RangeItem(self,_idx);
} else if (PySlice_Check(idx)) {
} else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx((PyObject *)idx,
((RangeObject *)(self))->end-((RangeObject *)(self))->start+1,
&start, &stop,
&step, &slicelen) < 0) {
&step, &slicelen) < 0)
{
return NULL;
}
return RangeSlice(self, start, stop);
} else {
}
else
{
PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
return NULL;
}
@@ -1164,20 +1303,25 @@ RangeSubscript(PyObject *self, PyObject* idx)
static Py_ssize_t
RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val)
{
if (PyLong_Check(idx)) {
if (PyLong_Check(idx))
{
long n = PyLong_AsLong(idx);
return RangeAsItem(self, n, val);
} else if (PySlice_Check(idx)) {
} else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx((PyObject *)idx,
((RangeObject *)(self))->end-((RangeObject *)(self))->start+1,
&start, &stop,
&step, &slicelen) < 0) {
&step, &slicelen) < 0)
{
return -1;
}
return RangeAsSlice(self, start, stop, val);
} else {
}
else
{
PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
return -1;
}
@@ -1390,6 +1534,147 @@ CurrentSetattro(PyObject *self UNUSED, PyObject *nameobj, PyObject *value)
}
}
/* Dictionary object - Definitions
*/
static PyInt DictionaryLength(PyObject *);
static PyMappingMethods DictionaryAsMapping = {
/* mp_length */ (lenfunc) DictionaryLength,
/* mp_subscript */ (binaryfunc) DictionaryItem,
/* mp_ass_subscript */ (objobjargproc) DictionaryAssItem,
};
static PyTypeObject DictionaryType;
static void
DictionaryDestructor(PyObject *self)
{
DictionaryObject *this = (DictionaryObject *)(self);
pyll_remove(&this->ref, &lastdict);
dict_unref(this->dict);
Py_TYPE(self)->tp_free((PyObject*)self);
}
/* List object - Definitions
*/
static PyInt ListLength(PyObject *);
static PyObject *ListItem(PyObject *, Py_ssize_t);
static PySequenceMethods ListAsSeq = {
(lenfunc) ListLength, /* sq_length, len(x) */
(binaryfunc) 0, /* RangeConcat, sq_concat, x+y */
(ssizeargfunc) 0, /* RangeRepeat, sq_repeat, x*n */
(ssizeargfunc) ListItem, /* sq_item, x[i] */
(void *) 0, /* was_sq_slice, x[i:j] */
(ssizeobjargproc) ListAssItem, /* sq_as_item, x[i]=v */
(void *) 0, /* was_sq_ass_slice, x[i:j]=v */
0, /* sq_contains */
(binaryfunc) ListConcatInPlace,/* sq_inplace_concat */
0, /* sq_inplace_repeat */
};
static PyObject *ListSubscript(PyObject *, PyObject *);
static Py_ssize_t ListAsSubscript(PyObject *, PyObject *, PyObject *);
static PyMappingMethods ListAsMapping = {
/* mp_length */ (lenfunc) ListLength,
/* mp_subscript */ (binaryfunc) ListSubscript,
/* mp_ass_subscript */ (objobjargproc) ListAsSubscript,
};
static PyTypeObject ListType;
static PyObject *
ListSubscript(PyObject *self, PyObject* idxObject)
{
if (PyLong_Check(idxObject))
{
long idx = PyLong_AsLong(idxObject);
return ListItem(self, idx);
}
else if (PySlice_Check(idxObject))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx(idxObject, ListLength(self), &start, &stop,
&step, &slicelen) < 0)
return NULL;
return ListSlice(self, start, stop);
}
else
{
PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
return NULL;
}
}
static Py_ssize_t
ListAsSubscript(PyObject *self, PyObject *idxObject, PyObject *obj)
{
if (PyLong_Check(idxObject))
{
long idx = PyLong_AsLong(idxObject);
return ListAssItem(self, idx, obj);
}
else if (PySlice_Check(idxObject))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx(idxObject, ListLength(self), &start, &stop,
&step, &slicelen) < 0)
return -1;
return ListAssSlice(self, start, stop, obj);
}
else
{
PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
return -1;
}
}
static void
ListDestructor(PyObject *self)
{
ListObject *this = (ListObject *)(self);
pyll_remove(&this->ref, &lastlist);
list_unref(this->list);
Py_TYPE(self)->tp_free((PyObject*)self);
}
/* Function object - Definitions
*/
static void
FunctionDestructor(PyObject *self)
{
FunctionObject *this = (FunctionObject *) (self);
func_unref(this->name);
PyMem_Del(this->name);
Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject *
FunctionGetattro(PyObject *self, PyObject *nameobj)
{
FunctionObject *this = (FunctionObject *)(self);
char *name = "";
if (PyUnicode_Check(nameobj))
name = _PyUnicode_AsString(nameobj);
if (strcmp(name, "name") == 0)
return PyUnicode_FromString((char *)(this->name));
return PyObject_GenericGetAttr(self, nameobj);
}
/* External interface
*/
@@ -1449,6 +1734,9 @@ PyMODINIT_FUNC Py3Init_vim(void)
PyType_Ready(&BufListType);
PyType_Ready(&WinListType);
PyType_Ready(&CurrentType);
PyType_Ready(&DictionaryType);
PyType_Ready(&ListType);
PyType_Ready(&FunctionType);
/* Set sys.argv[] to avoid a crash in warn(). */
PySys_SetArgv(1, argv);
@@ -1517,6 +1805,24 @@ LineToString(const char *str)
return result;
}
void
do_py3eval (char_u *str, typval_T *rettv)
{
DoPy3Command(NULL, (char *) str, rettv);
switch(rettv->v_type)
{
case VAR_DICT: ++rettv->vval.v_dict->dv_refcount; break;
case VAR_LIST: ++rettv->vval.v_list->lv_refcount; break;
case VAR_FUNC: func_ref(rettv->vval.v_string); break;
}
}
void
set_ref_in_python3 (int copyID)
{
set_ref_in_py(copyID);
}
static void
init_structs(void)
{
@@ -1598,6 +1904,35 @@ init_structs(void)
CurrentType.tp_flags = Py_TPFLAGS_DEFAULT;
CurrentType.tp_doc = "vim current object";
vim_memset(&DictionaryType, 0, sizeof(DictionaryType));
DictionaryType.tp_name = "vim.dictionary";
DictionaryType.tp_basicsize = sizeof(DictionaryObject);
DictionaryType.tp_dealloc = DictionaryDestructor;
DictionaryType.tp_as_mapping = &DictionaryAsMapping;
DictionaryType.tp_flags = Py_TPFLAGS_DEFAULT;
DictionaryType.tp_doc = "dictionary pushing modifications to vim structure";
DictionaryType.tp_methods = DictionaryMethods;
vim_memset(&ListType, 0, sizeof(ListType));
ListType.tp_name = "vim.list";
ListType.tp_dealloc = ListDestructor;
ListType.tp_basicsize = sizeof(ListObject);
ListType.tp_as_sequence = &ListAsSeq;
ListType.tp_as_mapping = &ListAsMapping;
ListType.tp_flags = Py_TPFLAGS_DEFAULT;
ListType.tp_doc = "list pushing modifications to vim structure";
ListType.tp_methods = ListMethods;
vim_memset(&FunctionType, 0, sizeof(FunctionType));
FunctionType.tp_name = "vim.list";
FunctionType.tp_basicsize = sizeof(FunctionObject);
FunctionType.tp_getattro = FunctionGetattro;
FunctionType.tp_dealloc = FunctionDestructor;
FunctionType.tp_call = FunctionCall;
FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
FunctionType.tp_doc = "object that calls vim function";
FunctionType.tp_methods = FunctionMethods;
vim_memset(&vimmodule, 0, sizeof(vimmodule));
vimmodule.m_name = "vim";
vimmodule.m_doc = vim_module_doc;

View File

@@ -445,8 +445,7 @@ get_number_indent(lnum)
if (vim_regexec(&regmatch, ml_get(lnum) + lead_len, (colnr_T)0))
{
pos.lnum = lnum;
pos.col = *regmatch.endp - (ml_get(lnum) + lead_len);
pos.col += lead_len;
pos.col = (colnr_T)(*regmatch.endp - ml_get(lnum));
#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
#endif
@@ -461,7 +460,7 @@ get_number_indent(lnum)
*
* I'm not sure if regmmatch_T (multi-match) is needed in this case.
* It may be true that this section would work properly using the
* regmatch_T code above, in which case, these two seperate sections
* regmatch_T code above, in which case, these two separate sections
* should be consolidated w/ FEAT_COMMENTS making lead_len > 0...
*/
#endif
@@ -1054,9 +1053,9 @@ open_line(dir, flags, second_line_indent)
}
if (lead_len)
{
/* allocate buffer (may concatenate p_exta later) */
/* allocate buffer (may concatenate p_extra later) */
leader = alloc(lead_len + lead_repl_len + extra_space + extra_len
+ (second_line_indent > 0 ? second_line_indent : 0));
+ (second_line_indent > 0 ? second_line_indent : 0) + 1);
allocated = leader; /* remember to free it later */
if (leader == NULL)
@@ -1354,7 +1353,8 @@ open_line(dir, flags, second_line_indent)
if (flags & OPENLINE_COM_LIST && second_line_indent > 0)
{
int i;
int padding = second_line_indent - (newindent + STRLEN(leader));
int padding = second_line_indent
- (newindent + (int)STRLEN(leader));
/* Here whitespace is inserted after the comment char.
* Below, set_indent(newindent, SIN_INSERT) will insert the
@@ -3342,7 +3342,7 @@ get_keystroke()
buf = alloc(buflen);
else if (maxlen < 10)
{
/* Need some more space. This migth happen when receiving a long
/* Need some more space. This might happen when receiving a long
* escape sequence. */
buflen += 100;
buf = vim_realloc(buf, buflen);
@@ -4499,7 +4499,7 @@ home_replace(buf, src, dst, dstlen, one)
{
size_t dirlen = 0, envlen = 0;
size_t len;
char_u *homedir_env;
char_u *homedir_env, *homedir_env_orig;
char_u *p;
if (src == NULL)
@@ -4525,9 +4525,25 @@ home_replace(buf, src, dst, dstlen, one)
dirlen = STRLEN(homedir);
#ifdef VMS
homedir_env = mch_getenv((char_u *)"SYS$LOGIN");
homedir_env_orig = homedir_env = mch_getenv((char_u *)"SYS$LOGIN");
#else
homedir_env = mch_getenv((char_u *)"HOME");
homedir_env_orig = homedir_env = mch_getenv((char_u *)"HOME");
#endif
#if defined(FEAT_MODIFY_FNAME) || defined(WIN3264)
if (vim_strchr(homedir_env, '~') != NULL)
{
int usedlen = 0;
int flen;
char_u *fbuf = NULL;
flen = (int)STRLEN(homedir_env);
(void)modify_fname((char_u *)":p", &usedlen,
&homedir_env, &fbuf, &flen);
flen = (int)STRLEN(homedir_env);
if (flen > 0 && vim_ispathsep(homedir_env[flen - 1]))
/* Remove the trailing / that is added to a directory. */
homedir_env[flen - 1] = NUL;
}
#endif
if (homedir_env != NULL && *homedir_env == NUL)
@@ -4585,6 +4601,9 @@ home_replace(buf, src, dst, dstlen, one)
/* if (dstlen == 0) out of space, what to do??? */
*dst = NUL;
if (homedir_env != homedir_env_orig)
vim_free(homedir_env);
}
/*

View File

@@ -6458,7 +6458,7 @@ line_count_info(line, wc, cc, limit, eol_size)
long chars = 0;
int is_word = 0;
for (i = 0; line[i] && i < limit; )
for (i = 0; i < limit && line[i] != NUL; )
{
if (is_word)
{

View File

@@ -308,7 +308,7 @@ vimLoadLib(char *name)
# ifndef GETTEXT_DLL
# define GETTEXT_DLL "libintl.dll"
# endif
/* Dummy funcitons */
/* Dummy functions */
static char *null_libintl_gettext(const char *);
static char *null_libintl_textdomain(const char *);
static char *null_libintl_bindtextdomain(const char *, const char *);
@@ -1409,7 +1409,7 @@ tgetch(int *pmodifiers, char_u *pch2)
/*
* mch_inchar(): low-level input funcion.
* mch_inchar(): low-level input function.
* Get one or more characters from the keyboard or the mouse.
* If time == 0, do not wait for characters.
* If time == n, wait a short time for characters.
@@ -3451,14 +3451,14 @@ dump_pipe(int options,
* to avoid to perform a blocking read */
ret = PeekNamedPipe(g_hChildStd_OUT_Rd, /* pipe to query */
NULL, /* optional buffer */
0, /* buffe size */
0, /* buffer size */
NULL, /* number of read bytes */
&availableBytes, /* available bytes total */
NULL); /* byteLeft */
repeatCount = 0;
/* We got real data in the pipe, read it */
while (ret != 0 && availableBytes > 0 && availableBytes > 0)
while (ret != 0 && availableBytes > 0)
{
repeatCount++;
toRead =
@@ -3638,7 +3638,7 @@ mch_system_piped(char *cmd, int options)
NULL, /* Process security attributes */
NULL, /* Thread security attributes */
// this command can be litigeous, handle inheritence was
// this command can be litigious, handle inheritance was
// deactivated for pending temp file, but, if we deactivate
// it, the pipes don't work for some reason.
TRUE, /* Inherit handles, first deactivated,

View File

@@ -46,12 +46,21 @@ char_u *get_user_var_name __ARGS((expand_T *xp, int idx));
list_T *list_alloc __ARGS((void));
void list_unref __ARGS((list_T *l));
void list_free __ARGS((list_T *l, int recurse));
listitem_T *listitem_alloc __ARGS((void));
void listitem_remove __ARGS((list_T *l, listitem_T *item));
dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
listitem_T *list_find __ARGS((list_T *l, long n));
char_u *list_find_str __ARGS((list_T *l, long idx));
void list_append __ARGS((list_T *l, listitem_T *item));
int list_append_tv __ARGS((list_T *l, typval_T *tv));
int list_append_dict __ARGS((list_T *list, dict_T *dict));
int list_append_string __ARGS((list_T *l, char_u *str, int len));
int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
void list_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2));
int garbage_collect __ARGS((void));
void set_ref_in_ht __ARGS((hashtab_T *ht, int copyID));
void set_ref_in_list __ARGS((list_T *l, int copyID));
void set_ref_in_item __ARGS((typval_T *tv, int copyID));
dict_T *dict_alloc __ARGS((void));
void dict_unref __ARGS((dict_T *d));
dictitem_T *dictitem_alloc __ARGS((char_u *key));
@@ -64,6 +73,7 @@ char_u *get_dict_string __ARGS((dict_T *d, char_u *key, int save));
long get_dict_number __ARGS((dict_T *d, char_u *key));
char_u *get_function_name __ARGS((expand_T *xp, int idx));
char_u *get_expr_name __ARGS((expand_T *xp, int idx));
int func_call __ARGS((char_u *name, typval_T *args, dict_T *selfdict, typval_T *rettv));
long do_searchpair __ARGS((char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit));
void set_vim_var_nr __ARGS((int idx, long val));
long get_vim_var_nr __ARGS((int idx));
@@ -94,6 +104,8 @@ void free_all_functions __ARGS((void));
void func_dump_profile __ARGS((FILE *fd));
char_u *get_user_func_name __ARGS((expand_T *xp, int idx));
void ex_delfunction __ARGS((exarg_T *eap));
void func_unref __ARGS((char_u *name));
void func_ref __ARGS((char_u *name));
void ex_return __ARGS((exarg_T *eap));
int do_return __ARGS((exarg_T *eap, int reanimate, int is_cmd, void *rettv));
void discard_pending_return __ARGS((void *rettv));

View File

@@ -42,7 +42,7 @@ int check_changed_any __ARGS((int hidden));
int check_fname __ARGS((void));
int buf_write_all __ARGS((buf_T *buf, int forceit));
int get_arglist __ARGS((garray_T *gap, char_u *str));
int get_arglist_exp __ARGS((char_u *str, int *fcountp, char_u ***fnamesp));
int get_arglist_exp __ARGS((char_u *str, int *fcountp, char_u ***fnamesp, int wig));
void set_arglist __ARGS((char_u *str));
void check_arg_idx __ARGS((win_T *win));
void ex_args __ARGS((exarg_T *eap));

View File

@@ -6,4 +6,6 @@ void ex_python __ARGS((exarg_T *eap));
void ex_pyfile __ARGS((exarg_T *eap));
void python_buffer_free __ARGS((buf_T *buf));
void python_window_free __ARGS((win_T *win));
void do_pyeval __ARGS((char_u *str, typval_T *rettv));
void set_ref_in_python __ARGS((int copyID));
/* vim: set ft=c : */

View File

@@ -6,4 +6,6 @@ void ex_py3 __ARGS((exarg_T *eap));
void ex_py3file __ARGS((exarg_T *eap));
void python3_buffer_free __ARGS((buf_T *buf));
void python3_window_free __ARGS((win_T *win));
void do_py3eval __ARGS((char_u *str, typval_T *rettv));
void set_ref_in_python3 __ARGS((int copyID));
/* vim: set ft=c : */

View File

@@ -3189,7 +3189,7 @@ ex_vimgrep(eap)
;
/* parse the list of arguments */
if (get_arglist_exp(p, &fcount, &fnames) == FAIL)
if (get_arglist_exp(p, &fcount, &fnames, TRUE) == FAIL)
goto theend;
if (fcount == 0)
{

View File

@@ -89,6 +89,9 @@
#include "vim.h"
#define MB_FILLER_CHAR '<' /* character used when a double-width character
* doesn't fit. */
/*
* The attributes that are actually active for writing to the screen.
*/
@@ -4016,7 +4019,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (n_skip > 0 && mb_l > 1 && n_extra == 0)
{
n_extra = 1;
c_extra = '<';
c_extra = MB_FILLER_CHAR;
c = ' ';
if (area_attr == 0 && search_attr == 0)
{
@@ -4576,6 +4579,15 @@ win_line(wp, lnum, startrow, endrow, nochange)
c = lcs_prec;
lcs_prec_todo = NUL;
#ifdef FEAT_MBYTE
if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
{
/* Double-width character being overwritten by the "precedes"
* character, need to fill up half the character. */
c_extra = MB_FILLER_CHAR;
n_extra = 1;
n_attr = 2;
extra_attr = hl_attr(HLF_AT);
}
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1)
{

View File

@@ -8553,7 +8553,7 @@ ex_mkspell(eap)
}
/* Expand all the remaining arguments (e.g., $VIMRUNTIME). */
if (get_arglist_exp(arg, &fcount, &fnames) == OK)
if (get_arglist_exp(arg, &fcount, &fnames, FALSE) == OK)
{
mkspell(fcount, fnames, ascii, eap->forceit, FALSE);
FreeWild(fcount, fnames);

View File

@@ -14,6 +14,7 @@ VIMPROG = /vim
# test27 can't edit file with "*"
# test52 only for Win32
# test85 no Lua interface
# test86, 87 no Python interface
SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test7.out test8.out test9.out \

View File

@@ -30,7 +30,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test68.out test69.out test71.out test72.out test73.out \
test74.out test75.out test76.out test77.out test78.out \
test79.out test80.out test81.out test82.out test83.out \
test84.out test85.out
test84.out test85.out test86.out test87.out
SCRIPTS32 = test50.out test70.out

View File

@@ -50,7 +50,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test68.out test69.out test71.out test72.out test73.out \
test74.out test75.out test76.out test77.out test78.out \
test79.out test80.out test81.out test82.out test83.out \
test84.out test85.out
test84.out test85.out test86.out test87.out
SCRIPTS32 = test50.out test70.out

View File

@@ -14,6 +14,7 @@ VIMPROG = ../vim.exe
# test27 can't edit file with "*" in file name
# test52 only for Win32
# test85 no Lua interface
# test86, 87 no Python interface
SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test7.out test8.out test9.out \

View File

@@ -27,7 +27,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test69.out test70.out test71.out test72.out test73.out \
test74.out test75.out test76.out test77.out test78.out \
test79.out test80.out test81.out test82.out test83.out \
test84.out test85.out
test84.out test85.out test86.out test87.out
SCRIPTS_GUI = test16.out

211
src/testdir/test86.in Normal file
View File

@@ -0,0 +1,211 @@
Tests for various python features. vim: set ft=vim :
STARTTEST
:so small.vim
:if !has('python') | e! test.ok | wq! test.out | endif
:py import vim
:fun Test()
:let l = []
:py l=vim.bindeval('l')
:py f=vim.bindeval('function("strlen")')
:" Extending List directly with different types
:py l.extend([1, "as'd", [1, 2, f, {'a': 1}]])
:$put =string(l)
:$put =string(l[-1])
:try
: $put =string(l[-4])
:catch
: $put =v:exception[:13]
:endtry
:" List assignment
:py l[0]=0
:$put =string(l)
:py l[-2]=f
:$put =string(l)
:"
:" Extending Dictionary directly with different types
:let d = {}
:py d=vim.bindeval('d')
:py d['1']='asd'
:py d['b']=[1, 2, f]
:py d['-1']={'a': 1}
:let dkeys = []
:py dk=vim.bindeval('dkeys')
:py dkeys=d.keys()
:py dkeys.sort()
:py dk.extend(dkeys)
:$put =string(dkeys)
:for [key, val] in sort(items(d))
: $put =string(key) . ' : ' . string(val)
: unlet key val
:endfor
:"
:" removing items with del
:py del l[2]
:$put =string(l)
:let l = range(8)
:py l=vim.bindeval('l')
:try
: py del l[:3]
: py del l[1:]
:catch
: $put =v:exception
:endtry
:$put =string(l)
:"
:py del d['-1']
:$put =string(d)
:"
:" removing items out of range: silently skip items that don't exist
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:" The following two ranges delete nothing as they match empty list:
:py del l[2:1]
:$put =string(l)
:py del l[2:2]
:$put =string(l)
:py del l[2:3]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py del l[2:4]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py del l[2:5]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py del l[2:6]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:" The following two ranges delete nothing as they match empty list:
:py del l[-1:2]
:$put =string(l)
:py del l[-2:2]
:$put =string(l)
:py del l[-3:2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py del l[-4:2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py del l[-5:2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py del l[-6:2]
:$put =string(l)
:"
:" Slice assignment to a list
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py l[0:0]=['a']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py l[1:2]=['b']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py l[2:4]=['c']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py l[4:4]=['d']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py l[-1:2]=['e']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py l[-10:2]=['f']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py l[2:-10]=['g']
:$put =string(l)
:let l = []
:py l=vim.bindeval('l')
:py l[0:0]=['h']
:$put =string(l)
:"
:" Locked variables
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:lockvar! l
:py l[2]='i'
:$put =string(l)
:unlockvar! l
:"
:" Function calls
:function New(...)
:return ['NewStart']+a:000+['NewEnd']
:endfunction
:function DictNew(...) dict
:return ['DictNewStart']+a:000+['DictNewEnd', self]
:endfunction
:let l=[function('New'), function('DictNew')]
:py l=vim.bindeval('l')
:py l.extend(list(l[0](1, 2, 3)))
:$put =string(l)
:py l.extend(list(l[1](1, 2, 3, self={'a': 'b'})))
:$put =string(l)
:py l.extend([l[0].name])
:$put =string(l)
:try
: py l[1](1, 2, 3)
:catch
: $put =v:exception[:16]
:endtry
:delfunction New
:try
: py l[0](1, 2, 3)
:catch
: $put =v:exception[:16]
:endtry
:if has('float')
: let l=[0.0]
: py l=vim.bindeval('l')
: py l.extend([0.0])
: $put =string(l)
:else
: $put ='[0.0, 0.0]'
:endif
:"
:" pyeval()
:let l=pyeval('range(3)')
:$put =string(l)
:let d=pyeval('{"a": "b", "c": 1, "d": ["e"]}')
:$put =sort(items(d))
:try
: let undef=pyeval('undefined_name')
:catch
: $put =v:exception[:13]
:endtry
:try
: let vim=pyeval('vim')
:catch
: $put =v:exception[:13]
:endtry
:if has('float')
: let f=pyeval('0.0')
: $put =string(f)
:else
: $put ='0.0'
:endif
:endfun
:"
:call Test()
:"
:delfunc Test
:call garbagecollect(1)
:"
:/^start:/,$wq! test.out
ENDTEST
start:

47
src/testdir/test86.ok Normal file
View File

@@ -0,0 +1,47 @@
start:
[1, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
[1, 2, function('strlen'), {'a': 1}]
Vim(put):E684:
[0, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
[0, function('strlen'), [1, 2, function('strlen'), {'a': 1}]]
['-1', '1', 'b']
'-1' : {'a': 1}
'1' : 'asd'
'b' : [1, 2, function('strlen')]
[0, function('strlen')]
[3]
{'1': 'asd', 'b': [1, 2, function('strlen')]}
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 1, 3]
[0, 1]
[0, 1]
[0, 1]
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 2, 3]
[2, 3]
[2, 3]
[2, 3]
['a', 0, 1, 2, 3]
[0, 'b', 2, 3]
[0, 1, 'c']
[0, 1, 2, 3, 'd']
[0, 1, 2, 'e', 3]
['f', 2, 3]
[0, 1, 'g', 2, 3]
['h']
[0, 1, 2, 3]
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}, 'New']
Vim(python):E725:
Vim(python):E117:
[0.0, 0.0]
[0, 1, 2]
['a', 'b']
['c', 1]
['d', ['e']]
Vim(let):E858:
Vim(let):E859:
0.0

211
src/testdir/test87.in Normal file
View File

@@ -0,0 +1,211 @@
Tests for various python features. vim: set ft=vim :
STARTTEST
:so small.vim
:if !has('python3') | e! test.ok | wq! test.out | endif
:py3 import vim
:fun Test()
:let l = []
:py3 l=vim.bindeval('l')
:py3 f=vim.bindeval('function("strlen")')
:" Extending List directly with different types
:py3 l+=[1, "as'd", [1, 2, f, {'a': 1}]]
:$put =string(l)
:$put =string(l[-1])
:try
: $put =string(l[-4])
:catch
: $put =v:exception[:13]
:endtry
:" List assignment
:py3 l[0]=0
:$put =string(l)
:py3 l[-2]=f
:$put =string(l)
:"
:" Extending Dictionary directly with different types
:let d = {}
:py3 d=vim.bindeval('d')
:py3 d['1']='asd'
:py3 d['b']=[1, 2, f]
:py3 d['-1']={'a': 1}
:let dkeys = []
:py3 dk=vim.bindeval('dkeys')
:py3 dkeys=d.keys()
:py3 dkeys.sort()
:py3 dk+=dkeys
:$put =string(dkeys)
:for [key, val] in sort(items(d))
: $put =string(key) . ' : ' . string(val)
: unlet key val
:endfor
:"
:" removing items with del
:py3 del l[2]
:$put =string(l)
:let l = range(8)
:py3 l=vim.bindeval('l')
:try
: py3 del l[:3]
: py3 del l[1:]
:catch
: $put =v:exception
:endtry
:$put =string(l)
:"
:py3 del d['-1']
:$put =string(d)
:"
:" removing items out of range: silently skip items that don't exist
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:" The following two ranges delete nothing as they match empty list:
:py3 del l[2:1]
:$put =string(l)
:py3 del l[2:2]
:$put =string(l)
:py3 del l[2:3]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 del l[2:4]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 del l[2:5]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 del l[2:6]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:" The following two ranges delete nothing as they match empty list:
:py3 del l[-1:2]
:$put =string(l)
:py3 del l[-2:2]
:$put =string(l)
:py3 del l[-3:2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 del l[-4:2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 del l[-5:2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 del l[-6:2]
:$put =string(l)
:"
:" Slice assignment to a list
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 l[0:0]=['a']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 l[1:2]=['b']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 l[2:4]=['c']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 l[4:4]=['d']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 l[-1:2]=['e']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 l[-10:2]=['f']
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 l[2:-10]=['g']
:$put =string(l)
:let l = []
:py3 l=vim.bindeval('l')
:py3 l[0:0]=['h']
:$put =string(l)
:"
:" Locked variables
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:lockvar! l
:py3 l[2]='i'
:$put =string(l)
:unlockvar! l
:"
:" Function calls
:function New(...)
:return ['NewStart']+a:000+['NewEnd']
:endfunction
:function DictNew(...) dict
:return ['DictNewStart']+a:000+['DictNewEnd', self]
:endfunction
:let l=[function('New'), function('DictNew')]
:py3 l=vim.bindeval('l')
:py3 l.extend(list(l[0](1, 2, 3)))
:$put =string(l)
:py3 l.extend(list(l[1](1, 2, 3, self={'a': 'b'})))
:$put =string(l)
:py3 l+=[l[0].name]
:$put =string(l)
:try
: py3 l[1](1, 2, 3)
:catch
: $put =v:exception[:13]
:endtry
:delfunction New
:try
: py3 l[0](1, 2, 3)
:catch
: $put =v:exception[:13]
:endtry
:if has('float')
: let l=[0.0]
: py3 l=vim.bindeval('l')
: py3 l.extend([0.0])
: $put =string(l)
:else
: $put ='[0.0, 0.0]'
:endif
:"
:" py3eval()
:let l=py3eval('[0, 1, 2]')
:$put =string(l)
:let d=py3eval('{"a": "b", "c": 1, "d": ["e"]}')
:$put =sort(items(d))
:try
: let undef=py3eval('undefined_name')
:catch
: $put =v:exception[:13]
:endtry
:try
: let vim=py3eval('vim')
:catch
: $put =v:exception[:13]
:endtry
:if has('float')
: let f=py3eval('0.0')
: $put =string(f)
:else
: $put ='0.0'
:endif
:endfun
:"
:call Test()
:"
:delfunc Test
:call garbagecollect(1)
:"
:/^start:/,$wq! test.out
ENDTEST
start:

47
src/testdir/test87.ok Normal file
View File

@@ -0,0 +1,47 @@
start:
[1, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
[1, 2, function('strlen'), {'a': 1}]
Vim(put):E684:
[0, 'as''d', [1, 2, function('strlen'), {'a': 1}]]
[0, function('strlen'), [1, 2, function('strlen'), {'a': 1}]]
['-1', '1', 'b']
'-1' : {'a': 1}
'1' : 'asd'
'b' : [1, 2, function('strlen')]
[0, function('strlen')]
[3]
{'1': 'asd', 'b': [1, 2, function('strlen')]}
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 1, 3]
[0, 1]
[0, 1]
[0, 1]
[0, 1, 2, 3]
[0, 1, 2, 3]
[0, 2, 3]
[2, 3]
[2, 3]
[2, 3]
['a', 0, 1, 2, 3]
[0, 'b', 2, 3]
[0, 1, 'c']
[0, 1, 2, 3, 'd']
[0, 1, 2, 'e', 3]
['f', 2, 3]
[0, 1, 'g', 2, 3]
['h']
[0, 1, 2, 3]
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}, 'New']
Vim(py3):E725:
Vim(py3):E117:
[0.0, 0.0]
[0, 1, 2]
['a', 'b']
['c', 1]
['d', ['e']]
Vim(let):E860:
Vim(let):E861:
0.0

View File

@@ -714,6 +714,48 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
573,
/**/
572,
/**/
571,
/**/
570,
/**/
569,
/**/
568,
/**/
567,
/**/
566,
/**/
565,
/**/
564,
/**/
563,
/**/
562,
/**/
561,
/**/
560,
/**/
559,
/**/
558,
/**/
557,
/**/
556,
/**/
555,
/**/
554,
/**/
553,
/**/
552,
/**/

View File

@@ -3723,7 +3723,7 @@ leave_tabpage(new_curbuf)
enter_tabpage(tp, old_curbuf, trigger_autocmds)
tabpage_T *tp;
buf_T *old_curbuf UNUSED;
int trigger_autocmds;
int trigger_autocmds UNUSED;
{
int old_off = tp->tp_firstwin->w_winrow;
win_T *next_prevwin = tp->tp_prevwin;