Skip to content
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

Shortcut to toggle between editor and sidebar #4

Closed
xiota opened this issue Oct 3, 2021 · 37 comments
Closed

Shortcut to toggle between editor and sidebar #4

xiota opened this issue Oct 3, 2021 · 37 comments
Labels
enhancement New feature or request

Comments

@xiota
Copy link
Owner

xiota commented Oct 3, 2021

It is indeed possible to switch with a shortcut to the editor and to switch with a shortcut to the sidebar. But one shortcut would be even better to toggle editor/sidebar.

@xiota xiota added the enhancement New feature or request label Oct 3, 2021
@ralf3u
Copy link

ralf3u commented Oct 3, 2021

I open a new issue for that: geany/geany#2914

I just put the thumbs-up-symbol for that issue number 2914, because a shortcut to toggle between editor and sidebar would be really great. I don't know which impact the thumbs-up-symbol has on the development timeline of an issue. But maybe it is better to have one thumbs-up-symbol than to have no thumbs-up-symbol.
So, if a user would like to use only one shortcut to toggle between editor and sidebar, then there you go: thumbs-up-symbol on issue number 2914.

@xiota
Copy link
Owner Author

xiota commented Oct 3, 2021

@ralf3u I agree a toggle is more convenient than separate shortcuts. That's why I'm willing to look into it if it's not accepted into the main editor.

@ralf3u
Copy link

ralf3u commented Oct 3, 2021

@xiota

That's why I'm willing to look into it if it's not accepted into the main editor.

I already tried in the shortcut editor of Geany to give the two actions the same shortcut. But Geany refused.

@xiota
Copy link
Owner Author

xiota commented Oct 7, 2021

@ralf3u I just added a keybinding to toggle between the preview pane and the editor. It's in 771c581. I will update the PPA.

If anything other than the editor is in focus, the keybinding will focus the editor. If the editor is in focus, the keybinding will focus the sidebar and switch tabs to the preview pane.

By default, there is no key combination set for the toggle. The setting is in preferences. You should find it near the end of the keybinding list under the heading "Preview".

@xiota xiota closed this as completed Oct 7, 2021
@ralf3u
Copy link

ralf3u commented Oct 7, 2021

@xiota

I just added a keybinding to toggle between the preview pane and the editor.

I don't know what to say. I'm speechless. It is just simply amazing!!
Thank you so much for this shortcut.

@ralf3u
Copy link

ralf3u commented Nov 5, 2021

If I press the shortcut toggle editor/sidebar, then the tab-title "Preview" seems to be in focus. There are no signs for that but if I do both tests below, both tests are negative. The goal should be: Not the tab-title "Preview" should be in focus, but the content of the Preview-tab.

control tests with a very long html-document, and with at least two tabs in the sidebar:
TEST 1: Open Geany, press the shortcut toggle editor/sidebar, then press the arrow-left-key only once: the content of the Preview-tab should still be in focus.
TEST 2: Open Geany, press the shortcut toggle editor/sidebar, then press the arrow-down-key only once: the html-document should move downwards.

In the end it should work exactly like the editor:
Open Geany, press 2x the shortcut toggle editor/sidebar: the content of the tab is in focus, and not the tab-title of the editor.

@xiota
Copy link
Owner Author

xiota commented Nov 5, 2021

I'll update the PPA.

@ralf3u
Copy link

ralf3u commented Nov 5, 2021

Something does not work properly: The content of the Preview-tab is completely empty for html-documents.

@xiota
Copy link
Owner Author

xiota commented Nov 5, 2021

Please try resetting the config and css files. If it still doesn't work, please provide more info. HTML documents with and without <?DOCTYPE html> are working on my computer with both light and dark themes.

@ralf3u
Copy link

ralf3u commented Nov 6, 2021

I did an update. I deleted the config-file of preview and I deleted the config-file of xitweaks, and I deleted all css-files of preview, so I don't need to reload them. And I deleted geany.css. Then I restarted Geany.

With or without DOCTYPE, unsaved or saved: The content of the Preview-tab is completely empty for html-documents.
Same with extra_css=disable.

Content of the Preview-tab of preview.conf: "Unable to process type: Conf, UTF-8."

