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

The glorious five shortcuts #59

Open ralf3u opened 1 week ago

ralf3u commented 1 week ago

Toggle between editor&sidebar and only sidebar Toggle between editor&sidebar and only editor Toggle (focus) or (only editor / only sidebar)

History This issue is based on the knowledge of #53.

ralf3u commented 1 week ago

Maybe it would be good to add two more shortcuts to the list in case users are overstrained with the shortcut Toggle (focus) or (only editor / only sidebar). Maybe then there is better understanding for that shortcut.

List of the shortcuts Toggle focus between editor and sidebar Toggle between editor&sidebar and only editor Toggle between editor&sidebar and only sidebar Toggle between only editor and only sidebar Toggle (focus) or (only editor / only sidebar)

Shortcuts inside or outside of Preview? I think it is better to program all the shortcuts either inside the plugin Preview or in an other plugin, like Preview shortcuts, because the shortcuts are connected. Maybe the best is to put them in the plugin Preview shortcuts, and at the same time to open for each shortcut an issue at geany. So, if one day the shortcuts will be implemented in Geany, there is no need any more for the plugin Preview shortcuts.

Auto-sidebar If the shortcuts are not programed with lua it could be that the auto-sidebar small edition could be used (with "small edition" I mean the very first auto-sidebar that you programed). And that is positive because it has less code and therefore maybe will create less problems.

Graphical glitch If the shortcuts are not programed with lua, then it could be that the graphical glitch (https://github.com/xiota/geanylua-scripts/issues/9) will not exist any more. With lua the focus didn't work. Maybe because of lua there is this graphical glitch.

Personal use The shortcut Toggle (focus) or (only editor / only sidebar) is the most important shortcut for me. But if it is too complicate to program the shortcut, then the next most important shortcut for me is Toggle between only editor and only sidebar. No matter which of both will be programed, it will be for me a huge improvement. Maybe it would be the best to start first with the shortcut Toggle between only editor and only sidebar before to start to program the other shortcuts.

ralf3u commented 1 week ago

What do you think about the shortcuts?

ralf3u commented 1 week ago

I would like to change the name of one shortcut: Instead of Toggle (focus) or (only editor / only sidebar) I would call the shortcut Toggle focus or toggle only editor/only sidebar

So this is the new list: Toggle focus between editor and sidebar Toggle between editor&sidebar and only editor Toggle between editor&sidebar and only sidebar Toggle between only editor and only sidebar Toggle focus or toggle only editor/only sidebar

xiota commented 1 week ago

Maybe they would fit in the xi-tweaks plugin.

Does the toggle focus between preview and editor shortcut work? Is focus in the contents of the preview?

ralf3u commented 1 week ago

Does the toggle focus between preview and editor shortcut work?

It works perfect.

Is focus in the contents of the preview?

The focus-feature works perfect in the plugin Preview but only if shortcuts are used. That is the reason why the shortcut Toggle focus between editor and sidebar works perfect. And that is the reason why it does not work for issue number 15 because there it is not a shortcut that is in action but a mouse. With the plugin Lua Scripts focus can't be set correctly.

ralf3u commented 1 week ago

The shortcut Toggle focus between editor and sidebar already exists. For the other four shortcuts I would like to write a specification that could be a good help for the realization of the four shortcuts. I will be back in some hours.

ralf3u commented 1 week ago

Thanks to the specification I recognized that I have to change the name of one shortcut that stands for "Switch mode". Instead of Toggle between editor&sidebar and only editor I prefer the name Toggle between editor&sidebar and only view. Toggle between editor&sidebar and only view stands for Toggle from editor&sidebar to only editor, or switch only sidebar to editor&sidebar. But that name is too long.

So this is the new list: Toggle focus between editor and sidebar Toggle between editor&sidebar and only sidebar Toggle between editor&sidebar and only view Toggle between only editor and only sidebar Toggle focus or toggle only editor/only sidebar

ralf3u commented 1 week ago

SPECIFICATION

Toggle focus between editor and sidebar IF sidebar has focus THEN focus editor IF editor has focus THEN focus sidebar (not an ELSE because of the message window)

Toggle between editor&sidebar and only sidebar IF only sidebar is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only sidebar [focus sidebar] (not nesserary: IF only editor is shown THEN do nothing)

Toggle between editor&sidebar and only view (see "REMARK") IF only sidebar is shown THEN show editor&sidebar [focus editor] IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor]

