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
15 stars 0 forks source link

add the shortcut "Toggle editor" to the plugin #38

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 editor", only the editor should appear; the highlighted line should be there when pressing it again, the only-editor-view should not be there any more; the highlighted line should be there

reasons for adding the shortcut to the plugin because the shortcut "Toggle Sidebar" of Geany does not have a state file, it is necessary to add the shortcut "Toggle editor" to the plugin (the shortcut "Toggle Sidebar" would correspond from the handling to the shortcut "Toggle editor" of Geany Preview), in order to add a state file, so that https://github.com/xiota/geanylua-scripts/issues/3 and the crisscross feature down below can be solved

focus feature always after pressing the shortcut: the content of the editor should be in focus, so the highlighted line should be there; this feature is not necessary to program, because it works perfect at the moment with the shortcut "Toggle Sidebar", that would correspond to the shortcut "Toggle editor" in Geany Preview

crisscross feature when pressing "Toggle sidebar", first the state file of the "Toggle sidebar" need to be checked; so, if only-sidebar-view is active, then first de-activate only-sidebar-view

name of the shortcut see explication in "name of the shortcut" in https://github.com/xiota/geany-preview/issues/37#issue-1271939796

autoside-bar this issue should also keep an eye on this issue https://github.com/xiota/geanylua-scripts/issues/3;

when closing Geany if only-editor-view is active:

xiota commented 2 years ago

Is this to hide the editor and show only the sidebar? Don't you already have this feature with a lua script?

ralf3u commented 2 years ago

Is this to hide the editor and show only the sidebar?

No, it is to show only the editor, so to hide the sidebar.

Don't you already have this feature with a lua script?

The lua-script is the alternative to #37.

xiota commented 2 years ago

No, it is to show only the editor, so to hide the sidebar.

The lua-script is the alternative to https://github.com/xiota/geany-preview/issues/37.

So a similar lua script could resolve this too?

ralf3u commented 2 years ago

So a similar lua script could resolve this too?

No, this is not necessary because in Geany there is already the shortcut "Toggle Sidebar". When I press that shortcut, then I can see only the editor. But the two disadvantages are: 1: it does not offer focus feature (see description above) 2: it does not offer crisscross feature (see description above)

ralf3u commented 2 years ago

So a similar lua script could resolve this too?

If both disadvantages from my last comment could be solved, then why not.

xiota commented 2 years ago

Trying to get focus to work has been frustrating. I'd rather not mess with it.

Does "crisscross feature" mean that the different toggles are aware of each other? I think that can be managed in the scripts. It makes them a bit more complicated, but still easier to write lua script than to change C code.

ralf3u commented 2 years 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 2 years ago

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

ralf3u commented 2 years ago

When the shortcut is active: It would be good if tab-browsing in the editor works correct with auto-sidebar.

ralf3u commented 2 years 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 editor is visible) and if the shortcut #37 is pressed, then nothing should happen.

ralf3u commented 1 year ago

Just for information: Also for a better performance of this fictional shortcut Toggle between only editor and editor/sidebar, I just opened at Geany a new issue with the number 3399 with the title "Highlighted line is not in the visible area when toggling sidebar 2x".

ralf3u commented 1 year ago

It was good that this issue was not fixed, because I just recognized that the Lua Script (https://github.com/xiota/geanylua-scripts/tree/main/toggle-editor) works perfect for me, because I changed the last days the way to code. The focus stays always in the editor while toggling, and that's good.

Two things that can be taken from this issue: 1 changing the current name from Toggle editor to Toggle between only editor and editor/sidebar would be good (even if it is a little bit long), because it describes better what happens while toggling 2 I think an additional Lua Script would be good, where also at the same time the focus would toggle. The shortcut name could be something like Toggle between only editor and editor/sidebar, + focus. Personally I would use that shortcut not so much like the current shortcut. I will open tomorrow a new issue for this shortcut on the geanylua-scripts-webpage.