Loading ...
Sorry, an error occurred while loading the content.

101953Re: Mindtuning: Cursor vs. lCursor vs. CursorIM?

Expand Messages
  • Dominique Pelle
    Feb 28, 2009
      Bram Moolenaar wrote:

      > Dominique Pelle wrote:
      >
      >> > John Little wrote:
      >> >
      >> >> On Feb 28, 6:53am, 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...
      >
      > Does this have any real effect?  If 'iminsert' is set to use lmap's
      > (value is 1), but there are none, it works the same way as setting
      > 'iminsert' off (value 0), right?


      I'm not 100% sure I understand the question. If 'iminsert' is value 1,
      then cursor has color "lCursor" regardless of whether there are keymaps
      or not.

      Problem happens in gVim only since lCursor only matters in GUI.

      The following test case illustrates the problem:

      $ gvim -u NONE -U NONE

      :hi Cursor guibg=#ff0000 " red cursor
      :hi lCursor guibg=#00ff00 " green cursor when keymap activated

      :set keymap=esperanto " or any other keymap

      :" type something in INSERT mode (Cursor should be green)
      icxgx<Esc>

      :" disable keymaps
      :set keymap=

      :" type something in INSERT mode again.
      :" Observe that cursor is still green (I would expect it to be red)
      icxgx<Esc>

      With proposed patch, the cursor is read (as I'd expect)
      in INSERT mode after disabling keymaps with ":set keymap="

      Without patch, the workaround to have proper cursor color
      when disabling keymaps is to do...

      :set iminsert=0 imsearch=0 keymap=

      -- Dominique

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 13 messages in this topic