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

[BUG] Space is consumed if it is a first symbol of second %{} group that contains other characters as well

Expand Messages
  • ZyX
    The following code will show `|| in a statusline while it is expected to show `| | : vim -u NONE -c set laststatus=2 -c let &statusline= %{ | }%{
    Message 1 of 2 , Nov 1, 2010
    • 0 Attachment
      The following code will show `||' in a statusline while it is expected to show
      `| |':
      vim -u NONE -c 'set laststatus=2' -c 'let &statusline="%{\"|\"}%{\" |\"}"'
      None of the following code have this issue:
      vim -u NONE -c 'set laststatus=2' -c 'let &statusline="%{\"|\"}%{\" \"}|"'
      vim -u NONE -c 'set laststatus=2' -c 'let &statusline="|%{\" |\"}"'
      vim -u NONE -c 'set laststatus=2' -c 'let &statusline="|%{\" \"}|"'
      tested on vim-7.3.47 (revision df6b12c84b23).

      Bug found by Sarah (http://stackoverflow.com/questions/4067613).
    • Bram Moolenaar
      ... Isn t this just that leading white space from the expression is always trimmeed? No, putting another item before it makes the space appears. Strange. --
      Message 2 of 2 , Nov 1, 2010
      • 0 Attachment
        ZyX wrote:

        > The following code will show `||' in a statusline while it is expected to show
        > `| |':
        > vim -u NONE -c 'set laststatus=2' -c 'let &statusline="%{\"|\"}%{\" |\"}"'
        > None of the following code have this issue:
        > vim -u NONE -c 'set laststatus=2' -c 'let &statusline="%{\"|\"}%{\" \"}|"'
        > vim -u NONE -c 'set laststatus=2' -c 'let &statusline="|%{\" |\"}"'
        > vim -u NONE -c 'set laststatus=2' -c 'let &statusline="|%{\" \"}|"'
        > tested on vim-7.3.47 (revision df6b12c84b23).
        >
        > Bug found by Sarah (http://stackoverflow.com/questions/4067613).

        Isn't this just that leading white space from the expression is always
        trimmeed? No, putting another item before it makes the space appears.
        Strange.

        --
        Did you ever stop to think... and forget to start again?
        -- Steven Wright

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.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
      Your message has been successfully submitted and would be delivered to recipients shortly.