Toggle between only editor and only sidebar IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus sidebar] (not nesserary: IF editor&sidebar is shown THEN do nothing)

Toggle focus or toggle only editor/only sidebar IF editor&sidebar is shown THEN { IF sidebar has focus THEN focus editor IF editor has focus THEN focus sidebar (not an ELSE because of the message window) } ELSE { IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus sidebar] }

REMARK Toggle between editor&sidebar and only view stands for Toggle from editor&sidebar to only editor, or switch only sidebar to editor&sidebar or for Switch mode (mode 1: editor&sidebar; mode 2: only view).

ralf3u commented 1 week ago

I would like to change a name of a shortcut. Instead of Toggle focus or toggle only editor/only sidebar I prefer Toggle focus or toggle only view.

So this is the new list: Toggle focus between editor and sidebar Toggle between editor&sidebar and only sidebar Toggle between editor&sidebar and only view Toggle between only editor and only sidebar Toggle focus or toggle only view

ralf3u commented 1 week ago

SPECIFICATION

Toggle focus between editor and sidebar IF sidebar has focus THEN focus editor IF editor has focus THEN focus sidebar (not an ELSE because of the message window)

Toggle between editor&sidebar and only sidebar IF only sidebar is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only sidebar [focus sidebar] (not nesserary: IF only editor is shown THEN do nothing)

Toggle between editor&sidebar and only view (see "REMARK") IF only sidebar is shown THEN show editor&sidebar [focus editor] IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor]

Toggle between only editor and only sidebar IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus sidebar] (not nesserary: IF editor&sidebar is shown THEN do nothing)

Toggle focus or toggle only view IF editor&sidebar is shown THEN { IF sidebar has focus THEN focus editor IF editor has focus THEN focus sidebar (not an ELSE because of the message window) } ELSE { IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus sidebar] }

REMARK Toggle between editor&sidebar and only view stands for Toggle between editor&sidebar and only editor, or switch only sidebar to editor&sidebar or for Switch mode (mode 1: editor&sidebar; mode 2: only view).

ralf3u commented 1 week ago

I would like to change the order of the shortcuts. Now the two less important shortcuts are on top because they can be replaced by the fifth shortcut. So this is the new list:

Toggle focus between editor and sidebar Toggle between only editor and only sidebar Toggle between editor&sidebar and only sidebar Toggle between editor&sidebar and only view Toggle focus or toggle only view

ralf3u commented 1 week ago

I would like to change a name of one shortcut. So this is the new list:

Toggle focus between editor and sidebar Toggle between only editor and only sidebar Toggle between editor&sidebar and only sidebar Switch mode: editor&sidebar or only view Toggle focus or toggle only view

Remark Switch mode: editor&sidebar or only view stands for Toggle between editor&sidebar and only editor, or switch only sidebar to editor&sidebar.

ralf3u commented 1 week ago

SPECIFICATION

Toggle focus between editor and sidebar IF sidebar has focus THEN focus editor IF editor has focus THEN focus sidebar (not an ELSE because of the message window)

Toggle between only editor and only sidebar IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus sidebar] (not nesserary: IF editor&sidebar is shown THEN do nothing)

Toggle between editor&sidebar and only sidebar IF only sidebar is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only sidebar [focus sidebar] (not nesserary: IF only editor is shown THEN do nothing)

Switch mode: editor&sidebar or only view (see "Remark") IF only sidebar is shown THEN show editor&sidebar [focus editor] IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor]

Toggle focus or toggle only view IF editor&sidebar is shown THEN { IF sidebar has focus THEN focus editor IF editor has focus THEN focus sidebar (not an ELSE because of the message window) } ELSE { IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus sidebar] }

Remark Switch mode: editor&sidebar or only view stands for Toggle between editor&sidebar and only editor, or switch only sidebar to editor&sidebar.

ralf3u commented 1 week ago

Because it could be that users are overstrained by the name or by the feature of the shortcut Switch mode: editor&sidebar or only view, I would like to add one more shortcut: Toggle between editor&sidebar and only editor. I put the shortcut on the third position (not so important) because the shortcut can be replaced by the shortcut Switch mode: editor&sidebar or only view. So this is the new list:

