@@ -322,3 +322,37 @@ func Test_search_cmdline3()
322322 call test_override (" char_avail" , 0 )
323323 bw !
324324endfunc
325+
326+ func Test_search_cmdline4 ()
327+ if ! exists (' +incsearch' )
328+ return
329+ endif
330+ " need to disable char_avail,
331+ " so that expansion of commandline works
332+ call test_override (" char_avail" , 1 )
333+ new
334+ call setline (1 , [' 1 the first' , ' 2 the second' , ' 3 the third' ])
335+ set incsearch
336+ $
337+ call feedkeys (" ?the\<c-g>\<cr> " , ' tx' )
338+ call assert_equal (' 3 the third' , getline (' .' ))
339+ $
340+ call feedkeys (" ?the\<c-g>\<c-g>\<cr> " , ' tx' )
341+ call assert_equal (' 1 the first' , getline (' .' ))
342+ $
343+ call feedkeys (" ?the\<c-g>\<c-g>\<c-g>\<cr> " , ' tx' )
344+ call assert_equal (' 2 the second' , getline (' .' ))
345+ $
346+ call feedkeys (" ?the\<c-t>\<cr> " , ' tx' )
347+ call assert_equal (' 1 the first' , getline (' .' ))
348+ $
349+ call feedkeys (" ?the\<c-t>\<c-t>\<cr> " , ' tx' )
350+ call assert_equal (' 3 the third' , getline (' .' ))
351+ $
352+ call feedkeys (" ?the\<c-t>\<c-t>\<c-t>\<cr> " , ' tx' )
353+ call assert_equal (' 2 the second' , getline (' .' ))
354+ " clean up
355+ set noincsearch
356+ call test_override (" char_avail" , 0 )
357+ bw !
358+ endfunc
0 commit comments