SF.net SVN: geany:[3387] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Tue Dec 16 16:27:17 UTC 2008
Revision: 3387
http://geany.svn.sourceforge.net/geany/?rev=3387&view=rev
Author: ntrel
Date: 2008-12-16 16:27:17 +0000 (Tue, 16 Dec 2008)
Log Message:
-----------
Move %ws and %newline% replacement into snippets-only code.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-12-16 13:38:10 UTC (rev 3386)
+++ trunk/ChangeLog 2008-12-16 16:27:17 UTC (rev 3387)
@@ -13,6 +13,8 @@
* src/search.c:
Set Find in Files directory entry to project base path or current
working directory if the current file has no path.
+ * src/editor.c:
+ Move %ws and %newline% replacement into snippets-only code.
2008-12-15 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-12-16 13:38:10 UTC (rev 3386)
+++ trunk/src/editor.c 2008-12-16 16:27:17 UTC (rev 3387)
@@ -1789,7 +1789,6 @@
* NOT any hard tabs (you get those when copying document text with the Tabs
* & Spaces indent mode set).
* @note This doesn't scroll the cursor in view afterwards. */
-/* note: %ws% and %newline% are just for snippets, they probably shouldn't be here :-/ */
static void editor_insert_text_block(GeanyEditor *editor, const gchar *text, gint insert_pos,
gint cursor_index, gint newline_indent_size)
{
@@ -1822,12 +1821,10 @@
/* transform line endings */
utils_string_replace_all(buf, "\n", editor_get_eol_char(editor));
- utils_string_replace_all(buf, "%newline%", editor_get_eol_char(editor));
/* transform tabs into indent widths (in spaces) */
whitespace = g_strnfill(editor_get_indent_prefs(editor)->width, ' ');
utils_string_replace_all(buf, "\t", whitespace);
- utils_string_replace_all(buf, "%ws%", whitespace);
g_free(whitespace);
if (cursor_index >= 0)
@@ -1852,7 +1849,7 @@
static gboolean snippets_complete_constructs(GeanyEditor *editor, gint pos, const gchar *word)
{
- gchar *str;
+ gchar *str, *whitespace;
GString *pattern;
gint step, str_len;
gsize cur_index;
@@ -1892,6 +1889,14 @@
/* replace any %template% wildcards */
snippets_replace_wildcards(editor, pattern);
+ /* transform other wildcards */
+ utils_string_replace_all(pattern, "%newline%", editor_get_eol_char(editor));
+
+ /* use spaces for indentation, will be fixed up */
+ whitespace = g_strnfill(editor_get_indent_prefs(editor)->width, ' ');
+ utils_string_replace_all(pattern, "%ws%", whitespace);
+ g_free(whitespace);
+
/* find the %cursor% pos (has to be done after all other operations) */
step = utils_strpos(pattern->str, "%cursor%");
if (step != -1)
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