Dominique Pelle wrote:

> John Little wrote:
>
>> On Feb 28, 6:53 am, Kenneth Reid Beesley wrote:
>>
>>> But  :help lCursor   returned no information.
>>
>> BTW, You could have tried
>>
>> :helpgrep lCursor
>>
>> Regards, John
>
> Yes, ":helpgrep lCursor" gives a few hints.  But still,
> lCursor deserves a tag I think to make ":help lCursor"
> work. I did not know about lCursor until today, it's useful.
>
> I wonder whether this is a bug though:
>
> $ gvim -u NONE -U NONE
>
> :hi Cursor guibg=#ff0000           " red cursor
> :hi lCursor guibg=#00ff00          " green cursor when keymap activated
>
> :set imcursor?
>  iminsert=2            " OK, expected
>
> :set keymap=esperanto   " or any other keymap
> :set iminsert?
>  iminsert=1            " OK, expected
>
> :set keymap=
> :set iminsert?
>  iminsert=1            " Hmmm, shouldn't this be back to 2???
>
> lCursor is nice so that cursor color changes aspect when a
> keymap is being activated. But if I cancel the keymap with
> ":set keymap=" then cursor remains in the same color
> (green, lCursor) as if there was still a keymap activated.
> It seems to me that the cursor should then become red
> (Cursor).  I can work around with ":set imcursor=2" which
> puts back the cursor in red (Cursor).
>
> In ":help iminsert" I see:
>
>        Specifies whether :lmap or an Input Method (IM) is to be used in
>        Insert mode.  Valid values:
>                0       :lmap is off and IM is off
>                1       :lmap is ON and IM is off
>                2       :lmap is off and IM is ON
>
> I'm using vim-7.2.127 (huge), GUI GTK2 on Linux x86.
>
> -- Dominique


Attached patch fixes the problem I described in my previous
email: it makes the cursor go back to normal color (Cursor
instead of lCursor) when cancelling keymaps with ":set keymap=".

Please review it since I must admit I don't fully understand
how 'iminsert' and 'imsearch' are supposed to work...

Regards
-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: option.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/option.c,v
retrieving revision 1.147
diff -c -r1.147 option.c
*** option.c	21 Feb 2009 19:28:43 -0000	1.147
--- option.c	28 Feb 2009 08:54:02 -0000
***************
*** 5798,5808 ****
  	errmsg = keymap_init();
  
  	/* When successfully installed a new keymap switch on using it. */
! 	if (*curbuf->b_p_keymap != NUL && errmsg == NULL)
  	{
! 	    curbuf->b_p_iminsert = B_IMODE_LMAP;
! 	    if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
! 		curbuf->b_p_imsearch = B_IMODE_LMAP;
  	    set_iminsert_global();
  	    set_imsearch_global();
  # ifdef FEAT_WINDOWS
--- 5798,5817 ----
  	errmsg = keymap_init();
  
  	/* When successfully installed a new keymap switch on using it. */
! 	if (errmsg == NULL)
  	{
! 	    if (*curbuf->b_p_keymap != NUL)
! 	    {
! 		curbuf->b_p_iminsert = B_IMODE_LMAP;
! 		if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
! 		    curbuf->b_p_imsearch = B_IMODE_LMAP;
! 	    }
! 	    else
! 	    {
! 		/* Revert to the default keymap */
! 		curbuf->b_p_iminsert = B_IMODE_NONE;
! 		curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
! 	    }
  	    set_iminsert_global();
  	    set_imsearch_global();
  # ifdef FEAT_WINDOWS

Reply via email to