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

[PATCH]Fix bug: %s/get_foo/ /g inserts "et_foo" not "get_foo"

Expand Messages
  • tyru
    Hi list. Attached patch fixed the problem. -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are
    Message 1 of 7 , Jun 6, 2011
    • 0 Attachment
      Hi list.

      Attached patch fixed the problem.

      --
      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
    • Ben Fritz
      ... What problem? in the command line always works fine for me. -- You received this message from the vim_dev maillist. Do not top-post! Type your
      Message 2 of 7 , Jun 6, 2011
      • 0 Attachment
        On Jun 6, 10:09 am, tyru <tyru....@...> wrote:
        > Hi list.
        >
        > Attached patch fixed the problem.
        >

        What problem? <C-R><C-W> in the command line always works fine for me.

        --
        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
      • Andy Wokula
        ... I see, it s the normal ^R^W that picks get_foo from the text. Problem arises if the interesting word (or a prefix of it) is already found at the end of
        Message 3 of 7 , Jun 6, 2011
        • 0 Attachment
          Am 06.06.2011 20:49, schrieb Ben Fritz:
          >
          >
          > On Jun 6, 10:09 am, tyru<tyru....@...> wrote:
          >> Hi list.
          >>
          >> Attached patch fixed the problem.
          >>
          >
          > What problem?<C-R><C-W> in the command line always works fine for me.

          I see, it's the normal ^R^W that picks "get_foo" from the text.

          Problem arises if the interesting word (or a prefix of it) is already
          found at the end of the cmdline. Try then ^R^W in the middle of the
          cmdline.

          In this case, the prefix is "g" and ^R^W gets you "et_foo".

          Help for ^R^W says the feature was meant to complete a word for
          'incsearch' (when the cursor is expected to be at the end of the
          cmdline).

          --
          Andy

          --
          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
        • tyru
          Sorry, I should have said about more details. This problem occurs in the following circumstances: - incsearch is on - get_foo is under the cursor - the
          Message 4 of 7 , Jun 6, 2011
          • 0 Attachment
            Sorry, I should have said about more details.

            This problem occurs in the following circumstances:
            - 'incsearch' is on
            - "get_foo" is under the cursor
            - the last character on the command-line is "g" like %s/get_foo//g
            - cursor position is <cursor>: %s/get_foo/<cursor>/g
            - type <C-r><C-w>

            The reason why this problem occurred is,
            that Vim looks for the part of inserted cword
            from the end of command-line.
            So I fixed that looks for from the current position of the command-line.


            On Tuesday, June 7, 2011, Andy Wokula <anwoku@...> wrote:
            > Am 06.06.2011 20:49, schrieb Ben Fritz:
            >
            >
            >
            > On Jun 6, 10:09 am, tyru<tyru....@...>  wrote:
            >
            > Hi list.
            >
            > Attached patch fixed the problem.
            >
            >
            >
            > What problem?<C-R><C-W>  in the command line always works fine for me.
            >
            >
            > I see, it's the normal ^R^W that picks "get_foo" from the text.
            >
            > Problem arises if the interesting word (or a prefix of it) is already
            > found at the end of the cmdline.  Try then ^R^W in the middle of the
            > cmdline.
            >
            > In this case, the prefix is "g" and ^R^W gets you "et_foo".
            >
            > Help for ^R^W says the feature was meant to complete a word for
            > 'incsearch' (when the cursor is expected to be at the end of the
            > cmdline).
            >
            > --
            > Andy
            >
            > --
            > 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 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
          • Bram Moolenaar
            ... I don t see how to reproduce the problem. Can you describe it more verbose? -- hundred-and-one symptoms of being an internet addict: 145. You e-mail your
            Message 5 of 7 , Jun 6, 2011
            • 0 Attachment
              Tyru wrote:

              > Attached patch fixed the problem.

              I don't see how to reproduce the problem. Can you describe it more
              verbose?

              --
              hundred-and-one symptoms of being an internet addict:
              145. You e-mail your boss, informing him you'll be late.

              /// 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
            • Bram Moolenaar
              ... OK, now I see the problem. Thanks for the patch, I ll add it later. -- hundred-and-one symptoms of being an internet addict: 148. You find it easier to
              Message 6 of 7 , Jun 6, 2011
              • 0 Attachment
                Tyru wrote:

                > Sorry, I should have said about more details.
                >
                > This problem occurs in the following circumstances:
                > - 'incsearch' is on
                > - "get_foo" is under the cursor
                > - the last character on the command-line is "g" like %s/get_foo//g
                > - cursor position is <cursor>: %s/get_foo/<cursor>/g
                > - type <C-r><C-w>
                >
                > The reason why this problem occurred is,
                > that Vim looks for the part of inserted cword
                > from the end of command-line.
                > So I fixed that looks for from the current position of the command-line.

                OK, now I see the problem. Thanks for the patch, I'll add it later.

                --
                hundred-and-one symptoms of being an internet addict:
                148. You find it easier to dial-up the National Weather Service
                Weather/your_town/now.html than to simply look out the window.

                /// 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
              • Ben Fritz
                ... Oh wow, this is fun! If you also add other flags, it will remove any of those characters as well. For example, with a new buffer containing only the word,
                Message 7 of 7 , Jun 7, 2011
                • 0 Attachment
                  On Jun 6, 10:37 pm, tyru <tyru....@...> wrote:
                  > Sorry, I should have said about more details.
                  >
                  > This problem occurs in the following circumstances:
                  > - 'incsearch' is on
                  > - "get_foo" is under the cursor
                  > - the last character on the command-line is "g" like %s/get_foo//g
                  > - cursor position is <cursor>: %s/get_foo/<cursor>/g
                  > - type <C-r><C-w>
                  >
                  > The reason why this problem occurred is,
                  > that Vim looks for the part of inserted cword
                  > from the end of command-line.
                  > So I fixed that looks for from the current position of the command-line.
                  >

                  Oh wow, this is fun! If you also add other flags, it will remove any
                  of those characters as well. For example, with a new buffer containing
                  only the word, "general", with the cursor on this word, type on the
                  command line:

                  :%s/foo//gen

                  Then position the cursor between the final two '/' characters and
                  press <C-R><C-W> and get:

                  :%s/foo/eral/gen

                  Shouldn't the fix actually look to see whether the current command-
                  line mode is search, rather than any of the other command-line modes?
                  See :help getcmdtype() for all of them. I can't see how the "feature"
                  of only inserting the remainder of the word is desirable in any of the
                  other modes, really.

                  Well, maybe it is somewhat useful...it would allow you to change your
                  mind if you start typing a word already under the cursor, and complete
                  the rest of the word automatically instead of inserting the entire
                  word. But it sure is unexpected! And I don't think 'incsearch' should
                  affect anything except for a search, that just doesn't make sense.

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