Compare commits

...

11 Commits

Author SHA1 Message Date
Bram Moolenaar
391b1dd040 patch 8.0.0404: not enough testing for quickfix
Problem:    Not enough testing for quickfix.
Solution:   Add some more tests. (Yegappan Lakshmanan)
2017-03-04 13:47:11 +01:00
Bram Moolenaar
24d7636e98 patch 8.0.0403: GUI tests may fail
Problem:    GUI tests may fail.
Solution:   Ignore the E285 error better. (Kazunobu Kuriyama)
2017-03-04 13:32:10 +01:00
Bram Moolenaar
cf5fdf7d16 patch 8.0.0402: :map completion does not have <special>
Problem:    :map completion does not have <special>. (Dominique Pelle)
Solution:   Recognize <special> in completion.  Add a test.
2017-03-02 23:05:51 +01:00
Bram Moolenaar
a0107bdf87 patch 8.0.0401: test fails with missing balloon feature
Problem:    Test fails with missing balloon feature.
Solution:   Add check for balloon feature.
2017-03-02 22:48:01 +01:00
Bram Moolenaar
358f6b0a36 patch 8.0.0400: some tests have a one second delay
Problem:    Some tests have a one second delay.
Solution:   Add --not-a-term in RunVim().
2017-03-02 22:43:01 +01:00
Bram Moolenaar
caf6434ac9 patch 8.0.0399: crash when using balloon_show() when not supported
Problem:    Crash when using balloon_show() when not supported. (Hirohito
            Higashi)
Solution:   Check for balloonEval not to be NULL. (Ken Takata)
2017-03-02 22:11:33 +01:00
Bram Moolenaar
66727e1607 patch 8.0.0398: illegal memory access with "t"
Problem:    Illegal memory access with "t".
Solution:   Use strncmp() instead of memcmp(). (Dominique Pelle, closes #1528)
2017-03-01 22:17:05 +01:00
Bram Moolenaar
5a66dfb25e patch 8.0.0397: can't build with +viminfo but without +eval
Problem:    Cannot build with the viminfo feature but without the eval
            feature.
Solution:   Adjust #ifdef. (John Marriott)
2017-03-01 20:40:39 +01:00
Bram Moolenaar
59716a27bd patch 8.0.0396: 'balloonexpr' only works synchronously
Problem:    'balloonexpr' only works synchronously.
Solution:   Add balloon_show(). (Jusufadis Bakamovic, closes #1449)
2017-03-01 20:32:44 +01:00
Bram Moolenaar
f8ab1b14fd patch 8.0.0395: testing the + register fails with Motif
Problem:    Testing the + register fails with Motif.
Solution:   Also ignore the "failed to create input context" error in the
            second gvim.  Don't use msg() when it would result in a dialog.
2017-03-01 18:30:34 +01:00
Bram Moolenaar
abc39ab642 patch 8.0.0394: tabs are not aligned when scrolling horizontally
Problem:    Tabs are not aligned when scrolling horizontally and a Tab doesn't
            fit. (Axel Bender)
Solution:   Handle a Tab as a not fitting character. (Christian Brabandt)
            Also fix that ":redraw" does not scroll horizontally to show the
            cursor.  And fix the test that depended on the old behavior.
2017-03-01 18:04:05 +01:00
22 changed files with 281 additions and 26 deletions

View File

@@ -1994,6 +1994,7 @@ assert_true({actual} [, {msg}]) none assert {actual} is true
asin({expr}) Float arc sine of {expr}
atan({expr}) Float arc tangent of {expr}
atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2}
balloon_show({msg}) none show {msg} inside the balloon
browse({save}, {title}, {initdir}, {default})
String put up a file requester
browsedir({title}, {initdir}) String put up a directory requester
@@ -2619,6 +2620,25 @@ atan2({expr1}, {expr2}) *atan2()*
< 2.356194
{only available when compiled with the |+float| feature}
balloon_show({msg}) *balloon_show()*
Show {msg} inside the balloon.
Example: >
func GetBalloonContent()
" initiate getting the content
return ''
endfunc
set balloonexpr=GetBalloonContent()
func BalloonCallback(result)
call balloon_show(a:result)
endfunc
<
The intended use is that fetching the content of the balloon
is initiated from 'balloonexpr'. It will invoke an
asynchronous method, in which a callback invokes
balloon_show(). The 'balloonexpr' itself can return an
empty string or a placeholder.
{only available when compiled with the +beval feature}
*browse()*
browse({save}, {title}, {initdir}, {default})

View File

@@ -58,6 +58,9 @@ static void f_asin(typval_T *argvars, typval_T *rettv);
static void f_atan(typval_T *argvars, typval_T *rettv);
static void f_atan2(typval_T *argvars, typval_T *rettv);
#endif
#ifdef FEAT_BEVAL
static void f_balloon_show(typval_T *argvars, typval_T *rettv);
#endif
static void f_browse(typval_T *argvars, typval_T *rettv);
static void f_browsedir(typval_T *argvars, typval_T *rettv);
static void f_bufexists(typval_T *argvars, typval_T *rettv);
@@ -483,6 +486,9 @@ static struct fst
#ifdef FEAT_FLOAT
{"atan", 1, 1, f_atan},
{"atan2", 2, 2, f_atan2},
#endif
#ifdef FEAT_BEVAL
{"balloon_show", 1, 1, f_balloon_show},
#endif
{"browse", 4, 4, f_browse},
{"browsedir", 2, 2, f_browsedir},
@@ -1362,6 +1368,18 @@ f_atan2(typval_T *argvars, typval_T *rettv)
}
#endif
/*
* "balloon_show()" function
*/
#ifdef FEAT_BEVAL
static void
f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED)
{
if (balloonEval != NULL)
gui_mch_post_balloon(balloonEval, get_tv_string_chk(&argvars[0]));
}
#endif
/*
* "browse(save, title, initdir, default)" function
*/

