Compare commits

...

7 Commits

Author SHA1 Message Date
1ed2276fd5 patch 8.0.1353: QuickFixCmdPost is not used consistently
Problem:    QuickFixCmdPost is not used consistently.
Solution:   Invoke QuickFixCmdPost consistently after QuickFixCmdPre.
            (Yegappan Lakshmanan, closes #2377)
2017-11-28 18:03:44 +01:00
f38c86eb6b patch 8.0.1352: dead URLs in the help go unnoticed
Problem:    Dead URLs in the help go unnoticed.
Solution:   Add a script to check URLs in the help files. (Christian Brabandt)
2017-11-28 14:19:07 +01:00
bdb8139098 patch 8.0.1351: warning for unused variables building with MinGW
Problem:    Warning for unused variables building with MinGW.
Solution:   Change a few #ifdefs (suggested by John Marriott). Remove
            superfluous checks of FEAT_MBYTE.
2017-11-27 23:24:08 +01:00
1355aad2b9 patch 8.0.1350: cannot build with +eval and -multi_byte
Problem:    Cannot build with +eval and -multi_byte.
Solution:   Adjust #ifdefs. (John Marriott)  Always include the multi_byte
            feature when an input method feature is enabled.
2017-11-27 22:49:01 +01:00
17471e84a7 patch 8.0.1349: options test fails when using Motif or GTK GUI
Problem:    Options test fails when using Motif or GTK GUI.
Solution:   Use "fixed" instead of "fixedsys" for Unix. Don't try "xxx" for
            guifonteset.  Don't set 'termencoding' to anything but "utf-8" for
            GTK.  Give an error if 'termencoding' can't be converted.
2017-11-26 23:47:18 +01:00
c8c75796a6 patch 8.0.1348: make testclean deletes script file on MS-Windows
Problem:    Make testclean deletes script file on MS-Windows.
Solution:   Rename file to avoid it starting with an "x".
2017-11-26 17:18:06 +01:00
e0aa23f7e3 patch 8.0.1347: MS-Windows: build broken by misplaced curly
Problem:    MS-Windows: build broken by misplaced curly.
Solution:   Move curly after #endif
2017-11-26 17:08:03 +01:00
12 changed files with 269 additions and 67 deletions

View File

@ -119,7 +119,6 @@ SRC_ALL = \
src/testdir/test[0-9]*a.ok \
src/testdir/test_[a-z]*.ok \
src/testdir/test49.vim \
src/testdir/test60.vim \
src/testdir/test83-tags? \
src/testdir/test77a.com \
src/testdir/test_*.vim \
@ -138,7 +137,7 @@ SRC_ALL = \
src/testdir/samples/*.txt \
src/testdir/samples/test000 \
src/testdir/if_ver*.vim \
src/testdir/xterm_ramp.vim \
src/testdir/color_ramp.vim \
src/proto.h \
src/proto/arabic.pro \
src/proto/beval.pro \
@ -585,6 +584,7 @@ RT_ALL = \
runtime/doc/*.txt \
runtime/doc/Makefile \
runtime/doc/doctags.c \
runtime/doc/test_urls.vim \
runtime/doc/vim.1 \
runtime/doc/evim.1 \
runtime/doc/vimdiff.1 \

68
runtime/doc/test_urls.vim Normal file
View File

@ -0,0 +1,68 @@
" Test for URLs in help documents.
"
" Opens a new window with all found URLS followed by return code from curl
" (anything other than 0 means unreachable)
"
" Written by Christian Brabandt.
func Test_check_URLs()
if has("win32")
echoerr "Doesn't work on MS-Windows"
return
endif
if executable('curl')
" Note: does not follow redirects!
let s:command = 'curl --silent --fail --output /dev/null --head '
elseif executable('wget')
" Note: only allow a couple of redirects
let s:command = 'wget --quiet -S --spider --max-redirect=2 --timeout=5 --tries=2 -O /dev/null '
else
echoerr 'Only works when "curl" or "wget" is available'
return
endif
let pat='\(https\?\|ftp\)://[^\t* ]\+'
exe 'helpgrep' pat
helpclose
let urls = map(getqflist(), 'v:val.text')
" do not use submatch(1)!
let urls = map(urls, {key, val -> matchstr(val, pat)})
" remove examples like user@host (invalid urls)
let urls = filter(urls, 'v:val !~ "@"')
" Remove example URLs which are invalid
let urls = filter(urls, {key, val -> val !~ '\<\(\(my\|some\)\?host\|machine\|hostname\|file\)\>'})
new
put =urls
" remove some more invalid items
" empty lines
v/./d
" remove # anchors
%s/#.*$//e
" remove trailing stuff (parenthesis, dot, comma, quotes), but only for HTTP
" links
g/^h/s#[.,)'"/>][:.]\?$##
g#^[hf]t\?tp:/\(/\?\.*\)$#d
silent! g/ftp://,$/d
silent! g/=$/d
let a = getline(1,'$')
let a = uniq(sort(a))
%d
call setline(1, a)
" Do the testing.
set nomore
%s/.*/\=TestURL(submatch(0))/
" highlight the failures
/.* \([0-9]*[1-9]\|[0-9]\{2,}\)$
endfunc
func TestURL(url)
" Relies on the return code to determine whether a page is valid
echom printf("Testing URL: %d/%d %s", line('.'), line('$'), a:url)
call system(s:command . shellescape(a:url))
return printf("%s %d", a:url, v:shell_error)
endfunc
call Test_check_URLs()

View File

@ -2052,8 +2052,8 @@ write_viminfo(char_u *file, int forceit)
/* can't stat the file, set conservative permissions */
(void)mch_setperm(tempname, 0600);
}
}
#endif
}
/*
* Check if the new viminfo file can be written to.

View File

@ -635,7 +635,8 @@
/* #define FEAT_MBYTE_IME */
# endif
#if defined(FEAT_MBYTE_IME) && !defined(FEAT_MBYTE)
/* Input methods are only useful with +multi_byte. */
#if (defined(FEAT_MBYTE_IME) || defined(FEAT_XIM)) && !defined(FEAT_MBYTE)
# define FEAT_MBYTE
#endif

