Author Topic: Brace Matching with < and >  (Read 1509 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1855
  • Hero Points: 179
  • Text
Brace Matching with < and >
« on: August 17, 2016, 11:56:56 pm »
Place cursor between "<" and "T2" in "foo" line
Ctrl+]  (find-matching-paren)
Cursor goes to matching ">"
Ctrl+]  (find-matching-paren)
Cursor goes to "(" after MACRO.

Do the same with "bar", where () replace <>, and it works correctly.
Or, add spaces around the ">" and it works correctly.


void foo(thing<T2, sizeof(T2), MACRO(T2)>) {}
void bar(thing(T2, sizeof(T2), MACRO(T2))) {}

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4938
  • Hero Points: 404
Re: Brace Matching with < and >
« Reply #1 on: August 18, 2016, 01:35:50 am »
We will look into this

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4938
  • Hero Points: 404
Re: Brace Matching with < and >
« Reply #2 on: August 18, 2016, 01:46:27 am »
Change def_pmatch_chars to "()[]{}<>". That will do what you want. It does effect all languages. That doesn't really matter in this case because the special C++ code isn't doing anything really smart. The code has no idea that this is a template class argument.

Not sure if we will change the default here.

Tim Kemp

  • Senior Community Member
  • Posts: 536
  • Hero Points: 90
Re: Brace Matching with < and >
« Reply #3 on: August 18, 2016, 11:59:26 am »
If you make this the default it will have an interesting effect on logical statements. I don't think you want that. For example:

Code: [Select]
if ((a<b) && (c>d)) {}
The highlighting of the matching character (> or <) is rather confusing.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4938
  • Hero Points: 404
Re: Brace Matching with < and >
« Reply #4 on: August 18, 2016, 01:17:40 pm »
The default code has a more conservative algorithm for handling <> highlighting. I'm sure it's not perfect but it doesn't goof on that example.

Tim Kemp

  • Senior Community Member
  • Posts: 536
  • Hero Points: 90
Re: Brace Matching with < and >
« Reply #5 on: August 18, 2016, 01:27:19 pm »
It does on my computer.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4938
  • Hero Points: 404
Re: Brace Matching with < and >
« Reply #6 on: August 18, 2016, 04:18:19 pm »
It does on my computer.


Are you def_pmatch_chars set to the default "()[]{}"?

Tim Kemp

  • Senior Community Member
  • Posts: 536
  • Hero Points: 90
Re: Brace Matching with < and >
« Reply #7 on: August 18, 2016, 05:10:36 pm »
No, "()[]{}<>", as you suggested to jporkkahtc. You'd mentioned maybe changing the default to this. I tried it to see if it would cause any weirdness. It did.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2821
  • Hero Points: 426
Re: Brace Matching with < and >
« Reply #8 on: August 24, 2016, 04:57:46 pm »
I am putting in a tweak to make this work more as expected for beta4.