patch 9.1.1059: completion: input text deleted with preinsert when adding leader

Problem:  completion: input text deleted with preinsert when adding leader
Solution: remove compl_length and check the ptr for being equal
          to pattern when preinsert is active (glepnir)

closes: #16545

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index d0f90c8..49e4465 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -3112,6 +3112,10 @@
   call assert_equal("hello hero", getline('.'))
   call assert_equal(2, col('.'))
 
+  call feedkeys("Shello hero\<CR>h\<C-X>\<C-N>er", 'tx')
+  call assert_equal("hero", getline('.'))
+  call assert_equal(3, col('.'))
+
   " can not work with fuzzy
   set cot+=fuzzy
   call feedkeys("S\<C-X>\<C-O>", 'tx')