View File

@ -498,9 +498,11 @@ static void TrackUserActivity(UINT uMsg);
*
* These LOGFONT used for IME.
*/
#ifdef FEAT_MBYTE
#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
/* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */
static LOGFONT norm_logfont;
#endif
#ifdef FEAT_MBYTE_IME
/* holds LOGFONT for 'guifont' always. */
static LOGFONT sub_logfont;
#endif
@ -3361,6 +3363,8 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
font_name = (char_u *)lf.lfFaceName;
#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
norm_logfont = lf;
#endif
#ifdef FEAT_MBYTE_IME
sub_logfont = lf;
#endif
#ifdef FEAT_MBYTE_IME
@ -5794,15 +5798,15 @@ gui_mch_set_sp_color(guicolor_T color)
gui.currSpColor = color;
}
#if defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)
#ifdef FEAT_MBYTE_IME
/*
* Multi-byte handling, originally by Sung-Hoon Baek.
* First static functions (no prototypes generated).
*/
#ifdef _MSC_VER
# include <ime.h> /* Apparently not needed for Cygwin, MingW or Borland. */
#endif
#include <imm.h>
# ifdef _MSC_VER
# include <ime.h> /* Apparently not needed for Cygwin, MingW or Borland. */
# endif
# include <imm.h>
/*
* handle WM_IME_NOTIFY message
@ -5954,7 +5958,7 @@ GetResultStr(HWND hwnd, int GCS, int *lenp)
#endif
/* For global functions we need prototypes. */
#if (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) || defined(PROTO)
#if defined(FEAT_MBYTE_IME) || defined(PROTO)
/*
* set font to IM.
@ -6079,7 +6083,7 @@ im_get_status(void)
return status;
}
#endif /* FEAT_MBYTE && FEAT_MBYTE_IME */
#endif /* FEAT_MBYTE_IME */
#if defined(FEAT_MBYTE) && !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
/* Win32 with GLOBAL IME */

View File

