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

Re: replace character does not work correctly

Expand Messages
  • Bram Moolenaar
    ... Thanks. How can the problem be reproduced? Does this require two lines with multi-byte characters and then using ra with a count? -- Everybody wants to
    Message 1 of 3 , Feb 28, 2013
      Yasuhiro Matsumoto wrote:

      > When type 'ra' with linewised lines, characters will be replaced. But
      > if the characters are multi-byte, some characters are remaining as
      > original. Below is a patch. Please check and include.
      >
      > https://gist.github.com/mattn/5054510
      >
      > diff -r 8b86b69546a9 src/ops.c
      > --- a/src/ops.c Wed Feb 20 21:26:00 2013 +0100
      > +++ b/src/ops.c Thu Feb 28 14:41:31 2013 +0900
      > @@ -2194,7 +2194,9 @@
      > {
      > /* This is slow, but it handles replacing a single-byte
      > * with a multi-byte and the other way around. */
      > - oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n);
      > +
      > + if (curwin->w_cursor.lnum == oap->end.lnum)
      > + oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n);
      > n = State;
      > State = REPLACE;
      > ins_char(c);


      Thanks. How can the problem be reproduced? Does this require two lines
      with multi-byte characters and then using "ra" with a count?

      --
      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/groups/opt_out.
    • Yasuhiro MATSUMOTO
      Sorry I forgot to mention about the two or more lines is needed to reproduce. ... -- - Yasuhiro Matsumoto -- -- You received this message from the vim_dev
      Message 2 of 3 , Feb 28, 2013
        Sorry I forgot to mention about the two or more lines is needed to reproduce.

        On 3/1/13, Bram Moolenaar <Bram@...> wrote:
        >
        > Yasuhiro Matsumoto wrote:
        >
        >> When type 'ra' with linewised lines, characters will be replaced. But
        >> if the characters are multi-byte, some characters are remaining as
        >> original. Below is a patch. Please check and include.
        >>
        >> https://gist.github.com/mattn/5054510
        >>
        >> diff -r 8b86b69546a9 src/ops.c
        >> --- a/src/ops.c Wed Feb 20 21:26:00 2013 +0100
        >> +++ b/src/ops.c Thu Feb 28 14:41:31 2013 +0900
        >> @@ -2194,7 +2194,9 @@
        >> {
        >> /* This is slow, but it handles replacing a single-byte
        >> * with a multi-byte and the other way around. */
        >> - oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n);
        >> +
        >> + if (curwin->w_cursor.lnum == oap->end.lnum)
        >> + oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n);
        >> n = State;
        >> State = REPLACE;
        >> ins_char(c);
        >
        >
        > Thanks. How can the problem be reproduced? Does this require two lines
        > with multi-byte characters and then using "ra" with a count?
        >
        > --
        > 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 ///
        >


        --
        - Yasuhiro Matsumoto

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