patch 9.1.1056: Vim doesn't highlight to be inserted text when completing

Problem:  Vim doesn't highlight to be inserted text when completing
Solution: Add support for the "preinsert" 'completeopt' value
          (glepnir)

Support automatically inserting the currently selected candidate word
that does not belong to the latter part of the leader.

fixes: #3433
closes: #16403

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/edit.c b/src/edit.c
index f4c5edf..72a82f8 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -690,8 +690,11 @@
 			&& stop_arrow() == OK)
 		{
 		    ins_compl_delete();
-		    ins_compl_insert(FALSE);
+		    ins_compl_insert(FALSE, FALSE);
 		}
+		// Delete preinserted text when typing special chars
+		else if (IS_WHITE_NL_OR_NUL(c) && ins_compl_preinsert_effect())
+		    ins_compl_delete();
 	    }
 	}