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

Re: [PATCH] add {dict} argument to getcharmod()

Expand Messages
  • tyru
    On Fri, Dec 2, 2011 at 6:40 PM, Yukihiro Nakadaira
    Message 1 of 7 , Dec 2, 2011
    • 0 Attachment
      On Fri, Dec 2, 2011 at 6:40 PM, Yukihiro Nakadaira <yukihiro.nakadaira@...> wrote:
      `:help getcharmod()` is not correct.
      Result was changed by v7-0055.
      And mouse double, triple and quadruple do not have individual bit.
      Actual result is

       2   shift
       4   control
       8   alt
       16  meta (when it's different from ALT)
       32  mouse double click
       64  mouse triple click
       96  mouse quadruple click
       128 Macintosh only: command

      Two bits are used for mouse.
      0b00100000 = double
      0b01000000 = triple
      0b01100000 = quadruple

      Dictionary version should behave as following.

      function! Getcharmoddict()
       let mod = getcharmod()
       return {
             \ 'shift': mod / 2 % 2,
             \ 'control': mod / 4 % 2,
             \ 'alt': mod / 8 % 2,
             \ 'meta': mod / 16 % 2,
             \ 'mousedouble': mod / 32 % 4 == 1,
             \ 'mousetriple': mod / 32 % 4 == 2,
             \ 'mousequad': mod / 32 % 4 == 3,
             \ 'command': mod / 128 % 2,
             \ }
      endfunction
      oh, I don't think about that code...
      maybe this patch becomes useless.
      but that code should be on getcharmod() help, isn't it?
       

      --
      Yukihiro Nakadaira - yukihiro.nakadaira@...

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.