Compare commits

...

15 Commits

Author SHA1 Message Date
Bram Moolenaar
d0b7bfa957 patch 8.2.4552: in a :def function "put = expr" does not work
Problem:    In a :def function "put = expr" does not work.
Solution:   Skip over white space. (closes #9936)
2022-03-12 14:51:16 +00:00
Bram Moolenaar
bbf84e2737 patch 8.2.4551: when mapping <Esc> terminal codes are not recognized
Problem:    When mapping <Esc> terminal codes are not recognized.
Solution:   Specifically recognize a mapping with just <Esc> and check for
            terminal codes even though there is no partial mapping.
            (closes #9903)
2022-03-12 13:48:39 +00:00
Bram Moolenaar
5b4f8a0e84 patch 8.2.4550: Motif: cannot set the color of the scrollbar thumb
Problem:    Motif: cannot set the color of the scrollbar thumb.
Solution:   Remove #ifdef.
2022-03-12 12:21:28 +00:00
Bram Moolenaar
e2adcf3974 patch 8.2.4549: cannot build with Motif and editres
Problem:    Cannot build with Motif and editres. (Tony Mechelynck)
Solution:   Fix configure mistake.
2022-03-12 11:57:25 +00:00
Bram Moolenaar
fb43cfc2c6 patch 8.2.4548: script-local function is deleted when used in a funcref
Problem:    Script-local function is deleted when used in a funcref.
Solution:   Do not consider a function starting with "<SNR>" reference
            counted. (closes #9916, closes #9820)
2022-03-11 18:54:17 +00:00
Bram Moolenaar
f52fac2ed9 patch 8.2.4547: the neXTaw GUI is old and does not work well
Problem:    The neXTaw GUI is old and does not work well.
Solution:   Remove the neXTaw GUI from configure to find out who still wants
            support for this GUI.
2022-03-11 16:01:26 +00:00
zeertzjq
0a4e098f32 patch 8.2.4546: duplicate #undef
Problem:    Duplicate #undef.
Solution:   Remove one #undef. (closes #9932)
2022-03-11 15:33:53 +00:00
Christian Brabandt
176711f069 patch 8.2.4545: MS-Windows: the installed icon is low resolution
Problem:    MS-Windows: the installed icon is low resolution.
Solution:   Use a better icon.  Install vim.ico. (Christian Brabandt,
            closes #9931, closes #9930)
2022-03-11 15:24:11 +00:00
Bram Moolenaar
dbf8094b17 patch 8.2.4544: Coverity warnings for not using returned value
Problem:    Coverity warnings for not using returned value.
Solution:   Assign to vim_ignored.
2022-03-11 14:54:03 +00:00
Yegappan Lakshmanan
20fb28b1dc patch 8.2.4543: Coverity warning for refactored tag search code
Problem:    Coverity warning for refactored tag search code.
Solution:   Avoid the warnings.  Update comments.  Add one more test case.
            (Yegappan Lakshmanan, closes #9928)
2022-03-11 12:05:18 +00:00
Bram Moolenaar
873f8243f6 patch 8.2.4542: Vim9: "break" inside try/catch not handled correctly
Problem:    Vim9: "break" inside try/catch not handled correctly.
Solution:   First jump to :endtry. (closes #9927)
2022-03-10 21:53:44 +00:00
Bram Moolenaar
e406ff87c8 patch 8.2.4541: Crash in debugger when a variable is not available
Problem:    Crash in debugger when a variable is not available in the current
            block.
Solution:   Check for a NULL name. (closes #9926)
2022-03-10 20:47:43 +00:00
Bram Moolenaar
1b1df95f1a patch 8.2.4540: line number for error is off by one
Problem:    Line number for error is off by one.
Solution:   Remember the line number of the comparison. (closes #9923)
2022-03-10 20:01:50 +00:00
Bram Moolenaar
53ba6ca5b2 patch 8.2.4539: when comparing special v:none and v:null are handled the same
Problem:    When comparing special v:none and v:null are handled the same when
            compiling.
Solution:   Pass more information so that v:none can be handled differently at
            compile time.  (issue #9923)
2022-03-10 19:23:28 +00:00
Yegappan Lakshmanan
bf40e90dfe patch 8.2.4538: the find_tags_in_file() function is too long
Problem:    The find_tags_in_file() function is too long.
Solution:   Refactor into smaller functions. (Yegappan Lakshmanan,
            closes #9920)
2022-03-10 18:36:54 +00:00
27 changed files with 1004 additions and 831 deletions

View File

@@ -631,6 +631,7 @@ SRC_DOS_BIN = \
src/xpm/x86/lib-vc14/libXpm.lib \
src/xpm/x86/lib/libXpm.a \
src/xpm/x86/lib/libXpm.lib \
runtime/bitmaps/vim.ico \
nsis/icons.zip \
# source files for Amiga, DOS, etc. (also in the extra archive)

View File

@@ -403,6 +403,9 @@ Section "$(str_section_exe)" id_section_exe
SetOutPath $0\autoload\xml
File ${VIMRT}\autoload\xml\*.*
SetOutPath $0\bitmaps
File ${VIMSRC}\vim.ico
SetOutPath $0\syntax
File ${VIMRT}\syntax\*.*

BIN
runtime/bitmaps/vim.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -343,7 +343,6 @@ CClink = $(CC)
#CONF_OPT_GUI = --enable-gnome-check
#CONF_OPT_GUI = --disable-gtk3-check
#CONF_OPT_GUI = --disable-motif-check
#CONF_OPT_GUI = --disable-nextaw-check
# Uncomment one of these lines to select a specific GUI to use.
# When using "yes" or nothing, configure will use the first one found: GTK+,
@@ -371,7 +370,6 @@ CClink = $(CC)
#CONF_OPT_GUI = --enable-gui=gtk3 --disable-gtktest
#CONF_OPT_GUI = --enable-gui=motif
#CONF_OPT_GUI = --enable-gui=motif --with-motif-lib="-static -lXm -shared"
#CONF_OPT_GUI = --enable-gui=nextaw
# Uncomment this line to run an individual test with gvim.
#GUI_TESTARG = GUI_FLAG=-g
@@ -1304,24 +1302,6 @@ MOTIF_MAN_TARGETS = yes
MOTIF_TESTTARGET = gui
MOTIF_BUNDLE =
### neXtaw GUI
NEXTAW_LIB = -lneXtaw
NEXTAW_SRC = gui.c gui_athena.c gui_x11.c gui_beval.c gui_at_fs.c
NEXTAW_OBJ = objects/gui.o objects/gui_athena.o objects/gui_x11.o \
objects/gui_beval.o objects/gui_at_fs.o
NEXTAW_DEFS = -DFEAT_GUI_ATHENA -DFEAT_GUI_NEXTAW $(NARROW_PROTO)
NEXTAW_IPATH = $(GUI_INC_LOC)
NEXTAW_LIBS_DIR = $(GUI_LIB_LOC)
NEXTAW_LIBS1 = $(NEXTAW_LIB)
NEXTAW_LIBS2 = -lXt
NEXTAW_INSTALL = install_normal install_gui_extra
NEXTAW_TARGETS = installglinks
NEXTAW_MAN_TARGETS = yes
NEXTAW_TESTTARGET = gui
NEXTAW_BUNDLE =
### (J) Sun OpenWindows 3.2 (SunOS 4.1.x) or earlier that produce these ld
# errors: ld: Undefined symbol
# _get_wmShellWidgetClass
@@ -2201,7 +2181,7 @@ os_vms.pro: os_vms.c
# must use os_vms_conf.h for auto/config.h
mv auto/config.h auto/config.h.save
cp os_vms_conf.h auto/config.h
$(CPROTO) -DVMS -UFEAT_GUI_NEXTAW -UFEAT_GUI_MOTIF -UFEAT_GUI_GTK $< > proto/$@
$(CPROTO) -DVMS -UFEAT_GUI_MOTIF -UFEAT_GUI_GTK $< > proto/$@
echo "/* vim: set ft=c : */" >> proto/$@
rm auto/config.h
mv auto/config.h.save auto/config.h
@@ -2218,8 +2198,7 @@ gui_gtk_gresources.pro: auto/gui_gtk_gresources.c
notags:
-rm -f tags
# Note: tags is made for the currently configured version, can't include both
# Motif and neXtaw GUI
# Note: tags is made for the currently configured version.
# You can ignore error messages for missing files.
tags TAGS: notags
$(TAGPRG) $(TAGS_FILES)

70
src/auto/configure vendored
View File

@@ -834,7 +834,6 @@ enable_gtk2_check
enable_gnome_check
enable_gtk3_check
enable_motif_check
enable_nextaw_check
enable_gtktest
with_gnome_includes
with_gnome_libs
@@ -1508,12 +1507,11 @@ Optional Features:
--disable-farsi Deprecated.
--enable-xim Include XIM input support.
--enable-fontset Include X fontset output support.
--enable-gui=OPTS X11 GUI. default=auto OPTS=auto/no/gtk2/gnome2/gtk3/motif/neXtaw/haiku/photon/carbon
--enable-gui=OPTS X11 GUI. default=auto OPTS=auto/no/gtk2/gnome2/gtk3/motif/haiku/photon/carbon
--enable-gtk2-check If auto-select GUI, check for GTK+ 2 default=yes
--enable-gnome-check If GTK GUI, check for GNOME default=no
--enable-gtk3-check If auto-select GUI, check for GTK+ 3 default=yes
--enable-motif-check If auto-select GUI, check for Motif default=yes
--enable-nextaw-check If auto-select GUI, check for neXtaw default=yes
--disable-gtktest Do not try to compile and run a test GTK program
--disable-icon-cache-update update disabled
--disable-desktop-database-update update disabled
@@ -9272,7 +9270,6 @@ SKIP_GTK2=YES
SKIP_GTK3=YES
SKIP_GNOME=YES
SKIP_MOTIF=YES
SKIP_NEXTAW=YES
SKIP_PHOTON=YES
SKIP_HAIKU=YES
GUITYPE=NONE
@@ -9332,8 +9329,7 @@ $as_echo "yes/auto - automatic GUI support" >&6; }
SKIP_GTK2=
SKIP_GTK3=
SKIP_GNOME=
SKIP_MOTIF=
SKIP_NEXTAW=;;
SKIP_MOTIF=;;
gtk2) { $as_echo "$as_me:${as_lineno-$LINENO}: result: GTK+ 2.x GUI support" >&5
$as_echo "GTK+ 2.x GUI support" >&6; }
SKIP_GTK2=;;
@@ -9347,9 +9343,6 @@ $as_echo "GTK+ 3.x GUI support" >&6; }
motif) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Motif GUI support" >&5
$as_echo "Motif GUI support" >&6; }
SKIP_MOTIF=;;
nextaw) { $as_echo "$as_me:${as_lineno-$LINENO}: result: neXtaw GUI support" >&5
$as_echo "neXtaw GUI support" >&6; }
SKIP_NEXTAW=;;
*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Sorry, $enable_gui GUI is not supported" >&5
$as_echo "Sorry, $enable_gui GUI is not supported" >&6; } ;;
esac
@@ -9426,23 +9419,6 @@ $as_echo "$enable_motif_check" >&6; }
fi
fi
if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or not to look for neXtaw" >&5
$as_echo_n "checking whether or not to look for neXtaw... " >&6; }
# Check whether --enable-nextaw-check was given.
if test "${enable_nextaw_check+set}" = set; then :
enableval=$enable_nextaw_check;
else
enable_nextaw_check="yes"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_nextaw_check" >&5
$as_echo "$enable_nextaw_check" >&6; };
if test "x$enable_nextaw_check" = "xno"; then
SKIP_NEXTAW=YES
fi
fi
@@ -9711,7 +9687,6 @@ $as_echo "no" >&6; }
if test "x$GTK_CFLAGS" != "x"; then
SKIP_GTK3=YES
SKIP_NEXTAW=YES
SKIP_MOTIF=YES
GUITYPE=GTK
@@ -9970,7 +9945,6 @@ $as_echo "no" >&6; }
if test "x$GTK_CFLAGS" != "x"; then
SKIP_GTK2=YES
SKIP_GNOME=YES
SKIP_NEXTAW=YES
SKIP_MOTIF=YES
GUITYPE=GTK
@@ -10276,45 +10250,11 @@ $as_echo "<not found>" >&6; }
fi
if test -z "$SKIP_MOTIF"; then
SKIP_NEXTAW=YES
GUITYPE=MOTIF
fi
if test -z "$SKIP_NEXTAW"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if neXtaw header files can be found" >&5
$as_echo_n "checking if neXtaw header files can be found... " >&6; }
cflags_save=$CFLAGS
CFLAGS="$CFLAGS $X_CFLAGS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <X11/Intrinsic.h>
#include <X11/neXtaw/Paned.h>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }; SKIP_NEXTAW=YES
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS=$cflags_save
fi
if test -z "$SKIP_NEXTAW"; then
GUITYPE=NEXTAW
fi
if test -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
if test -z "$SKIP_MOTIF"; then
if test -n "$GUI_INC_LOC"; then
GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
fi
@@ -10573,7 +10513,7 @@ done
fi
if test -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
if test -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
for ac_header in X11/xpm.h X11/Sunkeysym.h
@@ -10617,7 +10557,7 @@ $as_echo "X GUI selected; xim has been enabled" >&6; }
fi
fi
if test -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
if test -z "$SKIP_MOTIF"; then
cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X11/Xmu/Editres.h" >&5

