Revision: 5873 http://geany.svn.sourceforge.net/geany/?rev=5873&view=rev Author: colombanw Date: 2011-07-28 17:59:58 +0000 (Thu, 28 Jul 2011)
Log Message: ----------- Improve indentation width detection to better deal with Java and Vala files
Modified Paths: -------------- trunk/ChangeLog trunk/src/document.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-07-28 17:59:40 UTC (rev 5872) +++ trunk/ChangeLog 2011-07-28 17:59:58 UTC (rev 5873) @@ -5,6 +5,9 @@ src/ui_utils.c, geany.glade, doc/geany.txt, doc/geany.html: Allow to edit formerly hidden preferences in the prefs dialog (closes #3313315, patch by Dimitar Zhekov, thanks!). + * src/document.c: + Improve indentation width detection to better deal with Java + and Vala files.
2011-06-26 Colomban Wendling <colomban(at)geany(dot)org>
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2011-07-28 17:59:40 UTC (rev 5872) +++ trunk/src/document.c 2011-07-28 17:59:58 UTC (rev 5873) @@ -1023,18 +1023,15 @@ for (i = G_N_ELEMENTS(widths) - 1; i >= 0; i--) { if ((width % (i + 2)) == 0) - { widths[i]++; - break; - } } } count = 0; width = iprefs->width; - for (i = 0; i < (gint)G_N_ELEMENTS(widths); i++) + for (i = G_N_ELEMENTS(widths) - 1; i >= 0; i--) { - /* give small lengths higher weight not for nested blocks to confuse detection */ - if (widths[i] > count * 4) + /* give large indents higher weight not to be fooled by spurious indents */ + if (widths[i] >= count * 1.5) { width = i + 2; count = widths[i];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.