Skip to content

Fix indent for when pressing enter and the function param has a comma at the end

Waqar Ahmed requested to merge work/fixindent into master

Consider the case ([C] = cursor position):

void fn(int a,[C])

Pressing enter results in:

void fn(int a,
    [C]
)

which is totally opposite of what's expected.

With this change on pressing enter you will get this result:

void fn(int a,
        [C])

The cursor is aligned with the first char after the matching opening bracket. I have added a new testcase (plist26) to test this. Two test cases (plist20 and plist13) have been modified to pass the results. The modification is necessary because previously the cursor was aligned to the opening bracket and not one char after the bracket.

Edited by Waqar Ahmed

Merge request reports