Toggle focus between editor and sidebar Toggle between only editor and only sidebar Toggle between editor&sidebar and only editor Toggle between editor&sidebar and only sidebar Switch mode: editor&sidebar or only view Toggle focus or toggle only view

Now the list should be complete.

ralf3u commented 1 week ago

SPECIFICATION

Toggle focus between editor and sidebar IF sidebar has focus THEN focus editor IF editor has focus THEN focus sidebar (not an ELSE because of the message window)

Toggle between only editor and only sidebar IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus sidebar] (not nesserary: IF editor&sidebar is shown THEN do nothing)

Toggle between editor&sidebar and only editor IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor] (not nesserary: IF only sidebar is shown THEN do nothing)

Toggle between editor&sidebar and only sidebar IF only sidebar is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only sidebar [focus sidebar] (not nesserary: IF only editor is shown THEN do nothing)

Switch mode: editor&sidebar or only view (see "Remark") IF only sidebar is shown THEN show editor&sidebar [focus editor] IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor]

Toggle focus or toggle only view IF editor&sidebar is shown THEN { IF sidebar has focus THEN focus editor IF editor has focus THEN focus sidebar (not an ELSE because of the message window) } ELSE { IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus sidebar] }

Remark Switch mode: editor&sidebar or only view stands for Toggle between editor&sidebar and only editor, or switch only sidebar to editor&sidebar.

ralf3u commented 1 week ago

In the specification I don't like so much the expression focus sidebar. I would like to replace it by focus on the content-area of the Preview-tab. So, I will have to rewrite the specification.

ralf3u commented 1 week ago

SPECIFICATION

Toggle focus between editor and sidebar IF sidebar has focus THEN focus editor IF editor has focus THEN focus on the content-area of the Preview-tab (not an ELSE because of the message window)

Toggle between only editor and only sidebar IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus on the content-area of the Preview-tab] (not nesserary: IF editor&sidebar is shown THEN do nothing)

Toggle between editor&sidebar and only editor IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor] (not nesserary: IF only sidebar is shown THEN do nothing)

Toggle between editor&sidebar and only sidebar IF only sidebar is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only sidebar [focus on the content-area of the Preview-tab] (not nesserary: IF only editor is shown THEN do nothing)

Switch mode: editor&sidebar or only view (see "Remark") IF only sidebar is shown THEN show editor&sidebar [focus editor] IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor]

Toggle focus or toggle only view IF editor&sidebar is shown THEN { IF sidebar has focus THEN focus editor IF editor has focus THEN focus on the content-area of the Preview-tab (not an ELSE because of the message window) } ELSE { IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus on the content-area of the Preview-tab] }

Remark Switch mode: editor&sidebar or only view stands for Toggle between editor&sidebar and only editor, or switch only sidebar to editor&sidebar.

ralf3u commented 1 week ago

It could be that users will say that the Geany shortcut Toggle Sidebar is exactly the same like the shortcut Toggle between editor&sidebar and only editor. But that is not the case. If only sidebar is shown and if users press the shortcut Toggle Sidebar, then there will be an empty tab, because the editor is still disabled. If only sidebar is shown and if users press the shortcut Toggle between editor&sidebar and only editor, then nothing will happen.

I will add this kind of explication in the specification in Remarks.

ralf3u commented 1 week ago

SPECIFICATION

Toggle focus between editor and sidebar IF sidebar has focus THEN focus editor IF editor has focus THEN focus on the content-area of the Preview-tab (not an ELSE because of the message window)

Toggle between only editor and only sidebar IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus on the content-area of the Preview-tab] (not nesserary: IF editor&sidebar is shown THEN do nothing)

Toggle between editor&sidebar and only editor IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor] (not nesserary: IF only sidebar is shown THEN do nothing)

Toggle between editor&sidebar and only sidebar IF only sidebar is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only sidebar [focus on the content-area of the Preview-tab] (not nesserary: IF only editor is shown THEN do nothing)

Switch mode: editor&sidebar or only view (see "Remark") IF only sidebar is shown THEN show editor&sidebar [focus editor] IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor]

Toggle focus or toggle only view IF editor&sidebar is shown THEN { IF sidebar has focus THEN focus editor IF editor has focus THEN focus on the content-area of the Preview-tab (not an ELSE because of the message window) } ELSE { IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus on the content-area of the Preview-tab] }

