340 Commits

Author SHA1 Message Date
Colomban Wendling
c30936028e When not sorting the file list, don't preserve read order
If the caller doesn't want the list to be sorted, there is no need to
preserve the order in which the files were actually read, since that
order is undefined anyway.
2012-05-31 21:58:37 +02:00
Nick Treleaven
9426104f0b Remove utils_build_path() - use g_build_filename instead 2012-02-06 16:41:18 +00:00
Nick Treleaven
e7befb410c Remove utils_make_filename() - use g_strconcat instead 2012-02-06 16:36:51 +00:00
Nick Treleaven
58164c65f0 Remove static function utils_slist_remove_next() 2012-01-26 16:10:53 +00:00
Nick Treleaven
b287553e4a Use 'SETPTR' instead of 'setptr'
This makes it clearer we're using a macro.
2012-01-25 16:26:16 +00:00
Colomban Wendling
0aea05d10d Fix various integer signedness and minor styling issues
Most noteworthy change is that all build commands IDs and groups are
now unsigned everywhere negative values aren't explicitly handled with
a special meaning.  This should not change anything in behavior, only
makes clear the index won't underflow.
2011-12-18 00:32:22 +01:00
Nick Treleaven
13597df9df Convert Unix path separators on Windows when opening documents
Unix path separators can occur e.g. when using MSYS.
Windows does not allow filenames to contain Unix path separators so
this should be safe.
2011-11-01 15:46:11 +00:00
Nick Treleaven
fdd5537cc0 Use g_return_val_if_fail for some invalid NULL arguments 2011-10-31 17:22:39 +00:00
Matthew Brush
a23e999b7b Bump GTK+ version to 2.16 2011-10-28 10:25:58 -07:00
Matthew Brush
bd5fba7eb5 Remove extra whitespace at end of lines in all source files.
* Processed with rstrip-whitespace.py script added to scripts/ directory.
* Script run on all .c and .h files in src/ and plugins/ directories.
* Also remove more than one newline at the end of files.
2011-10-11 21:52:58 -07:00
Colomban Wendling
d06e9f4575 Remove $Id$ and $Date$ SVN keywords 2011-10-09 22:57:35 +02:00
Nick Treleaven
b673f0534e Fix argument description.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5998 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-10-05 15:33:40 +00:00
Colomban Wendling
965ef1a285 Cleanup utils_strpos()
Use strstr() to find the substring, which makes the code simpler and
is way faster (new version is nearly 2 times faster on my machine).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5994 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-10-03 17:06:12 +00:00
Colomban Wendling
7ff6f6b799 Cleanup utils_remove_ext_from_filename()
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5993 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-10-03 17:05:57 +00:00
Colomban Wendling
386b32122e Avoid an unnecessary string duplication in utils_str_casecmp()
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5992 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-10-03 17:05:41 +00:00
Nick Treleaven
5b220d70a2 * Merge branches/unstable:
- tagmanager/php.c:
   Fix parsing keyword-qualified functions strictly, e.g. don't 
   parse 'staticfunction' or 'fatfunction'.
 - src/utils.c, src/utils.h, src/editor.c:
   Use GRegex for snippet indentation replacement - fixes wrong 
   behaviour with Mac line endings.
 - tagmanager/lregex.c, TODO:
   Use GRegex for CTags instead of POSIX regex - GRegex is more 
   powerful. This also fixes a (HTML) performance issue on Windows. 
   Geany will now print a debug warning when using the "b" CTags 
   regex flag option for non-extended syntax. This is not currently 
   used by Geany's parsers.
   Note: GNU regex can't be removed yet as it's still used elsewhere 
   by Geany.
 - src/build.c, doc/pluginsignals.c:
   When saving on build, prompt for a filename if necessary.
   Emit the "build-start" signal only if saving succeeds.
 - src/build.c:
   Use #ifdef SYNC_SPAWN instead of G_OS_WIN32 for easier testing with 
   glib's asynchronous spawning (which doesn't work on Windows).
 - src/win32.c, src/win32.h, src/dialogs.c:
   Use GTK unsaved file dialog on Windows too because the button names 
   should be specific.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5987 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-10-03 14:35:11 +00:00
Nick Treleaven
9ca8db635a Use GRegex for snippet indentation replacement - fixes wrong
behaviour with Mac line endings.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/unstable@5973 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-09-30 11:10:22 +00:00
Colomban Wendling
0eadc9bd7b Compute needle length only once in utils_string_replace_all()
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5966 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-09-28 19:49:45 +00:00
Colomban Wendling
a89fcc2cc4 Fix utils_string_replace_all() to accept a NULL replacement again
Support of NULL as the replacement was lost in the code refactoring
introduced by revision 5730, and it broke a few plugins.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5965 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-09-28 19:49:28 +00:00
Colomban Wendling
0ebc4ed3a6 Minor wording fix
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5923 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-09-16 14:47:27 +00:00
Colomban Wendling
4151a973dd Ask the user if spawn fails in utils_open_browser()
Ask the user to configure a valid browser command if spawning it fails
rather than falling back to some arbitrary hardcoded defaults.

