5331 Commits

Author SHA1 Message Date
Enrico Tröger
00a5688249
Merge pull request #2111 from eht16/win32_socket_handling
Improve IPC socket handling
2019-04-07 09:41:24 +00:00
Enrico Tröger
690df746bf Windows: Use SO_EXCLUSIVEADDRUSE flag for IPC socket
SO_REUSEADDR on Windows allows to bind to an already used port
without an error. This way we never notice if the port is already used.
So use the Windows special flag SO_EXCLUSIVEADDRUSE to ensure we receive
an error if the port is already used.

Part of #641.
2019-04-07 11:33:05 +02:00
Enrico Tröger
d951db1e8a On Windows, raise the main window only when needed for IPC calls
We need to explicitly raise the main window on IPC commands
only when opening files and similar.
For query commands like "doclist" the focus should stay on the
remote instance.
2019-04-07 11:33:05 +02:00
Enrico Tröger
bd938af032 Use GLib logging for socket error messages
The "perror" logs were not very visible on non-Windows systems
(i.e. the user could see and notice them only when Geany was started
from the command line).
On Windows, those messages were never visible at all.

Add a new debug log message if Geany received an IPC command
from a remote instance.

Also, add a status bar and status window message if the initial socket
creation failed.
2019-04-07 11:33:05 +02:00
Jiří Techet
a1cf475fcf Sync ctags with upstream so that most parsers can be copied from uctags (#2018)
* Use latest version of htable

* Use latest version of mio

* Use latest version of objpool

* Use latest version of ptrarray

* Use latest version of vstring

This also requires adding trashbox.c/h which is now used by vstring and
inline macros from inline.h.

* Rename fieldSpec to fieldDefinition

See b56bd065123d69087acd6f202499d71a86a7ea7a upstream.

* Rename kindOption to kindDefinition

See e112e8ab6e0933b5bd7922e0dfb969b1f28c60fa upstream

* Rename kinds field in parserDefinition to kindTable

See 09ae690face8b5cde940e2d7cf40f8860381067b upstream.

* Rename structure fields about field in parserDefinition

See a739fa5fb790bc349a66b2bee0bf42cf289994e8 upstream.

* Use kindIndex instead of kindDefinition

This patch replaces kindDefinition related entries from sTagEntryInfo
with kindIndex so kinds are referenced indirectly using the index. For
more info please refer to commits:

16a2541c0698bd8ee03c1be8172ef3191f6e695a
f92e6bf2aeb21fd6b04756487f98d0eefa16d9ce

Some other changes had to be made to make the sources compile (without
bringing all the diffs from upstream). At some places, which aren't used
by Geany, only stub implementations have been created.

In particular, the regex parser has been disabled (for now?) because its
current implementation doesn't allow accessing kindDefinitions using
index and allowing this would require big changes in its implementation.
The affected parsers are Cobol, ActionScript and HTML. For HTML we can
use the token-based parser from upstream, and we should consider
whether Cobol and ActionScript are worth the effort to maintain a separate
regex implementation using GRegex (IMO these languages are dead enough
not to justify the extra effort).

The patch also disables tests for languages using regex parsers.

* Rename roleDesc to roleDefinition

See 1345725842c196cc0523ff60231192bcd588961b upstream. Since we don't care
about roles in Geany, we don't have to do the additional stuff the upstream
patch does.

* Add XTAG_ANONYMOUS used by jscript

See 0e4c5d4a0461bc8d9616fe3b97d75b91d014246e upstream.

* Include stdint.h in entry.h

* Don't use hash value as an Anonymous field identifier

Instead of something like "Anonymous0ab283cd9402" use sequential integer
values like "Anonymous1".

* Call anonReset in main part

See 3c91b1ea509df238feb86c9cbd552b621e462653 upstream.

* Use upstream javascript parser

* Use upstream css parser

* Create correctly sized MIO for 0 size

See https://github.com/universal-ctags/ctags/pull/1951

* Always enable promise API and subparsers for Geany

* Support subparsers in Geany and add HTML parser demonstrating this feature

This feature requires several changes:

1. Propagating language of the tag from ctags to Geany so we know whether
the tag comes from a master parser or a subparser.

2. We need to address the problem that tag types from a subparsers can
clash with tag types from master parsers or other subparsers used by the
master parser. For instance, HTML and both its css and javascript
subparsers use tm_tag_class_t but HTML uses it for <h2> headings, and
css and javascript for classes. Representing all of them using
tm_tag_class_t would lead to complete mess where all of these types would
for instance be listed in the same branch of the tree in the sidebar.

To avoid this problem, this patch adds another mapping for subparsers where
each tag type can be mapped to another tag type (which isn't used neither
by master parser or other subparsers). To avoid unwanted clashes with other
parsers, only tags explicitly mentioned in such mappings are added to tag
manager; other subparser tags are discarded.

For HTML this patch introduces mapping only for tm_tag_function_t (which
in this case maps to the same type) to mimick the previous HTML parser
behavior but other javascript and css tag types can be added this way
in the future too.

3. Since in most of the code Geany and tag manager assume that tags from
one file use the same language, subparser's tags are modified to have the
same language like the master parser.

4. HTML parser itself was copied from upstream without any modifications.
Tests were fixed as the parser now correctly ignores comments.

* Rename truncateLine field of tagEntryInfo

See 0e70b22791877322598f03ecbe3eb26a6b661001 upstream. Needed for Fortran
parser.

* Add dummy mbcs.h and trace.h

Included by javascript parser.

* Introduce an accessor to `locate' field of `Option'

See fb5ef68859f71ff2949f1d9a7cab7515f523532f upstream. Needed for Fortran.

* Add numarray.c/h

Needed by various parsers.

* Add getLanguageForFilename() and getLanguageForCommand()

See

416c5e6b8807feaec318d7f8addbb4107370c187
334e072f9d6d9954ebd3eb89bbceb252c20ae9dd

upstream. Needed for Sh parser.

* txt2tags: Fix scope separator definition and re-enable tests

* Rename rest.c to rst.c to match upstream filename

* Use upstream asciidoc and rst parsers

* Add asciidoc and rst unit tests

* Rename conf.c to iniconf.c to match upstream filename

* Add tests of conf, diff, md parsers from universal ctags

* Add more ctags unit tests

This patch adds unit tests for: nsis, docbook, haskell, haxe, abaqus, vala,
abc.

The only missing unit tests are for GLSL and Ferite parsers which
however share the implementation with the C parser and should be
reasonably well covered by other C-like language tests.

The tests were put together from various tutorials and help of the
languages in order to cover the tags these parsers generate. No guarantee
they'd compile with real parsers.

* Rename latex.c to tex.c to match upstream filename

* Rename entry points of parsers to match upstream names

* Initialize trashbox

* Add newline to the end of file
2019-04-06 12:14:30 +10:00
Andy Alt
b8cdfddf98 remove unneeded #include (tm_tag.h) (#2034)
Fixes the FIXME comment in the code.
2019-03-06 17:59:20 +10:00
Colomban Wendling
cd267de29c Merge pull request #2036 from techee/symbol_tree_vartype
Show variable type in a tooltip in symbol tree
2019-01-13 15:43:12 +01:00
Cristian Ciocaltea
6a0c2ef91c Fix stripping trailing spaces for custom file types using the DIFF lexer (#2041) 2019-01-09 18:39:54 +02:00
Jiří Techet
a2c9c22f2c Show variable type in a tooltip in symbol tree
Similarly to function prototypes, it shows the tooltip in a language
specific way.
2019-01-07 23:58:28 +01:00
Colomban Wendling
83d36f00ba Merge pull request #2032 from b4n/scintilla-rectangular-modifier-windows
Fix modifier for creating rectangular selections on Windows
2019-01-04 12:53:26 +01:00
Colomban Wendling
969e00a03f Merge pull request #2027 from geany/elextr-patch-4
Fix broken line breaking on existing lines
2019-01-02 22:42:16 +01:00
Colomban Wendling
f3a85525ae Fix escaping of infobar text against entity injection from filename
Fixes #2033.
2019-01-02 22:24:36 +01:00
Colomban Wendling
9fc709e1dc Fix modifier for creating rectangular selections on Windows
33dafac8f0713de79f04e2ebce2399fb914d6792 restored the pre-Scintilla
3.10 default on non-Windows, but also changed the Windows one.  Fix
this so the modifier keeps its historical value on Windows as well.
2019-01-02 14:10:07 +01:00
elextr
baa88de707
Fix broken line breaking on existing lines
sci_get_position_from_col() takes line number, not position of start of line.
2018-12-28 16:02:49 +10:00
Colomban Wendling
4452b365bf Merge pull request #1263 from techee/ctags_sync_main
First part of syncing with Universal-CTags.
2018-12-17 21:37:43 +01:00
Colomban Wendling
b6fe9f17ae Merge pull request #1878 from b4n/issue-1876
Various fixes reported in #1876
2018-12-16 18:55:06 +01:00
Colomban Wendling
560e559a2a Post release version bump
Say hello to Geany 1.35 "Siralt"!
2018-12-16 13:47:25 +01:00
Jason Cumbie
5f38675114 Do not report incorrect value for GeanyDocument:changed when quitting
Fix document_account_for_unsaved() so it does not alter the `changed`
flag on documents, in order for plugins to have a reliable value there
at all times.

Patch by @chrontec with small additional tidying up.

Closes #1857.
2018-12-12 20:15:53 +01:00
Colomban Wendling
23607a8bb6 Properly categorize VHDL strings 2018-12-09 11:23:07 +01:00
Colomban Wendling
33dafac8f0 Revert to previous modifier for creating rectangular selections
This is the default since forever, so don't change it on the users,
no matter what is the new default in Scintilla 3.10.0.

Fixes #2010.
2018-12-06 22:29:27 +01:00
Colomban Wendling
9cc18f9143 Merge pull request #1445 from kugel-/fix-1069
Improve goto-symbols popup
2018-12-04 22:43:18 +01:00
Colomban Wendling
8f16685d9e Fix a few signed vs unsigned comparisons 2018-12-03 22:33:59 +01:00
Thomas Martitz
724e7886de Changes for review comments
- Notably the utils_strv_{find_common_prefix,find_lcs,shorten_file_list}
  now take -1 for num to mean to compute the array length.

- utils_strv_find_common_prefix implementation simplified.

- if num == 0 is passed to the above functions the passed strv is not
  dereferenced (so could be NULL).
2018-12-03 22:33:59 +01:00
Thomas Martitz
e0a2c6277a Refactoring and review comments
- Fix lots of compiler warnings
- Fix a bug where a long base name would prevent ellipsizing the longest
  common substring
- rewrite utils_strv_shorten_file_list to be more clear (hopefully)
- use g_strlcpy
- optimize case where the longest common substring need not be searched for
2018-12-03 22:33:59 +01:00
Thomas Martitz
fb9673eb61 api: pass gtkdoc annotation parameter as-is
The array annotation has many possible parameters, this avoids having a Doxygen
command for each one.

Luckily you can define Doxygen commands multiple times with different a number
of parameters each.
2018-12-03 22:33:59 +01:00
Thomas Martitz
7fdd360b85 Fix one oops and a couple of mistakes in comments, found by review. 2018-12-03 22:33:59 +01:00
Thomas Martitz
c05837055b api: export new utils_strv_shorten_file_list() function
Since I based the algorithm of the above function on code in one of my python
plugins, I would like to remove the implementation in my plugin and call
Geany's function.
2018-12-03 22:33:59 +01:00
Thomas Martitz
b116a66862 symbols: provide a bit more path information in the goto-symbol popup.
From #1069:
> At the moment if symbols of the same name are defined in identically named
> files, it's hard to distinguish which file is which because there's no path
> in the popup.

> The popup should show part of the path until a directory where the paths
> differ so it's possible to distinguish the different files. At the same time
> there should probably be some top limit for the length of the paths as they
> can make the popup too wide.

This addresses the above by showing more of the file's paths but still try
to make it as short as possible. The file list is processed by the new
utils_strv_shorten_file_list(), as a result the popup will list files with
the common prefix stripped and the longest common sub-path ellipsized.

As a result, the file list shows enough of the path to make them unique but
still is still very short and doesn't make the dialog too wide.

Fixes #1069.
2018-12-03 21:51:01 +01:00
Thomas Martitz
4956b05d1e utils: add functions to process file name list
1) utils_strv_find_common_prefix
Locates the common prefix.

2) utils_strv_find_lcs
Finds the longest common substring.