View File

@@ -2443,7 +2443,7 @@ test "x$with_x" = xno -a "x$HAIKU" != "xyes" -a "x$MACOS_X" != "xyes" -a "x$QNX"
AC_MSG_CHECKING(--enable-gui argument)
AC_ARG_ENABLE(gui,
[ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/neXtaw/haiku/photon/carbon]], , enable_gui="auto")
[ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/haiku/photon/carbon]], , enable_gui="auto")
dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
dnl Do not use character classes for portability with old tools.
@@ -2455,7 +2455,6 @@ SKIP_GTK2=YES
SKIP_GTK3=YES
SKIP_GNOME=YES
SKIP_MOTIF=YES
SKIP_NEXTAW=YES
SKIP_PHOTON=YES
SKIP_HAIKU=YES
GUITYPE=NONE
@@ -2500,8 +2499,7 @@ else
SKIP_GTK2=
SKIP_GTK3=
SKIP_GNOME=
SKIP_MOTIF=
SKIP_NEXTAW=;;
SKIP_MOTIF=;;
gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
SKIP_GTK2=;;
gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
@@ -2511,8 +2509,6 @@ else
SKIP_GTK3=;;
motif) AC_MSG_RESULT(Motif GUI support)
SKIP_MOTIF=;;
nextaw) AC_MSG_RESULT(neXtaw GUI support)
SKIP_NEXTAW=;;
*) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
esac
@@ -2564,17 +2560,6 @@ if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
fi
fi
if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
AC_MSG_CHECKING(whether or not to look for neXtaw)
AC_ARG_ENABLE(nextaw-check,
[ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
, enable_nextaw_check="yes")
AC_MSG_RESULT($enable_nextaw_check);
if test "x$enable_nextaw_check" = "xno"; then
SKIP_NEXTAW=YES
fi
fi
dnl define an autoconf function to check for a specified version of GTK, and
dnl try to compile/link a GTK program.
dnl
@@ -2806,7 +2791,6 @@ if test -z "$SKIP_GTK2"; then
GUI_INC_LOC="$GTK_CFLAGS"], )
if test "x$GTK_CFLAGS" != "x"; then
SKIP_GTK3=YES
SKIP_NEXTAW=YES
SKIP_MOTIF=YES
GUITYPE=GTK
AC_SUBST(GTK_LIBNAME)
@@ -2856,7 +2840,6 @@ if test -z "$SKIP_GTK3"; then
if test "x$GTK_CFLAGS" != "x"; then
SKIP_GTK2=YES
SKIP_GNOME=YES
SKIP_NEXTAW=YES
SKIP_MOTIF=YES
GUITYPE=GTK
AC_SUBST(GTK_LIBNAME)
@@ -3017,28 +3000,11 @@ if test -z "$SKIP_MOTIF"; then
fi
if test -z "$SKIP_MOTIF"; then
SKIP_NEXTAW=YES
GUITYPE=MOTIF
AC_SUBST(MOTIF_LIBNAME)
fi
if test -z "$SKIP_NEXTAW"; then
AC_MSG_CHECKING(if neXtaw header files can be found)
cflags_save=$CFLAGS
CFLAGS="$CFLAGS $X_CFLAGS"
AC_TRY_COMPILE([
#include <X11/Intrinsic.h>
#include <X11/neXtaw/Paned.h>], ,
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
CFLAGS=$cflags_save
fi
if test -z "$SKIP_NEXTAW"; then
GUITYPE=NEXTAW
fi
if test -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
if test -z "$SKIP_MOTIF"; then
dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
dnl Avoid adding it when it twice
if test -n "$GUI_INC_LOC"; then
@@ -3100,7 +3066,7 @@ if test "$enable_xsmp" = "yes"; then
fi
if test -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
if test -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
@@ -3122,7 +3088,7 @@ if test -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GT
fi
fi
if test -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
if test -z "$SKIP_MOTIF"; then
cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h

View File

@@ -2849,6 +2849,7 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
int vim9script = in_vim9script();
int evaluate = evalarg == NULL
? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
long comp_lnum = SOURCING_LNUM;
if (getnext)
{
@@ -2904,6 +2905,8 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
{
int ret;
// use the line of the comparison for messages
SOURCING_LNUM = comp_lnum;
if (vim9script && check_compare_types(type, rettv, &var2) == FAIL)
{
ret = FAIL;

View File

@@ -2643,7 +2643,12 @@ handle_mapping(
max_mlen = mlen + 1;
}
if ((mp == NULL || max_mlen > mp_match_len) && keylen != KEYLEN_PART_MAP)
// May check for a terminal code when there is no mapping or only a partial
// mapping. Also check if there is a full mapping with <Esc>, unless timed
// out, since that is nearly always a partial match with a terminal code.
if ((mp == NULL || max_mlen > mp_match_len
|| (mp_match_len == 1 && *mp->m_keys == ESC && !*timedout))
&& keylen != KEYLEN_PART_MAP)
{
int save_keylen = keylen;

View File

@@ -398,7 +398,8 @@ EXTERN type_T t_any INIT6(VAR_ANY, 0, 0, TTFLAG_STATIC, NULL, NULL);
EXTERN type_T t_void INIT6(VAR_VOID, 0, 0, TTFLAG_STATIC, NULL, NULL);
EXTERN type_T t_bool INIT6(VAR_BOOL, 0, 0, TTFLAG_STATIC, NULL, NULL);
EXTERN type_T t_special INIT6(VAR_SPECIAL, 0, 0, TTFLAG_STATIC, NULL, NULL);
EXTERN type_T t_null INIT6(VAR_SPECIAL, 0, 0, TTFLAG_STATIC, NULL, NULL);
EXTERN type_T t_none INIT6(VAR_SPECIAL, 0, 0, TTFLAG_STATIC, NULL, NULL);
EXTERN type_T t_number INIT6(VAR_NUMBER, 0, 0, TTFLAG_STATIC, NULL, NULL);
EXTERN type_T t_number_bool INIT6(VAR_NUMBER, 0, 0, TTFLAG_STATIC|TTFLAG_BOOL_OK, NULL, NULL);
EXTERN type_T t_float INIT6(VAR_FLOAT, 0, 0, TTFLAG_STATIC, NULL, NULL);

View File

@@ -1906,9 +1906,7 @@ gui_mch_set_scrollbar_colors(scrollbar_T *sb)
if (gui.scroll_fg_pixel != INVALCOLOR)
XtVaSetValues(sb->id,
XmNforeground, gui.scroll_fg_pixel,
#if (XmVersion<1002)
XmNbackground, gui.scroll_fg_pixel,
#endif
NULL);
}

View File

@@ -1269,7 +1269,6 @@ nfa_emit_equi_class(int c)
EMIT2(c);
return OK;
#undef EMIT2
#undef EMIT2
}
/*

1403
src/tag.c

File diff suppressed because it is too large Load Diff

View File

@@ -73,6 +73,13 @@ func Test_Debugger()
endtry
return var1
endfunc
def Vim9Func()
for cmd in ['confirm', 'xxxxxxx']
for _ in [1, 2]
echo cmd
endfor
endfor
enddef
END
call writefile(lines, 'Xtest.vim')
@@ -298,6 +305,14 @@ func Test_Debugger()
\ 'line 5: catch'])
call RunDbgCmd(buf, 'c')
" Test showing local variable in :def function
call RunDbgCmd(buf, ':breakadd func 2 Vim9Func')
call RunDbgCmd(buf, ':call Vim9Func()', ['line 2: for _ in [1, 2]'])
call RunDbgCmd(buf, 'next', ['line 2: for _ in [1, 2]'])
call RunDbgCmd(buf, 'echo cmd', ['confirm'])
call RunDbgCmd(buf, 'breakdel *')
call RunDbgCmd(buf, 'cont')
" Test for :quit
call RunDbgCmd(buf, ':debug echo Foo()')
call RunDbgCmd(buf, 'breakdel *')

View File

@@ -811,11 +811,11 @@ endfunc
" Test for an unsorted tags file
func Test_tag_sort()
call writefile([
let l = [
\ "first\tXfoo\t1",
\ "ten\tXfoo\t3",
\ "six\tXfoo\t2"],
\ 'Xtags')
\ "six\tXfoo\t2"]
call writefile(l, 'Xtags')
set tags=Xtags
let code =<< trim [CODE]
int first() {}
@@ -826,7 +826,14 @@ func Test_tag_sort()
call assert_fails('tag first', 'E432:')
" When multiple tag files are not sorted, then message should be displayed
" multiple times
call writefile(l, 'Xtags2')
set tags=Xtags,Xtags2
call assert_fails('tag first', ['E432:', 'E432:'])
call delete('Xtags')
call delete('Xtags2')
call delete('Xfoo')
set tags&
%bwipe
@@ -1571,6 +1578,15 @@ func Test_tagbsearch()
call assert_equal(3, line('.'))
%bw!
" Binary search fails on EOF
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "!_TAG_FILE_SORTED\t1\t/0=unsorted, 1=sorted, 2=foldcase/",
\ "bar\tXfoo\t1",
\ "foo\tXfoo\t2"],
\ 'Xtags')
call assert_fails('tag bbb', 'E426:')
call delete('Xtags')
call delete('Xfoo')
set tags& tagbsearch&

View File

@@ -2331,6 +2331,22 @@ func Test_cmdline_literal()
set timeoutlen&
endfunc
func Test_mapping_esc()
set timeoutlen=10
new
nnoremap <Up> iHello<Esc>
nnoremap <Esc> <Nop>
call feedkeys(substitute(&t_ku, '\*', '', 'g'), 'Lx!')
call assert_equal("Hello", getline(1))
bwipe!
nunmap <Up>
nunmap <Esc>
set timeoutlen&
endfunc
" Test for translation of special key codes (<xF1>, <xF2>, etc.)
func Test_Keycode_Translation()
let keycodes = [

View File

@@ -1217,7 +1217,7 @@ def Test_put_command()
:2put =['a', 'b', 'c']
assert_equal(['ppp', 'a', 'b', 'c', 'above'], getline(2, 6))
:0put ='first'
:0put = 'first'
assert_equal('first', getline(1))
:1put! ='first again'
assert_equal('first again', getline(1))

View File

@@ -828,8 +828,29 @@ def Test_expr4_compare_null()
v9.CheckDefAndScriptFailure(['echo true != v:null'], 'E1072: Cannot compare bool with special')
v9.CheckDefAndScriptFailure(['echo v:null != true'], 'E1072: Cannot compare special with bool')
v9.CheckDefAndScriptFailure(['echo false == v:null'], 'E1072: Cannot compare bool with special')
enddef
v9.CheckDefExecAndScriptFailure(['echo [] == v:none'], ['E1072: Cannot compare list with special', 'E691: Can only compare List with List'])
def Test_expr4_compare_none()
var lines =<< trim END
assert_false('' == v:none)
assert_false('text' == v:none)
assert_true(v:none == v:none)
assert_false(v:none == '')
assert_false(v:none == 'text')
assert_true(v:none == v:none)
END
v9.CheckDefAndScriptSuccess(lines)
v9.CheckDefAndScriptFailure(['echo [] == v:none'], 'E1072: Cannot compare list with special')
v9.CheckDefAndScriptFailure(['echo 123 == v:none'], 'E1072: Cannot compare number with special')
v9.CheckDefAndScriptFailure(['echo 0z00 == v:none'], 'E1072: Cannot compare blob with special')
lines =<< trim END
echo [] == v:none
eval 0 + 0
END
v9.CheckDefAndScriptFailure(lines, 'E1072:', 1)
enddef
def Test_expr4_wrong_type()

View File

@@ -3717,6 +3717,24 @@ def Test_nested_closure_in_dict()
v9.CheckScriptSuccess(lines)
enddef
def Test_script_local_other_script()
var lines =<< trim END
function LegacyJob()
let FuncRef = function('s:close_cb')
endfunction
function s:close_cb(...)
endfunction
END
lines->writefile('Xlegacy.vim')
source Xlegacy.vim
g:LegacyJob()
g:LegacyJob()
g:LegacyJob()
delfunc g:LegacyJob
delete('Xlegacy.vim')
enddef
def Test_check_func_arg_types()
var lines =<< trim END
vim9script

View File

@@ -907,6 +907,28 @@ def Test_continue_in_try_in_while()
unlet g:sequence
enddef
def Test_break_in_try_in_for()
var lines =<< trim END
vim9script
def Ls(): list<string>
var ls: list<string>
for s in ['abc', 'def']
for _ in [123, 456]
try
eval [][0]
catch
break
endtry
endfor
ls += [s]
endfor
return ls
enddef
assert_equal(['abc', 'def'], Ls())
END
v9.CheckScriptSuccess(lines)
enddef
def Test_nocatch_return_in_try()
# return in try block returns normally
def ReturnInTry(): string

View File

@@ -2215,8 +2215,9 @@ numbered_function(char_u *name)
/*
* There are two kinds of function names:
* 1. ordinary names, function defined with :function or :def
* 2. numbered functions and lambdas
* 1. ordinary names, function defined with :function or :def;
* can start with "<SNR>123_" literally or with K_SPECIAL.
* 2. Numbered functions and lambdas: "<lambda>123"
* For the first we only count the name stored in func_hashtab as a reference,
* using function() does not count as a reference, because the function is
* looked up by name.
@@ -2224,7 +2225,7 @@ numbered_function(char_u *name)
int
func_name_refcount(char_u *name)
{
return numbered_function(name) || *name == '<';
return numbered_function(name) || (name[0] == '<' && name[1] == 'l');
}
/*

View File

@@ -750,6 +750,36 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4552,
/**/
4551,
/**/
4550,
/**/
4549,
/**/
4548,
/**/
4547,
/**/
4546,
/**/
4545,
/**/
4544,
/**/
4543,
/**/
4542,
/**/
4541,
/**/
4540,
/**/
4539,
/**/
4538,
/**/
4537,
/**/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -121,7 +121,7 @@ typedef enum {
ISN_CATCH, // drop v:exception
ISN_FINALLY, // start of :finally block
ISN_ENDTRY, // take entry off from ec_trystack
ISN_TRYCONT, // handle :continue inside a :try statement
ISN_TRYCONT, // handle :continue or :break inside a :try statement
// more expression operations
ISN_ADDLIST, // add two lists

View File

@@ -1206,6 +1206,7 @@ compile_continue(char_u *arg, cctx_T *cctx)
compile_break(char_u *arg, cctx_T *cctx)
{
scope_T *scope = cctx->ctx_scope;
int try_scopes = 0;
endlabel_T **el;
for (;;)
@@ -1215,16 +1216,29 @@ compile_break(char_u *arg, cctx_T *cctx)
emsg(_(e_break_without_while_or_for));
return NULL;
}
if (scope->se_type == FOR_SCOPE || scope->se_type == WHILE_SCOPE)
if (scope->se_type == FOR_SCOPE)
{
el = &scope->se_u.se_for.fs_end_label;
break;
}
if (scope->se_type == WHILE_SCOPE)
{
el = &scope->se_u.se_while.ws_end_label;
break;
}
if (scope->se_type == TRY_SCOPE)
++try_scopes;
scope = scope->se_outer;
}
// Jump to the end of the FOR or WHILE loop.
if (scope->se_type == FOR_SCOPE)
el = &scope->se_u.se_for.fs_end_label;
else
el = &scope->se_u.se_while.ws_end_label;
if (try_scopes > 0)
// Inside one or more try/catch blocks we first need to jump to the
// "finally" or "endtry" to cleanup. Then come to the next JUMP
// intruction, which we don't know the index of yet.
generate_TRYCONT(cctx, try_scopes, cctx->ctx_instr.ga_len + 1);
// Jump to the end of the FOR or WHILE loop. The instruction index will be
// filled in later.
if (compile_jump_to_end(el, JUMP_ALWAYS, cctx) == FAIL)
return FAIL;
@@ -1753,7 +1767,7 @@ compile_put(char_u *arg, exarg_T *eap, cctx_T *cctx)
if (eap->regname == '=')
{
char_u *p = line + 1;
char_u *p = skipwhite(line + 1);
if (compile_expr0(&p, cctx) == FAIL)
return NULL;

View File

@@ -1799,7 +1799,7 @@ compile_assign_unlet(
return FAIL;
}
type = get_type_on_stack(cctx, 0);
if ((dest_type != VAR_BLOB && type != &t_special)
if ((dest_type != VAR_BLOB && type->tt_type != VAR_SPECIAL)
&& need_type(type, &t_number,
-1, 0, cctx, FALSE, FALSE) == FAIL)
return FAIL;

View File

@@ -1622,7 +1622,10 @@ lookup_debug_var(char_u *name)
// Go through the local variable names, from last to first.
for (idx = debug_var_count - 1; idx >= 0; --idx)
{
if (STRCMP(((char_u **)dfunc->df_var_names.ga_data)[idx], name) == 0)
char_u *varname = ((char_u **)dfunc->df_var_names.ga_data)[idx];
// the variable name may be NULL when not available in this block
if (varname != NULL && STRCMP(varname, name) == 0)
return STACK_TV_VAR(idx);
}

View File

@@ -339,22 +339,30 @@ generate_two_op(cctx_T *cctx, char_u *op)
}
/*
* Get the instruction to use for comparing "type1" with "type2"
* Get the instruction to use for comparing two values with specified types.
* Either "tv1" and "tv2" are passed or "type1" and "type2".
* Return ISN_DROP when failed.
*/
static isntype_T
get_compare_isn(exprtype_T exprtype, vartype_T type1, vartype_T type2)
get_compare_isn(
exprtype_T exprtype,
typval_T *tv1,
typval_T *tv2,
type_T *type1,
type_T *type2)
{
isntype_T isntype = ISN_DROP;
vartype_T vartype1 = tv1 != NULL ? tv1->v_type : type1->tt_type;
vartype_T vartype2 = tv2 != NULL ? tv2->v_type : type2->tt_type;
if (type1 == VAR_UNKNOWN)
type1 = VAR_ANY;
if (type2 == VAR_UNKNOWN)
type2 = VAR_ANY;
if (vartype1 == VAR_UNKNOWN)
vartype1 = VAR_ANY;
if (vartype2 == VAR_UNKNOWN)
vartype2 = VAR_ANY;
if (type1 == type2)
if (vartype1 == vartype2)
{
switch (type1)
switch (vartype1)
{
case VAR_BOOL: isntype = ISN_COMPAREBOOL; break;
case VAR_SPECIAL: isntype = ISN_COMPARESPECIAL; break;
@@ -368,15 +376,28 @@ get_compare_isn(exprtype_T exprtype, vartype_T type1, vartype_T type2)
default: isntype = ISN_COMPAREANY; break;
}
}
else if (type1 == VAR_ANY || type2 == VAR_ANY
|| ((type1 == VAR_NUMBER || type1 == VAR_FLOAT)
&& (type2 == VAR_NUMBER || type2 == VAR_FLOAT))
|| (type1 == VAR_FUNC && type2 == VAR_PARTIAL)
|| (type1 == VAR_PARTIAL && type2 == VAR_FUNC))
else if (vartype1 == VAR_ANY || vartype2 == VAR_ANY
|| ((vartype1 == VAR_NUMBER || vartype1 == VAR_FLOAT)
&& (vartype2 == VAR_NUMBER || vartype2 == VAR_FLOAT))
|| (vartype1 == VAR_FUNC && vartype2 == VAR_PARTIAL)
|| (vartype1 == VAR_PARTIAL && vartype2 == VAR_FUNC))
isntype = ISN_COMPAREANY;
else if (type1 == VAR_SPECIAL || type2 == VAR_SPECIAL)
else if (vartype1 == VAR_SPECIAL || vartype2 == VAR_SPECIAL)
{
switch (type1 == VAR_SPECIAL ? type2 : type1)
if ((vartype1 == VAR_SPECIAL
&& (tv1 != NULL ? tv1->vval.v_number == VVAL_NONE
: type1 == &t_none)
&& vartype2 != VAR_STRING)
|| (vartype2 == VAR_SPECIAL
&& (tv2 != NULL ? tv2->vval.v_number == VVAL_NONE
: type2 == &t_none)
&& vartype1 != VAR_STRING))
{
semsg(_(e_cannot_compare_str_with_str),
vartype_name(vartype1), vartype_name(vartype2));
return ISN_DROP;
}
switch (vartype1 == VAR_SPECIAL ? vartype2 : vartype1)
{
case VAR_BLOB: break;
case VAR_CHANNEL: break;
@@ -387,7 +408,7 @@ get_compare_isn(exprtype_T exprtype, vartype_T type1, vartype_T type2)
case VAR_PARTIAL: break;
case VAR_STRING: break;
default: semsg(_(e_cannot_compare_str_with_str),
vartype_name(type1), vartype_name(type2));
vartype_name(vartype1), vartype_name(vartype2));
return ISN_DROP;
}
isntype = ISN_COMPARENULL;
@@ -400,20 +421,20 @@ get_compare_isn(exprtype_T exprtype, vartype_T type1, vartype_T type2)
|| isntype == ISN_COMPAREFLOAT))
{
semsg(_(e_cannot_use_str_with_str),
exprtype == EXPR_IS ? "is" : "isnot" , vartype_name(type1));
exprtype == EXPR_IS ? "is" : "isnot" , vartype_name(vartype1));
return ISN_DROP;
}
if (isntype == ISN_DROP
|| ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL
&& (type1 == VAR_BOOL || type1 == VAR_SPECIAL
|| type2 == VAR_BOOL || type2 == VAR_SPECIAL)))
&& (vartype1 == VAR_BOOL || vartype1 == VAR_SPECIAL
|| vartype2 == VAR_BOOL || vartype2 == VAR_SPECIAL)))
|| ((exprtype != EXPR_EQUAL && exprtype != EXPR_NEQUAL
&& exprtype != EXPR_IS && exprtype != EXPR_ISNOT
&& (type1 == VAR_BLOB || type2 == VAR_BLOB
|| type1 == VAR_LIST || type2 == VAR_LIST))))
&& (vartype1 == VAR_BLOB || vartype2 == VAR_BLOB
|| vartype1 == VAR_LIST || vartype2 == VAR_LIST))))
{
semsg(_(e_cannot_compare_str_with_str),
vartype_name(type1), vartype_name(type2));
vartype_name(vartype1), vartype_name(vartype2));
return ISN_DROP;
}
return isntype;
@@ -422,7 +443,7 @@ get_compare_isn(exprtype_T exprtype, vartype_T type1, vartype_T type2)
int
check_compare_types(exprtype_T type, typval_T *tv1, typval_T *tv2)
{
if (get_compare_isn(type, tv1->v_type, tv2->v_type) == ISN_DROP)
if (get_compare_isn(type, tv1, tv2, NULL, NULL) == ISN_DROP)
return FAIL;
return OK;
}
@@ -436,17 +457,14 @@ generate_COMPARE(cctx_T *cctx, exprtype_T exprtype, int ic)
isntype_T isntype;
isn_T *isn;
garray_T *stack = &cctx->ctx_type_stack;
vartype_T type1;
vartype_T type2;
RETURN_OK_IF_SKIP(cctx);
// Get the known type of the two items on the stack. If they are matching
// use a type-specific instruction. Otherwise fall back to runtime type
// checking.
type1 = get_type_on_stack(cctx, 1)->tt_type;
type2 = get_type_on_stack(cctx, 0)->tt_type;
isntype = get_compare_isn(exprtype, type1, type2);
isntype = get_compare_isn(exprtype, NULL, NULL,
get_type_on_stack(cctx, 1), get_type_on_stack(cctx, 0));
if (isntype == ISN_DROP)
return FAIL;
@@ -664,7 +682,8 @@ generate_PUSHSPEC(cctx_T *cctx, varnumber_T number)
isn_T *isn;
RETURN_OK_IF_SKIP(cctx);
if ((isn = generate_instr_type(cctx, ISN_PUSHSPEC, &t_special)) == NULL)
if ((isn = generate_instr_type(cctx, ISN_PUSHSPEC,
number == VVAL_NULL ? &t_null : &t_none)) == NULL)
return FAIL;
isn->isn_arg.number = number;
@@ -1475,7 +1494,7 @@ generate_CALL(cctx_T *cctx, ufunc_T *ufunc, int pushed_argcount)
type_T *actual;
actual = get_type_on_stack(cctx, argcount - i - 1);
if (actual == &t_special
if (actual->tt_type == VAR_SPECIAL
&& i >= regular_args - ufunc->uf_def_args.ga_len)
{
// assume v:none used for default argument value
@@ -1606,7 +1625,7 @@ generate_PCALL(
expected = type->tt_args[
type->tt_argcount - 1]->tt_member;
else if (i >= type->tt_min_argcount
&& actual == &t_special)
&& actual->tt_type == VAR_SPECIAL)
expected = &t_any;
else
expected = type->tt_args[i];