Skip to content

Commit 9289901

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents ae0b599 + 33c5e9f commit 9289901

5 files changed

Lines changed: 110 additions & 8 deletions

File tree

src/memline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ ml_open(buf_T *buf)
344344
b0p->b0_magic_int = (int)B0_MAGIC_INT;
345345
b0p->b0_magic_short = (short)B0_MAGIC_SHORT;
346346
b0p->b0_magic_char = B0_MAGIC_CHAR;
347-
STRNCPY(b0p->b0_version, "VIM ", 4);
347+
mch_memmove(b0p->b0_version, "VIM ", 4);
348348
STRNCPY(b0p->b0_version + 4, Version, 6);
349349
long_to_char((long)mfp->mf_page_size, b0p->b0_page_size);
350350

src/testdir/test_goto.vim

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,65 @@ func Test_gd_local_block()
309309
\ ]
310310
call XTest_goto_decl('1gd', lines, 11, 11)
311311
endfunc
312+
313+
func Test_motion_if_elif_else_endif()
314+
new
315+
a
316+
/* Test pressing % on #if, #else #elsif and #endif,
317+
* with nested #if
318+
*/
319+
#if FOO
320+
/* ... */
321+
# if BAR
322+
/* ... */
323+
# endif
324+
#elif BAR
325+
/* ... */
326+
#else
327+
/* ... */
328+
#endif
329+
.
330+
/#if FOO
331+
norm %
332+
call assert_equal([9, 1], getpos('.')[1:2])
333+
norm %
334+
call assert_equal([11, 1], getpos('.')[1:2])
335+
norm %
336+
call assert_equal([13, 1], getpos('.')[1:2])
337+
norm %
338+
call assert_equal([4, 1], getpos('.')[1:2])
339+
/# if BAR
340+
norm $%
341+
call assert_equal([8, 1], getpos('.')[1:2])
342+
norm $%
343+
call assert_equal([6, 1], getpos('.')[1:2])
344+
345+
bw!
346+
endfunc
347+
348+
func Test_motion_c_comment()
349+
new
350+
a
351+
/*
352+
* Test pressing % on beginning/end
353+
* of C comments.
354+
*/
355+
/* Another comment */
356+
.
357+
norm gg0%
358+
call assert_equal([4, 3], getpos('.')[1:2])
359+
norm %
360+
call assert_equal([1, 1], getpos('.')[1:2])
361+
norm gg0l%
362+
call assert_equal([4, 3], getpos('.')[1:2])
363+
norm h%
364+
call assert_equal([1, 1], getpos('.')[1:2])
365+
366+
norm G^
367+
norm %
368+
call assert_equal([5, 21], getpos('.')[1:2])
369+
norm %
370+
call assert_equal([5, 1], getpos('.')[1:2])
371+
372+
bw!
373+
endfunc

src/testdir/test_terminal.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func Test_terminal_scroll()
270270
endfunc
271271

272272
func Test_terminal_scrollback()
273-
let buf = Run_shell_in_terminal({})
273+
let buf = Run_shell_in_terminal({'term_rows': 15})
274274
set termwinscroll=100
275275
call writefile(range(150), 'Xtext')
276276
if has('win32')

src/testdir/test_undo.vim

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ endfunc
8585
func FillBuffer()
8686
for i in range(1,13)
8787
put=i
88-
" Set 'undolevels' to split undo.
88+
" Set 'undolevels' to split undo.
8989
exe "setg ul=" . &g:ul
9090
endfor
9191
endfunc
@@ -193,19 +193,19 @@ func Test_undolist()
193193
new
194194
set ul=100
195195

196-
let a=execute('undolist')
196+
let a = execute('undolist')
197197
call assert_equal("\nNothing to undo", a)
198198

199199
" 1 leaf (2 changes).
200200
call feedkeys('achange1', 'xt')
201201
call feedkeys('achange2', 'xt')
202-
let a=execute('undolist')
202+
let a = execute('undolist')
203203
call assert_match("^\nnumber changes when *saved\n *2 *2 .*$", a)
204204

205205
" 2 leaves.
206206
call feedkeys('u', 'xt')
207207
call feedkeys('achange3\<Esc>', 'xt')
208-
let a=execute('undolist')
208+
let a = execute('undolist')
209209
call assert_match("^\nnumber changes when *saved\n *2 *2 *.*\n *3 *2 .*$", a)
210210
close!
211211
endfunc
@@ -339,7 +339,7 @@ endfunc
339339
" Also test this in an empty buffer.
340340
func Test_cmd_in_reg_undo()
341341
enew!
342-
let @a="Ox\<Esc>jAy\<Esc>kdd"
342+
let @a = "Ox\<Esc>jAy\<Esc>kdd"
343343
edit +/^$ test_undo.vim
344344
normal @au
345345
call assert_equal(0, &modified)
@@ -348,7 +348,7 @@ func Test_cmd_in_reg_undo()
348348
normal @au
349349
call assert_equal(0, &modified)
350350
only!
351-
let @a=''
351+
let @a = ''
352352
endfunc
353353

354354
" This used to cause an illegal memory access
@@ -410,3 +410,35 @@ func Test_redo_empty_line()
410410
exe "norm."
411411
bwipe!
412412
endfunc
413+
414+
funct Test_undofile()
415+
" Test undofile() without setting 'undodir'.
416+
if has('persistent_undo')
417+
call assert_equal(fnamemodify('.Xundofoo.un~', ':p'), undofile('Xundofoo'))
418+
else
419+
call assert_equal('', undofile('Xundofoo'))
420+
endif
421+
call assert_equal('', undofile(''))
422+
423+
" Test undofile() with 'undodir' set to to an existing directory.
424+
call mkdir('Xundodir')
425+
set undodir=Xundodir
426+
let cwd = getcwd()
427+
if has('win32')
428+
" Replace windows drive such as C:... into C%...
429+
let cwd = substitute(cwd, '^\([A-Z]\):', '\1%', 'g')
430+
endif
431+
let cwd = substitute(cwd . '/Xundofoo', '/', '%', 'g')
432+
if has('persistent_undo')
433+
call assert_equal('Xundodir/' . cwd, undofile('Xundofoo'))
434+
else
435+
call assert_equal('', undofile('Xundofoo'))
436+
endif
437+
call assert_equal('', undofile(''))
438+
call delete('Xundodir', 'd')
439+
440+
" Test undofile() with 'undodir' set to a non-existing directory.
441+
call assert_equal('', undofile('Xundofoo'))
442+
443+
set undodir&
444+
endfunc

src/version.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,14 @@ static char *(features[]) =
776776

777777
static int included_patches[] =
778778
{ /* Add new patch number below this line */
779+
/**/
780+
26,
781+
/**/
782+
25,
783+
/**/
784+
24,
785+
/**/
786+
23,
779787
/**/
780788
22,
781789
/**/

0 commit comments

Comments
 (0)