Mercurial > vim
comparison src/testdir/test_search.vim @ 14522:97641c4f5687 v8.1.0274
patch 8.1.0274: 'incsearch' triggers on ":source"
commit https://github.com/vim/vim/commit/21f990e1c22ffa2fdb66a548ebbe25e6e7194776
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 11 19:20:49 2018 +0200
patch 8.1.0274: 'incsearch' triggers on ":source"
Problem: 'incsearch' triggers on ":source".
Solution: Check for the whole command name.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 11 Aug 2018 19:30:05 +0200 |
parents | 3648e74dd523 |
children | e36d6e01708c |
comparison
equal
deleted
inserted
replaced
14521:3c5a52ee583c | 14522:97641c4f5687 |
---|---|
340 norm ixx | 340 norm ixx |
341 exe "norm 0t\u93cf" | 341 exe "norm 0t\u93cf" |
342 bw! | 342 bw! |
343 endfunc | 343 endfunc |
344 | 344 |
345 func Test_search_cmdline3() | |
346 if !exists('+incsearch') | |
347 return | |
348 endif | |
349 " need to disable char_avail, | |
350 " so that expansion of commandline works | |
351 call test_override("char_avail", 1) | |
352 new | |
353 call setline(1, [' 1', ' 2 the~e', ' 3 the theother']) | |
354 set incsearch | |
355 1 | |
356 " first match | |
357 call feedkeys("/the\<c-l>\<cr>", 'tx') | |
358 call assert_equal(' 2 the~e', getline('.')) | |
359 " clean up | |
360 set noincsearch | |
361 call test_override("char_avail", 0) | |
362 bw! | |
363 endfunc | |
364 | |
365 func Cmdline3_prep() | 345 func Cmdline3_prep() |
366 " need to disable char_avail, | 346 " need to disable char_avail, |
367 " so that expansion of commandline works | 347 " so that expansion of commandline works |
368 call test_override("char_avail", 1) | 348 call test_override("char_avail", 1) |
369 new | 349 new |
375 set noincsearch | 355 set noincsearch |
376 call test_override("char_avail", 0) | 356 call test_override("char_avail", 0) |
377 bw! | 357 bw! |
378 endfunc | 358 endfunc |
379 | 359 |
360 func Test_search_cmdline3() | |
361 if !exists('+incsearch') | |
362 return | |
363 endif | |
364 call Cmdline3_prep() | |
365 1 | |
366 " first match | |
367 call feedkeys("/the\<c-l>\<cr>", 'tx') | |
368 call assert_equal(' 2 the~e', getline('.')) | |
369 | |
370 call Cmdline3_cleanup() | |
371 endfunc | |
372 | |
380 func Test_search_cmdline3s() | 373 func Test_search_cmdline3s() |
381 if !exists('+incsearch') | 374 if !exists('+incsearch') |
382 return | 375 return |
383 endif | 376 endif |
384 call Cmdline3_prep() | 377 call Cmdline3_prep() |
385 1 | 378 1 |
386 call feedkeys(":%s/the\<c-l>/xxx\<cr>", 'tx') | 379 call feedkeys(":%s/the\<c-l>/xxx\<cr>", 'tx') |
387 call assert_equal(' 2 xxxe', getline('.')) | 380 call assert_equal(' 2 xxxe', getline('.')) |
381 undo | |
382 call feedkeys(":%subs/the\<c-l>/xxx\<cr>", 'tx') | |
383 call assert_equal(' 2 xxxe', getline('.')) | |
384 undo | |
385 call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx') | |
386 call assert_equal(' 2 xxxe', getline('.')) | |
388 | 387 |
389 call Cmdline3_cleanup() | 388 call Cmdline3_cleanup() |
390 endfunc | 389 endfunc |
391 | 390 |
392 func Test_search_cmdline3g() | 391 func Test_search_cmdline3g() |
395 endif | 394 endif |
396 call Cmdline3_prep() | 395 call Cmdline3_prep() |
397 1 | 396 1 |
398 call feedkeys(":g/the\<c-l>/d\<cr>", 'tx') | 397 call feedkeys(":g/the\<c-l>/d\<cr>", 'tx') |
399 call assert_equal(' 3 the theother', getline(2)) | 398 call assert_equal(' 3 the theother', getline(2)) |
399 undo | |
400 call feedkeys(":global/the\<c-l>/d\<cr>", 'tx') | |
401 call assert_equal(' 3 the theother', getline(2)) | |
400 | 402 |
401 call Cmdline3_cleanup() | 403 call Cmdline3_cleanup() |
402 endfunc | 404 endfunc |
403 | 405 |
404 func Test_search_cmdline3v() | 406 func Test_search_cmdline3v() |
406 return | 408 return |
407 endif | 409 endif |
408 call Cmdline3_prep() | 410 call Cmdline3_prep() |
409 1 | 411 1 |
410 call feedkeys(":v/the\<c-l>/d\<cr>", 'tx') | 412 call feedkeys(":v/the\<c-l>/d\<cr>", 'tx') |
413 call assert_equal(1, line('$')) | |
414 call assert_equal(' 2 the~e', getline(1)) | |
415 undo | |
416 call feedkeys(":vglobal/the\<c-l>/d\<cr>", 'tx') | |
411 call assert_equal(1, line('$')) | 417 call assert_equal(1, line('$')) |
412 call assert_equal(' 2 the~e', getline(1)) | 418 call assert_equal(' 2 the~e', getline(1)) |
413 | 419 |
414 call Cmdline3_cleanup() | 420 call Cmdline3_cleanup() |
415 endfunc | 421 endfunc |
516 endif | 522 endif |
517 " need to disable char_avail, | 523 " need to disable char_avail, |
518 " so that expansion of commandline works | 524 " so that expansion of commandline works |
519 call test_override("char_avail", 1) | 525 call test_override("char_avail", 1) |
520 new | 526 new |
521 let @/='b' | 527 let @/ = 'b' |
522 call setline(1, [' bbvimb', '']) | 528 call setline(1, [' bbvimb', '']) |
523 set incsearch | 529 set incsearch |
524 " first match | 530 " first match |
525 norm! gg0 | 531 norm! gg0 |
526 " moves to next match of previous search pattern, just like /<cr> | 532 " moves to next match of previous search pattern, just like /<cr> |