This avoid spawning an unexpected browser when the configured one is
wrong, and gives the user a chance to correctly fix the preference.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5918 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-09-15 02:01:38 +00:00
Colomban Wendling
5d687aad27 Cleanup code in utils_open_browser()
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5909 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-09-11 17:06:11 +00:00
Colomban Wendling
ddb4ad5fa5 Fix some whitespace style errors
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5886 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-08-06 18:34:14 +00:00
Colomban Wendling
3bd6a01525 Fix a few signed vs. unsigned and differently-sized integer problems
Most notably, utils_get_line_endings() and document_open_file_list()
don't support -1 as the size anymore.  If the size should be computed
from null-terminated data, the caller code must take care of doing so.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5855 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-06-17 22:52:17 +00:00
Colomban Wendling
e9e3f6a8ab Remove most of the checks for GIO
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5852 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-06-17 22:51:17 +00:00
Nick Treleaven
26ddc69e5d Fix warning in utils_find_open_xml_tag() with malformed tags like
<~foo> (oops).



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5737 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-04-25 16:23:58 +00:00
Nick Treleaven
2a45938205 Add utils_find_open_xml_tag_pos() API function (patch by Eugene
Arshinov, thanks).



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5733 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-04-23 11:44:31 +00:00
Nick Treleaven
a89ba90b15 Add utils_string_find() to search in a fixed range.
Change utils_string_replace() to just replace a fixed number of
characters.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5730 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-04-19 16:36:29 +00:00
Nick Treleaven
0b2d16a41a Add function utils_string_replace() to replace in a fixed range.
Remove utils_string_replace_helper() and update cursor marker code.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5726 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-04-15 16:59:15 +00:00
Nick Treleaven
8a817e694b Make utils_build_path() return a copy for safety.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5721 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-04-13 12:59:20 +00:00
Nick Treleaven
8523592d11 Make utils_make_filename() return a copy for safety.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5709 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-04-11 14:26:51 +00:00
Colomban Wendling
7698bf60a7 Improve usage of G_(UN)?LIKELY()
G_(UN)?LIKELY() should be only used on whole conditional expressions,
and only if the branching is very highly predictable, not if it is only
more probable.

These macros should be used with care because a wrong prediction may
be a lot worst than what a good prediction can give.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5625 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-03-24 22:00:18 +00:00
Nick Treleaven
a46c2fd899 Support copying filetype definition file group keys from a system
keyfile with e.g. [styling=C].
Add function utils_make_filename() for building filenames easily.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5596 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-03-17 12:17:04 +00:00
Colomban Wendling
8e79a2255a Prefer prepend elements to lists rather than append them
This is for better performances since appending to a list means walking
it to find the last element to append to. When the list ordering
matters, simply reverse the list after prepengins.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5586 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-03-10 22:27:04 +00:00
Enrico Tröger
bf4067f910 Rename utils_is_file_writeable() into utils_is_file_writable().
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5539 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-02-06 16:47:18 +00:00
Enrico Tröger
6ac2623208 Update copyright information.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5528 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-01-19 19:39:09 +00:00
Nick Treleaven
43dc30a5d1 Merge trunk to r5519.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/unstable@5520 ea778897-0a13-0410-b9d1-a72fbfd435f5
2011-01-10 13:58:12 +00:00
Nick Treleaven
7a35566cc8 Fix detecting non-lowercase self-closing tags e.g. <BR> (#2226117).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/unstable@5494 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-12-22 13:18:26 +00:00
Nick Treleaven
66d8cbec81 Add warning for utils_write_file() that g_file_set_contents() is a better choice because it handles disk exhaustion safely.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5454 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-11-30 18:25:16 +00:00
Nick Treleaven
cba09d5e8d Check result of fclose() for utils_write_file().
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5453 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-11-30 18:18:24 +00:00
Nick Treleaven
ddefb0a0b4 Add API functions (patch by Eugene Arshinov, thanks):
Move editor.c: is_{string,comment,code}_style() functions to
highlighting.c, add to API.
Add editor_find_snippet(), editor_insert_snippet(),
utils_find_open_xml_tag() to API.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5409 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-11-16 15:07:40 +00:00
Nick Treleaven
cf6d15239e Make utils_ensure_same_eol_characters() convert all wrong line
endings to the desired one, not just the most common one.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5389 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-11-09 18:17:57 +00:00
Nick Treleaven
92d9221042 Remove trailing directory separator for app->datadir and
app->docdir for consistency with the other directory fields.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5348 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-11-01 15:17:22 +00:00
Nick Treleaven
0c689be43d Restore check for malformed XML tag from last commit.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5335 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-10-27 16:12:05 +00:00
Nick Treleaven
3c6212544c Auto-indent after an HTML/XML line with a missing closing tag (patch
by Eugene Arshinov, thanks).
Behaviour only applies if XML tag autoclosing is off.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5322 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-10-25 16:58:13 +00:00
Nick Treleaven
a366609fb0 Remove filetype default extensions from code.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5312 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-10-21 15:41:24 +00:00
Nick Treleaven
14d751dd87 Don't cache overridden lexer properties.
Add foreach_strv() to plugin API.
Add utils_strv_join().



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5280 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-10-05 11:07:10 +00:00
Enrico Tröger
befcb63e59 Ensure inserted templates always have proper line ending characters
according to the current document's preference.
This is also fixes problems with templates on Windows which had
always Unix line ending characters but now since they are read
from files, these have Windows line ending characters and had been
converted twice.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5114 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-08-01 17:20:50 +00:00
Enrico Tröger
a18f00ae62 Add utils_get_eol_char().
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5113 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-08-01 10:23:19 +00:00
Enrico Tröger
812d9cc480 Minor reformatting
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4884 ea778897-0a13-0410-b9d1-a72fbfd435f5
2010-05-08 13:10:33 +00:00