Remarks a) Switch mode: editor&sidebar or only view stands for Toggle between editor&sidebar and only editor, or switch only sidebar to editor&sidebar. b) The Geany shortcut Toggle Sidebar and the shortcut Toggle between editor&sidebar and only editor don't have the identical behavior. If only sidebar is shown and if users press the shortcut Toggle Sidebar, then there will be an empty tab, because the editor is still disabled. If only sidebar is shown and if users press the shortcut Toggle between editor&sidebar and only editor, then nothing will happen.

ralf3u commented 1 week ago

I would like to change the expression from only view to single view. So this is the new list:

Toggle focus between editor and sidebar Toggle between only editor and only sidebar Toggle between editor&sidebar and only editor Toggle between editor&sidebar and only sidebar Switch mode: editor&sidebar or single view Toggle focus or toggle single view

Now, that sounds cool.

ralf3u commented 1 week ago

SPECIFICATION

Toggle focus between editor and sidebar IF sidebar has focus THEN focus editor IF editor has focus THEN focus on the content-area of the Preview-tab (not an ELSE because of the message window)

Toggle between only editor and only sidebar IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus on the content-area of the Preview-tab] (not nesserary: IF editor&sidebar is shown THEN do nothing)

Toggle between editor&sidebar and only editor IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor] (not nesserary: IF only sidebar is shown THEN do nothing)

Toggle between editor&sidebar and only sidebar IF only sidebar is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only sidebar [focus on the content-area of the Preview-tab] (not nesserary: IF only editor is shown THEN do nothing)

Switch mode: editor&sidebar or single view (see "Remark") IF only sidebar is shown THEN show editor&sidebar [focus editor] IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor]

Toggle focus or toggle single view IF editor&sidebar is shown THEN { IF sidebar has focus THEN focus editor IF editor has focus THEN focus on the content-area of the Preview-tab (not an ELSE because of the message window) } ELSE { IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus on the content-area of the Preview-tab] }

Remarks a) Switch mode: editor&sidebar or single view stands for Toggle between editor&sidebar and only editor, or switch only sidebar to editor&sidebar. b) The Geany shortcut Toggle Sidebar and the shortcut Toggle between editor&sidebar and only editor don't have the identical behavior. If only sidebar is shown and if users press the shortcut Toggle Sidebar, then there will be an empty tab, because the editor is still disabled. If only sidebar is shown and if users press the shortcut Toggle between editor&sidebar and only editor, then nothing will happen.

ralf3u commented 1 week ago

I have some doubts about the specification. So, I have to rethink about it some days.

ralf3u commented 6 days ago

I'm still working on an optimization of the specification.

FYI, I just opened a new issue at geany. The issue number is 3979. The title of the issue is: Add to the shortcut "Toggle Sidebar" a command like "IF editor is disabled THEN enable editor" to avoid an empty tab.

ralf3u commented 5 days ago

FYI, I just opened a new issue at geany. The issue number is 3979.

The issue 3979 was closed yesterday. Because the maintainer didn't want to change the shortcut Toggle Sidebar at geany, I think that it would be good to add a second shortcut Toggle Sidebar to the list of shortcuts, so users who are used of that shortcut at geany can still use it.

Toggle Sidebar IF only editor is shown THEN show editor&sidebar [focus editor] IF editor&sidebar is shown THEN show only editor [focus editor] IF only sidebar is shown THEN show only editor [focus editor]

That would be shortcut number 7.

ralf3u commented 5 days ago

I would like to change a name of one shortcut: Instead of Switch mode: editor&sidebar or single view I would prefer Switch view: editor&sidebar or single view

Instead of the shortcut name Switch view: editor&sidebar or single view one could use also the name Toggle between editor&sidebar and single view. But I prefer to use the word Switch instead of Toggle because I think that this shortcut will be used less for toggling but more for switching. The shortcut Switch view: editor&sidebar or single view is the complementary counterpart to the shortcut Toggle focus or toggle single view.

ralf3u commented 5 days ago

Toggle between only editor and only sidebar IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus on the content-area of the Preview-tab] (not nesserary: IF editor&sidebar is shown THEN do nothing)

"IF editor&sidebar is shown THEN do nothing" is a restriction. I don't like so much restrictions because it has a taste of paternalism. But on the other hand the shortcut is doing exactly what the name of the shortcut is saying. The shortcut switch-views-(editor-↔-sidebar) in switch-views is interesting, but at same time confusing, because the shortcut does execute more than the name is saying. The shortcut is interesting because it does also execute when editor&sidebar are shown. So, I would like to add this shortcut to the list:

