Hi, I've made changes that allow for keeping the fold margin non-visible, but still be able to fold code (eg. via the shortcuts).
UI Additions: - "Show fold margin" in Preferences > Editor > Display. - "Show fold margin" in the View menu.
If code folding is disabled: - The 1st UI addition becomes greyed out, similarly to "Fold/unfold all children of a fold point" - The 2nd UI addition disappears, similarly to "Fold/Unfold All" in the Document menu.
Furthermore, if the code folding option is disabled and it becomes enabled, "Show fold margin" is automatically enabled. The rationale is to avoid confusing someone that enabled folding, but is not seeing any fold margin.
Finally, in the 2nd commit, which is actually not directly related to the above additions, I've added some logic to automatically unfold all code when switching off folding. Without it, already folded code will remain in the folded state with no option to unfold it without re-enabling the option. Should I make a different PR for this? (asusming it even is desired!)
Also, should I or would you suggest that I also modify the manual to document the additions? Should I add something about the new UI options in the language/translation files? You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/2927
-- Commit Summary --
* <a href="https://github.com/geany/geany/pull/2927/commits/3493f32c921218ae8512537898e0ad46807f2941">Add UI option to hide the fold margin, while keeping code folding</a> * <a href="https://github.com/geany/geany/pull/2927/commits/3ff536201efb74307c837f7585e0869be59d88fe">Automatically unfold all code when folding is switched off in preferences</a>
-- File Changes --
M data/geany.glade (30) M src/callbacks.c (10) M src/editor.c (6) M src/editor.h (1) M src/keyfile.c (2) M src/prefs.c (17) M src/ui_utils.c (5) M src/ui_utils.h (1)
-- Patch Links --
https://github.com/geany/geany/pull/2927.patch https://github.com/geany/geany/pull/2927.diff
I am not sure that being able to turn off folding is a good idea, IIUC parts of symbols handling uses it to locate the current block/function/construct. There may be other places its used as its the only part of Geany that provides structure information.
Havn't looked at the changes but IRO your questions:
Should I make a different PR for this? (asusming it even is desired!)
Sounds like its sensible to be part of the change.
Also, should I or would you suggest that I also modify the manual to document the additions?
Of course.
Should I add something about the new UI options in the language/translation files?
IIUC should happen automatically if the strings are marked for translation.
If you don't mind a simple user's opinion: I think these are all good changes; here's some questions and feedback:
UI Additions:
Why do choose to place these additions both in the Preferences and View menu ? From what I can tell, many (or most) of the settings in View are duplicates of those in Preferences. Maybe would be better to have in Preferences only those that are not directly about Viewing?
I've added some logic to automatically unfold all code when switching off folding
Nice, I noticed this little omission too. While you are at it, do you think it would be too hard to also add an option to choose the default folding state when opening a document? I for one would prefer the docs to open in all-folded state (given that it's not possible/ too hard to implement remembering of folding state). I heard at least one other [person](https://sourceforge.net/p/geany/feature-requests/727/) wishing this too.
@elextr:
I am not sure that being able to turn off folding is a good idea
Unless I'm misunderstanding you: code folding enable/disable option is already present in Preferences; **gkatev** is only implementing option to hide the fold margin.
Is it a good idea to place these additions both in the Preferences and View menu ? From what I can tell, many (or most) of the settings in View are duplicates of those in Preferences. Maybe would be better to have in Preferences only those that are not directly about Viewing the already-opened files.
As I said I havn't looked at the changes, but the general principle is that `View` should change the UI layout immediately and the current state be saved and restored, like the checkbox on `Show Message window` etc.
Unless I'm misunderstanding you: code folding enable/disable option is already present in Preferences
To be clear the comment that it is a bad idea was a general one, not specifically aimed at this PR.
But it was meant to indicate that therefore the operations in the PR that depend on turning it off are less useful since it should only very rarely be turned off.
I for one would prefer the docs to open in all-folded state (given that it's not possible/ too hard to implement remembering of folding state)
IIUC fold state saving has been folded into (see what I did there ;-) both numbered bookmarks and workbench plugins.
Re: View: That sounds sensible to me. And if the setting is good for "View" menu, it shouldn't need to go into "Preferences" as well.
To be clear the comment that it is a bad idea was a general one, not specifically aimed at this PR.
Oh, I see now; my bad.
So I don't have an opinion on whether folding should be allowed to be disabled or not, but currently it is, so I've implemented the new feature for all cases.. But, if you wanted to go ahead and remove the option to disable folding in the future, being able to hide the margin would satisfy those that do not use/want it.
On personal opinion level, since it's been mentioned here, I think the duplication of some items in the menu and the preferences dialog is ok. For example, with the 'hide fold margin' option, if you wanted to quickly enable/disable it, you would have to go through the not-necessarily-too-quick preferences dialog (if it was there only). When configuring the editor, it's useful to have everything "in reach", instead of looking around in menus (you can't even click on menus while the preferences are opened).
I will look into updating the manual.
When configuring the editor, it's useful to have everything "in reach", instead of looking around in menus (you can't even click on menus while the preferences are opened).
...
For example, with the 'hide fold margin' option, if you wanted to quickly enable/disable it
Good points. So then that's another criterion to decide on whether it goes into "View" menu, vs in "Preferences" and/or configuration files. (My motivation is just to reduce unnecessary duplication/visual noise in various settings' location ) Like, is 'hide fold margin' something you would want to change often ? Personally, I'd decide early on whether I want to hide it or not, set it so, and very rarely need to change it again.
Anyway, it's a relatively minor point, thanks again for implementing.
@gkatev pushed 2 commits.
6c52d3ebe6383d96c8a6f6b524c69b6f0007deb8 Add UI option to hide the fold margin, while keeping code folding 243388414938773e9cd38f48aeb237ca041f50e0 Automatically unfold all code when folding is switched off in preferences
Updated the manual.
Are there any updates to this? Did you perhaps need me to improve something?
Did you perhaps need me to improve something?
Currently there are large changes happening to fundamental features of Geany, so its likely nobody has time for other PRs and there are plenty of them ahead of you in the queue.
@gkatev pushed 2 commits.
215ad61f786d76f64d8233fc5af8c94dd1172c07 Add UI option to hide the fold margin, while keeping code folding 9a5a1e1acaad43fc2d4168991c0f191f7bca3598 Automatically unfold all code when folding is switched off in preferences
I updated this PR to work with the current master
@gkatev pushed 2 commits.
6a1b66e8b5633db75517ceb815fffd9ec4ebca4d Add UI option to hide the fold margin, while keeping code folding b3a5052b003423a9392110984e0d571cf541a029 Automatically unfold all code when folding is switched off in preferences
github-comments@lists.geany.org