If I right-click in the Preview-tab, then the context menu appears. If I choose "Reload", then the html-document appears. I have to do that every time I restart Geany.
If I change the tab, then Preview-tab is completely empty again for all html-documents.
If I change the code of one html-document in the editor, then Preview-tab is completely empty again for all html-documents.

@xiota
Copy link
Owner Author

xiota commented Nov 6, 2021

Please show the contents of a short HTML document that has this problem.

@ralf3u
Copy link

ralf3u commented Nov 6, 2021

Please show the contents of a short HTML document that has this problem.

<!DOCTYPE html>
<html>
<head><style></style></head>
<body>
<p>This is a test.</p>
</body>
</html>

When I restart Geany, then there is in the light theme in the Preview-tab for about 2 seconds "Loading." And then there is nothing.

@xiota
Copy link
Owner Author

xiota commented Nov 6, 2021

That file works on my computer. Do you have any css files with the same background and foreground color? What about geany.css?

@ralf3u
Copy link

ralf3u commented Nov 6, 2021

That file works on my computer. Do you have any css files with the same background and foreground color? What about geany.css?

As mentioned before, I deleted geany.css.

New try:

  • I closed all tabs except html-tabs in Geany
  • then I closed Geany
  • I deleted xitweaks.conf
  • I deleted preview.conf and all css-documents in the file preview
  • I deleted geany.css

Do the same steps on your computer, to see if the same problem exists on your computer.

Maybe it is because of pandoc.css, that is created automatically when Geany is restarted?
Preview works with txt-documents, but not with html-documents.

For txt-documents:
When I restart Geany, then there is in the light theme in the Preview-tab for about 2 seconds "Loading." And then there is in the Preview-tab the content of the txt-document.

For html-documents:
When I restart Geany, then there is in the light theme in the Preview-tab for about 2 seconds "Loading." And then there is nothing.

What I think
I think that the link to the WebKit2GTK-component is not correct any more, or something like this, because Preview wants to load the WebKit2GTK-component, but Preview can't load it, because Preview can't find it.
Or something is blocking Preview to execute the WebKit2GTK-component for html-documents.

@xiota
Copy link
Owner Author

xiota commented Nov 6, 2021

Is this a problem.only when restarting Geany? Do HTML files opened after Geany is already started load? What about if you switch documents that are already opened?

@ralf3u
Copy link

ralf3u commented Nov 6, 2021

Is this a problem.only when restarting Geany?

Not only when restarting Geany but also when Geany is open. Nothing is shown in the Preview of html-documents.

Do HTML files opened after Geany is already started load?

Nothing is shown in the Preview of html-documents.

What about if you switch documents that are already opened?

Nothing is shown in the Preview of all html-documents.

If I right-click in the Preview-tab, then the context menu appears. If I choose "Reload", then the html-document appears in the preview-tab.
If I change the tab, then Preview-tab is completely empty again for all html-documents.
If I change the code of one html-document in the editor, so for example if I just type one letter, like "t", then Preview-tab is completely empty again.

Did you do the following steps?

  • close all tabs except html-tabs in Geany
  • then close Geany
  • delete xitweaks.conf
  • delete preview.conf and all css-documents in the file preview
  • delete geany.css

Then reopen Geany. Do you see something in the Preview of html-documents?

@ralf3u
Copy link

ralf3u commented Nov 6, 2021

Same problem with the old computer. Nothing is shown in the Preview of all html-documents.
And on the old computer it is even worst: In the list of plugins, "Xi/Tweaks" is not there.

@xiota
Copy link
Owner Author

xiota commented Nov 6, 2021

On the old computer, the package geany-plugin-xi-tweak is installed and does not show up in the plugin manager?

I unloaded all plugins except Preview. Then deleted geany.css and the preview config folder. A file with the HTML you sent earlier loads and displays. Then I closed Geany, deleted the config folder, and switched to Arc dark. The HTML files loads and displays properly. The only thing I changed recently was for the shortcut key. That shouldn't affect the display. I'll look through the code and look for a typo or something that might cause problems.

What happens when you open a markdown document? (Create a file with some text and an .md extension.)

@ralf3u
Copy link

ralf3u commented Nov 7, 2021

On the old computer, the package geany-plugin-xi-tweak is installed and does not show up in the plugin manager?

Yes, it is installed, because if I do sudo apt show geany-plugin-xi-tweaks, then it shows a version number. But it does not show up in the plugin manager.

2021-11-07_terminal_b