View File

@@ -9812,6 +9812,7 @@ ex_redraw(exarg_T *eap)
RedrawingDisabled = 0;
p_lz = FALSE;
validate_cursor();
update_topline();
update_screen(eap->forceit ? CLEAR : VIsual_active ? INVERTED : 0);
#ifdef FEAT_TITLE

View File

@@ -4216,6 +4216,11 @@ set_context_in_map_cmd(
arg = skipwhite(arg + 8);
continue;
}
if (STRNCMP(arg, "<special>", 9) == 0)
{
arg = skipwhite(arg + 9);
continue;
}
#ifdef FEAT_EVAL
if (STRNCMP(arg, "<script>", 8) == 0)
{
@@ -4267,7 +4272,7 @@ ExpandMappings(
{
count = 0;
for (i = 0; i < 6; ++i)
for (i = 0; i < 7; ++i)
{
if (i == 0)
p = (char_u *)"<silent>";
@@ -4285,6 +4290,8 @@ ExpandMappings(
#endif
else if (i == 5)
p = (char_u *)"<nowait>";
else if (i == 6)
p = (char_u *)"<special>";
else
continue;

View File

@@ -539,7 +539,7 @@ emsg_not_now(void)
return FALSE;
}
#ifdef FEAT_EVAL
#if defined(FEAT_EVAL) || defined(PROTO)
static garray_T ignore_error_list = GA_EMPTY;
void
@@ -605,7 +605,8 @@ emsg(char_u *s)
#ifdef FEAT_EVAL
/* When testing some errors are turned into a normal message. */
if (ignore_error(s))
return msg(s);
/* don't call msg() if it results in a dialog */
return msg_use_printf() ? FALSE : msg(s);
#endif
called_emsg = TRUE;

View File

@@ -2099,7 +2099,7 @@ ga_concat_strings(garray_T *gap, char *sep)
return s;
}
#if defined(FEAT_VIMINFO) || defined(PROTO)
#if defined(FEAT_VIMINFO) || defined(FEAT_EVAL) || defined(PROTO)
/*
* Make a copy of string "p" and add it to "gap".
* When out of memory nothing changes.

View File

@@ -467,6 +467,12 @@ mch_inchar(
if ((wait_time < 0 || wait_time > 100L) && channel_any_readahead())
wait_time = 10L;
#endif
#ifdef FEAT_BEVAL
if (p_beval && wait_time > 100L)
/* The 'balloonexpr' may indirectly invoke a callback while waiting
* for a character, need to check often. */
wait_time = 100L;
#endif
/*
* We want to be interrupted by the winch signal

View File

@@ -1467,6 +1467,12 @@ WaitForChar(long msec)
dwWaitTime = 10;
}
#endif
#ifdef FEAT_BEVAL
if (p_beval && dwWaitTime > 100)
/* The 'balloonexpr' may indirectly invoke a callback while
* waiting for a character, need to check often. */
dwWaitTime = 100;
#endif
#ifdef FEAT_MZSCHEME
if (mzthreads_allowed() && p_mzq > 0
&& (msec < 0 || (long)dwWaitTime > p_mzq))

View File

@@ -3429,10 +3429,13 @@ win_line(
#else
--ptr;
#endif
/* If the character fits on the screen, don't need to skip it.
* Except for a TAB. */
if ((
#ifdef FEAT_MBYTE
/* character fits on the screen, don't need to skip it */
if ((*mb_ptr2cells)(ptr) >= c && col == 0)
(*mb_ptr2cells)(ptr) >= c ||
#endif
*ptr == TAB) && col == 0)
n_skip = v - vcol;
}

View File

@@ -1693,12 +1693,9 @@ searchc(cmdarg_T *cap, int t_cmd)
if (p[col] == c && stop)
break;
}
else
{
if (memcmp(p + col, lastc_bytes, lastc_bytelen) == 0
else if (STRNCMP(p + col, lastc_bytes, lastc_bytelen) == 0
&& stop)
break;
}
stop = TRUE;
}
}

View File

@@ -27,3 +27,6 @@ endfunc
func GUITearDownCommon()
call delete('Xhome', 'rf')
endfunc
" Ignore the "failed to create input context" error.
call test_ignore_error('E285')

View File

@@ -192,6 +192,7 @@ func RunVimPiped(before, after, arguments, pipecmd)
if cmd !~ '-u NONE'
let cmd = cmd . ' -u NONE'
endif
let cmd .= ' --not-a-term'
" With pipecmd we can't set VIMRUNTIME.
if a:pipecmd != ''

View File

@@ -274,7 +274,6 @@ endfunction
function Test_breakindent16()
" Check that overlong lines are indented correctly.
" TODO: currently it does not fail even when the bug is not fixed.
let s:input=""
call s:test_windows('setl breakindent briopt=min:0 ts=4')
call setline(1, "\t".repeat("1234567890", 10))
@@ -283,16 +282,16 @@ function Test_breakindent16()
redraw!
let lines=s:screen_lines(1,10)
let expect=[
\ " 123456",
\ " 789012",
\ " 345678",
\ " 901234",
\ ]
call s:compare_lines(expect, lines)
let lines=s:screen_lines(4,10)
let expect=[
\ " 901234",
\ " 567890",
\ " 123456",
\ " 7890 ",
\ ]
call s:compare_lines(expect, lines)
call s:close_windows()

View File

@@ -25,6 +25,26 @@ func Test_complete_wildmenu()
set nowildmenu
endfunc
func Test_map_completion()
if !has('cmdline_compl')
return
endif
call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <unique> <silent>', getreg(':'))
call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <script> <unique>', getreg(':'))
call feedkeys(":map <expr> <sc\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <expr> <script>', getreg(':'))
call feedkeys(":map <buffer> <e\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <buffer> <expr>', getreg(':'))
call feedkeys(":map <nowait> <b\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <nowait> <buffer>', getreg(':'))
call feedkeys(":map <special> <no\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <special> <nowait>', getreg(':'))
call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <silent> <special>', getreg(':'))
endfunc
func Test_match_completion()
if !has('cmdline_compl')
return

View File

@@ -466,3 +466,10 @@ func Test_getbufvar()
set fileformats&
endfunc
func Test_balloon_show()
if has('balloon_eval')
" This won't do anything but must not crash either.
call balloon_show('hi!')
endif
endfunc

View File

@@ -17,9 +17,6 @@ endfunc
" Test for resetting "secure" flag after GUI has started.
" Must be run first.
func Test_1_set_secure()
" Ignore the "failed to create input context" error.
call test_ignore_error('E285')
set exrc secure
gui -f
call assert_equal(1, has('gui_running'))
@@ -87,8 +84,12 @@ func Test_quoteplus()
let test_response = 'Yes, I can.'
let vim_exe = exepath(v:progpath)
let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
\ . vim_exe . ' -f -g -u NONE -U NONE --noplugin -c ''%s'''
let cmd = 'call feedkeys("'
\ . vim_exe
\ . ' -u NONE -U NONE --noplugin --not-a-term -c ''%s'''
" Ignore the "failed to create input context" error.
let cmd = 'call test_ignore_error("E285") | '
\ . 'gui -f | '
\ . 'call feedkeys("'
\ . '\"+p'
\ . ':s/' . test_call . '/' . test_response . '/\<CR>'
\ . '\"+yis'

View File

@@ -15,7 +15,10 @@ func TearDown()
call GUITearDownCommon()
endfunc
" Make sure that the tests will be done with the GUI activated.
" Ignore the "failed to create input context" error.
call test_ignore_error('E285')
" Start the GUI now, in the foreground.
gui -f
func Test_set_guiheadroom()

View File

@@ -217,3 +217,19 @@ func Test_list_with_listchars()
call s:compare_lines(expect, lines)
call s:close_windows()
endfunc
func Test_list_with_tab_and_skipping_first_chars()
call s:test_windows('setl list listchars=tab:>- ts=70 nowrap')
call setline(1, ["iiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa"])
call cursor(4,64)
norm! 2zl
let lines = s:screen_lines([1, 4], winwidth(0))
let expect = [
\ "---------------aaaaa",
\ "---------------aaaaa",
\ "---------------aaaaa",
\ "iiiiiiiii>-----aaaaa",
\ ]
call s:compare_lines(expect, lines)
call s:close_windows()
endfu

View File

@@ -220,3 +220,37 @@ func Test_multibyte_wrap_and_breakat()
call s:compare_lines(expect, lines)
call s:close_windows('setl brk&vim')
endfunc
func Test_chinese_char_on_wrap_column()
call s:test_windows("setl nolbr wrap sbr=")
syntax off
call setline(1, [
\ 'aaaaaaaaaaaaaaaaaaa中'.
\ 'aaaaaaaaaaaaaaaaa中'.
\ 'aaaaaaaaaaaaaaaaa中'.
\ 'aaaaaaaaaaaaaaaaa中'.
\ 'aaaaaaaaaaaaaaaaa中'.
\ 'aaaaaaaaaaaaaaaaa中'.
\ 'aaaaaaaaaaaaaaaaa中'.
\ 'aaaaaaaaaaaaaaaaa中'.
\ 'aaaaaaaaaaaaaaaaa中'.
\ 'aaaaaaaaaaaaaaaaa中'.
\ 'hello'])
call cursor(1,1)
norm! $
redraw!
let expect=[
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中hello ']
let lines = s:screen_lines([1, 10], winwidth(0))
call s:compare_lines(expect, lines)
call s:close_windows()
endfu

View File

@@ -128,6 +128,14 @@ func XlistTests(cchar)
let l = split(result, "\n")
call assert_equal([' 2 Xtestfile1:1 col 3: Line1',
\ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l)
" Test for '+'
redir => result
Xlist! +2
redir END
let l = split(result, "\n")
call assert_equal([' 2 Xtestfile1:1 col 3: Line1',
\ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l)
endfunc
func Test_clist()
@@ -925,6 +933,11 @@ func Test_efm2()
\ "(67,3) warning: 's' already defined"
\]
set efm=%+P[%f],(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%-Q
" To exercise the push/pop file functionality in quickfix, the test files
" need to be created.
call writefile(['Line1'], 'Xtestfile1')
call writefile(['Line2'], 'Xtestfile2')
call writefile(['Line3'], 'Xtestfile3')
cexpr ""
for l in lines
caddexpr l
@@ -935,6 +948,9 @@ func Test_efm2()
call assert_equal(2, l[2].col)
call assert_equal('w', l[2].type)
call assert_equal('e', l[3].type)
call delete('Xtestfile1')
call delete('Xtestfile2')
call delete('Xtestfile3')
" Tests for %E, %C and %Z format specifiers
let lines = ["Error 275",
@@ -1369,11 +1385,25 @@ func Test_switchbuf()
call assert_equal(2, winnr('$'))
call assert_equal(1, bufwinnr('Xqftestfile3'))
" If only quickfix window is open in the current tabpage, jumping to an
" entry with 'switchubf' set to 'usetab' should search in other tabpages.
enew | only
set switchbuf=usetab
tabedit Xqftestfile1
tabedit Xqftestfile2
tabedit Xqftestfile3
tabfirst
copen | only
clast
call assert_equal(4, tabpagenr())
tabfirst | tabonly | enew | only
call delete('Xqftestfile1')
call delete('Xqftestfile2')
call delete('Xqftestfile3')
set switchbuf&vim
enew | only
endfunc
func Xadjust_qflnum(cchar)
@@ -1691,3 +1721,56 @@ func Test_dirstack_cleanup()
caddbuffer
let &efm = save_efm
endfunc
" Tests for jumping to entries from the location list window and quickfix
" window
func Test_cwindow_jump()
set efm=%f%%%l%%%m
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
lopen | only
lfirst
call assert_true(winnr('$') == 2)
call assert_true(winnr() == 1)
" Location list for the new window should be set
call assert_true(getloclist(0)[2].text == 'Line 30')
" Open a scratch buffer
" Open a new window and create a location list
" Open the location list window and close the other window
" Jump to an entry.
" Should create a new window and jump to the entry. The scrtach buffer
" should not be used.
enew | only
set buftype=nofile
below new
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
lopen
2wincmd c
lnext
call assert_true(winnr('$') == 3)
call assert_true(winnr() == 2)
" Open two windows with two different location lists
" Open the location list window and close the previous window
" Jump to an entry in the location list window
" Should open the file in the first window and not set the location list.
enew | only
lgetexpr ["F1%5%Line 5"]
below new
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
lopen
2wincmd c
lnext
call assert_true(winnr() == 1)
call assert_true(getloclist(0)[0].text == 'Line 5')
enew | only
cgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
copen
cnext
call assert_true(winnr('$') == 2)
call assert_true(winnr() == 1)
enew | only
set efm&vim
endfunc

View File

@@ -294,3 +294,10 @@ func Test_searchpair()
q!
endfunc
func Test_searchc()
" These commands used to cause memory overflow in searchc().
new
norm ixx
exe "norm 0t\u93cf"
bw!
endfunc

View File

@@ -764,6 +764,28 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
404,
/**/
403,
/**/
402,
/**/
401,
/**/
400,
/**/
399,
/**/
398,
/**/
397,
/**/
396,
/**/
395,
/**/
394,
/**/
393,
/**/