3) utils_strv_shorten_file_list
Transforms the file list by removing the common prefix and ellipsizing
the longest common substring. This is intended to be used for fixing #1069.

Although only 3 will be used immediately, I separated the functionality, so
that the other two function can be used on their own.
2018-12-03 21:51:01 +01:00
Colomban Wendling
75094bd9c8 binreloc: Properly undef a macro before re-defining it 2018-12-02 23:14:26 +01:00
Colomban Wendling
8e6e3037ba Always show icons in the go to symbol popup
This uses a menu and is thus subject to the menu icons visibility
setting, but here it should reflect the view from the symbols list,
and thus show the icon in all cases.
2018-11-26 15:32:26 +01:00
elextr
653b06e07a
Fix line breaking with multibyte characters (#1960)
Fixes #1958 

Also replace GDK_space with ASCII space, its searching for that, not the keycode (which just happens to have the same value, lucky).
2018-11-18 19:29:54 +10:00
Colomban Wendling
939dab08e0 Process files in the order they are listed when generating a tags file 2018-11-12 11:33:58 +01:00
Colomban Wendling
fc6a9bb9cb tm: Cleanup include lookup
Don't use the files inode as the hash.  Although it looks like a good
idea for de-duplicating links as well, it has several issues, including
non-uniqueness of inodes across file systems.
The way it was done hashing the inode but comparing the file name
string pointers also made the hash mostly irrelevant, as it just stored
filenames sharing the same inode in the same hash bucket but without
actually doing any de-duplication, making the whole thing a convoluted
way of converting to a list.

Instead, hash and compare the filenames themselves, which, even though
it doesn't handle links de-duplication, is better than the
non-functional previous code.

Also, directly build the list and only use the hash table as a way for
checking for duplicates, which is both faster and gives a stable
output.
2018-11-12 10:22:29 +01:00
Jiří Techet
99e0f208b2 Merge branch 'master' into ctags_sync_main
# Conflicts:
#	ctags/main/lcpp.c
#	ctags/main/parse.c
2018-10-13 14:25:12 +02:00
Colomban Wendling
0b75601ac8 Merge pull request #1914 from b4n/scintilla/update-3-10-0
Update Scintilla to version 3.10.0

Fixes #1421.
2018-09-19 22:22:24 +02:00
Colomban Wendling
3f20ad363a Don't beep if there is no next snippet cursor
Now the keybinding can be overridden (e.g. using Tab for it as well as
normal behavior), beeping when there is no next cursor is more annoying
than useful.

Part of #1554.
2018-08-04 16:23:09 +02:00
Colomban Wendling
ea47c6c713 Update Diff styles for new Scintilla version
The new styles are for "diff of a diff", e.g. lines starting with `++`,
`+-`, `-+` and `--`.  Those are currently mapped conservatively keeping
the previous display behavior, until we have good style matches for
them.
2018-08-01 14:53:30 +02:00
Colomban Wendling
3fa7576e13 Update Scintilla to version 3.10.0
Scintilla 3.7.6/4.0.0 deprecated `SCE_*STYLEBITS*` and moved it to
deprecated features that require a build-time flag to be available.

Thus, drop use of those (as they are now no-ops anyway) and bump the
ABI (so plugins depending on those don't build mistakenly load) and API
(so a developer can guard use of those if wanted) version accordingly.
2018-08-01 14:51:52 +02:00
LarsGit223
63eaf257de keybindings: Added missing "Strip Trailing Spaces" (#1806)
Fixes #395.
2018-07-16 07:53:01 +10:00
Colomban Wendling
8cdf1d1ee8 Make a local function static 2018-06-15 23:08:54 +02:00
Colomban Wendling
99851b592a Remove unused parameter
Since 320e4b9d762e0bd7d550c62be614873db5a04ac4 the "smart line
indentation" explicitly doesn't restore cursor position, and doesn't
make use of the position parameter, which no caller really use anyway.
Remove it altogether to avoid confusion.
2018-06-15 23:06:10 +02:00
Colomban Wendling
4641ce3e9f Remove an unnecessary local variable 2018-06-15 22:37:13 +02:00
Colomban Wendling
40fc6775a3 Add a sanity check on the Save As callback
Add a defensive check to make sure to catch the unlikely but maybe
theoretically possible case where the document last document is closed
while the Save As dialog is running.
2018-06-15 22:34:57 +02:00
Deimos715
592c68b123 Update some links to HTTPS
See also b10b2a716784d7fa3fd953ebde55982c39878313 (PR #1840)

Closes #1868
2018-06-02 15:02:14 -07:00
Colomban Wendling
b778e4b56f Merge pull request #1843 from b4n/smooth-scroll-bug
Fix horizontal and page scroll on GTK3
2018-05-26 12:17:11 -04: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
Colomban Wendling
604eac9f06 Fix horizontal and page scroll on GTK3
Our custom scroll handler for horizontal (Shift+Scroll) and page
(Alt+Scroll) scroll didn't properly check the scroll direction and
assume that if it's not down it's up.  This was mostly not a problem
because the other types only were left and right scroll events, which
are a lot less common.

However, it became a lot more problematic with GTK 3.4 that introduced
"smooth scrolling", and thus a new scroll type that can happen for
events in any direction.  We then would scroll up (as we assume "not
down" is up) regardless of the actual direction of the event.

It's still not clear why we'd get smooth scroll events on X11 as no
code I can find asks for it and we generally don't get those, but
sometimes a Scintilla widget starts receiving them, leading to the bug.
On Wayland on the other hand, Scintilla asks for smooth scroll events,
so we need to have a fix for it in any case.
2018-04-24 19:19:56 -03:00
Paul Menzel
b10b2a7167 Use HTTPS URL for domain www.geany.org
Replace all occurrences with the command below.

    git grep -l 'http://www.geany.org' | xargs sed -i 's,http://www.geany.org,https://www.geany.org,g'
2018-04-23 17:11:37 +02:00
Colomban Wendling
1611e3f949 Merge pull request #1748 from kugel-/msgwin-api
Add GI-compatible msgwin_*_add()

Closes #1748.
2018-04-05 15:47:30 -04:00