Package: vim-common
Version: 2:8.0.0197-4+deb9u1
Severity: important

After upgrade to Stretch my <S-Insert> mapping in .vimrc stopped working.
In debian.vim there is a check for existing <S-Insert> mapping using maparg()
function. The second argument to this function is invalid. According to vim
documentation, {mode} argument can be either a single character string or an
empty string. Instead, a string with several characters is used, but the check
happens always against the first character only. Finally, as a result,
some existing mappings may become overridden.

Here is a proposed fix:

--- /usr/share/vim/vim80/debian.vim-orig    2017-12-03 22:29:53.939533583 +0200
+++ /usr/share/vim/vim80/debian.vim    2017-12-03 22:34:17.520734735 +0200
@@ -26,12 +26,21 @@ if &term =~ "xterm-debian" || &term =~ "
   set t_Sb= [4%dm
 endif

+function! <SID>MapExists(name, modes)
+  for mode in split(a:modes, '\zs')
+    if !empty(maparg(a:name, mode))
+      return 1
+    endif
+  endfor
+  return 0
+endfunction
+
 " Some Debian-specific things
 if has("autocmd")
   if has('gui')
     " Make shift-insert work like in Xterm
-    autocmd GUIEnter * if empty(maparg("<S-Insert>", "nvso")) |
execute "map <S-Insert> <MiddleMouse>" | endif
-    autocmd GUIEnter * if empty(maparg("<S-Insert>", "ic")) | execute
"map! <S-Insert> <MiddleMouse>" | endif
+    autocmd GUIEnter * if !<SID>MapExists("<S-Insert>", "nvso") |
execute "map <S-Insert> <MiddleMouse>" | endif
+    autocmd GUIEnter * if !<SID>MapExists("<S-Insert>", "ic") |
execute "map! <S-Insert> <MiddleMouse>" | endif
   endif
 endif


-- System Information:
Debian Release: 9.1
  APT prefers stable
  APT policy: (1000, 'stable'), (900, 'stable'), (750, 'testing'),
(500, 'stable-updates'), (500, 'unstable'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8),
LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages vim-common depends on:
ii  xxd  2:8.0.0197-4+deb9u1

Versions of packages vim-common recommends:
ii  vim-gtk [vim]  2:8.0.0197-4+deb9u1
ii  vim-tiny       2:8.0.0197-4+deb9u1

vim-common suggests no packages.

-- no debconf information

Reply via email to