Revision: 4812 http://geany.svn.sourceforge.net/geany/?rev=4812&view=rev Author: ntrel Date: 2010-04-09 12:09:16 +0000 (Fri, 09 Apr 2010)
Log Message: ----------- Fix inserting snippets with an indent when using Mac CR line endings.
Modified Paths: -------------- trunk/ChangeLog trunk/src/editor.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-04-08 16:26:36 UTC (rev 4811) +++ trunk/ChangeLog 2010-04-09 12:09:16 UTC (rev 4812) @@ -1,3 +1,10 @@ +2010-04-09 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/editor.c: + Fix inserting snippets with an indent when using Mac CR line + endings. + + 2010-04-08 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/editor.c:
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2010-04-08 16:26:36 UTC (rev 4811) +++ trunk/src/editor.c 2010-04-09 12:09:16 UTC (rev 4812) @@ -2121,6 +2121,7 @@ gchar *whitespace; GString *buf; const gchar cur_marker[] = "__GEANY_CURSOR_MARKER__"; + const gchar *eol = editor_get_eol_char(editor);
g_return_if_fail(text); g_return_if_fail(editor != NULL); @@ -2131,8 +2132,6 @@ if (cursor_index >= 0) g_string_insert(buf, cursor_index, cur_marker); /* remember cursor pos */
- /* Add line indents (in spaces) */ - if (newline_indent_size == -1) { /* count indent size up to insert_pos instead of asking sci @@ -2144,17 +2143,18 @@ g_free(tmp); }
+ /* Add line indents (in spaces) */ if (newline_indent_size > 0) { whitespace = g_strnfill(newline_indent_size, ' '); - setptr(whitespace, g_strconcat("\n", whitespace, NULL)); - utils_string_replace_all(buf, "\n", whitespace); + setptr(whitespace, g_strconcat(eol, whitespace, NULL)); + utils_string_replace_all(buf, eol, whitespace); g_free(whitespace); }
/* transform line endings */ if (replace_newlines) - utils_string_replace_all(buf, "\n", editor_get_eol_char(editor)); + utils_string_replace_all(buf, "\n", eol);
/* transform tabs into indent widths (in spaces) */ whitespace = g_strnfill(editor_get_indent_prefs(editor)->width, ' ');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.