Reindent for statements of multiple lines

Reindent for statements of multiple lines

2
NewbieNewbie
2

    Apr 06, 2006#1

    Hi

    In my code I usually split a statement over multiple lines for cleaness. But when I reindent my code with the default settings I get this:

    Code: Select all

    if (x==y or
    (y==z and w) or
    (a==c))
    {
      ...
    }
    But What I really wanted is the lines below the call also indent 1 space like:

    Code: Select all

    if (x==y or
     (y==z and w) or
     (a==c))
    {
      ...
    }
    
    If this possible and how to activate it?

    6,675585
    Grand MasterGrand Master
    6,675585

      Apr 06, 2006#2

      Click on the Open button at Configuration - Editor Display - Syntax Highlighting to open the wordfile you currently use. Press the Cancel button to close the configuration dialog.

      In the wordfile scroll to the language which is responsible for the syntax highlighting of you file. For example: /L1"C/C++" or /L9"JavaScript". A few lines below you should see lines like:

      /Indent Strings = "{" "if" "else" ":"
      /Unindent Strings = "}"

      What you need is:

      /Indent Strings = "{" "if"
      /Unindent Strings = "}" "{"

      Save the modified wordfile and test the indent and reindent feature.

      But you should know that you will get a bad indention if you have a code like:

      Code: Select all

      if (x==y) return;
      ...
      if (x==5) var = value;
      ...
      if (x==9 or
       (y==z and w) or
       (a==c))
      {
       ...
      }
      which is reindented with these settings to:

      Code: Select all

      if (x==y) return;
       ...
       if (x==5) var = value;
        ...
        if (x==9 or
         (y==z and w) or
         (a==c))
        {
         ...
        }
      You are forced to always use { } at every if as shown below:

      Code: Select all

      if (x==y)
      {
       return;
      }
      ...
      if (x==5) { var = value; }
      ...
      if (x==9 or
       (y==z and w) or
       (a==c))
      {
       ...
      }
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Apr 09, 2006#3

        Thanks for the reply. Is it possible to have two different indention lengths in a multiline statement, like:

        Code: Select all

        if (a=b) or
         (b=c) //Indention with 1 space
        {
           a++  //Indention with 3 spaces
           b++
        }

        6,675585
        Grand MasterGrand Master
        6,675585

          Apr 09, 2006#4

          roy79 wrote:Is it possible to have two different indention lengths in a multiline statement?
          No!
          Best regards from an UC/UE/UES for Windows user from Austria