patch 9.1.0507: hard to detect cursor movement in the command line

Problem:  hard to detect cursor movement in the command line
Solution: Add the CursorMovedC autocommand
          (Shougo Matsushita)

closes: #15040

Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index c9f257a..faa0f97 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -2096,6 +2096,21 @@
   au! CmdlineEnter
   au! CmdlineLeave
   let &shellslash = save_shellslash
+
+  au! CursorMovedC : let g:pos = getcmdpos()
+  let g:pos = 0
+  call feedkeys(":hello\<Left>\<ESC>", 'xt')
+  call assert_equal(5, g:pos)
+  call feedkeys(":12345678\<C-R>=setcmdpos(3)\<CR>\<ESC>", 'xt')
+  call assert_equal(3, g:pos)
+  au! CursorMovedC
+
+  " CursorMovedC changes the cursor position.
+  au! CursorMovedC : let g:pos = getcmdpos() | call setcmdpos(getcmdpos()-1)
+  let g:pos = 0
+  call feedkeys(":hello\<Left>\<ESC>", 'xt')
+  call assert_equal(5, g:pos)
+  au! CursorMovedC
 endfunc
 
 " Test for BufWritePre autocommand that deletes or unloads the buffer.