[ruby-cvs:79145] c94025b630 (master): [ruby/irb] Fix crashing when multiple open braces per line

"Ben" <[email protected]> Tue, 14 Jan 2020 15:45:00 +0900 (JST)
Newsgroups gmane.comp.lang.ruby.cvs
Message-ID <[email protected]>
Ben	2020-01-06 04:44:38 +0900 (Mon, 06 Jan 2020)

  New Revision: c94025b630

  https://github.com/ruby/ruby/commit/c94025b630

  Log:
    [ruby/irb] Fix crashing when multiple open braces per line
    =

    https://github.com/ruby/irb/issues/55
    =

    If we had put multiple open braces on a line the with no closing brac=
e
    spaces_of_nest array keeps getting '0' added to it. This means that w=
hen
    we pop off of this array we are saying that we should be in position =
zero
    for the next line. This is an issue because we don't always want to b=
e
    in position 0 after a closing brace.
    =

    Example:
    ```
    [[[
    ]
    ]
    ]
    ```
    In the above example the 'spaces_of_nest' array looks like this after=

    the first line is entered: [0,0,0]. We really want to be indented 4
    spaces for the 1st closing brace 2 for the 2nd and 0 for the 3rd. i.e=