[Geany-Users] Bug? Detecting indent width from content.

Lex Trotman elextr at xxxxx
Wed Oct 1 08:39:59 UTC 2014


On 23 September 2014 00:46, Péter <peter20 at mpp.hu> wrote:
> Hi!
>
> Here is my small sample file (indent unit is 4 spaces):
>
> -- -- -- --
> $ cat indent_width.cpp
> // Indent width, detect from content: 8 (wrong). Delete any line. Indent
> width, detect from content: 4 (good).
> namespace S {
>     int z () {
>         int i = 0;
>         char c = 2;
>         double d = 2.4;
>         d *= c;
>         return d + i;
>     }
> }
> -- -- -- --
>
> In Geany, the default indent at me is 4 spaces.
>
> Open the indent_width.cpp in Geany, issue an "Indent Width / Detect from
> Content" command.
> The indent is now (erroneously) 8 spaces!
>
> Now try deleting a line (for example the "double d = 2.4;").
> Repeat the autodetection: "Indent Width / Detect from Content".
> The indent is now (correctly) 4 spaces.
Hi,

Well, the detection is a heuristic that applies some weightings to
higher indents, so deleting a higher indent line can potentially
change the results of the heuristic as you have demonstrated.

I don't know where the heuristic came from, but since there are not
lots of complaints similar to this, it would need lots of evidence to
persuade a change.


>
> Geany's version is: 1.23.1 (current distributed (repository-ed) version).

I *hope* you meant 1.24.1 (which is the current release) or you should
poke your distro.

Cheers
Lex

>
> --
> Péter
>
>
> _______________________________________________
> Users mailing list
> Users at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/users


More information about the Users mailing list