mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
+14
-2
@@ -1,4 +1,4 @@
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Sep 01
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Sep 07
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -646,6 +646,8 @@ See |job_setoptions()| and |ch_setoptions()|.
|
||||
"out_buf": number the number of the buffer to write to
|
||||
"out_modifiable": 0 when writing to a buffer, 'modifiable' will be off
|
||||
(see below)
|
||||
"out_msg": 0 when writing to a new buffer, the first line will be
|
||||
set to "Reading from channel output..."
|
||||
|
||||
*job-err_io* *err_name* *err_buf*
|
||||
"err_io": "out" stderr messages to go to stdout
|
||||
@@ -657,6 +659,8 @@ See |job_setoptions()| and |ch_setoptions()|.
|
||||
"err_buf": number the number of the buffer to write to
|
||||
"err_modifiable": 0 when writing to a buffer, 'modifiable' will be off
|
||||
(see below)
|
||||
"err_msg": 0 when writing to a new buffer, the first line will be
|
||||
set to "Reading from channel error..."
|
||||
|
||||
"block_write": number only for testing: pretend every other write to stdin
|
||||
will block
|
||||
@@ -686,8 +690,16 @@ buffer number.
|
||||
|
||||
For a new buffer 'buftype' is set to "nofile" and 'bufhidden' to "hide". If
|
||||
you prefer other settings, create the buffer first and pass the buffer number.
|
||||
|
||||
*out_modifiable* *err_modifiable*
|
||||
The "out_modifiable" and "err_modifiable" options can be used to set the
|
||||
'modifiable' option off, or write to a buffer that has 'modifiable' off. That
|
||||
means that lines will be appended to the buffer, but the user can't easily
|
||||
change the buffer.
|
||||
*out_msg* *err_msg*
|
||||
The "out_msg" option can be used to specify whether a new buffer will have the
|
||||
first line set to "Reading from channel output...". The default is to add the
|
||||
message. "err_msg" does the same for channel error.
|
||||
|
||||
'modifiable' option off, or write to a buffer that has 'modifiable' off. That
|
||||
means that lines will be appended to the buffer, but the user can't easily
|
||||
change the buffer.
|
||||
|
||||
+4
-1
@@ -2058,7 +2058,7 @@ test1 \
|
||||
test_search_mbyte \
|
||||
test_utf8 \
|
||||
test_wordcount \
|
||||
test2 test3 test4 test5 test6 test7 test8 test9 \
|
||||
test3 test4 test5 test6 test7 test8 test9 \
|
||||
test11 test12 test14 test15 test17 test18 test19 \
|
||||
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
|
||||
test30 test31 test32 test33 test34 test36 test37 test38 test39 \
|
||||
@@ -2102,12 +2102,14 @@ test_arglist \
|
||||
test_fnameescape \
|
||||
test_fnamemodify \
|
||||
test_glob2regpat \
|
||||
test_gf \
|
||||
test_gn \
|
||||
test_goto \
|
||||
test_gui \
|
||||
test_hardcopy \
|
||||
test_help_tagjump \
|
||||
test_history \
|
||||
test_hlsearch \
|
||||
test_increment \
|
||||
test_increment_dbcs \
|
||||
test_job_fails \
|
||||
@@ -2145,6 +2147,7 @@ test_arglist \
|
||||
test_signs \
|
||||
test_sort \
|
||||
test_source_utf8 \
|
||||
test_smartindent \
|
||||
test_startup \
|
||||
test_startup_utf8 \
|
||||
test_stat \
|
||||
|
||||
+35
-6
@@ -1100,7 +1100,7 @@ channel_set_job(channel_T *channel, job_T *job, jobopt_T *options)
|
||||
* Returns NULL if there is something very wrong (error already reported).
|
||||
*/
|
||||
static buf_T *
|
||||
find_buffer(char_u *name, int err)
|
||||
find_buffer(char_u *name, int err, int msg)
|
||||
{
|
||||
buf_T *buf = NULL;
|
||||
buf_T *save_curbuf = curbuf;
|
||||
@@ -1125,7 +1125,8 @@ find_buffer(char_u *name, int err)
|
||||
#endif
|
||||
if (curbuf->b_ml.ml_mfp == NULL)
|
||||
ml_open(curbuf);
|
||||
ml_replace(1, (char_u *)(err ? "Reading from channel error..."
|
||||
if (msg)
|
||||
ml_replace(1, (char_u *)(err ? "Reading from channel error..."
|
||||
: "Reading from channel output..."), TRUE);
|
||||
changed_bytes(1, 0);
|
||||
curbuf = save_curbuf;
|
||||
@@ -1217,7 +1218,11 @@ channel_set_options(channel_T *channel, jobopt_T *opt)
|
||||
}
|
||||
else
|
||||
{
|
||||
buf = find_buffer(opt->jo_io_name[PART_OUT], FALSE);
|
||||
int msg = TRUE;
|
||||
|
||||
if (opt->jo_set2 & JO2_OUT_MSG)
|
||||
msg = opt->jo_message[PART_OUT];
|
||||
buf = find_buffer(opt->jo_io_name[PART_OUT], FALSE, msg);
|
||||
}
|
||||
if (buf != NULL)
|
||||
{
|
||||
@@ -1256,7 +1261,13 @@ channel_set_options(channel_T *channel, jobopt_T *opt)
|
||||
EMSGN(_(e_nobufnr), (long)opt->jo_io_buf[PART_ERR]);
|
||||
}
|
||||
else
|
||||
buf = find_buffer(opt->jo_io_name[PART_ERR], TRUE);
|
||||
{
|
||||
int msg = TRUE;
|
||||
|
||||
if (opt->jo_set2 & JO2_ERR_MSG)
|
||||
msg = opt->jo_message[PART_ERR];
|
||||
buf = find_buffer(opt->jo_io_name[PART_ERR], TRUE, msg);
|
||||
}
|
||||
if (buf != NULL)
|
||||
{
|
||||
if (opt->jo_set & JO_ERR_MODIFIABLE)
|
||||
@@ -2248,6 +2259,7 @@ append_to_buffer(buf_T *buffer, char_u *msg, channel_T *channel, int part)
|
||||
int save_write_to = buffer->b_write_to_channel;
|
||||
chanpart_T *ch_part = &channel->ch_part[part];
|
||||
int save_p_ma = buffer->b_p_ma;
|
||||
int empty = (buffer->b_ml.ml_flags & ML_EMPTY);
|
||||
|
||||
if (!buffer->b_p_ma && !ch_part->ch_nomodifiable)
|
||||
{
|
||||
@@ -2274,9 +2286,16 @@ append_to_buffer(buf_T *buffer, char_u *msg, channel_T *channel, int part)
|
||||
curbuf = buffer;
|
||||
u_sync(TRUE);
|
||||
/* ignore undo failure, undo is not very useful here */
|
||||
ignored = u_save(lnum, lnum + 1);
|
||||
ignored = u_save(lnum, lnum + 1 + (empty ? 1 : 0));
|
||||
|
||||
ml_append(lnum, msg, 0, FALSE);
|
||||
if (empty)
|
||||
{
|
||||
/* The buffer is empty, replace the first (dummy) line. */
|
||||
ml_replace(lnum, msg, TRUE);
|
||||
lnum = 0;
|
||||
}
|
||||
else
|
||||
ml_append(lnum, msg, 0, FALSE);
|
||||
appended_lines_mark(lnum, 1L);
|
||||
curbuf = save_curbuf;
|
||||
if (ch_part->ch_nomodifiable)
|
||||
@@ -4108,6 +4127,16 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
|
||||
opt->jo_set |= JO_OUT_MODIFIABLE << (part - PART_OUT);
|
||||
opt->jo_modifiable[part] = get_tv_number(item);
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "out_msg") == 0
|
||||
|| STRCMP(hi->hi_key, "err_msg") == 0)
|
||||
{
|
||||
part = part_from_char(*hi->hi_key);
|
||||
|
||||
if (!(supported & JO_OUT_IO))
|
||||
break;
|
||||
opt->jo_set2 |= JO2_OUT_MSG << (part - PART_OUT);
|
||||
opt->jo_message[part] = get_tv_number(item);
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "in_top") == 0
|
||||
|| STRCMP(hi->hi_key, "in_bot") == 0)
|
||||
{
|
||||
|
||||
@@ -1637,6 +1637,10 @@ struct channel_S {
|
||||
#define JO_ERR_MODIFIABLE 0x40000000 /* "err_modifiable" (JO_OUT_ << 1) */
|
||||
#define JO_ALL 0x7fffffff
|
||||
|
||||
#define JO2_OUT_MSG 0x0001 /* "out_msg" */
|
||||
#define JO2_ERR_MSG 0x0002 /* "err_msg" (JO_OUT_ << 1) */
|
||||
#define JO2_ALL 0x0003
|
||||
|
||||
#define JO_MODE_ALL (JO_MODE + JO_IN_MODE + JO_OUT_MODE + JO_ERR_MODE)
|
||||
#define JO_CB_ALL \
|
||||
(JO_CALLBACK + JO_OUT_CALLBACK + JO_ERR_CALLBACK + JO_CLOSE_CALLBACK)
|
||||
@@ -1648,6 +1652,7 @@ struct channel_S {
|
||||
typedef struct
|
||||
{
|
||||
int jo_set; /* JO_ bits for values that were set */
|
||||
int jo_set2; /* JO2_ bits for values that were set */
|
||||
|
||||
ch_mode_T jo_mode;
|
||||
ch_mode_T jo_in_mode;
|
||||
@@ -1659,6 +1664,7 @@ typedef struct
|
||||
char_u *jo_io_name[4]; /* not allocated! */
|
||||
int jo_io_buf[4];
|
||||
int jo_modifiable[4];
|
||||
int jo_message[4];
|
||||
channel_T *jo_channel;
|
||||
|
||||
linenr_T jo_in_top;
|
||||
|
||||
@@ -13,16 +13,13 @@ SCRIPTS_ALL = \
|
||||
test3.out \
|
||||
test4.out \
|
||||
test5.out \
|
||||
test6.out \
|
||||
test7.out \
|
||||
test8.out \
|
||||
test9.out \
|
||||
test14.out \
|
||||
test15.out \
|
||||
test18.out \
|
||||
test19.out \
|
||||
test20.out \
|
||||
test21.out \
|
||||
test22.out \
|
||||
test23.out \
|
||||
test24.out \
|
||||
@@ -74,7 +71,6 @@ SCRIPTS_ALL = \
|
||||
test95.out \
|
||||
test98.out \
|
||||
test99.out \
|
||||
test101.out \
|
||||
test103.out \
|
||||
test104.out \
|
||||
test107.out \
|
||||
@@ -109,7 +105,6 @@ SCRIPTS_MORE1 = \
|
||||
|
||||
# Tests that run on most systems, but not on Amiga and DOS/Windows.
|
||||
SCRIPTS_MORE2 = \
|
||||
test2.out \
|
||||
test12.out \
|
||||
test25.out \
|
||||
test49.out \
|
||||
@@ -147,7 +142,7 @@ SCRIPTS_GUI =
|
||||
# Keep test_alot*.res as the last one, sort the others.
|
||||
NEW_TESTS = test_arglist.res \
|
||||
test_assert.res \
|
||||
test_autochdir \
|
||||
test_autochdir.res \
|
||||
test_backspace_opt.res \
|
||||
test_bufwintabinfo.res \
|
||||
test_cdo.res \
|
||||
@@ -159,10 +154,12 @@ NEW_TESTS = test_arglist.res \
|
||||
test_digraph.res \
|
||||
test_farsi.res \
|
||||
test_fnameescape.res \
|
||||
test_gf.res \
|
||||
test_gn.res \
|
||||
test_gui.res \
|
||||
test_hardcopy.res \
|
||||
test_history.res \
|
||||
test_hlsearch.res \
|
||||
test_increment.res \
|
||||
test_increment_dbcs.res \
|
||||
test_job_fails.res \
|
||||
@@ -180,6 +177,7 @@ NEW_TESTS = test_arglist.res \
|
||||
test_ruby.res \
|
||||
test_search.res \
|
||||
test_signs.res \
|
||||
test_smartindent.res \
|
||||
test_startup.res \
|
||||
test_startup_utf8.res \
|
||||
test_stat.res \
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
Test for v:hlsearch vim: set ft=vim :
|
||||
|
||||
STARTTEST
|
||||
:" Last abc: Q
|
||||
:so small.vim
|
||||
:new
|
||||
:call setline(1, repeat(['aaa'], 10))
|
||||
:set hlsearch nolazyredraw
|
||||
:let r=[]
|
||||
:command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])
|
||||
/aaa
|
||||
:AddR
|
||||
:nohlsearch
|
||||
:AddR
|
||||
:let v:hlsearch=1
|
||||
:AddR
|
||||
:let v:hlsearch=0
|
||||
:AddR
|
||||
:set hlsearch
|
||||
:AddR
|
||||
:let v:hlsearch=0
|
||||
:AddR
|
||||
n:AddR
|
||||
:let v:hlsearch=0
|
||||
:AddR
|
||||
/
|
||||
:AddR
|
||||
:set nohls
|
||||
/
|
||||
:AddR
|
||||
:let r1=r[0][0]
|
||||
:" I guess it is not guaranteed that screenattr outputs always the same character
|
||||
:call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')
|
||||
:try
|
||||
: let v:hlsearch=[]
|
||||
:catch
|
||||
: call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))
|
||||
:endtry
|
||||
:bwipeout!
|
||||
:$put=r
|
||||
:call garbagecollect(1)
|
||||
:"
|
||||
:/^start:/,$wq! test.out
|
||||
:" vim: et ts=4 isk-=\:
|
||||
:call getchar()
|
||||
ENDTEST
|
||||
|
||||
start:
|
||||
@@ -1,12 +0,0 @@
|
||||
start:
|
||||
1:highlighted
|
||||
0:not highlighted
|
||||
1:highlighted
|
||||
0:not highlighted
|
||||
1:highlighted
|
||||
0:not highlighted
|
||||
1:highlighted
|
||||
0:not highlighted
|
||||
1:highlighted
|
||||
0:not highlighted
|
||||
Vim(let):E745:
|
||||
@@ -1,16 +0,0 @@
|
||||
Tests for not doing smart indenting when it isn't set.
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:set nocin nosi ai
|
||||
/some
|
||||
2cc#test
|
||||
:?start?,$w! test.out
|
||||
:qa!
|
||||
ENDTEST
|
||||
|
||||
start text
|
||||
some test text
|
||||
test text
|
||||
test text
|
||||
test text
|
||||
@@ -1,4 +0,0 @@
|
||||
start text
|
||||
#test
|
||||
test text
|
||||
test text
|
||||
@@ -1,29 +0,0 @@
|
||||
|
||||
This is a test if a URL is recognized by "gf", with the cursor before and
|
||||
after the "://". Also test ":\\".
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
/^first
|
||||
/tmp
|
||||
:call append(0, expand("<cfile>"))
|
||||
/^second
|
||||
/URL
|
||||
:call append(1, expand("<cfile>"))
|
||||
:if has("ebcdic")
|
||||
: set isf=@,240-249,/,.,-,_,+,,,$,:,~,\
|
||||
:else
|
||||
: set isf=@,48-57,/,.,-,_,+,,,$,:,~,\
|
||||
:endif
|
||||
/^third
|
||||
/name
|
||||
:call append(2, expand("<cfile>"))
|
||||
/^fourth
|
||||
/URL
|
||||
:call append(3, expand("<cfile>"))
|
||||
5GdG:wq! test.out
|
||||
ENDTEST
|
||||
first test for URL://machine.name/tmp/vimtest2a and other text
|
||||
second test for URL://machine.name/tmp/vimtest2b. And other text
|
||||
third test for URL:\\machine.name\vimtest2c and other text
|
||||
fourth test for URL:\\machine.name\tmp\vimtest2d, and other text
|
||||
@@ -1,4 +0,0 @@
|
||||
URL://machine.name/tmp/vimtest2a
|
||||
URL://machine.name/tmp/vimtest2b
|
||||
URL:\\machine.name\vimtest2c
|
||||
URL:\\machine.name\tmp\vimtest2d
|
||||
@@ -1,19 +0,0 @@
|
||||
Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
/start
|
||||
6[ :.w! test.out
|
||||
?start here
|
||||
6 :.w >>test.out
|
||||
:qa!
|
||||
ENDTEST
|
||||
|
||||
#include test21.in
|
||||
|
||||
/* test text test tex start here
|
||||
some text
|
||||
test text
|
||||
start OK if found this line
|
||||
start found wrong line
|
||||
test text
|
||||
@@ -1,2 +0,0 @@
|
||||
start OK if found this line
|
||||
start OK if found this line
|
||||
@@ -1,24 +0,0 @@
|
||||
Test for autocommand that redefines the argument list, when doing ":all".
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:au BufReadPost Xxx2 next Xxx2 Xxx1
|
||||
/^start of
|
||||
A1:.,/end of/w! Xxx1 " write test file Xxx1
|
||||
$r2:.,/end of/w! Xxx2 " write test file Xxx2
|
||||
$r3:.,/end of/w! Xxx3 " write test file Xxx3
|
||||
:next! Xxx1 Xxx2 Xxx3 " redefine arglist; go to Xxx1
|
||||
:all " open window for all args
|
||||
:w! test.out " Write contents of Xxx1
|
||||
:w >>test.out " Append contents of last window (Xxx1)
|
||||
:rew " should now be in Xxx2
|
||||
:w >>test.out " Append contents of Xxx2
|
||||
:qa!
|
||||
ENDTEST
|
||||
|
||||
start of test file Xxx
|
||||
this is a test
|
||||
this is a test
|
||||
this is a test
|
||||
this is a test
|
||||
end of test file Xxx
|
||||
@@ -1,18 +0,0 @@
|
||||
start of test file Xxx1
|
||||
this is a test
|
||||
this is a test
|
||||
this is a test
|
||||
this is a test
|
||||
end of test file Xxx
|
||||
start of test file Xxx1
|
||||
this is a test
|
||||
this is a test
|
||||
this is a test
|
||||
this is a test
|
||||
end of test file Xxx
|
||||
start of test file Xxx2
|
||||
this is a test
|
||||
this is a test
|
||||
this is a test
|
||||
this is a test
|
||||
end of test file Xxx
|
||||
@@ -287,3 +287,32 @@ function Test_argpos()
|
||||
call assert_equal(0, argidx())
|
||||
%argd
|
||||
endfunction
|
||||
|
||||
" Test for autocommand that redefines the argument list, when doing ":all".
|
||||
function Test_arglist_autocmd()
|
||||
autocmd BufReadPost Xxx2 next Xxx2 Xxx1
|
||||
call writefile(['test file Xxx1'], 'Xxx1')
|
||||
call writefile(['test file Xxx2'], 'Xxx2')
|
||||
call writefile(['test file Xxx3'], 'Xxx3')
|
||||
|
||||
new
|
||||
" redefine arglist; go to Xxx1
|
||||
next! Xxx1 Xxx2 Xxx3
|
||||
" open window for all args
|
||||
all
|
||||
call assert_equal('test file Xxx1', getline(1))
|
||||
wincmd w
|
||||
wincmd w
|
||||
call assert_equal('test file Xxx1', getline(1))
|
||||
" should now be in Xxx2
|
||||
rewind
|
||||
call assert_equal('test file Xxx2', getline(1))
|
||||
|
||||
autocmd! BufReadPost Xxx2
|
||||
enew! | only
|
||||
call delete('Xxx1')
|
||||
call delete('Xxx2')
|
||||
call delete('Xxx3')
|
||||
argdelete Xxx*
|
||||
bwipe! Xxx1 Xxx2 Xxx3
|
||||
endfunction
|
||||
|
||||
@@ -638,21 +638,27 @@ func BufCloseCb(ch)
|
||||
let g:Ch_bufClosed = 'yes'
|
||||
endfunc
|
||||
|
||||
func Run_test_pipe_to_buffer(use_name, nomod)
|
||||
func Run_test_pipe_to_buffer(use_name, nomod, do_msg)
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_pipe_to_buffer()')
|
||||
let g:Ch_bufClosed = 'no'
|
||||
let options = {'out_io': 'buffer', 'close_cb': 'BufCloseCb'}
|
||||
let expected = ['', 'line one', 'line two', 'this', 'AND this', 'Goodbye!']
|
||||
if a:use_name
|
||||
let options['out_name'] = 'pipe-output'
|
||||
let firstline = 'Reading from channel output...'
|
||||
if a:do_msg
|
||||
let expected[0] = 'Reading from channel output...'
|
||||
else
|
||||
let options['out_msg'] = 0
|
||||
call remove(expected, 0)
|
||||
endif
|
||||
else
|
||||
sp pipe-output
|
||||
let options['out_buf'] = bufnr('%')
|
||||
quit
|
||||
let firstline = ''
|
||||
call remove(expected, 0)
|
||||
endif
|
||||
if a:nomod
|
||||
let options['out_modifiable'] = 0
|
||||
@@ -667,7 +673,7 @@ func Run_test_pipe_to_buffer(use_name, nomod)
|
||||
call ch_sendraw(handle, "quit\n")
|
||||
sp pipe-output
|
||||
call WaitFor('line("$") >= 6 && g:Ch_bufClosed == "yes"')
|
||||
call assert_equal([firstline, 'line one', 'line two', 'this', 'AND this', 'Goodbye!'], getline(1, '$'))
|
||||
call assert_equal(expected, getline(1, '$'))
|
||||
if a:nomod
|
||||
call assert_equal(0, &modifiable)
|
||||
else
|
||||
@@ -681,31 +687,41 @@ func Run_test_pipe_to_buffer(use_name, nomod)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_to_buffer_name()
|
||||
call Run_test_pipe_to_buffer(1, 0)
|
||||
call Run_test_pipe_to_buffer(1, 0, 1)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_to_buffer_nr()
|
||||
call Run_test_pipe_to_buffer(0, 0)
|
||||
call Run_test_pipe_to_buffer(0, 0, 1)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_to_buffer_name_nomod()
|
||||
call Run_test_pipe_to_buffer(1, 1)
|
||||
call Run_test_pipe_to_buffer(1, 1, 1)
|
||||
endfunc
|
||||
|
||||
func Run_test_pipe_err_to_buffer(use_name, nomod)
|
||||
func Test_pipe_to_buffer_name_nomsg()
|
||||
call Run_test_pipe_to_buffer(1, 0, 1)
|
||||
endfunc
|
||||
|
||||
func Run_test_pipe_err_to_buffer(use_name, nomod, do_msg)
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_pipe_err_to_buffer()')
|
||||
let options = {'err_io': 'buffer'}
|
||||
let expected = ['', 'line one', 'line two', 'this', 'AND this']
|
||||
if a:use_name
|
||||
let options['err_name'] = 'pipe-err'
|
||||
let firstline = 'Reading from channel error...'
|
||||
if a:do_msg
|
||||
let expected[0] = 'Reading from channel error...'
|
||||
else
|
||||
let options['err_msg'] = 0
|
||||
call remove(expected, 0)
|
||||
endif
|
||||
else
|
||||
sp pipe-err
|
||||
let options['err_buf'] = bufnr('%')
|
||||
quit
|
||||
let firstline = ''
|
||||
call remove(expected, 0)
|
||||
endif
|
||||
if a:nomod
|
||||
let options['err_modifiable'] = 0
|
||||
@@ -720,7 +736,7 @@ func Run_test_pipe_err_to_buffer(use_name, nomod)
|
||||
call ch_sendraw(handle, "quit\n")
|
||||
sp pipe-err
|
||||
call WaitFor('line("$") >= 5')
|
||||
call assert_equal([firstline, 'line one', 'line two', 'this', 'AND this'], getline(1, '$'))
|
||||
call assert_equal(expected, getline(1, '$'))
|
||||
if a:nomod
|
||||
call assert_equal(0, &modifiable)
|
||||
else
|
||||
@@ -733,15 +749,19 @@ func Run_test_pipe_err_to_buffer(use_name, nomod)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_err_to_buffer_name()
|
||||
call Run_test_pipe_err_to_buffer(1, 0)
|
||||
call Run_test_pipe_err_to_buffer(1, 0, 1)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_err_to_buffer_nr()
|
||||
call Run_test_pipe_err_to_buffer(0, 0)
|
||||
call Run_test_pipe_err_to_buffer(0, 0, 1)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_err_to_buffer_name_nomod()
|
||||
call Run_test_pipe_err_to_buffer(1, 1)
|
||||
call Run_test_pipe_err_to_buffer(1, 1, 1)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_err_to_buffer_name_nomsg()
|
||||
call Run_test_pipe_err_to_buffer(1, 0, 0)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_both_to_buffer()
|
||||
@@ -1407,7 +1427,7 @@ func Test_collapse_buffers()
|
||||
1,$delete
|
||||
call job_start('cat test_channel.vim', {'out_io': 'buffer', 'out_name': 'testout'})
|
||||
call WaitFor('line("$") > g:linecount')
|
||||
call assert_inrange(g:linecount + 1, g:linecount + 2, line('$'))
|
||||
call assert_inrange(g:linecount, g:linecount + 1, line('$'))
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
@@ -1425,9 +1445,9 @@ func Test_raw_passes_nul()
|
||||
1,$delete
|
||||
call job_start('cat Xtestread', {'out_io': 'buffer', 'out_name': 'testout'})
|
||||
call WaitFor('line("$") > 2')
|
||||
call assert_equal("asdf\nasdf", getline(2))
|
||||
call assert_equal("xxx\n", getline(3))
|
||||
call assert_equal("\nyyy", getline(4))
|
||||
call assert_equal("asdf\nasdf", getline(1))
|
||||
call assert_equal("xxx\n", getline(2))
|
||||
call assert_equal("\nyyy", getline(3))
|
||||
|
||||
call delete('Xtestread')
|
||||
bwipe!
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
function! Test_charsearch()
|
||||
enew!
|
||||
call append(0, ['Xabcdefghijkemnopqretuvwxyz',
|
||||
\ 'Yabcdefghijkemnopqretuvwxyz',
|
||||
\ 'Zabcdefghijkemnokqretkvwxyz'])
|
||||
\ 'Yabcdefghijkemnopqretuvwxyz',
|
||||
\ 'Zabcdefghijkemnokqretkvwxyz'])
|
||||
" check that "fe" and ";" work
|
||||
1
|
||||
normal! ylfep;;p,,p
|
||||
|
||||
@@ -6,7 +6,7 @@ function! Test_fnameescape()
|
||||
try
|
||||
exe "w! " . fnameescape(fname)
|
||||
let status = v:true
|
||||
endtry
|
||||
endtry
|
||||
call assert_true(status, "Space")
|
||||
call delete(fname)
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
" This is a test if a URL is recognized by "gf", with the cursor before and
|
||||
" after the "://". Also test ":\\".
|
||||
function! Test_gf_url()
|
||||
enew!
|
||||
call append(0, [
|
||||
\ "first test for URL://machine.name/tmp/vimtest2a and other text",
|
||||
\ "second test for URL://machine.name/tmp/vimtest2b. And other text",
|
||||
\ "third test for URL:\\\\machine.name\\vimtest2c and other text",
|
||||
\ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other text"
|
||||
\ ])
|
||||
call cursor(1,1)
|
||||
call search("^first")
|
||||
call search("tmp")
|
||||
call assert_equal("URL://machine.name/tmp/vimtest2a", expand("<cfile>"))
|
||||
call search("^second")
|
||||
call search("URL")
|
||||
call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>"))
|
||||
if has("ebcdic")
|
||||
set isf=@,240-249,/,.,-,_,+,,,$,:,~,\
|
||||
else
|
||||
set isf=@,48-57,/,.,-,_,+,,,$,:,~,\
|
||||
endif
|
||||
call search("^third")
|
||||
call search("name")
|
||||
call assert_equal("URL:\\\\machine.name\\vimtest2c", expand("<cfile>"))
|
||||
call search("^fourth")
|
||||
call search("URL")
|
||||
call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>"))
|
||||
|
||||
set isf&vim
|
||||
enew!
|
||||
endfunction
|
||||
@@ -0,0 +1,34 @@
|
||||
" Test for v:hlsearch
|
||||
|
||||
function! Test_hlsearch()
|
||||
new
|
||||
call setline(1, repeat(['aaa'], 10))
|
||||
set hlsearch nolazyredraw
|
||||
let r=[]
|
||||
" redraw is needed to make hlsearch highlight the matches
|
||||
exe "normal! /aaa\<CR>" | redraw
|
||||
let r1 = screenattr(1, 1)
|
||||
nohlsearch | redraw
|
||||
call assert_notequal(r1, screenattr(1,1))
|
||||
let v:hlsearch=1 | redraw
|
||||
call assert_equal(r1, screenattr(1,1))
|
||||
let v:hlsearch=0 | redraw
|
||||
call assert_notequal(r1, screenattr(1,1))
|
||||
set hlsearch | redraw
|
||||
call assert_equal(r1, screenattr(1,1))
|
||||
let v:hlsearch=0 | redraw
|
||||
call assert_notequal(r1, screenattr(1,1))
|
||||
exe "normal! n" | redraw
|
||||
call assert_equal(r1, screenattr(1,1))
|
||||
let v:hlsearch=0 | redraw
|
||||
call assert_notequal(r1, screenattr(1,1))
|
||||
exe "normal! /\<CR>" | redraw
|
||||
call assert_equal(r1, screenattr(1,1))
|
||||
set nohls
|
||||
exe "normal! /\<CR>" | redraw
|
||||
call assert_notequal(r1, screenattr(1,1))
|
||||
call assert_fails('let v:hlsearch=[]', 'E745')
|
||||
call garbagecollect(1)
|
||||
call getchar(1)
|
||||
enew!
|
||||
endfunction
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
" Tests for not doing smart indenting when it isn't set.
|
||||
function! Test_nosmartindent()
|
||||
new
|
||||
call append(0, [" some test text",
|
||||
\ " test text",
|
||||
\ "test text",
|
||||
\ " test text"])
|
||||
set nocindent nosmartindent autoindent
|
||||
exe "normal! gg/some\<CR>"
|
||||
exe "normal! 2cc#test\<Esc>"
|
||||
call assert_equal(" #test", getline(1))
|
||||
enew! | close
|
||||
endfunction
|
||||
@@ -23,4 +23,34 @@ func Test_cancel_ptjump()
|
||||
quit
|
||||
endfunc
|
||||
|
||||
" Tests for [ CTRL-I and CTRL-W CTRL-I commands
|
||||
function Test_keyword_jump()
|
||||
call writefile(["#include Xinclude", "",
|
||||
\ "",
|
||||
\ "/* test text test tex start here",
|
||||
\ " some text",
|
||||
\ " test text",
|
||||
\ " start OK if found this line",
|
||||
\ " start found wrong line",
|
||||
\ "test text"], 'Xtestfile')
|
||||
call writefile(["/* test text test tex start here",
|
||||
\ " some text",
|
||||
\ " test text",
|
||||
\ " start OK if found this line",
|
||||
\ " start found wrong line",
|
||||
\ "test text"], 'Xinclude')
|
||||
new Xtestfile
|
||||
call cursor(1,1)
|
||||
call search("start")
|
||||
exe "normal! 5[\<C-I>"
|
||||
call assert_equal(" start OK if found this line", getline('.'))
|
||||
call cursor(1,1)
|
||||
call search("start")
|
||||
exe "normal! 5\<C-W>\<C-I>"
|
||||
call assert_equal(" start OK if found this line", getline('.'))
|
||||
enew! | only
|
||||
call delete('Xtestfile')
|
||||
call delete('Xinclude')
|
||||
endfunction
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -778,6 +778,10 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2344,
|
||||
/**/
|
||||
2343,
|
||||
/**/
|
||||
2342,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user