patch 9.1.0611: ambiguous mappings not correctly resolved with modifyOtherKeys

Problem:  ambiguous mappings not correctly resolved with modifyOtherKeys
Solution: Check for termcode when an upper case mapping is received and
          does not match (Oleg Goncharov)

Fix for mapping processing when capital leters are represented with terminal codes.

Problem: there are two mappings and
1) the first mapping is substring of the second,
2) the first non-matching letter is capital,
3) capital letters are represented with termcodes "ESC[27;2;<ascii code>~" in given system
then first mapping is applied instead of second.

Example:

    :map B b
    :map BBB blimp!

and then

    BBB -> bbb

instead of

    BBB -> blimp!

Solution: force termcodes check if capital letter does not match.

closes: #15251

Signed-off-by: Oleg Goncharov <goncharovoi@yandex.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim
index 7e450d9..507753c 100644
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -2256,6 +2256,17 @@
 
   iunmap '
   iunmap <C-W><C-A>
+
+  " clean buffer
+  %d _
+  imap B b
+  imap BBB blimp
+  let input = repeat(GetEscCodeCSI27('B', 2), 3)
+  call feedkeys("a" .. input .. "\<Esc>", 'Lx!')
+  call assert_equal('blimp', getline(1))
+  " cleanup
+  iunmap BBB
+  iunmap B
   set timeoutlen&
 endfunc