446 Commits

Author SHA1 Message Date
LarsGit223
63eaf257de keybindings: Added missing "Strip Trailing Spaces" (#1806)
Fixes #395.
2018-07-16 07:53:01 +10:00
Jiří Techet
38a0e4f5b0 Allow plugins to process keypress events before Geany (#1829)
In addition, the signal allows plugins swallow the event so it's not
processed by Geany.
2018-05-22 09:35:44 +10:00
Matthew Brush
fce58626b1 Add 'fall through' comments and fix actual bug
To document when switch cases fall through intentionally, hiding the
warning by GCC at the same time.

Moved the break statement outside of the if conditional in keybindings.c
as I believe this was an actual bug found by GCC's warnings.
2017-12-20 17:22:51 -08:00
Jiří Techet
83e8ae1737 Make sure GDK_MOD2_MASK is cleared when getting modifiers
gtk_accelerator_get_default_mod_mask() behaves differently on OS X under
GTK 3 when compared to GTK 2. On GTK 2 it used to clear the GDK_MOD2_MASK
bit while on GTK 3 it's preserved. We need to clear it ourselves
otherwise e.g. <Command>S leads to <Commands><Mod2>S and none of the
keybindings work under GTK 3.
2017-10-12 19:27:56 +02:00
Thomas Martitz
180e1da427 api: the commits 745f424 and 169feae should have incremented the API version, do so now
Increment one time for both, and fix the corresponding doc comments.
The comment for keybindings_load_keyfile() is reflowed to split into
brief/detail sections properly.
2017-08-04 01:13:11 -07:00
Jiří Techet
745f424b77 Export keybindings_load_keyfile() for plugins
This allows plugins to reload keybindings later during their execution.
For more info see the comment in the commit.

Closes #1430
2017-08-04 00:37:19 -07:00
Matthew Brush
6d663cbb0e Change all scintilla_send_message calls to use SSM macro 2017-08-03 23:48:30 -07:00
Thomas Martitz
b2668dae67 Better snippets (#1470)
* snippets: Allow keybinding overloading of snippet-next-cursor.

This allows to use the same key as for inserting snippets, or plugins to
map something to the same keybinding (e.g. if they implement a similar facility).

* snippets: Remove cursor position at the end of constructs.

This is not consistently done for all languages, and hard to get right
e.g. for python. It's probably not terribly useful either.

* snippets: Use Scintilla indicators for cursor posititons
* api: Increment API version.
* snippets: restore behavior of cursor-less snippets
* snippts: use ascii character for the placeholder.

Do not require documents to be UTF-8 for using snippets.

* snippets: fix start/end detection, when searching for the next cursor

Tested @vfaronov
2017-07-21 16:42:58 +10:00
Jiří Techet
2707006286 Fix crash when plugin_set_key_group() is called several times by plugins (#1426)
When plugin calls plugin_set_key_group() several times for the same
group (when creating keybindings dynamically and needs to reset them),
it crashes with the current code the second time it gets called.

The reason is that group->plugin_keys is an array into which entries of
group->key_items point and when calling

g_ptr_array_set_size(group->key_items, 0);

it calls free_key_binding() for every item - when these items are
deallocated by g_free(group->plugin_keys) previously, calls of
free_key_binding() reference an invalid memory.

Just first resizing group->key_items (and calling free_key_binding() for
its items) and freeing group->plugin_keys afterwards fixes the problem.
2017-04-15 20:48:03 +10:00
Colomban Wendling
dd4c851cab Fix focusing the Terminal tab in the message window
Use more generic code to not fall into the same issue next time layout
changes, and to potentially support plugin tabs in the message window.

Fixes #1198.
2016-08-30 16:19:58 +02:00
Abel 'Akronix' Serrano Juste
14904a18ff Added keybinding for Delete from line start to current position
Closes #1134
2016-07-13 15:51:10 -07:00
Colomban Wendling
9ba7f67238 Don't require plugin key group name and label strings to be static
Take a copy of the strings not to require them to live live as long as
the plugin does.

This is mostly useful for plugins implemented in dynamic languages
(e.g. through a plugin proxy), as most C plugins will use a static
string here; but it makes the API more straightforward and avoids odd
issues if any plugin doesn't use static strings here, even C ones.

Closes #1125.
2016-07-09 00:23:01 +02:00
Colomban Wendling
debe14549d Improve API docs related to keybindings configuration file 2016-03-03 15:00:15 +01:00
Colomban Wendling
3fda6988b3 Merge pull request #890 from kugel-/gtkdoc-hdr
Generated and ship a GtkDoc header suitable for GObject Introspection.
2016-03-01 18:53:08 +01:00
Colomban Wendling
f90da20359 Add @nullable annotations everywhere 2016-02-28 02:12:35 +01:00
Thomas Martitz
1f53552007 Undo removal of "can be NULL" remark
Also remove a unecessary empty line.
2016-02-25 14:50:25 +01:00
Colomban Wendling
2f55540f75 Merge pull request #582 from techee/tags_are_symbols
Use the word "symbol" instead of "tag" in the UI and documentation
2016-02-17 22:54:55 +01:00
Jiří Techet
9b686871de Use the word "symbol" instead of "tag" in the UI and documentation
For users a tag is <this> so the naming can be confusing.

The only exception where we probably shouldn't use the word symbol is the
"tags file" (*.tags) containing global tags - this has already the "tags"
extension and is more related to ctags and using "symbols file" is a bit
strange in this case.

As a result, the only places where this patch leaves the word "tag" are:

* phrase "tags file(s)"
* phrase "tags parser(s)"
* documentation mentioning the "tags" directory
* documentation mentioning the *.tags extension

and of course where it means the HTML/XML markup <thing>. The rest of the
uses of the word "tag" is replaced with "symbol".

Documentation is updated accordingly.

Fixes #579.
2016-02-17 22:38:00 +01:00
Thomas Sahlin
74e3dd6d1c Added keybindings for custom commands 4-9 2016-02-16 22:21:34 +01:00
Thomas Martitz
f2ebd288b3 doc: gir annotations cleanup
- @skip -> @girskip
- @null -> @nullable
- @addtogir -> @gironly
- changed internal xml representation of @cb, @cbdata, @cbfree
- @girskip keybindings_set_item() too
2016-02-16 07:14:27 +01:00
Thomas Martitz
bfa0946420 doxygen: various doxygen-related fixes in preparation for gtkdoc generation 2016-02-07 17:50:23 +01:00
Colomban Wendling
bfd5587f4f Merge pull request #852 from b4n/reflow-hang
Fix hang in reflow command (and small improvements around)
2016-01-18 03:40:56 +01:00
Colomban Wendling
a7ce20dc59 Merge pull request #826 from kugel-/doxygen-fixes2
Doxygen API fixes and cleanup.
2016-01-18 03:19:15 +01:00
Colomban Wendling
28f7c169fc Merge pull request #652 from b4n/kb/file-properties
Allow to set a keybinding for File->Properties
2016-01-09 20:07:23 +01:00
Colomban Wendling
e083c8d1c9 reflow: Use plain ASCII space instead of GDK_space
`GDK_space` is not guaranteed to have the value of an ASCII space
(although it does in practice), and using a GDK constant does not make
sense inside a text manipulation function.
2016-01-04 22:30:32 +01:00
Colomban Wendling
ffde79e8ef reflow: Don't split right before a whitespace
Avoid splitting lines right before a whitespace when reflowing (e.g.
in case of several consecutive ones) not to move whitespaces at the
start of the next line, which, while they will be removed later on,
can lead to incorrect reflow width and even fully empty lines.
Prefer leave trailing spaces then, which is less of a problem.
2016-01-04 22:21:19 +01:00
Colomban Wendling
46ed77bf19 reflow: Fix infinite loop on some input with many consecutive spaces
Avoid triggering auto-indentation with consecutive whitespaces when
reflowing, as it can lead to infinite loop if auto-indent leads to
inserting full lines.

Fixes #848.
2016-01-04 21:58:42 +01:00
Thomas Martitz
302b40e977 doxygen: various doxygen-related fixes in preparation for gtkdoc generation
Major changes are:

- Some types were accidentally documented, even though they couldn't be
accessed by any exported API functions. Those are removed (especially
from encodings.h).

- Some types were not documented where they should. Documentation is
added for them. Members are not necessarily documented separately if names
are self-explanatory.

- @a XXX refers to parameters of the function, it's inappropriate for
highlighting NULL (change to @c)

- As per consensus, build_info is removed from GeanyData (replaced by
pointer to avoid ABI break; added grep-able abi-todo tag so it doesn't get
forgotten)
2015-12-17 09:52:52 +01:00
Colomban Wendling
5dea35ada9 Respect Smart Home Key setting in Go To Start of Display Line 2015-10-25 14:05:37 +01:00
Colomban Wendling
9729f354e5 Allow to set a keybinding for File->Properties
Closes #622.
2015-09-10 19:20:18 +02:00
Thomas Martitz
7c2c9dc27a plugin api: add destroy_notify to the new keybinding APIs
The destroy_notify can be used to make Geany automatically free the
per-KeyGroup or per-KeyBinding user_data. This is particularly useful for
vala-based plugins or other (future) language bindings.

The destroy functions can be conviniently hooked into the destroy_notify of
the underlying GPtrArrays, therefore this commit also implements such notifies
internally.
2015-08-26 23:49:45 +02:00
Thomas Martitz
d3f6237505 plugin api: introduce keybindings_set_item_full and plugin_set_key_group_full
These function actually set the new GeanyKeyGroupFunc and
GeanyKeyBindingFunc and are exported for plugins
2015-08-26 23:49:37 +02:00
Thomas Martitz
1d08d3db4a plugin api: introduce GeanyKeyGroupFunc and GeanyKeyBindingFunc
These are new keybinding callback functions that take a few more parameters.
Most importantly they have pdata pointer which allows plugins
to store context information. This is especially useful for future plugins
in OOP languages to store an instance pointer there, or interpreted ones to
store interpreter context.
2015-08-26 23:46:45 +02:00
pik
4c504c2be2 Reorganize select callback
* select_all now works with splitwindow
* select_all now works with file-browser pane
* menu_select_all now works everywhere select_all hotkey does
2015-04-20 22:16:35 +02:00
pik
c214056ea1 Fix callbacks to scintilla functions to work with splitwindow
* Use Scintilla focus object instead of notebook document to fix
  splitwindow behaviour for cut, copy, paste and delete callbacks.
* move else-if to same line (style)
2015-04-20 22:16:07 +02:00
Colomban Wendling
f3078ebbc6 Merge branch 'kugel-/linkage-cleanup_rebase-for-merge'
This merges PR#429 with only small history cleanup (no code changes),
and ABI bump.

Closes #355, #358 and #429.
2015-04-10 16:54:30 +02:00
Colomban Wendling
9644fb0ae2 Define GEANY_{EXPORT,API}_SYMBOL from the build system
This makes it easier to define it consistently to what the compiler
and platform supports, and avoids having to include a special header
everywhere, which is some kind of a problem for separate libraries
like TagManager and especially Scintilla.

As we only use these macros from the source and not the headers, it
is fine for it to be defined to a configure-time check from the build
system.

Warning: Although Waf and Windows makefiles are updated they are not
         tested an will probably required tuning.
2015-04-10 16:08:08 +02:00
Colomban Wendling
1cea0b6a79 Merge pull request #411 from techee/shadows
Use consistent shadows across Geany
2015-03-26 22:53:29 +01:00
Jiří Techet
1a36eeaf4d Use consistent shadows across Geany
In principle, any scrolled window should have GTK_SHADOW_IN so the scrollbars
are not above the surface and there is a frame around the scrolled area.

The only exception are the elements of the main window where adding
GTK_SHADOW_IN causes there are too many shadows (or lines in 2D themes)
around the windows and the result isn't nice. So use GTK_SHADOW_NONE
for all main editor scrolled windows. (One additional exception is the
Help->Credits page which is gray and the extra frame doesn't look good.)

Replace frame around VTE with GtkViewport to avoid the extra line around.

Raise the second editor from the splitwindow plugin so it's at the same
level as the main editor.
2015-03-22 15:32:54 +01:00
Matthew Brush
2f08670763 Mark all plugin API functions to have "default" (public) visibility
Adds a new header `pluginexport.h` to put the macros in, could be
moved into an existing header (support.h?) by I didn't want to drag
a bunch of existing stuff into the source files for this one macro.

TagManager has relative include, this could be fixed by changing the
include directories for it if it's a problem. Mark the Scintilla
functions exported by re-declaring them in sciwrappers.c with the
attribute to avoid changing upstream Scintilla code.
2015-03-10 22:06:47 +01:00
Jiří Techet
2e1dc7aeba Don't use expose-event/draw signals of the menu
The expose-event/draw signals were used to reenable the menu
after it has been disabled when VTE overrides the given keybinding.
This doesn't work on OS X where GtkMenuBar isn't displayed
(there may be a similar problem with the global menubar on
Ubuntu).

The reason why these signals were used was probably slight
flickering of the menubar when using ordinary g_idle_add() to
reenable the menu (the dimmed menu gets drawn after which
it gets reenabled and redrawn non-dimmed). It is however possible
to use idle function with higher than redraw priority in which case
the menu is enabled before the redraw so the dimmed menu
isn't drawn at all.

Fixes https://sourceforge.net/p/geany/bugs/1081/
2015-03-04 12:40:45 +01:00
Colomban Wendling
15f75ca2ac Fix a few indentation style issues 2015-02-13 14:11:30 +01:00
Jiří Techet
daecf69c9c Make keybindings_get_modifiers() part of plugin API 2015-01-20 19:33:06 +01:00
Jiří Techet
82b413e506 Fix keybindings on OS X
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.
2015-01-20 19:33:06 +01:00
Colomban Wendling
740c12c0ca Remove "Show macro list" keybinding and feature
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.
2015-01-11 17:30:27 +01:00
Nick Treleaven
cfcbc6a205 Make Next/Previous Message keybindings work without a document open 2014-10-30 16:34:00 +00:00
Colomban Wendling
f5230f334e Fix moving editor tabs through keybindings 2014-10-12 18:00:12 +02:00
elextr
a8e8e2cd9e Merge pull request #312 from elextr/reflow_fix
Make reflow paragraph leave cursor at end of reflowed text, which is more likely to be useful than where it was left at the start of the last line.
2014-08-19 18:05:38 +10:00
Colomban Wendling
593b9dd2c9 Merge branch 'single-line-regex' 2014-08-10 01:51:48 +02:00
Colomban Wendling
482d2732af Add support for single-line regular expressions 2014-08-10 01:46:16 +02:00