Menu

#3 Error when formatting and there's MatchParen

1.0
closed
nobody
None
2014-12-27
2014-12-25
Anonymous
No

When I want to Format just some amount of selected lines in Visual mode, I get the following
error:


Error detected while processing function 715..991..985..982..981..929..971..913:
line 4:
E716: Key not present in Dictionary: pattern,'^(\%#=\d)\?','\1\C',"")})
E116: Invalid arguments for function substitute(v:val.pattern,'^(\%#=\d)\?','\1\C',"")})
E116: Invalid arguments for function extend(v:val, {"pattern": substitute(v:val.pattern,'^(\%#=\d)\?','\1\C',"")})
Error detected while processing function 715..991..985:
line 4:
E171: Missing :endif


The situation that this happens is specific, and I know how to avoid the error.

It happens only when the cursor is not positioned past the end of the selection area.

For example, in the following C file:

int main() {
}

If I select the two lines in Visual mode using line-selection (shift-v), but keep the cursor
at } and do :‘<,’>Format format, the error shows up, if I put the cursor after }, it executes
without problems.

This is the echo for getmatches() put just above the offending formatvim line:

  • When the cursor is after '}': [{'group': 'OverLength', 'pattern': '\%81v.+', 'priority': 10, 'id': 1}]
  • When the cursor is over ‘}’: [{'group': 'OverLength', 'pattern': '\%81v.+', 'priority': 10, 'id': 1}, {'group': 'MatchParen', 'id': 3, 'priority': 10, 'pos1': [2, 1, 1], 'pos2': [1, 12, 1]}]

Discussion

  • ZyX

    ZyX - 2014-12-27
    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.