User forums > Using Code::Blocks

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

(1/12) > >>

killerbot:

--- Code: ---int main()

--- End code ---

select the opening '(' => press '[' ==>


--- Code: ---int main[]

--- End code ---

select the opening '[' => press '(' ==>

--- Code: ---int main())

--- End code ---

==> so we get 2 ')'

dmoore:
I think this is a conflict with SmartIndent  :'(  (Disable smart indent and try again).

So I can
1/ Merge into smart indent.
2/ Change smart indent logic slightly (don't do smart indent's bracing if there is a selection) but keep the feature separate.
3/ Move the smart indent brace completion out of smart indent
4/ Do nothing / revert.

Obviously 4 isn't my preferred. The unappealing thing about 1 is having to do that logic 5+ times over for all of the SmartIndent languages. Not sure where these features really belong. It's not clear to me that a plugin named "Smart Indent" should include brace completions at all, but that's not a huge deal.

I was planning to add additional features:

* autoconversions for <, > (for html/xml), ' and "
* if user has a selection, typing a brace char (or quote char) puts the brace around the selection instead of deleting the selection.

zabzonk:
What are the circumstances in which one would want to do this? I don't think I have ever wanted to convert () to [].

dmoore:

--- Quote from: Neil Butterworth on October 20, 2012, 02:09:36 pm ---What are the circumstances in which one would want to do this? I don't think I have ever wanted to convert () to [].

--- End quote ---

Converting the braces is mostly useful for python (in C/C++, probably much less commonly needed). Removing the matching brace is probably generally useful as would be enclosing a selection in braces instead of just deleting it. But fair point, I could just make the changes to the smart indent python code.

Alpha:

--- Quote from: dmoore on October 20, 2012, 02:06:38 pm ---* if user has a selection, typing a brace char (or quote char) puts the brace around the selection instead of deleting the selection.

--- End quote ---
This feature already exists.  Do you have Selection brace completion enabled?  (Although, the recent SmartIndent refactor has restricted it to C/C++ only; I am exploring how to make it general purpose again.)

Navigation

[0] Message Index

[#] Next page

Go to full version