Improve indentation width detection to better deal with Java and Vala files
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5873 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
c26cd608b7
commit
018170c130
@ -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>
|
||||
|
@ -1023,18 +1023,15 @@ static gint detect_indent_width(GeanyEditor *editor, GeanyIndentType type)
|
||||
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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user