Hello,

I've been observing a regression on gvim since the release of vim 7.0.
I'm observing it on gvim 7.0.000 on windows, gvim 7.0.015 (or 17, I do
not remember) on Linux (gui=GTK2/Athena). It seems I do not have it with
the console version on Linux -- I haven't had the opportunity to test
the following lines of code with the console version.

I don't remember the problem on gvim 7.0e (at least I do not have it on
vim 7.0a on windows)


The problem consists in the combination of a few things:
- a nmapping selects (as in select-mode) a few characters
- an imapping calls a function (through i_CTRL-R) that executes the
  previous mapping with :normal, and then returns "\<esc>" to terminate
  the INSERT-SELECT mode and finish in select-mode.

Here are a few VimL lines that reproduce the problems.
Go in insert mode and type !exp!, Three lines are inserted, and
"toto" should be selected. It is not anymore

Hitting "!jp!" in normal-mode, or in insert-mode, selects "toto" as
expected.

Note: I have found a VimL workaround by returning
"\<c-\>\<c-n>\<c-\>\<c-n>gv\<c-g>" from I_expand_n_jump().
But there is still a regression I cannot explain.


------------------- >% --------------------
function! N_jump()
  call search('toto')
  let select = 'v' . virtcol('.').'|o'
  if &selection == 'exclusive' | let select = select . 'l' | endif
  call search('toto\zs')
  return select."\<c-g>"
endfunction

nnoremap !jp! @=N_jump()<cr>
imap     !jp! <c-\><c-n>!jp!

function! I_expand_n_jump()
  let str = "toto\ntiti\ntutu" 
  let l = line('.')
  put=str
  exe l
  normal !jp!
  return "\<esc>\<right>"
endfunction

inoremap !exp! <c-r>=I_expand_n_jump()<cr>
------------------- >% --------------------


-- 
Luc Hermitte
http://hermitte.free.fr/vim/

Reply via email to