What happens when you open a markdown document? (Create a file with some text and an .md extension.)

I created a document test.md. Nothing is shown in the Preview-tab. If I right-click in the Preview-tab, then the context menu appears. If I choose "Reload", then test.md appears in the preview-tab. So, same problem like html-documents.

new issue
For markdown documents there is also an other issue, because if I write **hh** then hh is not shown as bold in the Preview: It is the same text like in the editor, so **hh**, but not bold.
In the software ReText for example, it is shown as bold in the preview. In ReText I see in the preview hh as bold, so without stars as it should be.
I just opened a new issue for that (issue number 8: markdown-documents are not shown correctly in the preview).

I unloaded all plugins except Preview. Then deleted geany.css and the preview config folder. A file with the HTML you sent earlier loads and displays. Then I closed Geany, deleted the config folder, and switched to Arc dark. The HTML files loads and displays properly.

So, if you did exactly the same like me, but we both have different results, maybe it is because you use 21.10 and I use 21.04?

@xiota
Copy link
Owner Author

xiota commented Nov 7, 2021

maybe it is because you use 21.10 and I use 21.04?

I don't have 21.04 installed anymore, but do have one with 20.04. I just tested it, and it works fine.

I created a document test.md. Nothing is shown in the Preview-tab.

So there is some problem with both markdown and html documents? Please try the following:

sudo ldconfig

If that does not help, what happens when you enable the following options in preview.conf? (Note: If it works, this is not a permanent solution, but intended to help me narrow down what the cause of the problem is.)

html_processor=pandoc
markdown_processor=pandoc

In /var/cache/apt/archives, there should be copies of the old packages you've installed. Copy them out to another folder. (Please review the following commands to ensure they don't conflict with anything on your system.)

mkdir ~/preview-packages/
cp /var/cache/apt/archives/geany-plugin-preview*.deb  ~/preview-packages/
cd ~/preview-packages

Then you can install old ones to find one that works. Please let me know the file name of the newest one that works as expected. The command to install from deb files is:

sudo dpkg -i filename.deb

@ralf3u
Copy link

ralf3u commented Nov 7, 2021

What I did:

sudo ldconfig

I restarted Geany. Same problem like before.


Then I did:

html_processor=pandoc
markdown_processor=pandoc

Then in Edit, Plugin Preferences, in Preview I clicked on Reload, Apply and OK.
And now Preview is back for html-documents and for md-documents!!
And md-documents are now shown correct in the Preview.

As I mentioned before:

Maybe it is because of pandoc.css, that is created automatically when Geany is restarted?

Should I continue your description of #4 (comment)?
Somehow I don't want to continue the description because it seems to be too complicated for me.
Does my information till now help you to figure out where the problem is?

@xiota
Copy link
Owner Author

xiota commented Nov 7, 2021

Somehow I don't want to continue the description because it seems to be too complicated for me.

You don't have to if you don't want to. It would help me to locate which version of the plugin potentially introduced a change that could be causing your problem. The info you've provided is helpful though, so I'll see if I can find anything.

html_processor=pandoc causes Pandoc to filter the document. Pandoc does change the html, so what you see won't be exactly what you wrote. But it will let you use the plugin while I try to figure out the cause of the problem.

@ralf3u
Copy link

ralf3u commented Nov 7, 2021

In /var/cache/apt/archives
there is only one file about Geany: geany-plugin-xi-tweaks_0.01.0-20211010.041326-0xiota0~ubuntu21.04_all.deb.
And there is one folder called "partial" that can't be opened, and there is a document called "lock", so all together three files.

@ralf3u
Copy link

ralf3u commented Nov 7, 2021

It was this version, where Preview started not to work: #4 (comment)

@xiota
Copy link
Owner Author

xiota commented Nov 7, 2021

In /var/cache/apt/archives
there is only one file about Geany

Thanks for trying. Your system must be configured to clear the cache.

@ralf3u
Copy link

ralf3u commented Nov 7, 2021

I don't have 21.04 installed anymore, but do have one with 20.04. I just tested it, and it works fine.

So, maybe it is because of the processor. The old computer is using a Celeron N3060 and the new computer is using a Pentium N5000.

@xiota
Copy link
Owner Author

xiota commented Nov 7, 2021

So, maybe it is because of the processor. The old computer is using a Celeron N3060 and the new computer is using a Pentium N5000.

