-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shortcuts for Geany Preview #7
Comments
My understanding of what is possible now:
The problem with the above is that both the editor and sidebar can be made not visible at the same time. Also, I know how to change visibility in lua, but cannot change focus. So with that in mind... What about:
|
This stands in contradiction to xiota/geany-tab-style#6. |
You've opened up a lot of issues with long descriptions. It's easy to misread or lose track of what's going on. I don't know how to change focus in Lua, and if I had previously indicated otherwise, it was because I had forgotten or been mistaken about whether focus (or visibility) was the topic of discussion. You can probably point back to more posts where this or that was said, and it would just make everything even more complicated and easier to misread and lose track of. While changing focus among components is possible to an extent in C/C++, the exact component you want to have focused is often missed (eg, issues you've opened where various navigation steps don't do what's expected). Arbitrary focus changes beyond what's already done (change focus between editor and preview) are outside the scope of the Preview plugin. The plugin is intended to preview markup, not replace the web browser. If you can provide a clear, brief description of a few shortcuts for changing focus, I can think about adding them to the xi-tweaks or tweaks-ui plugins. A problem with the proposed shortcuts is the names don't reflect the proposed actions. The first one is named "Toggle between only editor and editor/sidebar". What is toggled? Visibility? Focus? Something else? Consider the existing shortcut in Preview, "Toggle focus between editor and preview". From the name, it's clear that focus is being toggled. Now looking at the proposed action:
The description is long and confusing. Is it any different from "Toggle focus between editor and sidebar" ? The second, I would call just "Focus the editor". The third, "Toggle sidebar visibility". The fourth, maybe "Alternate between editor-only and sidebar-only views". The fifth, maybe "Restore editor and sidebar views". Considering that I don't know how to change focus with Lua, that leaves: "Toggle sidebar visibility" (already possible with built-in shortcut), "Alternate between editor-only and sidebar-only views", and "Restore editor and sidebar views". I've proposed to combine the latter two into a single shortcut that switches among views: editor-only, editor+sidebar, sidebar-only. |
Yes, you are right, the names are not clear. So, here the new names: to 5: I prefer exit than restore
Sorry, I wrote the description in that way how I would program it in JavaScript. So, I will try a new description for 1: Is it OK like this, so I would continue to describe the shortcuts 2, 3, 4 and 5 in that style?
Well, at the moment I'm not so interested in that shortcut.
Yes, that was the reason to create an own shortcut for the sidebar and to add a state file, what is mentioned in the report, to check first if the other shortcut is active or not. If it is active, then I think it needs first to be disabled. |
Which is easier to understand?
Not only that, but the sort method I described is the least efficient. And there is a slight bug in the description that I didn't notice while writing it. People aren't computers. Explaining stuff like they are just makes it confusing.
That is better. But since I can't change focus with Lua, let's limit to visibility of components for now. 1: Toggle visibility between editor-only and editor+sidebar The names of 1, 3, 4 are self-explanatory. 2 is omitted because it is a variation of 1 with only focus changes. 5 could use some explanation. You use the word "exit", but that would mean you have to "enter" some sort of mode to use 1-4. I don't see why that should be the case. Introducing a mode is unnecessary and would probably complicate implementation.
I think a single shortcut to switch among all three views would be the most useful because it effectively provides the functionality of multiple shortcuts with reduced cognitive load.
Don't worry about the state file. That's an implementation detail that needs to be reworked. |
I've added a set of scripts, switch-views. They don't do exactly what's described above, but you should try them before making them more complicated. Also updated the toggle-editor and auto-sidebar scripts so that they all use the same functions as the switch-views scripts. |
Two things that I would change:
Exit is only for leaving 4. I think it's better to have a clear separation of the shortcuts, else it creates confusion . So, let's say I press the shortcut 4 multiple times for many hours. I can imagine that after that, if I want to see editor/sidebar again, I have difficulties to find a way how to get out of this loop. The word "Exit" would be a good help in my head for leaving this loop.
Well, I think that a clear separation of shortcuts from shortcut 1 to shortcut 5 would be the most useful, even if the cognitive load will increase.
I will try them tomorrow and I will give you feedback. |
Thanks. It will be easier to modify something concrete. I just pushed an update. The shortcuts now are:
They can be renamed by making symlinks and editing While coding the above, I just saw some Lua functions that might focus the editor (but not the sidebar). However, I want to finalize the visibility portion before trying to change focus.
The problem is the name of the Lua shortcuts are based on the file name. Linux uses
The way to "exit" the loop is to use a different shortcut. Suppose you're using a shortcut that alternates views between editor-only and sidebar-only. Now you stop at sidebar-only and want to show both editor and sidebar. You can toggle editor visibility. Then both will be visible. |
Just for documentation: The shortcuts are located in https://github.com/xiota/geanylua-scripts/tree/main/switch-views Before testing: Is there a reason why toggle-editor is not part of switch-views?
Yes, that's right. That was also an option for me when developing the shortcuts in my head. On the webpage https://github.com/xiota/geanylua-scripts/tree/main/switch-views, there is: Instead of a plus, one could use a hyphen. |
toggle-editor is included with switch-view. There's no need to use the separate toggle-editor. That folder exists because it was written first. auto-sidebar is not included with switch-views, but they can be installed together. You would have to manually combine some of the event files.
This is for Geany/Lua. Why does Firefox matter?
Hyphens are converted to spaces in the shortcut name. |
The new toggle-editor is from the documents different than the toggle-editor that you offered some weeks ago. Can the old toggle-editor still be used? What is the difference between the old and the new toggle-editor?
It could be that other users do it like me: I just tried all shortcuts. All shortcuts don't work. The message for the first shortcut: For the other shortcuts it is nearly the same message. Only the names of the documents are different. Just for information: |
The shortcuts use symlinks. You can either recreate them with whatever name you want or install using the following steps:
|
First command did work, but not the second command, even not with this command: I copied the files into geanylua, but no shortcuts appear for Lua Scripts. In geanylua there are the folders auto-sidebar, column-markers and so on.
I have no idea what symlinks are. Could you please give an example how to recreate them? |
Sorry, wrote the command wrong. Should be:
Copy the files from inside the Symlinks are references to the real files. This way the keybinding can be renamed without affecting the actual script. They're created with the command:
You can see which files are symlinks with
|
Oh, that's really really cool!!!!! I like specially switch-views-(editor-↔-sidebar).lua. It's so smooth!! It feels better than I expected! As far as the shortcuts concerned, I couldn't find bugs, so it's perfect. Issues with the scroll-bar within the sidebar Focus Based on the number of documents and code, I can imagine that you worked a lot for the realization of the shortcuts. Thank you so much for the shortcuts. |
This is out of my control.
There is potential to focus the editor, but not the sidebar.
Are you making the editor invisible? Then the focus goes to the sidebar tabs? As far as I can tell, this may not be fixable.
This might be fixable by focusing the editor. I plan to test this weekend.
You're welcome. |
I just did some testing.
|
There's somewhere a bug. I deleted all files in geanylua. Now if a HTML-document is in focus and if I let appear the sidebar through the menu bar (View), then the editor is not there any more. Only the sidebar is visible. Normally editor and sidebar should be visible side by side. I think it has maybe to do something with this: I deleted the swich-views-files at the wrong moment (maybe Geany was open, but I don't think so), when only the sidebar was visible. What do you think? |
I just pasted all switch-files in geanylua. All Geanylua shortcuts work, but not correctly. Maybe it has to do with my last comment and with the created file |
I can't see any more editor and sidebar side by side, even if the geanylua-file is empty, even after a restart of the computer, even after activating the sidebar. |
Maybe check Are you using the lua toggle-sidebar and not the built-in toggle sidebar? Are you copy/pasting from the webpage or copying the files from the |
In the Preferences of Geany in Keybindings there is no shortcut for
I did this:
I deleted all files from the geanylua-file to test the old auto-sidebar. Also with the old auto-sidebar I can't see any more editor and sidebar side by side. |
Preferences / Keybindings / Lua Script / Toggle sidebar visibility
Then to complete installation, open
Editor state should be restored on Geany restart. Toolbar needs to be toggled on from Geany perspective. Menubar / View / Show Sidebar. |
Yes, there is a shortcut. It is F4. If I toggle F4, then editor is shown or sidebar is shown, but not both at the same time.
Yes, this is what I did.
Yes, this is what I did. |
Maybe this could help to find a solution: |
What I did today: I tested the switch-views, then deleted the files, then I tested the old auto-sidebar, then I deleted the files, then I wanted to test again the switch-views by pasting the files. And then the bug was there. Just for information: I will continue tomorrow. There is no hurry to fix this problem the next days. |
I'm so sorry. The line (between editor and sidebar) was completely at the left, nearly invisible. I have no idea how this happened. So, everything is fine. Again: I'm so sorry. Thank you for your help. |
I can not reproduce 1. I don't know why. But I can reproduce 2 in that way: If editor and sidebar are both visible at the same time, then I click in the middle of the content area of the editor, and if I press 3x the shortcut |
I was thinking about suggesting you check for that. Glad you found it. I think Geany has some bugs related to sizing the panels when the window is resized/maximized. I think there's already a bug report, but it's unlikely to be fixed any time soon because the interaction between the components is complicated and it's hard to change anything without breaking something else.
The problem seems to be related to message window visibility. I have the message window visible. When I hide it, I am able to replicate your issue. Since I cannot change focus with Lua, a workaround would be to show the message window (menubar / View / Show Message Window) and resize it so that it's hidden. |
Aaahh ...! Yes, resize! That explains why the line between editor and sidebar disappeared. I was wondering because I didn't change the width of the editor.
For documentation reasons, do you have the issue number of the bug?
Well, at the moment this issue is not so important for me. I handle the problem like this: after switching: I press 1x the arrow-right-key, so that the cursor is visible in the editor. To the focus problem 1 mentioned in #7 (comment):
Sorry, I recognized that I did some mistakes, so here is the correction:
The scroll-bar that is visible for a part of the second is more on the left side, although my scroll-bar of the editor is more on the right side when editor and sidebar are both visible (I use the editor on the left side, while the sidebar is on the right side). That's strange. From the color of the scroll-bar and the length of the inside of the scroll-bar it looks like it is the same scroll-bar like the scroll-bar of the sidebar that is located completely on the right side of the window. That's also strange. Is that OK if I open a new issue at Geany, or you want to open it? Just for documentation: I tested the shortcuts with an HTML-document and with a Fountain-document. Before closing this issue I would like to test the shortcuts with the new auto-sidebar what I will do in the next days. I will leave a feedback here. |
Run |
If I open Geany from the home-file, then it is 1.39. If I open it from /usr/bin/geany then it is 1.38. Yesterday I just installed the nightly tarball of Geany and nothing else. I tested the scintilla-bug in 1.38 that I downloaded yesterday and the issue is not there any more although the issue was in 1.38. |
You must have two different versions in different locations. The package manager usually installs to |
On Lubuntu 23.04 I tried to install Preview on the nightly tarball of Geany with those lines:
like it is described on https://github.com/xiota/geany-preview. The result in the terminal for the last line is:
Did I make something wrong? |
According to cmark-gfm, the version in the repository is Try updating the repository and upgrading installed packages before installing the plugin:
Let me know if that helps or if you still have problems. |
The answer is:
|
I'll double check the PPA. Can you also check files in |
content of the document
|
I'm forcing an update of the lunar package on the PPA. As usual, takes some hours to build and update. In case it doesn't work, can you paste the output of |
Does not work either.
|
Pushed another update. Let me know if it works after it rebuilds. |
It Works. Did you try to solve the issue with the auto-sidebar? |
Maybe you missed my last message, and that is why I ask again the question: Did you try to solve the issue with the auto-sidebar? |
Sorry, lost track of the message and forgot to respond. The script works fine on my computer. Think the problem may be the Lua libary that the plugin is using. Pushing an update to the PPA to use a different library. |
It works, but when opening Geany, this is the message: This is the download-link that I used today: In the file geanylua there is only the content of the file auto-sidebar. |
The script is trying to access document properties (filetype) before the document has been created. Remove reference to |
The scripts work now without an error-message. Thank you so much. |
Is there a reason why auto-sidebar does not work any more with fountain-documents?
|
Is this a new install of Geany? You have to add the Fountain filetype. See xiota/geany-tab-style#6. I should probably some of add that info to the docs for the Preview plugin. |
Yes! That helped me: |
For reasons of documentation: The issue-numbers at geany-plugins are 1229, 1234, 1230 and 1236. Did I understand it right, that if the fixes will be integrated in geany-plugins, then the focus feature should work correctly when using the shortcuts? |
Maybe someday. It's up to the maintainers. Even if the maintainers accepted them, they wouldn't be seen in any distros until the next release, which could be a year or more away. If you're using the plugins from my PPA, the fixes should already included.
Depends on which "focus feature" you're referring to. Focus (on a specific widget, like the preview pane) is a separate issue. I don't recall using |
So, the both fixes don't solve the focus-feature of the preview-pane? |
|
The last sentence sounds for me as you have an idea how to solve the focus-issue. Am I right? |
No. I don't know how to fix it. I feel like it would be difficult, maybe not even possible. So I don't even want to look at it, especially since I have PRs that haven't been merged yet, even though they fix significant bugs. |
Shortcut names
1:
Toggle between only editor and editor/sidebar
2:
Toggle between only editor and editor/sidebar; focus stays in the editor
3:
Toggle between only sidebar and editor/sidebar
4:
Toggle between only editor and only sidebar
5:
Exit "Toggle between only editor and only sidebar"
Shortcuts in action
1: if "only editor" is not shown, then (show "only editor" & put editor in focus), else (show editor/sidebar & put sidebar in focus)
2: if "only editor" is not shown, then (show "only editor" & put editor in focus), else (show editor/sidebar & put editor in focus)
3: if "only sidebar" is not shown, then (show "only sidebar" & put sidebar in focus), else (show editor/sidebar & put editor in focus)
4: if the shortcuts 1, 2 and 3 are blocked, then (if "only editor" is shown, then (show "only sidebar" & put sidebar in focus), else (show "only editor" & put editor in focus)); if editor/sidebar is shown, then (block the shortcuts 1, 2 and 3 & show "only editor" & put editor in focus)
5: if the shortcuts 1, 2 and 3 are blocked, then (unblock the shortcuts 1, 2 and 3 & show editor/sidebar & put editor in focus)
Explication
Toggling the shortcut 1 or toggling the shortcut 2 is interesting, if one don't want to see the whole result, so if one don't want to see only the sidebar. The shortcut 1 is more for testing functionality change, like shortcuts on the webpage, while the shortcut 2 is more for testing content change. The starting point of shortcut 4 is editor/sidebar, else the shortcut 4 creates too much confusion.
Remark
This report is based on the knowledge of xiota/geany-preview#37, xiota/geany-preview#38 and xiota/geany-preview#40.
The shortcut 2 exists already https://github.com/xiota/geanylua-scripts/tree/main/toggle-editor as stand-alone-version (,so without state file; the state file is mentioned in xiota/geany-preview#37).
The text was updated successfully, but these errors were encountered: