This commit provides 1 correction and 2.5 enhancements for Geany's context action:
1. The correction is:
- In case you hadn't set the context action, calling a popup menu on a selected text/word brings up a menu with all 'goto & context' items being enabled. The context doesn't work at that, of course. It should not be enabled: 1) when no text is selected 2) even more important: when there is no context action set. This commit corrects this.
2. The enhancements are:
- This commit introduces %f, %d, %e, %p, %l placeholders into the context string, i.e. the same ones as in Compile/ Build/ Run. Without them the context is somehow (indeed much) restricted.
- (As consequence) the set context action is active when there is no selected text or a word under caret. Even if there are no placeholders in the context string it may contain a really useful command to access with a fast hotkey, all the more the context is specific to the file type. This commit always enables the context if it's defined in Geany's settings no matter there is or no placeholder in it.
- (0.5 of enhancement) if there would be some new 'goto & context' menu items with their own requirements for access, this commit would facilitate their implementation.
There are a few bla-bla left. This new Geany's context can respond not only to %s, %f, %d etc., but to all Geany's surroundings. E.g. it can show a current state of the project from different viewpoints. Or perform the various actions for maintainance of it. All that done without leaving Geany IDE. One of innumerable possible implementations is here: https://wiki.geany.org/howtos/using_with_tcl_tk As a matter of fact this commit was born of it.
----
About the modifications of code.
1. For the access to 'build_replace_placeholder' function (introducing %f, %d .. placeholders) I need to modify build.c and build.h.
2. It is included in the proper place of callbacks.c.
3. To unlock the context (and move its access check to other place) I need to comment a line of keybindings.c. Actually this unlocks the hotkey of context.
4. To enable a separate (from other 'goto' items) checking of context access, I need to modify ui_utils.c (and its ui_utils.h).
5. The real access to all 'goto' items (the context including) is checked in editor.c.
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1841
-- Commit Summary --
* Correction and enhancements for context action
-- File Changes --
M src/build.c (3) M src/build.h (1) M src/callbacks.c (10) M src/editor.c (18) M src/keybindings.c (2) M src/ui_utils.c (10) M src/ui_utils.h (2)
-- Patch Links --
https://github.com/geany/geany/pull/1841.patch https://github.com/geany/geany/pull/1841.diff