Compare commits

..

12 Commits

Author SHA1 Message Date
7c23d1d9d9 patch 8.0.0280: problem setting multi-byte environment var on MS-Windows
Problem:    On MS-Windows setting an environment variable with multi-byte
            strings does not work well.
Solution:   Use wputenv when possible. (Taro Muraoka, Ken Takata)
2017-02-01 13:14:16 +01:00
168dd00f72 patch 8.0.0279: MSVC 2015 uses a different dll name
Problem:    With MSVC 2015 the dll name is vcruntime140.dll.
Solution:   Check the MSVC version and use the right dll name. (Ken Takata)
2017-02-01 13:02:47 +01:00
f1ab9c1370 patch 8.0.0278: GUI test fails on MS-Windows
Problem:    GUI test fails on MS-Windows.
Solution:   Check that tester_HOME exists.
2017-02-01 12:32:58 +01:00
56e6bd7ba2 patch 8.0.0277: the GUI test may trigger fontconfig and take a long time
Problem:    The GUI test may trigger fontconfig and take a long time.
Solution:   Set $XDG_CACHE_HOME. (Kazunobu Kuriyama)
2017-02-01 12:08:47 +01:00
3954e3c4b5 patch 8.0.0276: unnecessary #ifdefs
Problem:    Checking for FEAT_GUI_GNOME inside GTK 3 code is unnecessary.
Solution:   Remove the #ifdef. (Kazunobu Kuriyama)
2017-02-01 11:50:09 +01:00
e3caa11090 patch 8.0.0275: the screen may be updated at the wrong time
Problem:    When checking for CTRL-C typed the GUI may detect a screen resize
            and redraw the screen, causing trouble.
Solution:   Set updating_screen in ui_breakcheck().
2017-01-31 22:07:42 +01:00
070b33da93 patch 8.0.0274: possible recursive screen updating causes trouble
Problem:    When update_single_line() is called recursively, or another screen
            update happens while it is busy, errors may occur.
