Author Topic: EditorTweaks: new option 'Convert Matching Braces' : little bug  (Read 29345 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9493
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #15 on: October 27, 2012, 10:34:45 pm »
Anyone else tested it?
I've applied it in my local copy but didn't test.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #16 on: October 29, 2012, 12:50:22 am »
Here is a candidate patch.

Having troubles applying this on linux. There are different line endings in at least one of the target files (I thought we had done something to fix this in our SVN). Do you mind attaching a patch file Alpha?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #17 on: October 29, 2012, 01:13:38 am »
Also, is there a good reason to put the brace completion stuff in cbEditor instead of the plugin base? I thought the point of making smart indent a set of plugins was to reduce the amount of cruft in the editor code.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #18 on: October 29, 2012, 01:28:06 am »
Attached.

I thought we had done something to fix this in our SVN.
Most files are set to match system EOL style, however, it appears as if the files added by Smart Indent are CR LF only.

Also, is there a good reason to put the brace completion stuff in cbEditor instead of the plugin base?
I put it there so the editor has access to use it as fall-back if no plugin supports the current lexer.  The Smart Indent plugins for languages that I am less familiar with just call this more-generic method, whereas the C++ plugin has its own specialized implementation (that I previously wrote - although, it occasionally has some issues, so I may have to look back at it again).
I did this under the same idea that cbEditor contains a minimal auto-indent (just copy the previous line's indentation).  Not sure if this was correct thinking...

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #19 on: October 29, 2012, 02:26:45 am »
I put it there so the editor has access to use it as fall-back if no plugin supports the current lexer. 

That makes some sense.

Thx for the patch.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9493
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #20 on: October 29, 2012, 10:13:53 am »
Attached.
Did that patch change anything in comparison to the previous one? After applying this I see no differences to what I already had with the previous patch...?! ???
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #21 on: October 29, 2012, 01:30:43 pm »
Attached.
Did that patch change anything in comparison to the previous one? After applying this I see no differences to what I already had with the previous patch...?! ???

I think it is the same, I just wanted it this way to hopefully make it easier to apply.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #22 on: October 29, 2012, 02:56:20 pm »
This seems to work as I would expect on different types of files. I don't love the undo behavior, but I guess it makes sense that undo gives you what you would expect if selection brace matching was turned off.

Small style thing: I thought we added at least one line of empty whitespace between class method implementations. (I notice that whitespace is virtually non-existent in most of the smartindent cpp files.)

@morten: can you check/change the newline svn properties of those files? (And any other recently added files)
« Last Edit: October 29, 2012, 03:04:38 pm by dmoore »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #23 on: October 29, 2012, 03:14:45 pm »
Also @Morten, if this is ok with you one of us should apply. (I haven't tested on windows, but nothing seems OS specific in this one)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9493
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #24 on: October 29, 2012, 03:57:07 pm »
Also @Morten, if this is ok with you one of us should apply. (I haven't tested on windows, but nothing seems OS specific in this one)
Feel free to do so - I've tested it under Windows meanwhile. It looks OK.

Concerning the SVN props: I'll have a look...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #25 on: October 29, 2012, 09:21:09 pm »
Did that patch change anything in comparison to the previous one? After applying this I see no differences to what I already had with the previous patch...?! ???
The line endings are different... oh, LF and CR LF look exactly the same in your browser? ;)

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #26 on: October 29, 2012, 10:27:11 pm »
@Alpha: For python, I noticed that smart indent does not provide brace completions for non-selected text. If we are doing it for C/C++, why not python (and other languages) too? I guess this would be a separate patch, and, if so, I am happy to commit the last one.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #27 on: October 29, 2012, 11:28:05 pm »
Brace completion and selection brace completion are (in my opinion) completely separate features, so yes, different patch.

Fall-back for brace completion would have to be very conservative, because languages differ so greatly.  Compare editing C/C++ with editing XML/HTML (the only places brace completion is currently implemented); they act quite different.

If I am able, I will see what I can come up with in the next few days.

If we are doing it for C/C++, why not python (and other languages) too?
I guess simply no one got there yet.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #28 on: October 29, 2012, 11:56:31 pm »
That's what I thought. Will commit your patch soon.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: EditorTweaks: new option 'Convert Matching Braces' : little bug
« Reply #29 on: October 30, 2012, 12:12:40 am »
Committed in rev 8489. Apologies for spacing and forgetting to give you credit in the log message, Alpha.  :-[ Hopefully we give you commit access soon!