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

shift-Tab key on iOS and UTF8

Expand Messages
  • Zulox4
    Hello, I added a Ctrl key to iOS version, and tried to modify the code for iOS to add the touch for shift-tab, (I use shift-Ctrl-I touches combination). For
    Message 1 of 6 , May 11 10:48 PM
    • 0 Attachment
      Hello,
      I added a Ctrl key to iOS version, and tried to modify the code for iOS to add the touch for shift-tab, (I use shift-Ctrl-I touches combination). For sending the touches to vim it is used the add_to_input_buf function, in insertText function, the code source example is in file link:
      https://github.com/applidium/Vim/blob/master/src/gui_ios.m
      .....
      - (void)insertText:(NSString *)text {

      add_to_input_buf((char_u *)[text UTF8String], [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);

      [_textView setNeedsDisplay];

      }

      - (void)deleteBackward {

      char escapeString[] = {BS, 0};

      [self insertText:[NSString stringWithUTF8String:escapeString]];

      }
      .....
      But I did not find the correct codes (bytes) or the good array of chars, i think (3 bytes) to send to the buffer with add_to_input_buf for shift-tab to send to the buffer with add_to_input_buf in ex (:) mode, for completion, for example for the keystrokes :no<sh-tab> to have :normal.
      In can say that the <Tab> key (on IOS with Ctrl-I) work well for completion.
      Could someone give a little help?
      Thanks a lot !

      --
      --
      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 because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Tony Mechelynck
      ... AFAIK, the cooked keyboard input mode used by Vim makes all three of Tab, Ctrl-i and Ctrl-Shift-i appear the same to it (0x09). Blame the inventors of
      Message 2 of 6 , May 12 1:21 AM
      • 0 Attachment
        On 12/05/13 07:48, Zulox4 wrote:
        > Hello,
        > I added a Ctrl key to iOS version, and tried to modify the code for iOS to add the touch for shift-tab, (I use shift-Ctrl-I touches combination). For sending the touches to vim it is used the add_to_input_buf function, in insertText function, the code source example is in file link:
        > https://github.com/applidium/Vim/blob/master/src/gui_ios.m
        > .....
        > - (void)insertText:(NSString *)text {
        >
        > add_to_input_buf((char_u *)[text UTF8String], [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
        >
        > [_textView setNeedsDisplay];
        >
        > }
        >
        > - (void)deleteBackward {
        >
        > char escapeString[] = {BS, 0};
        >
        > [self insertText:[NSString stringWithUTF8String:escapeString]];
        >
        > }
        > .....
        > But I did not find the correct codes (bytes) or the good array of chars, i think (3 bytes) to send to the buffer with add_to_input_buf for shift-tab to send to the buffer with add_to_input_buf in ex (:) mode, for completion, for example for the keystrokes :no<sh-tab> to have :normal.
        > In can say that the <Tab> key (on IOS with Ctrl-I) work well for completion.
        > Could someone give a little help?
        > Thanks a lot !
        >

        AFAIK, the "cooked" keyboard input mode used by Vim makes all three of
        Tab, Ctrl-i and Ctrl-Shift-i appear the same to it (0x09). Blame the
        inventors of the ASCII papertape code, who intentionally made the Shift
        key status irrelevant when used in combination with Ctrl+letter. So I
        don't think you'll be able to map Ctrl-i and Ctrl-Shift-i to do
        different things in Vim. Note, BTW, that while I is Shift-i (A is
        Shift-a, B is Shift-b, etc.), the notation Ctrl-I is how one usually
        shows the Ctrl-i combination (similarly Ctrl-A actually means Ctrl-a,
        Ctrl-B means Ctrl-b, etc.).

        See also :help map.txt


        Best regards,
        Tony.
        --
        There's no easy quick way out, we're gonna have to live through our
        whole lives, win, lose, or draw.
        -- Walt Kelly

        --
        --
        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 because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Zulox4
        Hi, In iOS, a have my virtual keyboard, I have added Ctrl touch. When use Ctrl (have a status variable, working like shift) and after touch i (not same time),
        Message 3 of 6 , May 12 7:11 AM
        • 0 Attachment
          Hi,

          In iOS, a have my virtual keyboard, I have added Ctrl touch. When use Ctrl (have a status variable, working like shift) and after touch i (not same time), generate ascii for i => this combination generate a TAB, (send to buffer 09 with add_to_input_buf), that works, but when used (shift+i) =>(gnerate ascii code for I), and touched ctrl before, (for me that is ctrl-sh-i or ctrl-I), I need to send to buffer with add_to_input_buf the good sequence of bytes for Sh-Tab in Vim, I tried a lot of combination, but doesn't work.

          Thanks !
          On Sunday, May 12, 2013 10:21:48 AM UTC+2, Tony Mechelynck wrote:
          > On 12/05/13 07:48, Zulox4 wrote:
          >
          > > Hello,
          >
          > > I added a Ctrl key to iOS version, and tried to modify the code for iOS to add the touch for shift-tab, (I use shift-Ctrl-I touches combination). For sending the touches to vim it is used the add_to_input_buf function, in insertText function, the code source example is in file link:
          >
          > > https://github.com/applidium/Vim/blob/master/src/gui_ios.m
          >
          > > .....
          >
          > > - (void)insertText:(NSString *)text {
          >
          > >
          >
          > > add_to_input_buf((char_u *)[text UTF8String], [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
          >
          > >
          >
          > > [_textView setNeedsDisplay];
          >
          > >
          >
          > > }
          >
          > >
          >
          > > - (void)deleteBackward {
          >
          > >
          >
          > > char escapeString[] = {BS, 0};
          >
          > >
          >
          > > [self insertText:[NSString stringWithUTF8String:escapeString]];
          >
          > >
          >
          > > }
          >
          > > .....
          >
          > > But I did not find the correct codes (bytes) or the good array of chars, i think (3 bytes) to send to the buffer with add_to_input_buf for shift-tab to send to the buffer with add_to_input_buf in ex (:) mode, for completion, for example for the keystrokes :no<sh-tab> to have :normal.
          >
          > > In can say that the <Tab> key (on IOS with Ctrl-I) work well for completion.
          >
          > > Could someone give a little help?
          >
          > > Thanks a lot !
          >
          > >
          >
          >
          >
          > AFAIK, the "cooked" keyboard input mode used by Vim makes all three of
          >
          > Tab, Ctrl-i and Ctrl-Shift-i appear the same to it (0x09). Blame the
          >
          > inventors of the ASCII papertape code, who intentionally made the Shift
          >
          > key status irrelevant when used in combination with Ctrl+letter. So I
          >
          > don't think you'll be able to map Ctrl-i and Ctrl-Shift-i to do
          >
          > different things in Vim. Note, BTW, that while I is Shift-i (A is
          >
          > Shift-a, B is Shift-b, etc.), the notation Ctrl-I is how one usually
          >
          > shows the Ctrl-i combination (similarly Ctrl-A actually means Ctrl-a,
          >
          > Ctrl-B means Ctrl-b, etc.).
          >
          >
          >
          > See also :help map.txt
          >
          >
          >
          >
          >
          > Best regards,
          >
          > Tony.
          >
          > --
          >
          > There's no easy quick way out, we're gonna have to live through our
          >
          > whole lives, win, lose, or draw.
          >
          > -- Walt Kelly

          --
          --
          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 because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Zulox4
          Hello, I found that shift-Tab (K_SH_TAB) is a K_SPECIAL key (3 bytes), like Back-space, that has code 08H. At the end, in normal.c the K_SPECIAL keys are
          Message 4 of 6 , May 12 11:13 PM
          • 0 Attachment
            Hello,

            I found that shift-Tab (K_SH_TAB) is a K_SPECIAL key (3 bytes), like Back-space, that has code 08H.
            At the end, in normal.c the K_SPECIAL keys are compared with:
            #define K_S_TAB TERMCAP2KEY('k', 'B') ===> -17003 value => 128,107,98 bytes
            #define K_BS TERMCAP2KEY('k', 'b') ===> -25195 value => 128,107,66 bytes

            What is the code of Shift-Tab after call of inchar function in getchar.c ?
            here :
            ...
            /*
            * get a character: 3. from the user - get it
            */
            wait_tb_len = typebuf.tb_len;
            c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len,
            typebuf.tb_buflen - typebuf.tb_off - typebuf.tb_len - 1,
            !advance
            ? 0
            : ((typebuf.tb_len == 0
            || !(p_timeout || (p_ttimeout
            && keylen == KEYLEN_PART_KEY)))
            ? -1L
            : ((keylen == KEYLEN_PART_KEY && p_ttm >= 0)
            ? p_ttm
            : p_tm)), typebuf.tb_change_cnt);

            ...

            Thanks a lot !
            Best regards !
            On Sunday, May 12, 2013 4:11:35 PM UTC+2, Zulox4 wrote:
            > Hi,
            >
            > In iOS, a have my virtual keyboard, I have added Ctrl touch. When use Ctrl (have a status variable, working like shift) and after touch i (not same time), generate ascii for i => this combination generate a TAB, (send to buffer 09 with add_to_input_buf), that works, but when used (shift+i) =>(gnerate ascii code for I), and touched ctrl before, (for me that is ctrl-sh-i or ctrl-I), I need to send to buffer with add_to_input_buf the good sequence of bytes for Sh-Tab in Vim, I tried a lot of combination, but doesn't work.
            >
            > Thanks !
            > On Sunday, May 12, 2013 10:21:48 AM UTC+2, Tony Mechelynck wrote:
            > > On 12/05/13 07:48, Zulox4 wrote:
            > >
            > > > Hello,
            > >
            > > > I added a Ctrl key to iOS version, and tried to modify the code for iOS to add the touch for shift-tab, (I use shift-Ctrl-I touches combination). For sending the touches to vim it is used the add_to_input_buf function, in insertText function, the code source example is in file link:
            > >
            > > > https://github.com/applidium/Vim/blob/master/src/gui_ios.m
            > >
            > > > .....
            > >
            > > > - (void)insertText:(NSString *)text {
            > >
            > > >
            > >
            > > > add_to_input_buf((char_u *)[text UTF8String], [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
            > >
            > > >
            > >
            > > > [_textView setNeedsDisplay];
            > >
            > > >
            > >
            > > > }
            > >
            > > >
            > >
            > > > - (void)deleteBackward {
            > >
            > > >
            > >
            > > > char escapeString[] = {BS, 0};
            > >
            > > >
            > >
            > > > [self insertText:[NSString stringWithUTF8String:escapeString]];
            > >
            > > >
            > >
            > > > }
            > >
            > > > .....
            > >
            > > > But I did not find the correct codes (bytes) or the good array of chars, i think (3 bytes) to send to the buffer with add_to_input_buf for shift-tab to send to the buffer with add_to_input_buf in ex (:) mode, for completion, for example for the keystrokes :no<sh-tab> to have :normal.
            > >
            > > > In can say that the <Tab> key (on IOS with Ctrl-I) work well for completion.
            > >
            > > > Could someone give a little help?
            > >
            > > > Thanks a lot !
            > >
            > > >
            > >
            > >
            > >
            > > AFAIK, the "cooked" keyboard input mode used by Vim makes all three of
            > >
            > > Tab, Ctrl-i and Ctrl-Shift-i appear the same to it (0x09). Blame the
            > >
            > > inventors of the ASCII papertape code, who intentionally made the Shift
            > >
            > > key status irrelevant when used in combination with Ctrl+letter. So I
            > >
            > > don't think you'll be able to map Ctrl-i and Ctrl-Shift-i to do
            > >
            > > different things in Vim. Note, BTW, that while I is Shift-i (A is
            > >
            > > Shift-a, B is Shift-b, etc.), the notation Ctrl-I is how one usually
            > >
            > > shows the Ctrl-i combination (similarly Ctrl-A actually means Ctrl-a,
            > >
            > > Ctrl-B means Ctrl-b, etc.).
            > >
            > >
            > >
            > > See also :help map.txt
            > >
            > >
            > >
            > >
            > >
            > > Best regards,
            > >
            > > Tony.
            > >
            > > --
            > >
            > > There's no easy quick way out, we're gonna have to live through our
            > >
            > > whole lives, win, lose, or draw.
            > >
            > > -- Walt Kelly

            --
            --
            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 because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Tony Mechelynck
            ... [...] I think you re on a wild goose chase. To make F5 act like Tab and Shift-F5 act like Shift-Tab (in all modes), you would just write the following
            Message 5 of 6 , May 14 3:21 AM
            • 0 Attachment
              On 13/05/13 08:13, Zulox4 wrote:
              > Hello,
              >
              > I found that shift-Tab (K_SH_TAB) is a K_SPECIAL key (3 bytes), like Back-space, that has code 08H.
              > At the end, in normal.c the K_SPECIAL keys are compared with:
              > #define K_S_TAB TERMCAP2KEY('k', 'B') ===> -17003 value => 128,107,98 bytes
              > #define K_BS TERMCAP2KEY('k', 'b') ===> -25195 value => 128,107,66 bytes
              >
              > What is the code of Shift-Tab after call of inchar function in getchar.c ?
              > here :
              [...]

              I think you're on a wild goose chase.

              To make F5 act like Tab and Shift-F5 act like Shift-Tab (in all modes),
              you would just write the following (with < > signs and all) somewhere in
              your vimrc, and nothing more would be necessary:

              map <F5> <Tab>
              map <S-F5> <S-Tab>
              map! <F5> <Tab>
              map! <S-F5> <S-Tab>

              You want to use Ctrl-I and Ctrl-Shift-I rather than F5 and Shift-F5. Now
              Ctrl-I already acts like Tab out of the box because Vim cannot tell them
              apart (and for the same reason, Ctrl-M acts like <Enter> and Ctrl-[ acts
              like <Esc>). So far so good. The problem is with Ctrl-Shift-I. Vim
              cannot tell Ctrl-I and Ctrl-Shift-I apart from each other (even if some
              other program can), therefore you cannot make them do different things
              in Vim. This is documented: see ":help CTRL-{char}" (without the quotes,
              and typed just like this, ending in bra see eich aye ahr ket).


              Best regards,
              Tony.
              --
              SOLDIER: Where did you get the coconuts?
              ARTHUR: Through ... We found them.
              SOLDIER: Found them? In Mercea. The coconut's tropical!
              "Monty Python and the Holy Grail" PYTHON (MONTY)
              PICTURES LTD

              --
              --
              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 because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • Zulox4
              ... You have right, I tried to map the F5 key to Shift-Tab combination, but when using for completion the normal word with the keystrokes ... i have ... The
              Message 6 of 6 , May 14 1:54 PM
              • 0 Attachment
                On Tuesday, May 14, 2013 12:21:41 PM UTC+2, Tony Mechelynck wrote:
                > On 13/05/13 08:13, Zulox4 wrote:
                >
                > > Hello,
                >
                > >
                >
                > > I found that shift-Tab (K_SH_TAB) is a K_SPECIAL key (3 bytes), like Back-space, that has code 08H.
                >
                > > At the end, in normal.c the K_SPECIAL keys are compared with:
                >
                > > #define K_S_TAB TERMCAP2KEY('k', 'B') ===> -17003 value => 128,107,98 bytes
                >
                > > #define K_BS TERMCAP2KEY('k', 'b') ===> -25195 value => 128,107,66 bytes
                >
                > >
                >
                > > What is the code of Shift-Tab after call of inchar function in getchar.c ?
                >
                > > here :
                >
                > [...]
                >
                >
                >
                > I think you're on a wild goose chase.
                >
                >
                >
                > To make F5 act like Tab and Shift-F5 act like Shift-Tab (in all modes),
                >
                > you would just write the following (with < > signs and all) somewhere in
                >
                > your vimrc, and nothing more would be necessary:
                >
                >
                >
                > map <F5> <Tab>
                >
                > map <S-F5> <S-Tab>
                >
                > map! <F5> <Tab>
                >
                > map! <S-F5> <S-Tab>
                >
                >
                >
                > You want to use Ctrl-I and Ctrl-Shift-I rather than F5 and Shift-F5. Now
                >
                > Ctrl-I already acts like Tab out of the box because Vim cannot tell them
                >
                > apart (and for the same reason, Ctrl-M acts like <Enter> and Ctrl-[ acts
                >
                > like <Esc>). So far so good. The problem is with Ctrl-Shift-I. Vim
                >
                > cannot tell Ctrl-I and Ctrl-Shift-I apart from each other (even if some
                >
                > other program can), therefore you cannot make them do different things
                >
                > in Vim. This is documented: see ":help CTRL-{char}" (without the quotes,
                >
                > and typed just like this, ending in bra see eich aye ahr ket).
                >
                >
                >
                >
                >
                > Best regards,
                >
                > Tony.
                >
                > --
                >
                > SOLDIER: Where did you get the coconuts?
                >
                > ARTHUR: Through ... We found them.
                >
                > SOLDIER: Found them? In Mercea. The coconut's tropical!
                >
                > "Monty Python and the Holy Grail" PYTHON (MONTY)
                >
                > PICTURES LTD

                You have right, I tried to map the F5 key to Shift-Tab combination, but when using for completion the "normal" word with the keystrokes

                :no<F5>

                i have

                :no<S-Tab>

                The expected output should be

                :normal

                What wrong ? Thanks a lot for helping !

                --
                --
                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 because you are subscribed to the Google Groups "vim_dev" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/groups/opt_out.
              Your message has been successfully submitted and would be delivered to recipients shortly.