diff --git a/style.md b/style.md index 1d358f0..6bafa52 100644 --- a/style.md +++ b/style.md @@ -258,13 +258,15 @@ The prime directive of line-wrapping is: prefer to break at a **higher syntactic * the dot separator (`.`) * the two colons of a member reference (`::`) 2. When a line is broken at an _assignment_ operator the break comes _after_ the symbol. - 3. A method or constructor name stays attached to the open parenthesis (`(`) that follows it. + 3. A method or constructor name stays attached to the opening parenthesis (`(`) that follows it. 4. A comma (`,`) stays attached to the token that precedes it. 5. A lambda arrow (`->`) stays attached to the argument list that precedes it. + 6. A closing parenthesis (`)`) stays attached to the token that precedes it if the corresponding opening parenthesis (`(`) is on the same line. + 7. A closing parenthesis (`)`) on a different line than its corresponding opening parenthesis (`(`) is placed on a line by itself indented the same amount as the line with the opening parenthesis. + * Exception: If the closing parenthesis is immediately followed by an opening curly brace (`{`), the open brace is placed on the same line as the closing parenthesis separated by a space. Note: The primary goal for line wrapping is to have clear code, _not necessarily_ code that fits in the smallest number of lines. - ### Continuation indent When line-wrapping, each line after the first (each _continuation line_) is indented at least +8 from the original line. @@ -349,7 +351,7 @@ Multiple consecutive blank lines are permitted, but not encouraged or ever requi Beyond where required by the language or other style rules, and apart from literals, comments, and KDoc, a single ASCII space also appears in the following places only: - 1. Separating any reserved word, such as `if`, `for`, or `catch` from an open parenthesis (`(`) that follows it on that line. + 1. Separating any reserved word, such as `if`, `for`, or `catch` from an opening parenthesis (`(`) that follows it on that line. ```kotlin // WRONG!