Re: Regression in gvim 7.0.00x

2006-05-25 Thread Benji Fisher
On Thu, May 25, 2006 at 02:06:55AM +0200, Luc Hermitte wrote:
 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.

 I do not have time to look at this closely, but I assume it is
because certain undocumented modes are now no longer supported.  This
was discussed on the vim users' list on the thread Insert Visual mode,
started by Gerald Lai on April 22.  (That is from my personal mail
archive; I assume that is enough information for you to find the
thread.)

 I see the following note in doc/version7.txt :

--- fixes and changes since Vim 7.0f ---
[...]
Prevent that using CTRL-R = in Insert mode can start Visual mode.

HTH --Benji Fisher


Re: Regression in gvim 7.0.00x

2006-05-25 Thread Benji Fisher
On Thu, May 25, 2006 at 03:17:54PM +0200, Luc Hermitte wrote:
 * On Thu, May 25, 2006 at 08:30:52AM -0400, Benji Fisher [EMAIL PROTECTED] 
 wrote:
 
   I see the following note in doc/version7.txt :
  
  --- fixes and changes since Vim 7.0f ---
  [...]
  Prevent that using CTRL-R = in Insert mode can start Visual mode.
 
 Must I understand that the workaround I've found won't work in the
 future ?  (the workaround consists in returning
 c-\c-nc-\c-ngvc-g to i_CTRL-R=)

 AFAIK this will continue to work.  The change is what you already
noticed (I think):  if C-R= calls a function, and that function
changes the mode, that will not be respected.  It is OK if the function
returns characters that change the mode.

 You might also have a look at

:help :map-expression

I have not played with it yet, but I think the idea is to give a simpler
alternative to certain C-R= constructions.

 What about @= ? Can I use it to execute a sequence that will change the
 mode to insert- or select-mode, according to the result of my function ?
 Or is it also an undocumented feature that may not be supported in the
 future ?

 I am not sure what you have in mind.

 Changes like this are not at all common.  In this case, vim was put
in an undocumented mode, and Bram was afraid that its behavior would be
unpredictable in that case.  (It could be considered a bug, since all of
vim's modes are supposed to be listed under :help vim-modes .)

HTH --Benji Fisher


Regression in gvim 7.0.00x

2006-05-24 Thread Luc Hermitte
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-ngv\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/