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

Visual Block break multi-byte characters.

Expand Messages
  • mattn
    Hi list. ... aaa あああ bbb ... axaa xあああ bxaa ... Because visual block select first letter in second line.
    Message 1 of 6 , Aug 6, 2014
      Hi list.

      -----------------
      aaa
      あああ
      bbb
      -----------------

      When type: gg0l<C-V>jjIx<Esc> in the buffer above, result should be:

      -----------------
      axaa
      xあああ
      bxaa
      -----------------

      Because visual block select first letter in second line.

      http://go-gyazo.appspot.com/ff56afa0c9e03c34.png

      But currently, vim breaks multi-byte characters.

      -----------------
      axaa
      x <81><82>ああ
      bxbb
      -----------------


      diff -r 2a798dca16bf src/ops.c
      --- a/src/ops.c Wed Aug 06 19:09:16 2014 +0200
      +++ b/src/ops.c Thu Aug 07 14:23:10 2014 +0900
      @@ -609,6 +609,25 @@
      }
      }

      +#ifdef FEAT_MBYTE
      + if (has_mbyte && spaces > 0)
      + {
      + if (b_insert)
      + {
      + int off = (*mb_head_off)(oldp, oldp + offset + spaces);
      + spaces -= off;
      + count -= off;
      + }
      + else
      + {
      + int off = (*mb_off_next)(oldp, oldp + offset);
      + offset += off;
      + spaces = 0;
      + count = 0;
      + }
      + }
      +#endif
      +
      newp = alloc_check((unsigned)(STRLEN(oldp)) + s_len + count + 1);
      if (newp == NULL)
      continue;

      --
      --
      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/d/optout.
    • Bram Moolenaar
      ... Thanks! Could you perhaps also write a test to catch this problem? -- login: yes password: I don t know, please tell me password is incorrect login: yes
      Message 2 of 6 , Aug 7, 2014
        Yasuhiro Matsumoto wrote:

        > Hi list.
        >
        > -----------------
        > aaa
        > あああ
        > bbb
        > -----------------
        >
        > When type: gg0l<C-V>jjIx<Esc> in the buffer above, result should be:
        >
        > -----------------
        > axaa
        > xあああ
        > bxaa
        > -----------------
        >
        > Because visual block select first letter in second line.
        >
        > http://go-gyazo.appspot.com/ff56afa0c9e03c34.png
        >
        > But currently, vim breaks multi-byte characters.
        >
        > -----------------
        > axaa
        > x <81><82>ああ
        > bxbb
        > -----------------

        Thanks! Could you perhaps also write a test to catch this problem?

        --
        login: yes
        password: I don't know, please tell me
        password is incorrect
        login: yes
        password: incorrect

        /// 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/d/optout.
      • Edward Fox
        ... What s your internal encoding? I can t reproduce with encoding set as utf-8 . There s no broken multi-byte character as in your case, but I do see an
        Message 3 of 6 , Aug 7, 2014
          On Wed Aug 06 2014 at 下午10:27:16 mattn <mattn.jp@...> wrote:
          Hi list.

          -----------------
          aaa
          あああ
          bbb
          -----------------

          When type: gg0l<C-V>jjIx<Esc> in the buffer above, result should be:

          -----------------
          axaa
          xあああ
          bxaa
          -----------------

          Because visual block select first letter in second line.

          http://go-gyazo.appspot.com/ff56afa0c9e03c34.png

          But currently, vim breaks multi-byte characters.

          -----------------
          axaa
           x <81><82>ああ
          bxbb
          -----------------

          What's your internal encoding? I can't reproduce with encoding set as "utf-8". There's no broken multi-byte character as in your case, but I do see an extra white space at the beginning of the second line.

          Could you please help make sure that your change can fix that problem as well? Thanks!
           


          diff -r 2a798dca16bf src/ops.c
          --- a/src/ops.c Wed Aug 06 19:09:16 2014 +0200
          +++ b/src/ops.c Thu Aug 07 14:23:10 2014 +0900
          @@ -609,6 +609,25 @@
                      }
                  }

          +#ifdef FEAT_MBYTE
          +       if (has_mbyte && spaces > 0)
          +       {
          +           if (b_insert)
          +           {
          +               int off = (*mb_head_off)(oldp, oldp + offset + spaces);
          +               spaces -= off;
          +               count -= off;
          +           }
          +           else
          +           {
          +               int off = (*mb_off_next)(oldp, oldp + offset);
          +               offset += off;
          +               spaces = 0;
          +               count = 0;
          +           }
          +       }
          +#endif
          +
                  newp = alloc_check((unsigned)(STRLEN(oldp)) + s_len + count + 1);
                  if (newp == NULL)
                      continue;

          --
          --
          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@googlegroups.com.
          For more options, visit https://groups.google.com/d/optout.

          --
          --
          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/d/optout.
        • mattn
          ... I used encoding=utf-8. Should be possible to reproduce. -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below
          Message 4 of 6 , Aug 7, 2014
            On Friday, August 8, 2014 5:10:12 AM UTC+9, Edward Fox wrote:
            > What's your internal encoding? I can't reproduce with encoding set as "utf-8". There's no broken multi-byte character as in your case, but I do see an extra white space at the beginning of the second line.
            > Could you please help make sure that your change can fix that problem as well? Thanks!

            I used encoding=utf-8. Should be possible to reproduce.


            --
            --
            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/d/optout.
          • mattn
            ... I put here. https://gist.github.com/mattn/19a6e4235c6603f39724 -- -- You received this message from the vim_dev maillist. Do not top-post! Type your
            Message 5 of 6 , Aug 7, 2014
              On Friday, August 8, 2014 4:35:33 AM UTC+9, Bram Moolenaar wrote:
              > Yasuhiro Matsumoto wrote:
              >
              >
              >
              > > Hi list.
              >
              > >
              >
              > > -----------------
              >
              > > aaa
              >
              > > あああ
              >
              > > bbb
              >
              > > -----------------
              >
              > >
              >
              > > When type: gg0l<C-V>jjIx<Esc> in the buffer above, result should be:
              >
              > >
              >
              > > -----------------
              >
              > > axaa
              >
              > > xあああ
              >
              > > bxaa
              >
              > > -----------------
              >
              > >
              >
              > > Because visual block select first letter in second line.
              >
              > >
              >
              > > http://go-gyazo.appspot.com/ff56afa0c9e03c34.png
              >
              > >
              >
              > > But currently, vim breaks multi-byte characters.
              >
              > >
              >
              > > -----------------
              >
              > > axaa
              >
              > > x <81><82>ああ
              >
              > > bxbb
              >
              > > -----------------
              >
              >
              >
              > Thanks! Could you perhaps also write a test to catch this problem?
              >
              >
              >
              > --
              >
              > login: yes
              >
              > password: I don't know, please tell me
              >
              > password is incorrect
              >
              > login: yes
              >
              > password: incorrect
              >
              >
              >
              > /// 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 ///

              I put here.

              https://gist.github.com/mattn/19a6e4235c6603f39724

              --
              --
              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/d/optout.
            • Bram Moolenaar
              ... Thanks! -- Everybody wants to go to heaven, but nobody wants to die. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net ///
              Message 6 of 6 , Aug 8, 2014
                Yasuhiro Matsumoto wrote:

                > > > Hi list.
                > > >
                > > > -----------------
                > > > aaa
                > > > あああ
                > > > bbb
                > > > -----------------
                > > >
                > > > When type: gg0l<C-V>jjIx<Esc> in the buffer above, result should be:
                > > >
                > > > -----------------
                > > > axaa
                > > > xあああ
                > > > bxaa
                > > > -----------------
                > > >
                > > > Because visual block select first letter in second line.
                > > >
                > > > http://go-gyazo.appspot.com/ff56afa0c9e03c34.png
                > > >
                > > > But currently, vim breaks multi-byte characters.
                > > >
                > > > -----------------
                > > > axaa
                > > > x <81><82>ああ
                > > > bxbb
                > > > -----------------
                > >
                > > Thanks! Could you perhaps also write a test to catch this problem?
                >
                > I put here.
                >
                > https://gist.github.com/mattn/19a6e4235c6603f39724

                Thanks!

                --
                Everybody wants to go to heaven, but nobody wants to die.

                /// 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/d/optout.
              Your message has been successfully submitted and would be delivered to recipients shortly.