xiota / geany-preview

Turns Geany into a markdown editor by providing a preview pane in the sidebar to show the formatting of several light-weight languages as they are edited. Supported document types include AsciiDoc, DocBook, Fountain, HTML, LaTeX, Markdown, MediaWiki, reStructuredText, Textile, and Txt2Tags.
GNU General Public License v3.0
12 stars 0 forks source link

add the shortcut "Toggle sidebar" to the plugin #37

Closed ralf3u closed 1 year ago

ralf3u commented 2 years ago

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" https://github.com/xiota/geany-preview/issues/34#issuecomment-1162606954

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

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

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 https://github.com/xiota/geanylua-scripts/issues/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" https://github.com/xiota/geany-preview/issues/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").

xiota commented 2 years ago

I would rather leave this as a lua script. Could you explain more succinctly why the script isn't good enough?

ralf3u commented 2 years ago

I would rather leave this as a lua script. Could you explain more succinctly why the script isn't good enough?

The lua-script works fine. The three reasons for this issue are: 1: the lua-script does not offer focus feature (see description above) 2: the lua-script does not offer crisscross feature (see description above) 3: the lua-script does not work out of the box of Geany Preview

I admit that this issue is an advanced feature.

ralf3u commented 1 year ago

focus-feature For reasons of documentation, I would like to mention that, according to https://github.com/xiota/geany-preview/issues/5#issuecomment-1272538526, the focus-feature could be realized in this issue by a kind of copy/paste of the focus-feature of the shortcut "Toggle focus between editor and sidebar":

Not exactly copy/paste, but they're doable.

ralf3u commented 1 year ago

Today I have a better shortcut name than Toggle sidebar: Toggle between only sidebar and editor/sidebar

ralf3u commented 1 year ago

Today I think it is better not to offer the crisscross-feature to the shortcut, because the shortcut Toggle between only editor and only sidebar offers the crisscross-feature. I recognized today that this would mean less confusion.

So, if the shortcut is active (only sidebar is visible) and if the shortcut #38 is pressed, then nothing should happen.

xiota commented 1 year ago

This is out-of-scope for the preview plugin. The lua scripts provide "good enough" functionality. I'll take a look at them again to see if/how they can be improved.

ralf3u commented 1 year ago

I'll take a look at them again to see if/how they can be improved.

Before you look at it again, please give me till tomorrow time to rethink about this shortcut, if the features that I described in this issue are really good.