SF.net SVN: geany:[5959] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Sep 26 16:31:32 UTC 2011


Revision: 5959
          http://geany.svn.sourceforge.net/geany/?rev=5959&view=rev
Author:   ntrel
Date:     2011-09-26 16:31:32 +0000 (Mon, 26 Sep 2011)
Log Message:
-----------
Fix not indenting snippet contents for documents with non-\n line 
endings.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/editor.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-09-26 16:18:36 UTC (rev 5958)
+++ trunk/ChangeLog	2011-09-26 16:31:32 UTC (rev 5959)
@@ -2,6 +2,9 @@
 
  * src/editor.c:
    Fix not converting \n to document line endings in snippets.
+ * src/editor.c:
+   Fix not indenting snippet contents for documents with non-\n line 
+   endings.
 
 
 2011-09-22  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2011-09-26 16:18:36 UTC (rev 5958)
+++ trunk/src/editor.c	2011-09-26 16:31:32 UTC (rev 5959)
@@ -2375,7 +2375,6 @@
 {
 	ScintillaObject *sci = editor->sci;
 	gint line_start = sci_get_line_from_position(sci, insert_pos);
-	gchar *whitespace;
 	GString *buf;
 	const gchar *eol = editor_get_eol_char(editor);
 	gint idx;
@@ -2404,9 +2403,12 @@
 	/* Add line indents (in spaces) */
 	if (newline_indent_size > 0)
 	{
+		const gchar *nl = replace_newlines ? "\n" : eol;
+		gchar *whitespace;
+		
 		whitespace = g_strnfill(newline_indent_size, ' ');
-		setptr(whitespace, g_strconcat(eol, whitespace, NULL));
-		utils_string_replace_all(buf, eol, whitespace);
+		setptr(whitespace, g_strconcat(nl, whitespace, NULL));
+		utils_string_replace_all(buf, nl, whitespace);
 		g_free(whitespace);
 	}
 

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