<div dir="ltr"><div class="gmail_quote">On Thu, May 6, 2010 at 04:54, Lex Trotman <span dir="ltr"><<a href="mailto:elextr@gmail.com">elextr@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div dir="ltr"><div>there are a couple of things i would like to add to geany:</div>

<div>1) brace balancing - the current behavior is to auto-close a brace with no neighboring closing brace ("{" becomes "{}", but "{{}" remains "{{}" and not "{{}}")</div>

</div></blockquote></div><div><br>Yes, if any brace is already followed by a matching close (matching after taking into account any following open braces) then an extra isn't added.  As you say, that doesn't mean that braces balance in the file, but if they don't balance where do you put the close??  If I have { { } } and I add a brace at position 3 giving { { { } } do I want { {} { } } or do I want { { { } } }??  So the current behaviour of not adding anything other than for level one open braces is probably better.<br>

</div></div></blockquote><div> </div><div>this unwanted behavior you describe is to some extent already in place in geany - given a string "(...)", when adding a new "(" to the left of the string, scintilla will return -1 for bracematching and so geany will add a ")" automatically, which results in "()(...)". but i may have wanted to produce "((...))".</div>

<div>all the same, the example you gave is a good argument against my suggested change.</div><div>for me personally, coupling brace-balancing with allowing users to wrap the current selection in braces (similar to the "comment current line" feature) would be a good solution.</div>

<div>i would like to hear thoughts on the matter.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div>
 </div><div class="im"><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div dir="ltr"><div> i like the use of brace-matching, so i'm not suggesting to make braces close blindly, but am looking into adding a brace-balance calculation function.</div>


</div></blockquote></div><div><br>Scanning will have to be done in Scintilla because it has the information to ignore braces in strings and comments, so level saving probably should be done there as well.<br></div></div>

</blockquote><div> </div><div>this is true to a limited extent. both in geany 0.18 and in the trunk version, when 2 matching braces are separated by a 3rd brace in a string or in a comment, the correct pair are colored as matching. however, if there is a closing brace in a comment or string and an opening brace is added before the comment/string, the brace will not auto-close. i think i'll have a look at this to try and find out why this is happening.</div>

<div><br></div><div>kind regards,</div><div>avi</div></div></div>