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

[PATCH] Set ambiwidth option (East Asian ambiguous width) automatically

Expand Messages
  • Hayaki Saito
    Hi This patch detects East Asian ambiguous width (UAX #11) state of terminals at the start-up time. It makes Vim automatically set ambiwidth option to
    Message 1 of 3 , Feb 10, 2013
    • 0 Attachment
      Hi

      This patch detects East Asian ambiguous width (UAX #11) state of terminals at the start-up time.
      It makes Vim automatically set "ambiwidth" option to "double" when it is running inside some CJK terminals,
      This feature works only when Vim is compiled with +multi_byte and +termresponse feature, and termcap option t_u7 should be set to "\e[6n".

      I tested it on the following terminals.

      - xterm with "-cjk" option
      - gnome-terminal(VTE) with environment "VTE_CJK_WIDTH=1"
      - mlterm with "--ac=2" option
      - MinTTY with CJK font environment
      - GNU Screen version 4.01.00devel with "cjkwidth" command and let &t_u7="\e[6n"'
      - TeraTerm
      - RLogin
      - Poderosa
      - iTerm2 with "Treat ambiguous-width characters as double width" option
      - Terminal.app(OSX 10.8) with CJK width option

      if $TERM is 'screen', termcap option t_u7 is empty by default.
      So we need to add the following code in vimrc for testing it.

      if !has('gui_running') && has('vim_starting') && exists('+t_u7') && $TERM =~ 'screen'
      let &t_u7 = "\e[6n"
      endif

      ---
      Hayaki Saito
      user@...

      --
      --
      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.
    • Hayaki Saito
      Sorry, I found out this patch have some defects. In some terminals (such as xterm), Shift-F3 key input sequense ESC [ 1 ; 2 R may be confused with the
      Message 2 of 3 , Feb 10, 2013
      • 0 Attachment
        Sorry, I found out this patch have some defects.
        In some terminals (such as xterm), Shift-F3 key input sequense "ESC [ 1 ;  2 R" may be confused with the cursor position report.
        Attached patch is fixed it.

        Regards.

        ---
        Hayaki Saito
        user@...

      • Bram Moolenaar
        ... Thanks! I ll add it to the todo list. -- Kisses may last for as much as, but no more than, five minutes. [real standing law in Iowa, United States of
        Message 3 of 3 , Feb 10, 2013
        • 0 Attachment
          Hayaki Saito wrote:

          > This patch detects East Asian ambiguous width (UAX #11) state of
          > terminals at the start-up time.
          > It makes Vim automatically set "ambiwidth" option to "double" when it
          > is running inside some CJK terminals,
          > This feature works only when Vim is compiled with +multi_byte and
          > +termresponse feature, and termcap option t_u7 should be set to
          > "\e[6n".
          >
          > I tested it on the following terminals.
          >
          > - xterm with "-cjk" option
          > - gnome-terminal(VTE) with environment "VTE_CJK_WIDTH=1"
          > - mlterm with "--ac=2" option
          > - MinTTY with CJK font environment
          > - GNU Screen version 4.01.00devel with "cjkwidth" command and let &t_u7="\e[6n"'
          > - TeraTerm
          > - RLogin
          > - Poderosa
          > - iTerm2 with "Treat ambiguous-width characters as double width" option
          > - Terminal.app(OSX 10.8) with CJK width option
          >
          > if $TERM is 'screen', termcap option t_u7 is empty by default.
          > So we need to add the following code in vimrc for testing it.
          >
          > if !has('gui_running') && has('vim_starting') && exists('+t_u7') && $TERM =~ 'screen'
          > let &t_u7 = "\e[6n"
          > endif

          Thanks! I'll add it to the todo list.

          --
          Kisses may last for as much as, but no more than, five minutes.
          [real standing law in Iowa, United States of America]

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ an exciting new programming language -- http://www.Zimbu.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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