When working with Python file Geany ignores indentation settings and sometimes inserts tabs even when configured with the saner spaces choie (which should be default anyway) particularly after pressing enter after any ":" like after if and while constructs in Python. This makes it essentially not very useful for such programming tasks as the indentation will constantly be messed up. I recall this setting was always a bit of a pain in Geany and needed program restarts to be applied, but previously at least it worked after restart, now its behavior is inconsistent.
Version used: [geany-2.0_osx_arm64.dmg](https://download.geany.org/geany-2.0_osx_arm64.dmg)
It seems one can avoid having it insert tabs by setting auto-indent mode to None, but then when pressing tabs it will still insert tabs instead of spaces despite "Tab key indents". Maybe automated testcases could ensure the most basic functionality won't break again in the future?
What is inserted for indentation is set in `Document->Indent Type->Spaces` and number by `Document->Indent Width->4` (or whatever).
The values for those two settings are set on loading a file is to the value in preferences or project properties which overrides the preferences if a project is open.
Both of those have a `Detect from file` option which you may prefer if your files are consistent (which Python files should be)
I see, this makes sense, thank you for clarifying! I wasn't aware this can be set on a per-file basis and that this can contradict what is specified in the settings. This was indeed the cause of the issue, please feel free to close the issue.
Closed #3721 as completed.
When using 2.0 on Windows the indentation I have set in `Preferences->Editor->Indentation->Width` is completely ignored in all open documents. I have indeed clicked `Project->Apply default indentation` and no change. I have even closed every document, closed Geany, reopened Geany then open each document and the editor indentation width is completely ignored. Going to `Document->Indentation Width` shows 4 when I have set 2 globally. Geany 1.38 works as expected, however.
@willbprog127 do you have a project open? It has indentation settings which override the default preference.
@willbprog127 do you have a project open? It has indentation settings which override the default preference.
No, no project open.
I know from the past that this setting is 'tricky' although it really shouldn't be. Geany is a great editor / IDE, it's just little things like this that make it frustrating to use when setting up on a new system.
I guess in retrospect the real story is that file preference should not override global settings in the first place unless the user has explicitly changed it for the particular file. It is just confusing and strange behavior that the settings can have no effect when file-based defaults do not agree.
Indentation is stupidly complex, everyone should use _my_ standard, 4 spaces :grinning:
But sadly thats not the case, in languages like Python indentation sets program structure, so Python really should use spaces and it defines tab as 8 spaces for where they are mixed, Geany is C which doesn't care, but the devs do and decree tabs but 4 space width, GNU uses two spaces IIRC, other projects use other rules.
So it varies by project, by filetype, and needs a default for new files. So Geany has all three, with filetype file indentation settings (if present) overriding default in the preferences, and project overriding both filetype and default (IIRC, I didn't check).
But that doesn't handle the user opening a random file from somewhere else, so they need to be able to select the indentation setting manually, and have that override everything, and stick (at least as long as the file is open, and across Geany restarts).
But that can be quite a pain, so there is an option to try to detect the indentation from the file when its opened, but its a heuristic, and as such can be wrong, so the manual override is still needed.
github-comments@lists.geany.org