Compare commits

...

17 Commits

Author SHA1 Message Date
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
=?UTF-8?q?Dundar=20G=C3=B6c?=
48f83c31d1 patch 8.2.4537: output from linter and language server shows up in git
Problem:    Output from linter and language server shows up in git.
Solution:   Add patterns to .gitignore. (Goc Dundar, closes #9925)
2022-03-10 15:51:24 +00:00
Bram Moolenaar
cf6662082f patch 8.2.4536: debugger test fails when breaking on expression
Problem:    Debugger test fails when breaking on expression.
Solution:   Compare strings with "==" instead of "is".
2022-03-10 13:29:20 +00:00
Christian Brabandt
81da16b53f patch 8.2.4535: filename modifer ":8" removes the filename
Problem:    Filename modifer ":8" removes the filename.
Solution:   Use strncpy() instead of vim_strncpy(). (Christian Brabandt,
            closes #9918, closes #8600)
2022-03-10 12:24:02 +00:00
Bram Moolenaar
f8691004b0 patch 8.2.4534: Vim9: "is" operator with empty string and null returns true
Problem:    Vim9: "is" operator with empty string and null returns true.
Solution:   Consider empty string and null to be different for "is".
2022-03-10 12:20:53 +00:00
Bram Moolenaar
56b84b1728 patch 8.2.4533: Vim9: no test that after assigning null type is still checked
Problem:    Vim9: no test that after assigning null the type is still checked.
Solution:   Add a test.
2022-03-09 19:46:48 +00:00
Stuart Henderson
f2832ad965 patch 8.2.4532: suspending with CTRL-Z does not work on OpenBSD
Problem:    Suspending with CTRL-Z does not work on OpenBSD.
Solution:   Adjust #ifdef for SIGTSTP. (Stuart Henderson, closes #9912)
2022-03-09 14:33:02 +00:00
=?UTF-8?q?Dundar=20G=C3=B6c?=
f01a653ac5 patch 8.2.4531: LGTM warnings for condition and buffer size
Problem:    LGTM warnings for condition always true and buffer size too small.
Solution:   Remove the useless condition.  Make the buffer larger. (Goc
            Dundar, closes #9914)
2022-03-09 13:00:54 +00:00
30 changed files with 1035 additions and 835 deletions

7
.gitignore vendored
View File

@@ -96,5 +96,10 @@ src/shadow-*
src/runtime
src/pixmaps
# other possible files build by tools
# other files possibly created by tools
src/cscope.out
# Linter/language server files
/.cache/clangd/
/.ccls-cache/
/compile_commands.json

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 -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

@@ -558,7 +558,7 @@ transchar_nonprint(buf_T *buf, char_u *charbuf, int c)
charbuf[1] = c ^ 0x40; // DEL displayed as ^?
charbuf[2] = NUL;
}
else if (enc_utf8 && c >= 0x80)
else if (enc_utf8)
{
transchar_hex(charbuf, c);
}

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 -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

@@ -989,7 +989,12 @@ debuggy_find(
}
else
{
if (typval_compare(tv, bp->dbg_val, EXPR_IS, FALSE) == OK
// Use "==" instead of "is" for strings, that is what we
// always have done.
exprtype_T type = tv->v_type == VAR_STRING
? EXPR_EQUAL : EXPR_IS;
if (typval_compare(tv, bp->dbg_val, type, FALSE) == OK
&& tv->vval.v_number == FALSE)
{
typval_T *v;

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

@@ -186,7 +186,7 @@ shortpath_for_invalid_fname(
// unless get_short_pathname() did its work in-place.
*fname = *bufp = save_fname;
if (short_fname != save_fname)
vim_strncpy(save_fname, short_fname, len);
STRNCPY(save_fname, short_fname, len);
save_fname = NULL;
}

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

@@ -887,8 +887,9 @@ sig_tstp SIGDEFARG(sigarg)
else
got_tstp = TRUE;
#ifndef __ANDROID__
// this is not required on all systems
#if !defined(__ANDROID__) && !defined(__OpenBSD__)
// This is not required on all systems. On some systems (at least Android
// and OpenBSD) this breaks suspending with CTRL-Z.
signal(SIGTSTP, (RETSIGTYPE (*)())sig_tstp);
#endif
SIGRETURN;

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

@@ -6370,7 +6370,7 @@ req_codes_from_term(void)
static void
req_more_codes_from_term(void)
{
char buf[11];
char buf[23]; // extra size to shut up LGTM
int old_idx = xt_index_out;
// Don't do anything when going to exit.

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

@@ -88,4 +88,9 @@ func Test_ColonEight_MultiByte()
call delete(dir, 'd')
endfunc
func Test_ColonEight_notexists()
let non_exists='C:\windows\newfile.txt'
call assert_equal(non_exists, fnamemodify(non_exists, ':p:8'))
endfunc
" vim: shiftwidth=2 sts=2 expandtab

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

@@ -340,10 +340,35 @@ def Test_null_values()
var j: job = null_job
var c: channel = null_channel
endif
var d: dict<func> = {a: function('tr'), b: null_function}
END
v9.CheckDefAndScriptSuccess(lines)
enddef
def Test_keep_type_after_assigning_null()
var lines =<< trim END
var b: blob
b = null_blob
b = 'text'
END
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected blob but got string')
lines =<< trim END
var l: list<number>
l = null_list
l = ['text']
END
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected list<number> but got list<string>')
lines =<< trim END
var d: dict<string>
d = null_dict
d = {a: 1, b: 2}
END
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected dict<string> but got dict<number>')
enddef
def Test_skipped_assignment()
var lines =<< trim END
for x in []

View File

@@ -801,6 +801,13 @@ def Test_expr4_compare_null()
assert_false(null_string != null)
assert_false(v:null != test_null_string())
assert_false(null != null_string)
assert_true(null_string is test_null_string())
assert_false(null_string is '')
assert_false('' is null_string)
assert_false(null_string isnot test_null_string())
assert_true(null_string isnot '')
assert_true('' isnot null_string)
END
v9.CheckDefAndScriptSuccess(lines)
unlet g:null_dict
@@ -821,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

@@ -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

@@ -1583,9 +1583,23 @@ typval_compare_string(
i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2);
switch (type)
{
case EXPR_IS:
case EXPR_IS: if (in_vim9script())
{
// Really check it is the same string, not just
// the same value.
val = tv1->vval.v_string == tv2->vval.v_string;
break;
}
// FALLTHROUGH
case EXPR_EQUAL: val = (i == 0); break;
case EXPR_ISNOT:
case EXPR_ISNOT: if (in_vim9script())
{
// Really check it is not the same string, not
// just a different value.
val = tv1->vval.v_string != tv2->vval.v_string;
break;
}
// FALLTHROUGH
case EXPR_NEQUAL: val = (i != 0); break;
case EXPR_GREATER: val = (i > 0); break;
case EXPR_GEQUAL: val = (i >= 0); break;

View File

@@ -750,6 +750,40 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4547,
/**/
4546,
/**/
4545,
/**/
4544,
/**/
4543,
/**/
4542,
/**/
4541,
/**/
4540,
/**/
4539,
/**/
4538,
/**/
4537,
/**/
4536,
/**/
4535,
/**/
4534,
/**/
4533,
/**/
4532,
/**/
4531,
/**/
4530,
/**/

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;

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);
}
@@ -3313,9 +3316,8 @@ exec_instructions(ectx_T *ectx)
break;
default:
tv->v_type = VAR_STRING;
tv->vval.v_string = vim_strsave(
iptr->isn_arg.string == NULL
? (char_u *)"" : iptr->isn_arg.string);
tv->vval.v_string = iptr->isn_arg.string == NULL
? NULL : vim_strsave(iptr->isn_arg.string);
}
break;

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];