Hi Avi,<br><br><div class="gmail_quote">On 6 May 2010 08:28, Avi Hayoun <span dir="ltr"><<a href="mailto:iceman400@gmail.com">iceman400@gmail.com</a>></span> wrote:<br><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">hi everyone.<div>my name is avi and i am a BSc CS student nearing the end of my first year of university. i really like geany and am interested in contributing to the project. i have an average knowledge in C and basic knowledge in C++, but have some experience working in collaboration with other devs on an existing code base. i'm also pretty good at figuring things out as i go along, so hopefully i'll be able to be of use without making too much of a mess :P.</div>
<div><br></div><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><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><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 looked through the code that handles brace auto-closing, and noticed that braces aren't closed blindly, unlike quotes. i assume this difference is either because scintilla doesn't offer quote balancing (i didn't look though) or to try to prevent the code from being littered by accidental braces.</div>
</div></blockquote><div><br>Quotes don't have different open and close characters so balancing is a different concept. And because following text is styled as a string, missing close quotes are reasonably visible. <br>
</div><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><br>This would require either to scan the whole file to find if it is balanced in respect of the newly added open brace or storing brace level with each brace so the scan is limited. 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><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>2) an optional closing-character-overwrite (with toggleable preference) - i like the brace\quotes autocomplete features, but will sometimes close braces\quotes myself (so i type both "{" and "}") and would like the option to have geany overwrite the auto-closed brace (so if i type "{}" the result will be "{}" and not "{}}" like it is now) </div>
</div></blockquote><div><br>Could be useful for the fast fingered independent of other changes. Maybe patch this for a start, what do others think?<br> </div><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>and the same for quotes (so " ' ' " doesn't become " ' ' ' ' "). this preference would use brace-balancing to decide when to overwrite a closing character (so when adding a "}" to "{{@}" where the @ is, no overwrite would occur, and the result would be "{{}}").</div>
<div><br></div><div>i am having trouble deciding how to implement the brace-balancing:</div><div>on the one hand, the code for this would be very similar to the scintilla method Document::BraceMatch(), with the difference of returning a value indicating the balance (for example, 1 if opening braces > closing braces, 0 if even, -1 if opening < closing) instead of the index of the matching brace. so it would seem natural to write the function in scintilla, but that would require adding an api to the method and adding a scintilla wrapper for it in geany, which seems like overkill for a function that has only 1 use case (that i can think of. when else would i want to know if braces are balanced, other than when trying to balance them...?). on the other hand, by looking over the scintillaWrappers file in geany, i think it would be messy to implement the same thing directly in geany instead of in scintilla.</div>
</div></blockquote><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><br></div><div>are these features that you would like added to geany (cause if not, i would just make a messy fix for myself and be done with it :P)?</div>
</div></blockquote><div><br><div>
As i said above I think you would have to do it in Scintilla (or the language lexer???). <br>
</div>
</div><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>if so, any suggestions regarding my dilema?</div></div></blockquote><div><br>Remember if its in Geany it has to work for different languages, not just C/C++ so it must interact properly with the lexer which Scintilla does.<br>
<br>Cheers<br>Lex<br> </div><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><br></div><div>cheers,</div><div>avi.</div></div>
<br>_______________________________________________<br>
Geany-devel mailing list<br>
<a href="mailto:Geany-devel@uvena.de">Geany-devel@uvena.de</a><br>
<a href="http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel" target="_blank">http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel</a><br>
<br></blockquote></div><br>