Solution:   Check and update updating_screen. (Christian Brabandt)
2017-01-31 21:53:39 +01:00
c4a249a736 patch 8.0.0273: dead code detected by Coverity
Problem:    Dead code detected by Coverity when not using gnome.
Solution:   Rearrange the #ifdefs to avoid dead code.
2017-01-30 22:56:48 +01:00
432c839ebd patch 8.0.0272: crash on exit is not detected when running tests
Problem:    Crash on exit is not detected when running tests.
Solution:   Remove the dash before the command. (Dominique Pelle, closes
            #1425)
2017-01-30 22:01:01 +01:00
a4c906a4a1 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Problem:    May get ml_get error when :tcldo deletes lines or switches to
            another buffer. (Nikolai Pavlov, closes #1421)
Solution:   Check the buffer and line every time.
2017-01-29 23:26:37 +01:00
c593fee0e5 patch 8.0.0270: may get ml_get error when :rubydo deletes lines
Problem:    May get ml_get error when :rubydo deletes lines or switches to
            another buffer. (Nikolai Pavlov, issue #1421)
Solution:   Check the buffer and line every time.
2017-01-29 23:11:25 +01:00
85b5743d3e patch 8.0.0269: may get ml_get error when :perldo deletes lines
Problem:    May get ml_get error when :perldo deletes lines or switches to
            another buffer. (Nikolai Pavlov, issue #1421)
Solution:   Check the buffer and line every time.
2017-01-29 22:59:12 +01:00
21 changed files with 191 additions and 21 deletions

View File

@ -285,8 +285,10 @@ MSVCRT_VER = ($(MSVCVER) / 10 - 50)
# Base name of the msvcrXX.dll
!if $(MSVCRT_VER) <= 60
MSVCRT_NAME = msvcrt
!else
!elseif $(MSVCRT_VER) <= 130
MSVCRT_NAME = msvcr$(MSVCRT_VER)
!else
MSVCRT_NAME = vcruntime$(MSVCRT_VER)
!endif
!if $(MSVC_MAJOR) == 6

View File

@ -2198,6 +2198,7 @@ test_arglist \
test_tabpage \
test_tagcase \
test_tagjump \
test_tcl \
test_textobjects \
test_timers \
test_true_false \

View File

@ -3171,9 +3171,9 @@ delete_event_cb(GtkWidget *widget UNUSED,
static int
get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
{
# ifdef FEAT_GUI_GNOME
GtkOrientation item_orientation = GTK_ORIENTATION_HORIZONTAL;
# ifdef FEAT_GUI_GNOME
if (using_gnome && widget != NULL)
{
GtkWidget *parent;
@ -3192,7 +3192,10 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
item_orientation = bonobo_dock_item_get_orientation(dockitem);
}
}
# else
# define item_orientation GTK_ORIENTATION_HORIZONTAL
# endif
# if GTK_CHECK_VERSION(3,0,0)
if (widget != NULL
&& item_orientation == orientation
@ -3209,16 +3212,16 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return allocation.height;
else
return allocation.width;
# else
# ifdef FEAT_GUI_GNOME
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return widget->allocation.height;
else
return widget->allocation.width;
# else
return widget->allocation.height;
# endif
# endif
}
return 0;

View File

@ -1286,6 +1286,7 @@ ex_perldo(exarg_T *eap)
SV *sv;
char *str;
linenr_T i;
buf_T *was_curbuf = curbuf;
if (bufempty())
return;
@ -1321,11 +1322,14 @@ ex_perldo(exarg_T *eap)
SAVETMPS;
for (i = eap->line1; i <= eap->line2; i++)
{
/* Check the line number, the command my have deleted lines. */
if (i > curbuf->b_ml.ml_line_count)
break;
sv_setpv(GvSV(PL_defgv), (char *)ml_get(i));
PUSHMARK(sp);
perl_call_pv("VIM::perldo", G_SCALAR | G_EVAL);
str = SvPV(GvSV(PL_errgv), length);
if (length)
if (length || curbuf != was_curbuf)
break;
SPAGAIN;
if (SvTRUEx(POPs))

View File

@ -783,6 +783,7 @@ void ex_rubydo(exarg_T *eap)
{
int state;
linenr_T i;
buf_T *was_curbuf = curbuf;
if (ensure_ruby_initialized())
{
@ -792,6 +793,8 @@ void ex_rubydo(exarg_T *eap)
{
VALUE line;
if (i > curbuf->b_ml.ml_line_count)
break;
line = vim_str2rb_enc_str((char *)ml_get(i));
rb_lastline_set(line);
eval_enc_string_protect((char *) eap->arg, &state);
@ -800,6 +803,8 @@ void ex_rubydo(exarg_T *eap)
error_print(state);
break;
}
if (was_curbuf != curbuf)
break;
line = rb_lastline_get();
if (!NIL_P(line))
{

View File

@ -1958,6 +1958,7 @@ ex_tcldo(exarg_T *eap)
char var_line[VARNAME_SIZE];
linenr_T first_line = 0;
linenr_T last_line = 0;
buf_T *was_curbuf = curbuf;
rs = eap->line1;
re = eap->line2;
@ -1979,6 +1980,8 @@ ex_tcldo(exarg_T *eap)
}
while (err == TCL_OK && rs <= re)
{
if ((linenr_T)rs > curbuf->b_ml.ml_line_count)
break;
line = (char *)ml_get_buf(curbuf, (linenr_T)rs, FALSE);
if (!line)
{
@ -1994,7 +1997,7 @@ ex_tcldo(exarg_T *eap)
#if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) || TCL_MAJOR_VERSION > 8
|| Tcl_LimitExceeded(tclinfo.interp)
#endif
)
|| curbuf != was_curbuf)
break;
line = (char *)Tcl_GetVar(tclinfo.interp, var_line, 0);
if (line)

View File

@ -4453,9 +4453,6 @@ vim_setenv(char_u *name, char_u *val)
{
sprintf((char *)envbuf, "%s=%s", name, val);
putenv((char *)envbuf);
# ifdef libintl_putenv
libintl_putenv((char *)envbuf);
# endif
}
#endif
#ifdef FEAT_GETTEXT

View File

@ -515,6 +515,7 @@ static char *null_libintl_textdomain(const char *);
static char *null_libintl_bindtextdomain(const char *, const char *);
static char *null_libintl_bind_textdomain_codeset(const char *, const char *);
static int null_libintl_putenv(const char *);
static int null_libintl_wputenv(const wchar_t *);
static HINSTANCE hLibintlDLL = NULL;
char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
@ -526,6 +527,7 @@ char *(*dyn_libintl_bindtextdomain)(const char *, const char *)
char *(*dyn_libintl_bind_textdomain_codeset)(const char *, const char *)
= null_libintl_bind_textdomain_codeset;
int (*dyn_libintl_putenv)(const char *) = null_libintl_putenv;
int (*dyn_libintl_wputenv)(const wchar_t *) = null_libintl_wputenv;
int
dyn_libintl_init(void)
@ -591,9 +593,14 @@ dyn_libintl_init(void)
/* _putenv() function for the libintl.dll is optional. */
hmsvcrt = find_imported_module_by_funcname(hLibintlDLL, "getenv");
if (hmsvcrt != NULL)
{
dyn_libintl_putenv = (void *)GetProcAddress(hmsvcrt, "_putenv");
if (dyn_libintl_putenv == NULL || dyn_libintl_putenv == putenv)
dyn_libintl_wputenv = (void *)GetProcAddress(hmsvcrt, "_wputenv");
}
if (dyn_libintl_putenv == NULL || dyn_libintl_putenv == _putenv)
dyn_libintl_putenv = null_libintl_putenv;
if (dyn_libintl_wputenv == NULL || dyn_libintl_wputenv == _wputenv)
dyn_libintl_wputenv = null_libintl_wputenv;
return 1;
}
@ -610,6 +617,7 @@ dyn_libintl_end(void)
dyn_libintl_bindtextdomain = null_libintl_bindtextdomain;
dyn_libintl_bind_textdomain_codeset = null_libintl_bind_textdomain_codeset;
dyn_libintl_putenv = null_libintl_putenv;
dyn_libintl_wputenv = null_libintl_wputenv;
}
/*ARGSUSED*/
@ -658,6 +666,13 @@ null_libintl_putenv(const char *envstring)
return 0;
}
/*ARGSUSED*/
int
null_libintl_wputenv(const wchar_t *envstring)
{
return 0;
}
#endif /* DYNAMIC_GETTEXT */
/* This symbol is not defined in older versions of the SDK or Visual C++ */
@ -6985,3 +7000,43 @@ fix_arg_enc(void)
set_alist_count();
}
#endif
int
mch_setenv(char *var, char *value, int x)
{
char_u *envbuf;
envbuf = alloc((unsigned)(STRLEN(var) + STRLEN(value) + 2));
if (envbuf == NULL)
return -1;
sprintf((char *)envbuf, "%s=%s", var, value);
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
WCHAR *p = enc_to_utf16(envbuf, NULL);
vim_free(envbuf);
if (p == NULL)
return -1;
_wputenv(p);
# ifdef libintl_wputenv
libintl_wputenv(p);
# endif
/* Unlike Un*x systems, we can free the string for _wputenv(). */
vim_free(p);
}
else
#endif
{
_putenv((char *)envbuf);
# ifdef libintl_putenv
libintl_putenv((char *)envbuf);
# endif
/* Unlike Un*x systems, we can free the string for _putenv(). */
vim_free(envbuf);
}
return 0;
}

View File

@ -202,7 +202,9 @@ Trace(char *pszFormat, ...);
#define ASSERT_NULL_OR_POINTER(p, type) \
ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE))
#define mch_setenv(name, val, x) setenv(name, val, x)
#ifndef HAVE_SETENV
# define HAVE_SETENV
#endif
#define mch_getenv(x) (char_u *)getenv((char *)(x))
#ifdef __BORLANDC__
# define vim_mkdir(x, y) mkdir(x)

View File

@ -65,4 +65,5 @@ void free_cmd_argsW(void);
void used_file_arg(char *name, int literal, int full_path, int diff_mode);
void set_alist_count(void);
void fix_arg_enc(void);
int mch_setenv(char *var, char *value, int x);
/* vim: set ft=c : */

View File

@ -824,8 +824,9 @@ update_single_line(win_T *wp, linenr_T lnum)
int j;
/* Don't do anything if the screen structures are (not yet) valid. */
if (!screen_valid(TRUE))
if (!screen_valid(TRUE) || updating_screen)
return;
updating_screen = TRUE;
if (lnum >= wp->w_topline && lnum < wp->w_botline
&& foldedCount(wp, lnum, &win_foldinfo) == 0)
@ -865,13 +866,11 @@ update_single_line(win_T *wp, linenr_T lnum)
# endif
}
need_cursor_line_redraw = FALSE;
updating_screen = FALSE;
}
#endif
#if defined(FEAT_SIGNS) || defined(FEAT_GUI)
static void update_prepare(void);
static void update_finish(void);
/*
* Prepare for updating one or more windows.
* Caller must check for "updating_screen" already set to avoid recursiveness.

View File

@ -193,6 +193,7 @@ NEW_TESTS = test_arglist.res \
test_substitute.res \
test_syntax.res \
test_system.res \
test_tcl.res \
test_textobjects.res \
test_undo.res \
test_usercommands.res \

View File

@ -78,7 +78,7 @@ test1.out: test1.in
# 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
-$(RUN_VIM) $*.in
$(RUN_VIM) $*.in
# For flaky tests retry one time. No tests at the moment.
#@/bin/sh -c "if test -f test.out -a $* = test61; then \
@ -108,7 +108,7 @@ bench_re_freeze.out: bench_re_freeze.vim
# 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
-$(RUN_VIM) $*.in
$(RUN_VIM) $*.in
@/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
nolog:

View File

@ -10,7 +10,12 @@ func SetUp()
set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0
endif
" Gnome insists on creating $HOME/.gnome2/..
" Gnome insists on creating $HOME/.gnome2/, set $HOME to avoid changing the
" actual home directory. But avoid triggering fontconfig by setting the
" cache directory. Only needed for Unix.
if $XDG_CACHE_HOME == '' && exists('g:tester_HOME')
let $XDG_CACHE_HOME = g:tester_HOME . '/.cache'
endif
call mkdir('Xhome')
let $HOME = fnamemodify('Xhome', ':p')
endfunc

View File

@ -82,6 +82,21 @@ function Test_perldo()
1
call assert_false(search('\Cperl'))
bw!
" Check deleting lines does not trigger ml_get error.
new
call setline(1, ['one', 'two', 'three'])
perldo VIM::DoCommand("%d_")
bwipe!
" Check switching to another buffer does not trigger ml_get error.
new
let wincount = winnr('$')
call setline(1, ['one', 'two', 'three'])
perldo VIM::DoCommand("new")
call assert_equal(wincount + 1, winnr('$'))
bwipe!
bwipe!
endfunc
function Test_VIM_package()

View File

@ -32,3 +32,20 @@ func Test_ruby_evaluate_dict()
redir END
call assert_equal(['{"a"=>"foo", "b"=>123}'], split(l:out, "\n"))
endfunc
func Test_rubydo()
" Check deleting lines does not trigger ml_get error.
new
call setline(1, ['one', 'two', 'three'])
rubydo Vim.command("%d_")
bwipe!
" Check switching to another buffer does not trigger ml_get error.
new
let wincount = winnr('$')
call setline(1, ['one', 'two', 'three'])
rubydo Vim.command("new")
call assert_equal(wincount + 1, winnr('$'))
bwipe!
bwipe!
endfunc

23
src/testdir/test_tcl.vim Normal file
View File

@ -0,0 +1,23 @@
" Tests for the Tcl interface.
if !has('tcl')
finish
end
function Test_tcldo()
" Check deleting lines does not trigger ml_get error.
new
call setline(1, ['one', 'two', 'three'])
tcldo ::vim::command %d_
bwipe!
" Check switching to another buffer does not trigger ml_get error.
new
let wincount = winnr('$')
call setline(1, ['one', 'two', 'three'])
tcldo ::vim::command new
call assert_equal(wincount + 1, winnr('$'))
bwipe!
bwipe!
endfunc

View File

@ -2,4 +2,9 @@
" Always use "sh", don't use the value of "$SHELL".
set shell=sh
" While some tests overwrite $HOME to prevent them from polluting user files,
" we need to remember the original value so that we can tell external systems
" where to ask about their own user settings.
let g:tester_HOME = $HOME
source setup.vim

View File

@ -363,12 +363,19 @@ ui_breakcheck(void)
void
ui_breakcheck_force(int force)
{
int save_us = updating_screen;
/* We do not want gui_resize_shell() to redraw the screen here. */
++updating_screen;
#ifdef FEAT_GUI
if (gui.in_use)
gui_mch_update();
else
#endif
mch_breakcheck(force);
updating_screen = save_us;
}
/*****************************************************************************

View File

@ -764,6 +764,30 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
280,
/**/
279,
/**/
278,
/**/
277,
/**/
276,
/**/
275,
/**/
274,
/**/
273,
/**/
272,
/**/
271,
/**/
270,
/**/
269,
/**/
268,
/**/

View File

@ -594,6 +594,7 @@ extern int (*dyn_libintl_putenv)(const char *envstring);
# endif
# define textdomain(domain) (*dyn_libintl_textdomain)(domain)
# define libintl_putenv(envstring) (*dyn_libintl_putenv)(envstring)
# define libintl_wputenv(envstring) (*dyn_libintl_wputenv)(envstring)
# else
# include <libintl.h>
# define _(x) gettext((char *)(x))