patch 8.2.2295: incsearch does not detect empty pattern properly

Problem:    Incsearch does not detect empty pattern properly.
Solution:   Return magic state when skipping over a pattern. (Christian
            Brabandt, closes #7612, closes #6420)
diff --git a/src/testdir/dumps/Test_incsearch_sub_01.dump b/src/testdir/dumps/Test_incsearch_sub_01.dump
new file mode 100644
index 0000000..5924fbd
--- /dev/null
+++ b/src/testdir/dumps/Test_incsearch_sub_01.dump
@@ -0,0 +1,9 @@
+|f+0&#ffffff0|o@1| |1| @64
+|f|o@1| |2| @64
+|f|o@1| |3| @64
+|f|o@1| |4| @64
+|a|b|c|||d|e|f| @62
+|~+0#4040ff13&| @68
+|~| @68
+|~| @68
+|:+0#0000000&|%|s|/|\|v|a|b|c||> @59
diff --git a/src/testdir/dumps/Test_incsearch_sub_02.dump b/src/testdir/dumps/Test_incsearch_sub_02.dump
new file mode 100644
index 0000000..c6b58cb
--- /dev/null
+++ b/src/testdir/dumps/Test_incsearch_sub_02.dump
@@ -0,0 +1,9 @@
+|f+0&#ffffff0|o@1| |1| @64
+|f|o@1| |2| @64
+|f|o@1| |3| @64
+|f|o@1| |4| @64
+|a|b|c|||d|e|f| @62
+|~+0#4040ff13&| @68
+|~| @68
+|~| @68
+|:+0#0000000&|1|,|5|s|/|\|v||> @60
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 1018294..2dc53d9 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1808,4 +1808,33 @@
   bw
 endfunc
 
+func Test_incsearch_substitute_dump2()
+  CheckOption incsearch
+  CheckScreendump
+
+  call writefile([
+	\ 'set incsearch hlsearch scrolloff=0',
+	\ 'for n in range(1, 4)',
+	\ '  call setline(n, "foo " . n)',
+	\ 'endfor',
+	\ 'call setline(5, "abc|def")',
+	\ '3',
+	\ ], 'Xis_subst_script2')
+  let buf = RunVimInTerminal('-S Xis_subst_script2', {'rows': 9, 'cols': 70})
+
+  call term_sendkeys(buf, ':%s/\vabc|')
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_sub_01', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  " The following should not be highlighted
+  call term_sendkeys(buf, ':1,5s/\v|')
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_sub_02', {})
+
+
+  call StopVimInTerminal(buf)
+  call delete('Xis_subst_script2')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab