8366 Commits

Author SHA1 Message Date
Colomban Wendling
927b364311 Merge pull request #647 from konsolebox/master
Use 'g' as mnemonic key for "Use multi-line matching" instead of 'l'.

Closes #589.
2015-09-09 20:01:37 +02:00
Ross Konsolebox
8253e2bd48 Use 'g' as shortcut key for "Use multi-line matching" instead of 'l'.
The current shorcut key for "Use multi-line matching" conflicts with
"In Selection" when "Use regular expressions" is enabled.  It should be
convenient if we change it.

We choose 'g' since other letters are already in use:

   u: "Use regular expressions"
   s: "Search for"
   e: "Use escape sequences"
   m: "Mark"
   l: "In Selection"
   t: "Match from start of word"
   i: "In Document"
   n: "Replace & Find"
   a: "Case sensitive"
   c: "Close"
   h: "Replace with"
2015-09-09 13:37:10 +08:00
Colomban Wendling
6db80a247f Don't open more than one document for non-existing paths from the CLI
When creating a new document for a non-existing file from the command
line, check if we don't already have opened it and simply show the
existing one if we do.  This avoids creating new documents that will be
saved to the same location again and again.

Closes https://bugs.launchpad.net/linuxmint/+bug/1482558
2015-09-08 16:23:57 +02:00
elextr
8b767fea49 Merge pull request #638 from Akronix/master
Added multiline comment for filetypes.haskell
2015-09-02 09:10:33 +10:00
Abel 'Akronix' Serrano Juste
80c4cd0de0 Added multiline comment for filetypes.haskell 2015-09-01 19:12:59 +02:00
Thomas Martitz
d4f26fdb13 plugin api: bump API number for new keybindings APIs 2015-08-26 23:51:33 +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
Enrico Tröger
db7a13b478 Mark "Open in New Window" menu item as translatable 2015-08-25 21:53:23 +02:00
Colomban Wendling
b8a99752f0 Bump API version for new plugin entry points (oops)
Closes #624.
2015-08-24 19:40:17 +02:00
Colomban Wendling
280163a244 Merge pull request #469 from kugel-/new_hooks
Plugin loader redesign
2015-08-23 23:50:44 +02:00
Colomban Wendling
b7bcf14ddf Merge pull request #613 from SiegeLord/even_more_rust_updates
Rust updates
2015-08-23 23:48:39 +02:00
Thomas Martitz
765000be92 plugins: Clarify which API functions may be called within geany_load_module()
Since geany_load_module() is called for non-enabled plugins you may not
use the plugin API here yet. The only exceptions to this rule are API functions
required for plugin registration.

This rule is hard to enforce (would need to g_return_if_val(PLUGIN_LOADED_OK(p))
for all API functions (well, those taking a plugin pointer anyway), so this
rule is only documented for now.
2015-08-23 20:01:42 +02:00
Thomas Martitz
437837d3a5 plugins: separate geany_plugin_set_data() dual-use
It was found that because geany_plugin_set_data() could be used by both
plugin's init() and geany_load_module(), that it introduced some uncertainty
as to when to call the free_func. init() callers might expect the call
around the same time as cleanup() is called, while geany_load_module()
callers expected the call at module unload time.

It was indeed called at module unload time. But that means that init() callers
cannot call it again reliably after in a init()->cleanup()->init() flow (when
toggling the plugin) without fully unloading the plugin (which is what we do
currently but that's we would want to change).

With the separation we can actually destroy the data depending on where
it was set and do everything unambigiously.
2015-08-23 20:01:42 +02:00
Thomas Martitz
d54b65b9ac plugins: Updated doxygen for the new plugin loader
The documentation provides a quite detailed description of the new loader
In addition it adds a "how to transition" that briefly describes the old
loader (for curious newcomers) and lots of hints for porting legacy
plugins to the new loader.
2015-08-23 20:01:41 +02:00
Thomas Martitz
58c8144afc plugins: Pass pdata to PluginCallback function by default
If the plugin did not set its own user_data we set it to whatever it set
with geany_plugin_register_full() or geany_plugin_set_data().
This is particularly convinient because PluginCallback is usually statically
allocated, at which point dynamically allocated plugin data doesn't exists yet.
2015-08-23 20:01:41 +02:00
Thomas Martitz
43c58e0fdd plugins: change return codes of geany_load_module() and GeanyPluginFuncs::init
- The return value from geany_load_module is removed (void). It was ignored
  anyway and we have to check separately whether the plugin loaded OK or not
  anyway. If the plugin specific code fails it should simply not call
  geany_plugin_register() (which it should only call iff all other conditions
  are good).

- GeanyPluginFuncs::init() now returns a bool to allow failing initialization.
  Some plugins might want to defer work to their init() (i.e. only do
  it when the plugin was activated by the user), and some of that work can
  possibly fail (e.g. GtkBuilder fails to load .xml).

Note that the GUI integration of the latter is less than ideal but this kind
of GUI/policy work is out of scope for this patch set. Therefore a plugin
failing to init is simply removed from the PM dialog as if it became
incompatible. However, as the code that generates the list does not call init
they will show up again if the PM dialog is re-opened.
2015-08-23 20:01:41 +02:00
Thomas Martitz
8241278472 demoplugin: Adapt demoplugin to the new loader
Demoplugin, while not installed by default, is a nice starting point
and mini-howto. Therefore it should advertise the new loader from the
beginning.
2015-08-23 20:01:41 +02:00
Thomas Martitz
75827c69c0 plugins: Refactor legacy plugin support
With geany_plugin_set_data() the legacy plugin support can be made
more transparent by using wrapper functions that call the actual plugin_*
functions. This allows to remove the differentiation in code that's not
directly concerned with actually loading plugins.

This commit doesn't change anything except for one thing: legacy plugins now
cannot call geany_plugin_set_data(). But it is meant for new-style plugins
anyway.
2015-08-23 20:01:38 +02:00
Thomas Martitz
f2579141bb plugins: Replace geany_plugin_register() pdata with a separate API function
The API function adds a free_func parameter, and can also be called
after geany_plugin_register(), i.e. in the plugin's init() callback. This
fixes a by-design memory leak and gives greater flexibility.
2015-08-23 15:23:24 +02:00
Thomas Martitz
babf008335 plugins: Let plugins fill GeanyPlugin::callbacks instead of passing their own pointer
This is easier to handle if we decide to add callbacks. Since we can
zero-initialize callbacks before passing it to the plugin we can be certain as
to which callbacks the plugin knew about when it was compiled. This is exactly
the same method used for GeanyPlugin::info already and easier than inspecting
the API version.
2015-08-23 15:23:22 +02:00
Thomas Martitz
721009e262 plugins: plugin loader redesign
The old plugin loader has a number of deficiencies:

- plugins need to export a couple of callback functions into the global namespace
- plugins need to export data pointers, that are written by Geany
- the exported functions have no user_data param, so there is no way to
  pass context/state back to the plugin (it needs global storage for that)
- plugin registration is implicit, plugins have no way to not register themselves
  (it may want that due to missing runtime dependencies)
- plugins perform the ABI/API verification, and even though we provide a
  convinience wrapper, it may get that wrong

As a result, I designed a new loader with the following design principles
- semantics of callbacks should not change, but they they shouldn't be mess
  with the global namespace
- each callback receives a self-identifying param (the GeanyPlugin instance) and
  a plugin-defined data pointer for their own use
- explicit registration through a new API function
- in-core API/ABI checks

The following principles shall be left unchanged:
- The scan is done on startup and when the PM dialog is opened
- Geany allocates GeanyPluginPrivate for each plugin, and GeanyPlugin is
  a member of it
- Geany initially probes for the validity of the plugin, including file type
  and API/ABI check, thus Geany has the last word in determining what a
  plugin is
- the PM dialog is updated with the proper, translated plugin information
- the PM dialog GUI and user interaction in general is unchanged

With the redesign, plugins export a single function: geany_load_module().
This is called when the GModule is loaded. The main purpose of this function
is to call geany_plugin_register() (new API function) to register the plugin.
This is the only function that is learned about through g_module_symbol().
Within this call the plugin should
a) set the localized info fields of GeanyPlugin::info
b) pass compiled-against and minimum API version as well as compiled-against
   ABI version, to allow Geany to verify compatibility
c) pass a pointer to an instance of GeanyPluginFuncs
   which holds pointers to enhanced versions of the known callbacks (except
   configure_single which is dropped).
d) optionally pass a plugin-private data pointer for later callbacks

Enhanced means that all callbacks receive the GeanyPlugin pointer as the first
and a pdata pointer as the last. pdata is private to the plugin and is set
by geany_plugin_register().

The callbacks need (should) not be globally defined anymore, and the global
GeanyData, GeanyPlugin and GeanyFunctions pointers are ignored and not set
anymore. GeanyData is available through GeanyPlugin::geany_data.
2015-08-23 15:23:20 +02:00
Pavel Sountsov
568787bc2f Change Rust tests to be in line with the ones in the universal-ctags tests. 2015-08-21 21:21:18 -07:00
Pavel Sountsov
91ee437640 Parse 'where' bounds correctly. 2015-08-21 21:19:47 -07:00
Pavel Sountsov
6814fc1a62 Update Rust keywords. 2015-08-21 21:17:59 -07:00
Colomban Wendling
c251dcb45f Merge pull request #394 from SiegeLord/selection_document_mods
Make Document > Strip trailing spaces/Replace tabs/Replace spaces use
the current selection.
2015-08-21 22:26:41 +02:00
Jiří Techet
3495cf05ab Remove saved file's mtime check comparing it with the current time
As the edited file can be a remote file on a server with a different time
zone, the mtime can actually be in the future. In this case the check not
only shows the misleading warning but more importantly the

doc->priv->mtime < st.st_mtime

check never happens and the user doesn't get the modified file prompt.

Setting

doc->priv->mtime = time(NULL);

to the current time on file creation isn't harmful in any way because the
saved file's mtime is taken but it's a bit misleading so better to set it
to 0.
2015-08-18 19:48:12 +02:00
Colomban Wendling
624048ea5e Keep selection stable when replacing tabs and spaces 2015-08-16 11:38:51 -07:00
Pavel Sountsov
2a887fee30 Don't strip spaces from the next line when whole lines are selected. 2015-08-16 11:22:01 -07:00
Pavel Sountsov
186a43c1d1 Document the changes to space/tab replacement 2015-08-16 11:22:01 -07:00
Pavel Sountsov
795230c572 Use current selection when replacing tabs/spaces from the menu.
When saving the file, the tabs are removed from the whole file as usual.
2015-08-16 11:22:01 -07:00
Pavel Sountsov
381d74b1a7 Use current selection when stripping trailing whitespace from the menu.
When the lines are stripped due to the file being saved, ignore the selection.
2015-08-16 11:22:01 -07:00
Frank Lanitz
31325bb231 Update of Swedish translation 2015-08-06 09:02:46 +02:00
Dominic Hopf
a26a2257db Merge pull request #599 from oliwer/perlkeywords
Add new keywords for recent versions of Perl
2015-08-05 10:24:52 +02:00
Olivier Duclos
a6c3cdc2cd Add new keywords for recent versions of Perl
This commit adds the following new keywords for perl:
 - say
 - state
 - given, when, default
 - __SUB__

While __SUB__ was introduced in perl 5.16, the others date back
to v5.10 released in 2007!
2015-08-05 10:05:02 +02:00
Matthew Brush
bff71b3a88 Fix "Open in New Window" command arguments
Closes #590
2015-08-03 17:04:52 -07:00
Wayne Nilsen
1b5ec633e3 Use Cargo tool for Rust build commands
Closes PR #557
2015-07-30 22:40:53 -07:00
Colomban Wendling
c0898618f9 Merge pull request #574 from eht16/doxygen_fixes
Fix Doxygen warnings
2015-07-22 21:52:10 +02:00
Enrico Tröger
50b150b66d Merge pull request #583 from eht16/win32_fix_native_dialogs
Windows: restore modern design of native file dialogs
2015-07-22 21:50:57 +02:00
Enrico Tröger
2ae6c7fd0f Fix Doxygen warnings
This resolves warnings from Doxygen about non-existing commands
caused by unescaped backslashes as well as multiply
defined section names.
2015-07-22 20:00:34 +02:00
Enrico Tröger
c5b0fc459a Merge pull request #573 from zhekov/cleanup-win32defines
Cleanup win32defines
2015-07-22 19:59:38 +02:00
Enrico Tröger
5510a5a00e Merge pull request #585 from codebrainz/remove-style-debug-print
Remove needless debug print
2015-07-21 21:31:43 +02:00
Matthew Brush
21bb11ddd7 Remove needless debug print
Prevents spamming the console when SCLEX_CONTAINER
is activated (ex. by plugins).
2015-07-21 11:15:27 -07:00
Enrico Tröger
97fca1b29d Windows: restore modern design of native file dialogs
This restores the previously used "modern design" of the Windows
native file open/save dialogs. Also make the dialogs resizable.

Fixes #578.
2015-07-19 23:13:45 +02:00
Jiří Techet
fb63f9e43a Use monospace font for the message window by default
Since both gcc and llvm use ^ to mark the position of the error now,
monospace font seems to be a better default font for the message window
to avoid the ^ character misalignment.

Fixes #435.
2015-07-18 21:28:40 +02:00
Colomban Wendling
1658babe45 Remove obsolete GTK compatibility code 2015-07-14 15:44:47 +02:00
Jiří Techet
2328f84e37 Disallow the possibility to use tm_tags_find() on unsorted array
This function won't work correctly on unsorted array because the second
part of the function (after the tags search) expects the array is sorted
by name. The only user of this is tm_source_file_set_tag_arglist() in which
we can go through the tags manually by ourselves (it needs only a single
value so the original behavior of tm_tags_find() wasn't a problem).
Eliminate the tags_search() function as it isn't needed any more.

Just cleanup, not functional change.
2015-07-14 09:46:59 +02:00
Jiří Techet
99e222ea37 Eliminate calls of slow tm_tags_extract() on big arrays
Do the same with struct/class/union... member tags as we do with
typenames - extract them from the edited file and merge them with
the array containing all of them so while editing, there should
be no slowdowns because one file usually doesn't contain so many
tags. This eliminates about 2s freeze when typing "." on a linux
kernel project with 2300000 tags.

Extract typename and member tags also for global tags in case someone
creates a giant tags file - this needs to be done just once when
loading the tag files.

All the remaining tm_tags_extract() in Geany are called on
file tag array only so there shouldn't be any performance problems.
2015-07-14 09:44:33 +02:00
Jiří Techet
5c18b3d132 Improve scoped search
This patch contains a bit too many things which are however related.

It started by the part in editor.c (where we previously used only the
first type we found to perform scoped search) by going through all the
possible variable types until the scoped search returns some result
(this is useful if variable foo is used once as int and once as struct
and if the int is the first type found, we won't get the struct's members).

This didn't work. After an hour of debugging, it turned out that
because tm_workspace_find_scope_members() calls internally
tm_workspace_find() and this function returns static array, this
invalidates the array returned by the tm_workspace_find() used
previously to get all the possible variable types.

Since this is really dangerous and hard to notice, I tried to eliminate
the static returns from both tm_workspace_find() and
tm_workspace_find_scoped_members().

The tm_workspace_find_scoped_members() function is where I got
stuck because as I started to understand what it's doing, I found
many problems there. This patch does the following in this function:

1. Eliminates search_global and no_definitions parameters because
we always search the whole workspace and this simplifies the slightly
strange logic at the end of the function.
2. Returns members from global tags even when something found in
workspace tags - previously global tags were skipped when something
was found from workspace tags but I don't see a reason why.
3. Adds the lang parameter to restrict tags by language (we do this
with normal search and the same should be done here).
4. Previously when searching for types with members the function
returned NULL when more than one such type was found (there should
have been >=1 instead of ==1 at line 906). This patch improves the
logic a bit and if multiple types are found, it tries to use the one
which is other than typedef because it probably has some members (the
typedef can resolve to e.g. int).
5. Previously the function prevented only direct typedef loops like

typedef A B;
typedef B A;

but a loop like A->B->C->A would lead to an infinite cycle. This patch
restricts the number how many times the typedef can be resolved by
using for loop with limited number of repetitions and giving up when
nothing useful is resolved.
6. Finally the patch tries to simplify the function a bit, make it
easier to read and adds some comments to make it clearer what the
function does.
2015-07-14 09:44:33 +02:00