SF.net SVN: geany:[4847] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Wed Apr 21 17:19:27 UTC 2010
Revision: 4847
http://geany.svn.sourceforge.net/geany/?rev=4847&view=rev
Author: ntrel
Date: 2010-04-21 17:19:27 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Support {ob} and {cb} wildcards for snippets too (fixes #2937008).
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/geany.html
trunk/doc/geany.txt
trunk/src/editor.c
trunk/src/templates.c
trunk/src/templates.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-04-21 17:16:27 UTC (rev 4846)
+++ trunk/ChangeLog 2010-04-21 17:19:27 UTC (rev 4847)
@@ -3,12 +3,15 @@
* src/templates.c, doc/geany.txt, doc/geany.html:
Support {ob} and {cb} in fileheader and file templates; they are
replaced last with { and }. This allows 'escaping' of wildcard
- strings (fixes #2937008).
+ strings.
* src/editor.c, plugins/classbuilder.c:
Fix Class Builder plugin to use correct indentation instead of
always tabs.
Make editor_insert_text_block() only replace leading tabs for the
'Tabs' indent type; also group edits for undo.
+ * src/templates.c, src/templates.h, src/editor.c, doc/geany.txt,
+ doc/geany.html:
+ Support {ob} and {cb} wildcards for snippets too (fixes #2937008).
2010-04-19 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html 2010-04-21 17:16:27 UTC (rev 4846)
+++ trunk/doc/geany.html 2010-04-21 17:19:27 UTC (rev 4847)
@@ -4889,11 +4889,11 @@
<tr><td>ob</td>
<td>Opening Brace (used to prevent other
wildcards being expanded).</td>
-<td>file templates, file header.</td>
+<td>file templates, file header, snippets.</td>
</tr>
<tr><td>cb</td>
<td>Closing Brace.</td>
-<td>file templates, file header.</td>
+<td>file templates, file header, snippets.</td>
</tr>
<tr><td>developer</td>
<td>The name of the developer.</td>
@@ -5996,7 +5996,7 @@
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2010-04-21 16:56 UTC.
+Generated on: 2010-04-21 17:17 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt 2010-04-21 17:16:27 UTC (rev 4846)
+++ trunk/doc/geany.txt 2010-04-21 17:19:27 UTC (rev 4847)
@@ -4230,9 +4230,9 @@
============== ============================================= =======================================
Wildcard Description Available in
============== ============================================= =======================================
-ob Opening Brace (used to prevent other file templates, file header.
+ob Opening Brace (used to prevent other file templates, file header, snippets.
wildcards being expanded).
-cb Closing Brace. file templates, file header.
+cb Closing Brace. file templates, file header, snippets.
developer The name of the developer. file templates, file header,
function description, ChangeLog entry,
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2010-04-21 17:16:27 UTC (rev 4846)
+++ trunk/src/editor.c 2010-04-21 17:19:27 UTC (rev 4847)
@@ -2081,19 +2081,6 @@
}
-static void snippets_replace_wildcards(GeanyEditor *editor, GString *text)
-{
- const gchar *file_name = DOC_FILENAME(editor->document);
- gchar *basename = g_path_get_basename(file_name);
-
- templates_replace_default_dates(text);
- templates_replace_valist(text, "{filename}", basename, NULL);
- templates_replace_command(text, file_name, editor->document->file_type->name, NULL);
-
- g_free(basename);
-}
-
-
/* this only works with spaces only indentation on the lines */
static void fix_line_indents(GeanyEditor *editor, gint line_start, gint line_end)
{
@@ -2289,7 +2276,7 @@
}
/* replace any %template% wildcards */
- snippets_replace_wildcards(editor, pattern);
+ templates_replace_common(pattern, editor->document->file_name, editor->document->file_type, NULL);
/* transform other wildcards */
/* convert to %newlines%, else we get endless loops */
Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c 2010-04-21 17:16:27 UTC (rev 4846)
+++ trunk/src/templates.c 2010-04-21 17:19:27 UTC (rev 4847)
@@ -128,6 +128,11 @@
static void replace_static_values(GString *text);
static gchar *get_template_fileheader(GeanyFiletype *ft);
+static void templates_replace_default_dates(GString *text);
+static void templates_replace_valist(GString *text,
+ const gchar *first_wildcard, ...) G_GNUC_NULL_TERMINATED;
+static void templates_replace_command(GString *text, const gchar *file_name,
+ const gchar *file_type, const gchar *func_name);
/* some simple macros to reduce code size and make the code readable */
@@ -285,8 +290,8 @@
}
-static void templates_replace_common(GString *template, const gchar *fname,
- GeanyFiletype *ft, const gchar *func_name)
+void templates_replace_common(GString *template, const gchar *fname,
+ GeanyFiletype *ft, const gchar *func_name)
{
gchar *shortname;
@@ -718,7 +723,7 @@
* "{another_wildcard}", "another value", NULL);
*
* The argument list must be terminated with NULL. */
-void templates_replace_valist(GString *text, const gchar *first_wildcard, ...)
+static void templates_replace_valist(GString *text, const gchar *first_wildcard, ...)
{
va_list args;
const gchar *key, *value;
@@ -745,7 +750,7 @@
}
-void templates_replace_default_dates(GString *text)
+static void templates_replace_default_dates(GString *text)
{
gchar *year = utils_get_date_time(template_prefs.year_format, NULL);
gchar *date = utils_get_date_time(template_prefs.date_format, NULL);
@@ -797,7 +802,7 @@
}
-void templates_replace_command(GString *text, const gchar *file_name,
+static void templates_replace_command(GString *text, const gchar *file_name,
const gchar *file_type, const gchar *func_name)
{
gchar *match = NULL;
Modified: trunk/src/templates.h
===================================================================
--- trunk/src/templates.h 2010-04-21 17:16:27 UTC (rev 4846)
+++ trunk/src/templates.h 2010-04-21 17:19:27 UTC (rev 4847)
@@ -72,13 +72,9 @@
gchar *templates_get_template_licence(GeanyDocument *doc, gint licence_type);
-void templates_replace_default_dates(GString *text);
+void templates_replace_common(GString *template, const gchar *fname,
+ GeanyFiletype *ft, const gchar *func_name);
-void templates_replace_valist(GString *text, const gchar *first_wildcard, ...) G_GNUC_NULL_TERMINATED;
-
-void templates_replace_command(GString *text, const gchar *file_name,
- const gchar *file_type, const gchar *func_name);
-
void templates_free_templates(void);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list