condition
before to start to solve this issue, the shortcut name "Toggle between the editor and preview" should be changed to "Toggle between editor and preview" #34 (comment)
behavior
when pressing 1x the shortcut "Toggle sidebar", only the sidebar should appear
when pressing it again, the only-sidebar-view should not be there any more
tab feature
the shortcut "Toggle sidebar" should have exactly the same tab feature like the shortcut "Toggle focus between the editor and preview", so that users are less disoriented; so, when switching focus from the editor to the sidebar, then the Preview-tab should be in foreground, but when leaving sidebar focus, then the foreground of the tab of the sidebar should not change
- if the editor is in focus while editor and preview is visible, and if there is an other tab of the sidebar than the Preview-tab in the foreground, then, when pressing the shortcut "Toggle sidebar", the Preview-tab should be in the foreground
- if only the sidebar is visible, and an other tab of the sidebar than the Preview-tab is in the foreground, then, when pressing the shortcut "Toggle sidebar", the tab of the sidebar should not lose the foreground
- if the sidebar is in focus while editor and preview is visible, and an other tab of the sidebar than the Preview-tab is in the foreground, then, when pressing the shortcut "Toggle sidebar", the tab of the sidebar should not lose the foreground
I don't think that the tab feature need to be programed. I think that it will work automatically when focus feature will work.
focus feature
the shortcut "Toggle sidebar" should have exactly the same focus feature like the shortcut "Toggle focus between the editor and preview", so that users are less disoriented
- if the editor is in focus, and when pressing the shortcut "Toggle sidebar", the content of the Preview-tab should be in focus
- if the sidebar is in focus, and when pressing the shortcut "Toggle sidebar", then the highlighted line should appear in the editor, on that place where it was the last time
Maybe the focus feature could be solved with copy & paste of a part of the code of the shortcut "Toggle focus between the editor and preview", because they have both exactly the same focus feature.
crisscross feature
a state file would be good, so that interactions between the shortcut "Toggle sidebar" and the shortcut "Toggle editor" are possible, so that when pressing "Toggle sidebar" and then "Toggle editor", or vice versa, that no empty Geany appears;
so, if "Toggle editor" is active, then first de-activate only-editor-view
alternative
as long as the shortcut "Toggle sidebar" is not part of the plugin, the toggle-editor-scripts can be used (https://github.com/xiota/geanylua-scripts); but the scripts don't offer all the features above
name of the shortcut
In Geany there is the shortcut "Toggle Sidebar". This makes sense, because in Geany the editor is the center while other tools are some kind of accessories, what can be enabled and disabled. But in the plugin Geany Preview the center consists of two items: editor and preview. So, here we have a completely other starting point. Now, before pressing a shortcut in Geany Preview, users have a clear vision of the final result in them heads. And the final result is to see only the sidebar. And that is why the shortcut should be called "Toggle sidebar" and not "Toggle editor", even if it is about disabling and enabling the editor.
By the way, the possible shortcut "Toggle editor" inside the plugin, would correspond to the shortcut "Toggle Sidebar" in Geany, because the final result is to see only the editor, even if it is about disabling and enabling the sidebar.
history
this issue is a continuation of xiota/geanylua-scripts#4
reasons for adding the shortcut to the plugin
I think that the three shortcuts "Toggle focus between the editor and preview", "Toggle Sidebar" and "Toggle editor" are important shortcuts in Geany Preview. And also because they don't need to be personalized, they should be inside the plugin (the shortcut "Toggle focus between the editor and preview" is already part of the plugin). And I think that the shortcut "Toggle sidebar" is easier to develop and to maintain than outside Geany Preview (see down below "possible order of development"). And users will benefit of options that work out of the box.
possible order of development
I think that it is easier to develop first the shortcut "Toggle editor" #38 and then this shortcut, because then somehow the development of this shortcut is something like a copy & paste work (the code for focus feature can be copied from the code "Toggle focus between the editor and preview" ", and the code the for the crisscross feature can be copied from the code of the shortcut "Toggle editor").