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

Invalid indent for C++ inside lambda body.

Expand Messages
  • Sektor van Skijlen
    Probably 4th attempt, wish me luck. It can be visible when you type something like: fn( a, [](int x) { // indent by +2 &sw, ok empty // indent by +1 &sw, ok
    Message 1 of 1 , Apr 24, 2012
    • 0 Attachment
      Probably 4th attempt, wish me luck.

      It can be visible when you type something like:

      fn( a,
      [](int x) { // indent by +2 &sw, ok
      empty // indent by +1 &sw, ok
      // indent by ... -3 &sw ???


      If you type this in the normal portion of code (not inside lambda),
      the last line indents with 1 &sw. But if you type it inside lambda,
      the cursor is placed at the position where the calling function
      begins.

      If you just type {, it indents normally, like usual. If you type a
      line ended with ; it's still ok, the next line continues with same
      indent.

      The same thing is when you use if, while, for, try - anything that
      should be followed by just one line of indent, but next line should
      not be indented.

      I *suspect* this is a setting controlled by "n" option in cinoptions
      (or "+", or maybe both have the same algorithm of counting the base
      indent).

      This problem cannot be solved by any combination of settings because
      it simply behaves differently, depending on whether the cursor is
      inside the lambda or not.

      This happens with the default cinoptions, on vim 7.3

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