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

getregtype() become always 1 for blockwised-star-yank on non-linux environment.

Expand Messages
  • mattn
    Hi, list. Copy texts into star register, like: CTRL-V jjjjll *y, getregtype() should return ^V3 . On linux environment, it works fine because vim seems to
    Message 1 of 5 , Jul 8 3:51 AM
      Hi, list.

      Copy texts into star register, like: CTRL-V jjjjll "*y,
      getregtype() should return "^V3". On linux environment, it works fine because vim seems to handle changes of clipboard.

      Below is a patch to re-calculate y_width.

      - Yasuhiro Matsumoto

      diff -r b8f703a4e55f src/ops.c
      --- a/src/ops.c Fri Jul 04 16:43:17 2014 +0200
      +++ b/src/ops.c Tue Jul 08 19:40:23 2014 +0900
      @@ -906,6 +906,15 @@
      y_current = &(y_regs[i]);
      if (writing) /* remember the register we write into for do_put() */
      y_previous = y_current;
      + if (y_current->y_array != NULL && y_current->y_type == MBLOCK)
      + {
      + for (i = 0; i < y_current->y_size; ++i)
      + {
      + int width = mb_string2cells(y_current->y_array[i], -1) - 1;
      + if (y_current->y_width < width)
      + y_current->y_width = width;
      + }
      + }
      }

      #if defined(FEAT_CLIPBOARD) || defined(PROTO)

      --
      --
      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
      ... I m a bit confused: Why would it work on Linux and not on MS-Windows? I guess the value of y_width is computed but perhaps stored in the wrong location?
      Message 2 of 5 , Jul 9 4:43 AM
        Yasuhiro Matsumoto wrote:

        > Copy texts into star register, like: CTRL-V jjjjll "*y,
        > getregtype() should return "^V3". On linux environment, it works fine
        > because vim seems to handle changes of clipboard.
        >
        > Below is a patch to re-calculate y_width.

        I'm a bit confused: Why would it work on Linux and not on MS-Windows?
        I guess the value of y_width is computed but perhaps stored in the wrong
        location? If that is so it would be better to copy the value of
        y_width.

        Hmm, perhaps it works to copy y_width in copy_yank_reg() ?
        No, that apparently already happens.

        --
        My girlfriend told me I should be more affectionate.
        So I got TWO girlfriends.

        /// 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.
      • Yukihiro Nakadaira
        ... Vim doesn t store y_width to clipboard, so we lost y_width when copy from clipboard. On Linux, Vim uses its register directly without accessing clipboard
        Message 3 of 5 , Jul 9 9:11 PM
          On Wed, Jul 9, 2014 at 8:43 PM, Bram Moolenaar <Bram@...> wrote:

          Yasuhiro Matsumoto wrote:

          > Copy texts into star register, like: CTRL-V jjjjll "*y,
          > getregtype() should return "^V3". On linux environment, it works fine
          > because vim seems to handle changes of clipboard.
          >
          > Below is a patch to re-calculate y_width.

          I'm a bit confused: Why would it work on Linux and not on MS-Windows?
          I guess the value of y_width is computed but perhaps stored in the wrong
          location?  If that is so it would be better to copy the value of
          y_width.

          Hmm, perhaps it works to copy y_width in copy_yank_reg() ?
          No, that apparently already happens.

          Vim doesn't store y_width to clipboard, so we lost y_width when copy
          from clipboard.  On Linux, Vim uses its register directly without
          accessing clipboard when Vim has ownership of it.  When clipboard is
          owned by another Vim, we lost y_width just like on Windows.

          --
          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 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
          ... I m wondering if this is the right place to do the computation. It should only be needed the first time the register is used, after that the y_width value
          Message 4 of 5 , Jul 16 8:39 AM
            Yasuhiro Matsumoto wrote:

            > Copy texts into star register, like: CTRL-V jjjjll "*y,
            > getregtype() should return "^V3". On linux environment, it works fine because vim seems to handle changes of clipboard.
            >
            > Below is a patch to re-calculate y_width.
            >
            > - Yasuhiro Matsumoto
            >
            > diff -r b8f703a4e55f src/ops.c
            > --- a/src/ops.c Fri Jul 04 16:43:17 2014 +0200
            > +++ b/src/ops.c Tue Jul 08 19:40:23 2014 +0900
            > @@ -906,6 +906,15 @@
            > y_current = &(y_regs[i]);
            > if (writing) /* remember the register we write into for do_put() */
            > y_previous = y_current;
            > + if (y_current->y_array != NULL && y_current->y_type == MBLOCK)
            > + {
            > + for (i = 0; i < y_current->y_size; ++i)
            > + {
            > + int width = mb_string2cells(y_current->y_array[i], -1) - 1;
            > + if (y_current->y_width < width)
            > + y_current->y_width = width;
            > + }
            > + }
            > }

            I'm wondering if this is the right place to do the computation. It
            should only be needed the first time the register is used, after that
            the y_width value should already be correct.

            Does it work to only compute y_width when "writing" is TRUE?
            Or perhaps y_width needs to be set when the register is filled
            elsewhere?

            Going through all the lines in the register an calling mb_string2cells()
            is quite a bit of work. It should not be done unless needed.

            --
            BEDEVERE: Stand by for attack!!
            [CUT TO enormous army forming up. Trebuchets, rows of PIKEMEN, siege
            towers, pennants flying, shouts of "Stand by for attack!" Traditional
            army build-up shots. The shouts echo across the ranks of the army.
            We see various groups reacting, and stirring themselves in readiness.]
            ARTHUR: Who are they?
            BEDEVERE: Oh, just some friends!
            "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

            /// 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.
          • Bram Moolenaar
            ... Also, test_eval breaks with this change. -- ARTHUR: CHARGE! [The mighty ARMY charges. Thundering noise of feet. Clatter of coconuts. Shouts etc.
            Message 5 of 5 , Jul 16 9:18 AM
              I wrote:

              > Yasuhiro Matsumoto wrote:
              >
              > > Copy texts into star register, like: CTRL-V jjjjll "*y,
              > > getregtype() should return "^V3". On linux environment, it works fine because vim seems to handle changes of clipboard.
              > >
              > > Below is a patch to re-calculate y_width.
              > >
              > > - Yasuhiro Matsumoto
              > >
              > > diff -r b8f703a4e55f src/ops.c
              > > --- a/src/ops.c Fri Jul 04 16:43:17 2014 +0200
              > > +++ b/src/ops.c Tue Jul 08 19:40:23 2014 +0900
              > > @@ -906,6 +906,15 @@
              > > y_current = &(y_regs[i]);
              > > if (writing) /* remember the register we write into for do_put() */
              > > y_previous = y_current;
              > > + if (y_current->y_array != NULL && y_current->y_type == MBLOCK)
              > > + {
              > > + for (i = 0; i < y_current->y_size; ++i)
              > > + {
              > > + int width = mb_string2cells(y_current->y_array[i], -1) - 1;
              > > + if (y_current->y_width < width)
              > > + y_current->y_width = width;
              > > + }
              > > + }
              > > }
              >
              > I'm wondering if this is the right place to do the computation. It
              > should only be needed the first time the register is used, after that
              > the y_width value should already be correct.
              >
              > Does it work to only compute y_width when "writing" is TRUE?
              > Or perhaps y_width needs to be set when the register is filled
              > elsewhere?
              >
              > Going through all the lines in the register an calling mb_string2cells()
              > is quite a bit of work. It should not be done unless needed.

              Also, test_eval breaks with this change.

              --
              ARTHUR: CHARGE!
              [The mighty ARMY charges. Thundering noise of feet. Clatter of coconuts.
              Shouts etc. Suddenly there is a wail of a siren and a couple of police
              cars roar round in front of the charging ARMY and the POLICE leap out and
              stop them. TWO POLICEMAN and the HISTORIAN'S WIFE. Black Marias skid up
              behind them.]
              HISTORIAN'S WIFE: They're the ones, I'm sure.
              "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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