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

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

Expand Messages
  • John Little
    ... BTW, You could have tried ... Regards, John --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist.
    Message 1 of 13 , Feb 27, 2009
    • 0 Attachment
      On Feb 28, 6:53 am, Kenneth Reid Beesley <krbees...@...> wrote:

      > But  :help lCursor   returned no information.

      BTW, You could have tried

      :helpgrep lCursor

      Regards, John
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Dominique Pelle
      ... 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
      Message 2 of 13 , Feb 28, 2009
      • 0 Attachment
        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

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Dominique Pelle
        ... 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
        Message 3 of 13 , Feb 28, 2009
        • 0 Attachment
          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
          -~----------~----~----~----~------~----~------~--~---
        • Tony Mechelynck
          ... With no patch, just use ... and the cursor will go back to Cursor. Currently, setting keymap to something also sets iminsert to 1 but setting keymap
          Message 4 of 13 , Feb 28, 2009
          • 0 Attachment
            On 28/02/09 10:00, Dominique Pelle wrote:
            > 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

            With no patch, just use

            :setlocal keymap= imi=0

            and the cursor will go back to Cursor.

            Currently, setting 'keymap' to something also sets 'iminsert' to 1 but
            setting 'keymap' to empty doesn't automagically set 'iminsert' to zero.
            Similarly, I think there is an interaction between using an Input Method
            (XIM or Windows IME) and setting 'imi' to 2 but I don't know the details.

            Warning: a future patch issued by Bram is currently being tested (by me
            and possibly by others) about setting 'iminsert' locally and not
            globally when using ":setlocal keymap=keymapname". It has been published
            in an email by Bram with Subject "Re: Bug? Keymaps (when set by menu)
            and 'iminsert' (when set implicitly by setting 'keymap') are set
            globally", sent to vim_dev list and dated "Thu, 26 Feb 2009 04:21:36 +0100".


            Best regards,
            Tony.
            --
            SIGIRO -- too much irony (core dumped)

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Bram Moolenaar
            ... 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
            Message 5 of 13 , Feb 28, 2009
            • 0 Attachment
              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?

              --
              hundred-and-one symptoms of being an internet addict:
              137. You decide to stay in college for an additional year or two,
              just so you can have the free Internet access.

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ download, build and distribute -- http://www.A-A-P.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Tony Mechelynck
              On 28/02/09 23:33, Bram Moolenaar wrote: [...] ... Except that when lCursor is defined, the cursor will have a weird color. It doesn t trouble _me_ because I
              Message 6 of 13 , Feb 28, 2009
              • 0 Attachment
                On 28/02/09 23:33, Bram Moolenaar wrote:
                [...]
                > 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?
                >

                Except that when lCursor is defined, the cursor will have a weird color.
                It doesn't trouble _me_ because I know what 'iminsert' is about.


                Best regards,
                Tony.
                --
                There is a great discovery still to be made in Literature: that of
                paying literary men by the quantity they do NOT write.

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • Dominique Pelle
                ... 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.
                Message 7 of 13 , Feb 28, 2009
                • 0 Attachment
                  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
                  -~----------~----~----~----~------~----~------~--~---
                • Bram Moolenaar
                  ... OK, so this is just about the cursor color. I thought the intention was to fix something else. ... The alternative would be to have the cursor color also
                  Message 8 of 13 , Mar 1, 2009
                  • 0 Attachment
                    Dominique Pelle wrote:

                    > >> > John Little wrote:
                    > >> >
                    > >> >> On Feb 28, 6:53am, Kenneth Reid Beesley wrote:
                    > >> >>
                    > >> >>> But :help lCursor =A0returned 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=3D#ff0000 =A0 =A0 =A0" red cursor
                    > >> > :hi lCursor guibg=3D#00ff00 =A0 =A0 " green cursor when keymap activat=
                    > ed
                    > >> >
                    > >> > :set imcursor?
                    > >> > iminsert=3D2 =A0 =A0 =A0" OK, expected
                    > >> >
                    > >> > :set keymap=3Desperanto =A0" or any other keymap
                    > >> > :set iminsert?
                    > >> > iminsert=3D1 =A0 =A0 =A0" OK, expected
                    > >> >
                    > >> > :set keymap=3D
                    > >> > :set iminsert?
                    > >> > iminsert=3D1 =A0 =A0 =A0" 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=3D" 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=3D2" which
                    > >> > puts back the cursor in red (Cursor).
                    > >> >
                    > >> > In ":help iminsert" I see:
                    > >> >
                    > >> > =A0 =A0Specifies whether :lmap or an Input Method (IM) is to be used i=
                    > n
                    > >> > =A0 =A0Insert mode. Valid values:
                    > >> > =A0 =A0 =A0 =A00 =A0 =A0:lmap is off and IM is off
                    > >> > =A0 =A0 =A0 =A01 =A0 =A0:lmap is ON and IM is off
                    > >> > =A0 =A0 =A0 =A02 =A0 =A0: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=3D".
                    > >>
                    > >> 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? =A0If '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.

                    OK, so this is just about the cursor color. I thought the intention was
                    to fix something else.

                    > 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=

                    The alternative would be to have the cursor color also take into account
                    if any keymappings are defined. But that's getting complicated.

                    I think the code should check that 'iminsert' and 'imsearch' are
                    actually at the B_IMODE_LMAP value. Otherwise this doesn't work:

                    :set iminsert=2 keymap=

                    New patch:


                    *** ../vim-7.2.128/src/option.c Sat Feb 21 20:27:00 2009
                    --- src/option.c Sun Mar 1 23:15:21 2009
                    ***************
                    *** 5797,5810 ****
                    /* load or unload key mapping tables */
                    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
                    status_redraw_curbuf();
                    # endif
                    --- 5797,5824 ----
                    /* load or unload key mapping tables */
                    errmsg = keymap_init();

                    ! if (errmsg == NULL)
                    {
                    ! if (*curbuf->b_p_keymap != NUL)
                    ! {
                    ! /* Installed a new keymap, switch on using it. */
                    ! curbuf->b_p_iminsert = B_IMODE_LMAP;
                    ! if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
                    ! curbuf->b_p_imsearch = B_IMODE_LMAP;
                    ! }
                    ! else
                    ! {
                    ! /* Cleared the keyamp, may reset 'iminsert' and 'imsearch'. */
                    ! if (curbuf->b_p_iminsert == B_IMODE_LMAP)
                    ! curbuf->b_p_iminsert = B_IMODE_NONE;
                    ! if (curbuf->b_p_imsearch == B_IMODE_LMAP)
                    ! curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
                    ! }
                    ! if ((opt_flags & OPT_LOCAL) == 0)
                    ! {
                    ! set_iminsert_global();
                    ! set_imsearch_global();
                    ! }
                    # ifdef FEAT_WINDOWS
                    status_redraw_curbuf();
                    # endif


                    --
                    hundred-and-one symptoms of being an internet addict:
                    143. You dream in pallettes of 216 websafe colors.

                    /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                    /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                    \\\ download, build and distribute -- http://www.A-A-P.org ///
                    \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_use" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Tony Mechelynck
                    On 01/03/09 23:59, Bram Moolenaar wrote: [...] ... [...] I notice it includes the patch I ve been testing, about not setting iminsert globally when using
                    Message 9 of 13 , Mar 2, 2009
                    • 0 Attachment
                      On 01/03/09 23:59, Bram Moolenaar wrote:
                      [...]
                      > I think the code should check that 'iminsert' and 'imsearch' are
                      > actually at the B_IMODE_LMAP value. Otherwise this doesn't work:
                      >
                      > :set iminsert=2 keymap=
                      >
                      > New patch:
                      [...]

                      I notice it includes the patch I've been testing, about not setting
                      'iminsert' globally when using ":setlocal keymap=...". I'm not going to
                      test this one, but if I were, I would first reverse that other one (and
                      when it becomes official, I will) before applying this new one. If
                      anyone has (like me) been testing Bram's option.c patch published a few
                      days ago about keymap/imi: people, heed my warning.


                      Best regards,
                      Tony.
                      --
                      Real software engineers don't debug programs, they verify correctness.
                      This process doesn't necessarily involve execution of anything on a
                      computer, except perhaps a Correctness Verification Aid package.

                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_use" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    • Dominique Pelle
                      ... I tried the proposed patch. It looks OK. Just a minor typo to report in the comment: keyamp - keymap Thanks! -- Dominique
                      Message 10 of 13 , Mar 3, 2009
                      • 0 Attachment
                        2009/3/1 Bram Moolenaar <Bram@...>:
                        >
                        > Dominique Pelle wrote:
                        >
                        >> >> > John Little wrote:
                        >> >> >
                        >> >> >> On Feb 28, 6:53am, Kenneth Reid Beesley wrote:
                        >> >> >>
                        >> >> >>> But :help lCursor =A0returned 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=3D#ff0000 =A0 =A0 =A0" red cursor
                        >> >> > :hi lCursor guibg=3D#00ff00 =A0 =A0 " green cursor when keymap activat=
                        >> ed
                        >> >> >
                        >> >> > :set imcursor?
                        >> >> > iminsert=3D2 =A0 =A0 =A0" OK, expected
                        >> >> >
                        >> >> > :set keymap=3Desperanto =A0" or any other keymap
                        >> >> > :set iminsert?
                        >> >> > iminsert=3D1 =A0 =A0 =A0" OK, expected
                        >> >> >
                        >> >> > :set keymap=3D
                        >> >> > :set iminsert?
                        >> >> > iminsert=3D1 =A0 =A0 =A0" 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=3D" 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=3D2" which
                        >> >> > puts back the cursor in red (Cursor).
                        >> >> >
                        >> >> > In ":help iminsert" I see:
                        >> >> >
                        >> >> > =A0 =A0Specifies whether :lmap or an Input Method (IM) is to be used i=
                        >> n
                        >> >> > =A0 =A0Insert mode. Valid values:
                        >> >> > =A0 =A0 =A0 =A00 =A0 =A0:lmap is off and IM is off
                        >> >> > =A0 =A0 =A0 =A01 =A0 =A0:lmap is ON and IM is off
                        >> >> > =A0 =A0 =A0 =A02 =A0 =A0: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=3D".
                        >> >>
                        >> >> 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? =A0If '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.
                        >
                        > OK, so this is just about the cursor color.  I thought the intention was
                        > to fix something else.
                        >
                        >> 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=
                        >
                        > The alternative would be to have the cursor color also take into account
                        > if any keymappings are defined.  But that's getting complicated.
                        >
                        > I think the code should check that 'iminsert' and 'imsearch' are
                        > actually at the B_IMODE_LMAP value.  Otherwise this doesn't work:
                        >
                        >        :set iminsert=2 keymap=
                        >
                        > New patch:
                        >
                        >
                        > *** ../vim-7.2.128/src/option.c Sat Feb 21 20:27:00 2009
                        > --- src/option.c        Sun Mar  1 23:15:21 2009
                        > ***************
                        > *** 5797,5810 ****
                        >        /* load or unload key mapping tables */
                        >        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
                        >            status_redraw_curbuf();
                        >  # endif
                        > --- 5797,5824 ----
                        >        /* load or unload key mapping tables */
                        >        errmsg = keymap_init();
                        >
                        > !       if (errmsg == NULL)
                        >        {
                        > !           if (*curbuf->b_p_keymap != NUL)
                        > !           {
                        > !               /* Installed a new keymap, switch on using it. */
                        > !               curbuf->b_p_iminsert = B_IMODE_LMAP;
                        > !               if (curbuf->b_p_imsearch != B_IMODE_USE_INSERT)
                        > !                   curbuf->b_p_imsearch = B_IMODE_LMAP;
                        > !           }
                        > !           else
                        > !           {
                        > !               /* Cleared the keyamp, may reset 'iminsert' and 'imsearch'. */
                        > !               if (curbuf->b_p_iminsert == B_IMODE_LMAP)
                        > !                   curbuf->b_p_iminsert = B_IMODE_NONE;
                        > !               if (curbuf->b_p_imsearch == B_IMODE_LMAP)
                        > !                   curbuf->b_p_imsearch = B_IMODE_USE_INSERT;
                        > !           }
                        > !           if ((opt_flags & OPT_LOCAL) == 0)
                        > !           {
                        > !               set_iminsert_global();
                        > !               set_imsearch_global();
                        > !           }
                        >  # ifdef FEAT_WINDOWS
                        >            status_redraw_curbuf();
                        >  # endif
                        >


                        I tried the proposed patch. It looks OK.
                        Just a minor typo to report in the comment: keyamp -> keymap

                        Thanks!

                        -- Dominique

                        --~--~---------~--~----~------------~-------~--~----~
                        You received this message from the "vim_use" maillist.
                        For more information, visit http://www.vim.org/maillist.php
                        -~----------~----~----~----~------~----~------~--~---
                      Your message has been successfully submitted and would be delivered to recipients shortly.