Which issue is that for?

For slower computer, I would just expect it to take longer to display, rather than not display at all. There are timing options in preview.conf to give slower processors more time before sending another update request.

Looking at my commit logs, I did change from using C strings to C++ std::strings. The advantage of C++ is better memory management. The disadvantage is it can be slower in some cases. I don't understand why it would work on one computer, but not another though.

Would you mind downloading and testing Big-Fish.fountain. If the link doesn't work, you can get the file from fountain.io. The link should be on the lower-right.

@ralf3u
Copy link

ralf3u commented Nov 7, 2021

Would you mind downloading and testing Big-Fish.fountain.

Big-Fish.fountain works perfect in the Preview.

To the version when Preview started to make problems: It was the version, where pandoc.css was created in the preview-file automatically after restarting Geany.

@xiota
Copy link
Owner Author

xiota commented Nov 7, 2021

It was the version, where pandoc.css was created in the preview-file automatically after restarting Geany.

pandoc.css was always supposed to be created. There was a bug that was preventing it from being created in a few versions of the plugin. Then I fixed it... I'll look back to see when that was.

@ralf3u
Copy link

ralf3u commented Nov 7, 2021

Then I fixed it... I'll look back to see when that was.

It was this version, where Preview started not to work and where pandoc.css was created in the preview-file automatically after restarting Geany: #4 (comment)

@ralf3u
Copy link

ralf3u commented Nov 7, 2021

In case you are interested: Because I will not use Geany for coding for the next weeks, you can offer every day a new version with small changes to localize where the problem is. I will give you every day feedback.

@xiota
Copy link
Owner Author

xiota commented Nov 7, 2021

you can offer every day a new version with small changes to localize where the problem is

Good to know I can update the PPA without disrupting anything. I looked over the code and don't see anything that would cause problems.

I just tried the packages with Ubuntu 21.04, and it works as expected. So working on my end with 20.04, 21.04, and 21.10.

Have you tried double clicking in the preview pane to see if there is some invisible text?

@xiota
Copy link
Owner Author

xiota commented Nov 8, 2021

@ralf3u I've pushed a minor update to the PPA. I don't expect it to fix the html/markdown problem though. Would you please open it as a new issue?

@ralf3u
Copy link

ralf3u commented Nov 9, 2021

I don't expect it to fix the html/markdown problem though. Would you please open it as a new issue?

I opened yesterday issue number 9 for that.
And for the issue with the missing plugin Xi/Tweaks, I opened today issue number 10.

@xiota
Copy link
Owner Author

xiota commented Nov 9, 2021

And for the issue with the missing plugin Xi/Tweaks, I opened today issue number 10.

Please open the issue at xiota/geany-tweaks

@ralf3u
Copy link

ralf3u commented Nov 10, 2021

@xiota

Please open the issue at xiota/geany-tweaks

It seems to be that xi/tweaks will be split in two plugins. So until there is only one plugin, would it be not better to let issue number 10 open?

I tested now the shortcut toggle editor/sidebar. It works perfect.
Thank you so much for this feature.

I use as shortcut F2 for toggle editor/sidebar. Just for interest: Which shortcut are you using?

@xiota
Copy link
Owner Author

xiota commented Nov 10, 2021

It seems to be that xi/tweaks will be split in two plugins. So until there is only one plugin, would it be not better to let issue number 10 open?

I would prefer it be moved to xiota/geany-tweaks/. After you do that, I will remove it from here, which is a different plugin.

For naming, I'm thinking of "Tweaks-UI" for the plugin that will be submitted to geany-plugins. The other plugin will have the sidebar focus highlighting and menu-hiding. Basically keeping it because you use the focus highlighting and so you won't have to load yet another plugin just for menu hiding. Otherwise, I'd probably abandon the focus highlighting because I haven't been able to get it to work properly.

I use as shortcut F2 for toggle editor/sidebar. Just for interest: Which shortcut are you using?

F2 is usually assigned to rename in file managers, so I don't want to get confused. Some shortcuts I'm using...

  • F4 open terminal (adding to project organizer plugin) – This works in some file managers too.
  • shift+F4 open folder (adding to project organizer)
  • shift+F5 switch header/source (project organizer)
  • F7 switch editor/sidebar (I don't use it normally. It's for testing the feature.)
  • shift+F8 build source code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants