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

Re: [patch] Fix handling of \L/\U

Expand Messages
  • James McCoy
    ... treat ... work ... The s/ L topic states following characters made uppercase, until E and s/ u states next character made uppercase so a u should only
    Message 1 of 7 , Feb 15, 2013


      On Feb 15, 2013 9:24 AM, "Bram Moolenaar" <Bram@...> wrote:
      >
      >
      >
      > James McCoy wrote:
      >
      > > > > The other day in #vim, someone was wondering why :s/SOMEWORD/\L\u&/
      > > > > was resulting in sOMEWORD instead of title-case (Someword).
      > > > >
      > > > > That seemed like a reasonable expectation and is how PCRE would treat
      > > > > that substitution, so I came up with the attached patch to make Vim work
      > > > > like that.  Also included are tests.
      > > >
      > > > Thanks, sounds like a good solution.  Implementation is fairly simple.
      > > >
      > > > Can you also write an update for the documentation?
      > >
      > > That's the other part I forgot to mention.  The documentation already
      > > describes the behavior I implemented.
      >
      > Where?  I cannot find a match for \L\u in the documentation.

      The s/\L topic states

        following characters made uppercase, until \E

      and s/\u states

        next character made uppercase

      so a \u should only affect the character after it, not terminate the existing \L effect.  Were you looking for this specific example to be documented?

      James

      --
      --
      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.
       
       
    • Bram Moolenaar
      ... But it never worked that way, so far a u would undo a previous L. That was not explicitly mentioned, but it has always worked that way. I think it s good
      Message 2 of 7 , Feb 15, 2013
        James McCoy wrote:

        > > > > > The other day in #vim, someone was wondering why :s/SOMEWORD/\L\u&/
        > > > > > was resulting in sOMEWORD instead of title-case (Someword).
        > > > > >
        > > > > > That seemed like a reasonable expectation and is how PCRE would treat
        > > > > > that substitution, so I came up with the attached patch to make Vim work
        > > > > > like that. Also included are tests.
        > > > >
        > > > > Thanks, sounds like a good solution. Implementation is fairly simple.
        > > > >
        > > > > Can you also write an update for the documentation?
        > > >
        > > > That's the other part I forgot to mention. The documentation already
        > > > describes the behavior I implemented.
        > >
        > > Where? I cannot find a match for \L\u in the documentation.
        >
        > The s/\L topic states
        >
        > following characters made uppercase, until \E
        >
        > and s/\u states
        >
        > next character made uppercase
        >
        > so a \u should only affect the character after it, not terminate the
        > existing \L effect. Were you looking for this specific example to be
        > documented?

        But it never worked that way, so far a \u would undo a previous \L.
        That was not explicitly mentioned, but it has always worked that way.
        I think it's good to explicitly state how this works.

        There should be a specific example of how to change a line of words into
        title case. It's very useful. We might even want to put it in the user
        manual. That would be usr_10.txt

        --
        FATAL ERROR! SYSTEM HALTED! - Press any key to continue doing nothing.

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