SF.net SVN: geany:[3945] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Jul 9 14:20:22 UTC 2009


Revision: 3945
          http://geany.svn.sourceforge.net/geany/?rev=3945&view=rev
Author:   ntrel
Date:     2009-07-09 14:20:22 +0000 (Thu, 09 Jul 2009)

Log Message:
-----------
Support 'tab indents, space aligns' style for auto-indentation
(closes #2789109).

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-07-09 13:51:37 UTC (rev 3944)
+++ trunk/ChangeLog	2009-07-09 14:20:22 UTC (rev 3945)
@@ -12,6 +12,9 @@
    Fix using GtkMessageType instead of gint param for
    dialogs_show_msgbox*().
    Add missing G_GNUC_PRINTF macro check to API dialog funcs.
+ * src/editor.c:
+   Support 'tab indents, space aligns' style for auto-indentation
+   (closes #2789109).
 
 
 2009-07-08  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2009-07-09 13:51:37 UTC (rev 3944)
+++ trunk/src/editor.c	2009-07-09 14:20:22 UTC (rev 3945)
@@ -1136,17 +1136,28 @@
 static void insert_indent_after_line(GeanyEditor *editor, gint line)
 {
 	ScintillaObject *sci = editor->sci;
+	gint line_indent = sci_get_line_indentation(sci, line);
 	gint size = get_indent_size_after_line(editor, line);
 	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
+	gchar *text;
 
-	if (size > 0)
+	if (size == 0)
+		return;
+
+	if (iprefs->type == GEANY_INDENT_TYPE_TABS && size == line_indent)
 	{
-		gchar *text;
+		/* support tab indents, space aligns style - copy last line 'indent' exactly */
+		gint start = sci_get_position_from_line(sci, line);
+		gint end = sci_get_line_indent_position(sci, line);
 
+		text = sci_get_contents_range(sci, start, end);
+	}
+	else
+	{
 		text = get_whitespace(iprefs, size);
-		sci_add_text(sci, text);
-		g_free(text);
 	}
+	sci_add_text(sci, text);
+	g_free(text);
 }
 
 


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