News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

EditorTweaks: new option 'Convert Matching Braces' : little bug

Started by killerbot, October 20, 2012, 09:28:15 AM

Previous topic - Next topic

MortenMacFly

Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

dmoore

Quote from: Alpha on October 26, 2012, 11:02:21 PM
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?
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

dmoore

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.
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

Alpha

Attached.

Quote from: dmoore on October 29, 2012, 12:50:22 AM
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.

Quote from: dmoore 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 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...

dmoore

Quote from: Alpha on October 29, 2012, 01:28:06 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.
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

MortenMacFly

Quote from: Alpha on October 29, 2012, 01:28:06 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

dmoore

Quote from: MortenMacFly on October 29, 2012, 10:13:53 AM
Quote from: Alpha on October 29, 2012, 01:28:06 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...?! ???

I think it is the same, I just wanted it this way to hopefully make it easier to apply.
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

dmoore

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)
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

dmoore

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)
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

MortenMacFly

Quote from: dmoore 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)
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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Alpha

Quote from: MortenMacFly on October 29, 2012, 10:13:53 AM
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? ;)

dmoore

@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.
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

Alpha

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.

Quote from: dmoore on October 29, 2012, 10:27:11 PM
If we are doing it for C/C++, why not python (and other languages) too?
I guess simply no one got there yet.

dmoore

Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

dmoore

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!
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]