@ -4790,7 +4790,7 @@ iconv_end(void)
# define USE_IMSTATUSFUNC (*p_imsf != NUL)
#endif
#ifdef FEAT_EVAL
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
static void
call_imactivatefunc(int active)
{
@ -6486,7 +6486,7 @@ static int im_was_set_active = FALSE;
int
im_get_status()
{
# ifdef FEAT_EVAL
# if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
if (USE_IMSTATUSFUNC)
return call_imstatusfunc();
# endif

View File

@ -6369,8 +6369,13 @@ did_set_string_option(
* display output conversion. */
if (((varp == &p_enc && *p_tenc != NUL) || varp == &p_tenc))
{
convert_setup(&input_conv, p_tenc, p_enc);
convert_setup(&output_conv, p_enc, p_tenc);
if (convert_setup(&input_conv, p_tenc, p_enc) == FAIL
|| convert_setup(&output_conv, p_enc, p_tenc) == FAIL)
{
EMSG3(_("E950: Cannot convert between %s and %s"),
p_tenc, p_enc);
errmsg = e_invarg;
}
}
# if defined(WIN3264) && defined(FEAT_MBYTE)

View File

@ -4055,6 +4055,7 @@ ex_cfile(exarg_T *eap)
#ifdef FEAT_AUTOCMD
char_u *au_name = NULL;
#endif
int res;
if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile
|| eap->cmdidx == CMD_laddfile)
@ -4102,28 +4103,18 @@ ex_cfile(exarg_T *eap)
* :caddfile adds to an existing quickfix list. If there is no
* quickfix list then a new list is created.
*/
if (qf_init(wp, p_ef, p_efm, (eap->cmdidx != CMD_caddfile
&& eap->cmdidx != CMD_laddfile),
*eap->cmdlinep, enc) > 0
&& (eap->cmdidx == CMD_cfile
|| eap->cmdidx == CMD_lfile))
{
res = qf_init(wp, p_ef, p_efm, (eap->cmdidx != CMD_caddfile
&& eap->cmdidx != CMD_laddfile), *eap->cmdlinep, enc);
#ifdef FEAT_AUTOCMD
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf);
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf);
#endif
if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile))
{
if (wp != NULL)
qi = GET_LOC_LIST(wp);
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
}
else
{
#ifdef FEAT_AUTOCMD
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf);
#endif
}
}
/*
@ -5450,6 +5441,7 @@ ex_cbuffer(exarg_T *eap)
#ifdef FEAT_AUTOCMD
char_u *au_name = NULL;
#endif
int res;
if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer
|| eap->cmdidx == CMD_laddbuffer)
@ -5509,20 +5501,19 @@ ex_cbuffer(exarg_T *eap)
qf_title = IObuff;
}
if (qf_init_ext(qi, qi->qf_curlist, NULL, buf, NULL, p_efm,
res = qf_init_ext(qi, qi->qf_curlist, NULL, buf, NULL, p_efm,
(eap->cmdidx != CMD_caddbuffer
&& eap->cmdidx != CMD_laddbuffer),
eap->line1, eap->line2,
qf_title, NULL) > 0)
{
qf_title, NULL);
#ifdef FEAT_AUTOCMD
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
curbuf->b_fname, TRUE, curbuf);
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
curbuf->b_fname, TRUE, curbuf);
#endif
if (eap->cmdidx == CMD_cbuffer || eap->cmdidx == CMD_lbuffer)
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
}
if (res > 0 && (eap->cmdidx == CMD_cbuffer ||
eap->cmdidx == CMD_lbuffer))
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
}
}
}
@ -5540,6 +5531,7 @@ ex_cexpr(exarg_T *eap)
#ifdef FEAT_AUTOCMD
char_u *au_name = NULL;
#endif
int res;
if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_lgetexpr
|| eap->cmdidx == CMD_laddexpr)
@ -5578,20 +5570,19 @@ ex_cexpr(exarg_T *eap)
if ((tv->v_type == VAR_STRING && tv->vval.v_string != NULL)
|| (tv->v_type == VAR_LIST && tv->vval.v_list != NULL))
{
if (qf_init_ext(qi, qi->qf_curlist, NULL, NULL, tv, p_efm,
res = qf_init_ext(qi, qi->qf_curlist, NULL, NULL, tv, p_efm,
(eap->cmdidx != CMD_caddexpr
&& eap->cmdidx != CMD_laddexpr),
(linenr_T)0, (linenr_T)0, *eap->cmdlinep,
NULL) > 0)
{
NULL);
#ifdef FEAT_AUTOCMD
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
curbuf->b_fname, TRUE, curbuf);
if (au_name != NULL)
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
curbuf->b_fname, TRUE, curbuf);
#endif
if (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr)
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
}
if (res > 0 && (eap->cmdidx == CMD_cexpr ||
eap->cmdidx == CMD_lexpr))
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
}
else
EMSG(_("E777: String or List expected"));

View File

@ -11,7 +11,8 @@ endfor
for nr in range(8, 15)
let s .= "\033[10" . (nr - 8) . "m "
endfor
let s .= "\033[107m|"
" Add | in original color pair to see white background.
let s .= "\033[m|"
call setline(2, s)
" 6 x 6 x 6 color cube
@ -22,7 +23,7 @@ for high in range(0, 5)
let nr = low + high * 36
let s .= "\033[48;5;" . (nr + 16) . "m "
endfor
let s .= "\033[107m|"
let s .= "\033[m|"
call setline(high + 4, s)
endfor
@ -32,9 +33,9 @@ let s = ''
for nr in range(0, 23)
let s .= "\033[48;5;" . (nr + 232) . "m "
endfor
let s .= "\033[107m|"
let s .= "\033[m|"
call setline(11, s)
set binary
write! <sfile>:h/xterm_ramp.txt
write! <sfile>:h/color_ramp.txt
quit

View File

@ -19,6 +19,9 @@ let script = [
/#define p_term
let end = line('.')
" font name that works everywhere (hopefully)
let fontname = has('win32') ? 'fixedsys' : 'fixed'
" Two lists with values: values that work and values that fail.
" When not listed, "othernum" or "otherstring" is used.
let test_values = {
@ -93,8 +96,9 @@ let test_values = {
\ 'foldmarker': [['((,))'], ['', 'xxx']],
\ 'formatoptions': [['', 'vt', 'v,t'], ['xxx']],
\ 'guicursor': [['', 'n:block-Cursor'], ['xxx']],
\ 'guifont': [['', 'fixedsys'], []],
\ 'guifontwide': [['', 'fixedsys'], []],
\ 'guifont': [['', fontname], []],
\ 'guifontwide': [['', fontname], []],
\ 'guifontset': [['', fontname], []],
\ 'helplang': [['', 'de', 'de,it'], ['xxx']],
\ 'highlight': [['', 'e:Error'], ['xxx']],
\ 'imactivatekey': [['', 'S-space'], ['xxx']],
@ -126,6 +130,7 @@ let test_values = {
\ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']],
\ 'term': [[], []],
\ 'termsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']],
\ 'termencoding': [has('gui_gtk') ? [] : ['', 'utf-8'], ['xxx']],
\ 'toolbar': [['', 'icons', 'text'], ['xxx']],
\ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']],
\ 'ttymouse': [['', 'xterm'], ['xxx']],
@ -189,8 +194,11 @@ while 1
call add(script, "endif")
endif
call add(script, 'set ' . name . '&')
call add(script, 'set ' . shortname . '&')
" cannot change 'termencoding' in GTK
if name != 'termencoding' || !has('gui_gtk')
call add(script, 'set ' . name . '&')
call add(script, 'set ' . shortname . '&')
endif
if name == 'verbosefile'
call add(script, 'call delete("xxx")')
endif

View File

@ -1966,26 +1966,136 @@ func Test_Autocmd()
cexpr "F1:10:Line 10"
caddexpr "F1:20:Line 20"
cgetexpr "F1:30:Line 30"
enew! | call append(0, "F2:10:Line 10")
cbuffer!
enew! | call append(0, "F2:20:Line 20")
cgetbuffer
enew! | call append(0, "F2:30:Line 30")
caddbuffer
cexpr ""
caddexpr ""
cgetexpr ""
silent! cexpr non_existing_func()
silent! caddexpr non_existing_func()
silent! cgetexpr non_existing_func()
let l = ['precexpr',
\ 'postcexpr',
\ 'precaddexpr',
\ 'postcaddexpr',
\ 'precgetexpr',
\ 'postcgetexpr',
\ 'precbuffer',
\ 'precexpr',
\ 'postcexpr',
\ 'precaddexpr',
\ 'postcaddexpr',
\ 'precgetexpr',
\ 'postcgetexpr',
\ 'precexpr',
\ 'precaddexpr',
\ 'precgetexpr']
call assert_equal(l, g:acmds)
let g:acmds = []
enew! | call append(0, "F2:10:Line 10")
cbuffer!
enew! | call append(0, "F2:20:Line 20")
cgetbuffer
enew! | call append(0, "F2:30:Line 30")
caddbuffer
new
let bnum = bufnr('%')
bunload
exe 'silent! cbuffer! ' . bnum
exe 'silent! cgetbuffer ' . bnum
exe 'silent! caddbuffer ' . bnum
enew!
let l = ['precbuffer',
\ 'postcbuffer',
\ 'precgetbuffer',
\ 'postcgetbuffer',
\ 'precaddbuffer',
\ 'postcaddbuffer']
\ 'postcaddbuffer',
\ 'precbuffer',
\ 'precgetbuffer',
\ 'precaddbuffer']
call assert_equal(l, g:acmds)
call writefile(['Xtest:1:Line1'], 'Xtest')
call writefile([], 'Xempty')
let g:acmds = []
cfile Xtest
caddfile Xtest
cgetfile Xtest
cfile Xempty
caddfile Xempty
cgetfile Xempty
silent! cfile do_not_exist
silent! caddfile do_not_exist
silent! cgetfile do_not_exist
let l = ['precfile',
\ 'postcfile',
\ 'precaddfile',
\ 'postcaddfile',
\ 'precgetfile',
\ 'postcgetfile',
\ 'precfile',
\ 'postcfile',
\ 'precaddfile',
\ 'postcaddfile',
\ 'precgetfile',
\ 'postcgetfile',
\ 'precfile',
\ 'postcfile',
\ 'precaddfile',
\ 'postcaddfile',
\ 'precgetfile',
\ 'postcgetfile']
call assert_equal(l, g:acmds)
let g:acmds = []
helpgrep quickfix
silent! helpgrep non_existing_help_topic
vimgrep test Xtest
vimgrepadd test Xtest
silent! vimgrep non_existing_test Xtest
silent! vimgrepadd non_existing_test Xtest
set makeprg=
silent! make
set makeprg&
let l = ['prehelpgrep',
\ 'posthelpgrep',
\ 'prehelpgrep',
\ 'posthelpgrep',
\ 'previmgrep',
\ 'postvimgrep',
\ 'previmgrepadd',
\ 'postvimgrepadd',
\ 'previmgrep',
\ 'postvimgrep',
\ 'previmgrepadd',
\ 'postvimgrepadd',
\ 'premake',
\ 'postmake']
call assert_equal(l, g:acmds)
if has('unix')
" Run this test only on Unix-like systems. The grepprg may not be set on
" non-Unix systems.
" The following lines are used for the grep test. Don't remove.
" Grep_Autocmd_Text: Match 1
" GrepAdd_Autocmd_Text: Match 2
let g:acmds = []
silent grep Grep_Autocmd_Text test_quickfix.vim
silent grepadd GrepAdd_Autocmd_Text test_quickfix.vim
silent grep abc123def Xtest
silent grepadd abc123def Xtest
let l = ['pregrep',
\ 'postgrep',
\ 'pregrepadd',
\ 'postgrepadd',
\ 'pregrep',
\ 'postgrep',
\ 'pregrepadd',
\ 'postgrepadd']
call assert_equal(l, g:acmds)
endif
call delete('Xtest')
call delete('Xempty')
endfunc
func Test_Autocmd_Exception()

View File

@ -771,6 +771,20 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1353,
/**/
1352,
/**/
1351,
/**/
1350,
/**/
1349,
/**/
1348,
/**/
1347,
/**/
1346,
/**/