On OS X the Command key is used for common keybindings instead
of Ctrl. Introduce a new macro, GEANY_PRIMARY_MOD_MASK that
represents the Command key on OS X and Ctrl on other platforms.
For some events, such as mouse key press, GDK_MOD2_MASK is returned
for the Command key by GTK instead of GDK_META_MASK (which is returned
when Command is pressed together with some other key). To hide this
behavior from users, introduce keybindings_get_modifiers() which can be
used instead of gtk_accelerator_get_default_mod_mask() and which
inserts GDK_META_MASK when GDK_MOD2_MASK is found in the mask
on OS X.
This feature looks like a poorly implemented subset of "Complete word",
but lacks some important features like prefix filtering. It is also
misnamed as it shows not only macros, but also variables and enums.
It also only shows `editor_prefs.autocompletion_max_entries`, but does
so from *each* file, not as a whole.
So drop it altogether, as this feature doesn't really look useful and
the current implementation seem to suffer of too many shortcomings for
it to realistically be actually used.
This is a mega-commit - because most of it had to be done in one go
otherwise some commits would fail to compile - that attempts to fix a
few problems with Geany's includes as well as various other related
cleanups. After this change it's easier to use includes and there's
little worry about which order things are included in or who includes
what.
Overview of changes:
* Include config.h at the start of each source file if HAVE_CONFIG_H
is defined (and never in headers).
* Go through each source file and make the includes section generally
like this:
- Always config.h first as above
- Then if the file has a header with the same name, include that
- Then include in alphabetical order each other internal/geany header.
- Then include standard headers
- Then include non-standard system headers
- Then include GLib/GTK+ related stuff
* Doing as above makes it easier to find implicit header include
dependencies and it exposed quite a few weird problems with includes
or forward declarations, fix those.
* Make geany.h contain not much besides some defines.
- Add a little header file "app.h" for GeanyApp and move it there
- Move "app" global to new "app.h" file
- Move "ignore_callback" global to "callbacks.h"
- Move "geany_object" global to "geanyobject.h"
* Add an include in "geany.h" for "app.h" since GeanyApp used to be
defined there and some plugins included this header to access
GeanyApp.
* Include "gtkcompat.h" everywhere instead of gtk/gtk.h so that
everywhere sees the same definitions (not a problem in practice AFAIK
so this could be changed back if better that way.
* Remove forward declarations from previous commits as some people
apparently consider this bad style, despite that it reduces inter-
header dependencies.
TODO:
* As always, to test on win32
* As always, to test with not Autotools
* Test plugins better, both builtin and geany-plugins, likely API/ABI bump
* Test with various defines/flags that may change what is included
* win32.[ch] not really touched since I couldn't test
This is for work on making the files scannable by GObject-Introspection
but is still useful otherwise (even fixes a FIXME in the comments). I
made this by using a simple GNU Make file and trying to compile the
sources each on their own without all the build system infrastructure.
* Add keybindingsprivate.h file to hold private GeanyKeyGroup structure
and remove it from the GEANY_PRIVATE guard in keybindings.h.
* Move private members that were guarded by GEANY_PRIVATE from
GeanyFiletypes to GeanyFiletypesPrivate and remove guarded build.h
include.
* Move private members that were guarded by GEANY_PRIVATE from
GeanyProject to GeanyProjectPrivate.
Using the exact same string avoids duplicate translation, and here only
mnemonic changes were introduced with commit
95306ac8db4fc38ad7ba7e172328cef5117efaf0.
When switching the current notebook tab, we need to take only visible
pages into account. If we don't and we try switching to an invisible
page, nothing happens.
In practice, the issue is visible on the message window notebook if one
of the tabs are hidden due to one of the "msgwin_*_visible" settings.
Extract `split_line` function from `reflow_lines` to reimplement it in
the future without using SCI_SPLITLINES to achieve the
behaviour consistent with the "Line breaking" option.
If we provide an AccelGroup when creating a menu item using a sock ID,
it installs the GTK default accelerator, accelerator we can't remove
since we don't know about it. So, don't give an AccelGroup so GTK
don't install it's own accelerator.
This fix also required to properly update the accelerator on some item
we used to ignore since the update didn't work anyway (since the GTK
accelerator was displayed instead).
Note that this doesn't fix the fact the editor popup menu accelerators
are never updated after startup so they don't get updated before
restart after changing a keybinding in the preferences. This is a
separate (and less problematic) issue due to a simple lack of update.
Closes#1912683 and #3599251.
Although using menu items for these is not very practical, it helps
discoverability, and they're more useful and intuitive than 'Transpose
Current Line'.
Write an empty keybindings.conf for new users to prevent the workaround
for old defaults being written.
Also remove generated comment in keybindings.conf, this file doesn't
need an explanation as it is generated by Geany.
This provides a workaround so existing users who upgrade should now
be unaffected.
The default changed for these in commits
82769a046c6394d073cc8a32677d8d4794c12c4c and
9ae71ab6cc3bb8185939e1536ffba41beb896686, but this may be
confusing/annoying for existing users who have not edited any
keybindings.
Those commit messages were wrong about never affecting existing
users. Thanks to Lex for raising this.
Previously it was useful because `reflow_lines`, in case when selection
contained trailing newline, removed that newline from selection by
calling `sci_set_selection_end` which only works when anchor > current
cursor position (it's mentioned in Scintilla's documentation on
SCI_SETSELECTIONEND).
Now trailing newline is removed by calling `sci_deselect_last_newline`
which uses `sci_set_selection` with `start` and `end` arguments. This
function works regardless of the interposition of current cursor
position and anchor.
The code joined current line with the next one when no text is selected.
For "Join lines" command this behaviour is wrong; for "Reflow paragraph"
the case is already handled outside the `reflow_lines` function.