Toggle single view, also from editor&sidebar IF only sidebar is shown THEN show only editor [focus editor] IF only editor is shown THEN show only sidebar [focus on the content-area of the Preview-tab] IF editor&sidebar is shown THEN show only editor [focus editor]

That would be shortcut number 8.

I would like to change the name of the shortcut Toggle between only editor and only sidebar. I prefer Toggle single view

ralf3u commented 5 days ago

I deleted my last comment because there was a mistake.

I have two questions: At the moment in geanylua I don't use auto-sidebar to make tests without the auto-sidebar.

Steps to reproduce editor&sidebar is shown

  1. Press the shortcut switch-views-(editor-↔-sidebar) (result: only sidebar is shown)
  2. Press the shortcut switch-views-(editor-↔-sidebar) (result: only editor is shown)
  3. Press the shortcut Toggle Sidebar

Why nothing happens? Why do I have to press Toggle Sidebar a second time to let appear the sidebar?

ralf3u commented 4 days ago

Why nothing happens? Why do I have to press Toggle Sidebar a second time to let appear the sidebar?

Did you find an answer?

xiota commented 4 days ago

Why nothing happens? Why do I have to press Toggle Sidebar a second time to let appear the sidebar?

Did you find an answer?

Probably the built-in shortcut (toggle sidebar) does not expect something else (lua script) to also show/hide the sidebar, and vice versa. If a bug in Lua plugin is causing it (unlikely), can try to fix it. Otherwise, don't know if anything can be done.

ralf3u commented 4 days ago

If a bug in Lua plugin is causing it (unlikely), can try to fix it.

I'm not interested to fix the issue because the goal is that "the glorious five shortcuts" should replace the lua shortcuts – too many lua shortcuts have the focus issue.

I just try to understand why the Geany shortcut Toggle Sidebar need to be pressed two times. And I have no explication for that.

I understand that when only sidebar is shown (editor is disabled), and then if the shortcut Toggle Sidebar is pressed, then there is an empty screen because editor and sidebar are both disabled.

But what I don't understand is: If only editor is shown (sidebar is disabled), and then if the shortcut Toggle Sidebar is pressed, then nothing happens or rather the shortcut Toggle Sidebar need to be pressed in total in succession two times to see editor&sidebar. Why two times?

ralf3u commented 3 days ago

But what I don't understand is: If only editor is shown (sidebar is disabled), and then if the shortcut Toggle Sidebar is pressed, then nothing happens or rather the shortcut Toggle Sidebar need to be pressed in total in succession two times to see editor&sidebar. Why two times?

I didn't find an answer to the question, but I think I found the cause why things does not work correctly when the Geany shortcut Toggle Sidebar is used.

I just found another artifact with the Geany shortcut Toggle Sidebar in combination with geanylua-switch-views.

Steps to reproduce

  1. editor&sidebar is shown
  2. press the Geany shortcut Toggle Sidebar (result: only the editor is shown)
  3. press the shortcut of geanylua-switch-views Show both editor and sidebar

Result Editor&sidebar are both visible, but the sidebar is completely empty. There are not even tabs in the sidebar. Same situation here: I have to press two times the Geany shortcut Toggle Sidebar so that something visible happens.

Possible Explication It seems to be that the Geany shortcut Toggle Sidebar does not disable the sidebar but does something else than disabling. Maybe the Geany shortcut Toggle Sidebar is using something like true or false as parameters. It seems to be that the Geany shortcut Toggle Sidebar is using other parameters than the shortcut of geanylua-switch-views.

Before to try to solve the issue 59 I think it would be good to know which parameters the Geany shortcut Toggle Sidebar is using when toggling, with the aim to use exactly those parameters for solving issue 59 so that it will not cause artifacts when the Geany shortcut Toggle Sidebar is used.

If you can't find which parameters the Geany shortcut Toggle Sidebar is using, I can ask the current chief maintainer of Geany at geany with the issue number 3979.

Do you know which parameters the Geany shortcut Toggle Sidebar is exactly using?

ralf3u commented 3 days ago

Before to continue anything it would be good to remove entirely the focus-code of the plugin Preview (see https://github.com/xiota/geany-preview/issues/15#issuecomment-2404517788).