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

[switch-views:] sidebar_focus() does not work at all in Geany Preview #10

Open
ralf3u opened this issue May 19, 2023 · 13 comments
Open

Comments

@ralf3u
Copy link

ralf3u commented May 19, 2023

The two shortcuts Toggle sidebar 2 and Switch view (editor↔sidebar)
If one of the two shortcuts is pressed two times, then the content-area of the Preview-tab is not in focus.

Help
If one want to put the focus on the content-area of the Preview-tab after having pressed one of the two shortcuts, then a help could be to press two times the shortcut Toggle focus between editor and the sidebar (the current built-in-shortcut of Geany Preview).

Possible solution to fix this issue
A possible solution is to fork Geanylua, so to create some kind of GeanyLua special, that allows to have access to a common library. So, then in Geany Preview the shortcut Toggle focus between editor and the sidebar needs to be removed and needs to be pasted in the library, so both plugins (Geanylua special and Geany Preview) have access to it.

History
The knowledge of this issue is based on #7.

@xiota
Copy link
Owner

xiota commented May 19, 2023

I'm not going to fork GeanyLua. It's too much work to maintain a separate project. If any of my current PRs make progress, I'd be willing to look at submitting more changes.

@ralf3u
Copy link
Author

ralf3u commented Apr 21, 2024

The issue still exists for the shortcut Switch view (editor↔sidebar) in Geany 2.0.

@ralf3u
Copy link
Author

ralf3u commented Apr 21, 2024

The shortcuts Focus sidebar 1 and Focus sidebar 2 and Toggle sidebar 2 also don't work.

@ralf3u
Copy link
Author

ralf3u commented Apr 21, 2024

The shortcuts Toggle editor 1 and Toggle editor 2 also don't work in that way that the content of the Preview-tab is in focus.

@ralf3u
Copy link
Author

ralf3u commented Jan 27, 2025

I would like to mention issue number 3289 at geany with the title add a sign to the sidebar to know if sidebar is in focus or not in focus. In that issue number there are some more explication and links to that subject.

@ralf3u ralf3u changed the title Focus does not work correctly when using two shortcuts in Geany Preview [switch-views:] sidebar_focus() does not work at all in Geany Preview Jan 27, 2025
@ralf3u
Copy link
Author

ralf3u commented Jan 27, 2025

I changed the title of this issue from
Focus does not work correctly when using two shortcuts in Geany Preview
to
[switch-views:] sidebar_focus() does not work at all in Geany Preview.

@ralf3u
Copy link
Author

ralf3u commented Jan 27, 2025

The whole description of the function sidebar_focus() is located in the document toggle-functions.lua:

function sidebar_focus()
  if sidebar_is_visible() then
    geany.keycmd("FOCUS_SIDEBAR")
  end
end

@xiota
Copy link
Owner

xiota commented Jan 28, 2025

The sidebar_focus() function looks okay to me. It calls a built-in geany function. If you assign a keyboard shortcut directly to the functionality in geany, does the shortcut work?

I think I found some other mistakes in the functions. Will have to do some testing.

@ralf3u
Copy link
Author

ralf3u commented Jan 28, 2025

If you assign a keyboard shortcut directly to the functionality in geany, does the shortcut work?

Not at all. That is the reason why I changed the title of this issue.
The function sidebar_focus() can be completely removed from the switch-views. That will change nothing.
I tested the shortcut when the tab-title of the editor is in focus, when the tab-title of the Preview-tab is in focus, when the content-area of the editor is in focus and when the frame or border of the Preview-tab is in focus.

@ralf3u
Copy link
Author

ralf3u commented Jan 28, 2025

I changed the document focus-editor.lua in that way:

lua_path=geany.appinfo().scriptdir..geany.dirsep
dofile(lua_path.."toggle-functions.lua")
-- ---------------

geany.signal("notebook1", "grab-focus")

Then, if I press the shortcut of focus-editor.lua, the tab-title of the editor is in focus, but there is no cursor in the editor.

I tried this because I was thinking that if the issue number 3966 at geany would be solved (the issue title of 3966 is: Feature request: When clicking on a tab-title of the sidebar, the focus should always be set on the content-area of the tab), then geany.signal("notebook3", "grab-focus") could put the content-area of the tab of the sidebar in focus. But that's not the case. In other words: Even if issue number 3966 is fixed at geany, it will not fix the focus-issue of the content-area of the preview-tab.

@ralf3u
Copy link
Author

ralf3u commented Jan 28, 2025

If you assign a keyboard shortcut directly to the functionality in geany, does the shortcut work?

The content of the shortcut focus-sidebar-1.lua:

lua_path=geany.appinfo().scriptdir..geany.dirsep
dofile(lua_path.."toggle-functions.lua")
-- ---------------

sidebar_focus()

It does not work at all.

@ralf3u
Copy link
Author

ralf3u commented Jan 29, 2025

Will have to do some testing.

I think the best would be to create with geanylua ONLY the shortcut Focus preview OUTSIDE switch-views to be sure that nothing else influences the shortcut. If you don't want to publish the shortcut Focus preview on the homepage of geanylua-scripts, then just publish here the documents in this issue in a comment, so I can copy and paste it to test the shortcut.

Once the shortcut Focus preview works, the next step would be to integrate the shortcut in switch-views.

@ralf3u
Copy link
Author

ralf3u commented Jan 29, 2025

[...] shortcut Focus preview

A better name for the shortcut would be Focus content of the Preview-tab.

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

No branches or pull requests

2 participants