Skip to content

Add the shortcut "Toggle between editor&sidebar and only sidebar" #82

@ralf3u

Description

@ralf3u

Knowledge
This issue is based on switch-views and toggle-views at geanylua-scripts.

History
The last days the shortcut Toggle sidebar visibility and focus was added to the plugin Preview. The shortcut offers at the same time the following shortcut of toggle-views when sidebar width is set to 100%: Toggle between only sidebar and only editor. So, the only shortcut what is missing in Preview of toggle-views is Toggle between editor&sidebar and only sidebar.

Vertical line between editor and sidebar
I think that switch-views was developed with geanylua-scripts in order to remember the width of the sidebar. My approach to solve the shortcut Show editor&sidebar or toggle between editor&sidebar and only sidebar within Preview is to give up remembering the width of sidebar. Instead, the width of the sidebar could be defined in preview.conf with an entry like sidebar_width = 40 that would be connected only with the shortcut Show editor&sidebar or toggle between editor&sidebar and only sidebar. The number would give the percentage. Users could use numbers for example between 10 and 90 for a realistic use. So, numbers like 4 or 92 would be not possible.

Fictional example when the shortcut is executed
If only editor is shown, and then if I press the shortcut Show editor&sidebar or toggle between editor&sidebar and only sidebar, then editor&sidebar will appear with a 60:40 relation (if sidebar_width = 40). So, it will, before pressing the shortcut, not respect the remembered sidebar width. If I press again the shortcut Show editor&sidebar or toggle between editor&sidebar and only sidebar, then only sidebar will appear.
Now if I press the shortcut Toggle sidebar visibility and focus I can use that shortcut as Toggle between only sidebar and only editor. If only editor is shown, then if I press the shortcut Show editor&sidebar or toggle between editor&sidebar and only sidebar, then editor&sidebar will appear.
I can still change the width of the sidebar with the mouse by moving the vertical line between editor and sidebar, and then I can use many times the shortcut Toggle sidebar visibility and focus with a relation that is not 60:40.

Conditions when pressing the shortcut

  • IF sidebar is disabled, THEN show editor&sidebar.
  • IF editor&sidebar is shown (so, if sidebar is enabled and if sidebar is not width=100%), THEN show only sidebar (sidebar width=100%).
  • IF only sidebar is shown (so, if sidebar width=100%), THEN show editor&sidebar.

Benefits of the shortcut if it can be programed

  • The geanylua-script switch-views could be removed at geanylua-scripts.
  • There is no need for the realization of toggle-views at geanylua-scripts.
  • The current auto-sidebar at geanylua-scripts could be removed and could be replaced by the small version of auto-sidebar described in issue number 12 at geanylua-scripts.
  • There is no need for the two additional shortcuts Toggle Sidebar and Toggle sidebar visibility and focus in switch-views and in toggle-views (the reason is the empty tab that appears with the geanylua-scripts if both shortcuts are not implemented).
  • Maybe there will be no graphical glitch any more (see issue number 9 at geanylua-scripts).

Next step when this issue is fixed
The realization of the shortcut Toggle between only sidebar and only editor could be the next step in order to have a more simple use of the shortcuts (see down below "Shortcuts for advanced users"). The shortcut Toggle between only sidebar and only editor should not execute if editor&sidebar is visible in order to create less confusion.

Shortcuts for beginners
For beginners these shortcuts could be interesting:
F2: Toggle focus between Sidebar and Editor
F3: Toggle sidebar visibility and focus

Shortcuts for advanced users
For advanced users these shortcuts could be interesting:
F2: Toggle focus between Sidebar and Editor
F3: Toggle sidebar visibility and focus
F4: Show editor&sidebar or toggle between editor&sidebar and only sidebar
F5: Toggle between only sidebar and only editor

Version
0.2.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions