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

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • 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: 6823
  • Hero Points: 526
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: 6823
  • Hero Points: 526
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: 546
  • Hero Points: 92
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: 6823
  • Hero Points: 526
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: 546
  • Hero Points: 92
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: 6823
  • Hero Points: 526
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: 546
  • Hero Points: 92
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

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
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.