SF.net SVN: geany: [667] trunk/src/sci_cb.c

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Aug 3 14:08:14 UTC 2006


Revision: 667
Author:   ntrel
Date:     2006-08-03 07:08:10 -0700 (Thu, 03 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=667&view=rev

Log Message:
-----------
Use common on_new_line_added for CR or LF added

Modified Paths:
--------------
    trunk/src/sci_cb.c
Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2006-08-03 13:27:30 UTC (rev 666)
+++ trunk/src/sci_cb.c	2006-08-03 14:08:10 UTC (rev 667)
@@ -35,8 +35,10 @@
 static gchar indent[100];
 
 
+static void on_new_line_added(ScintillaObject *sci, gint idx);
+
+
 // callback func called by all editors when a signal arises
-
 void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer user_data)
 {
 	struct SCNotification *nt;
@@ -129,29 +131,13 @@
 			{
 				case '\r':
 				{	// simple indentation (only for CR format)
-					if (doc_list[idx].use_auto_indention && (sci_get_eol_mode(sci) == SC_EOL_CR))
-					{
-						sci_cb_get_indent(sci, pos, FALSE);
-						sci_add_text(sci, indent);
-					}
-					// " * " auto completion in multiline C/C++ comments
 					if (sci_get_eol_mode(sci) == SC_EOL_CR)
-					{
-						sci_cb_auto_multiline(sci, pos);
-						if (app->pref_editor_auto_complete_constructs) sci_cb_auto_latex(sci, pos, idx);
-					}
+						on_new_line_added(sci, idx);
 					break;
 				}
 				case '\n':
 				{	// simple indentation (for CR/LF and LF format)
-					if (doc_list[idx].use_auto_indention)
-					{
-						sci_cb_get_indent(sci, pos, FALSE);
-						sci_add_text(sci, indent);
-					}
-					// " * " auto completion in multiline C/C++ comments
-					sci_cb_auto_multiline(sci, pos);
-					if (app->pref_editor_auto_complete_constructs) sci_cb_auto_latex(sci, pos, idx);
+					on_new_line_added(sci, idx);
 					break;
 				}
 				case '>':
@@ -250,6 +236,22 @@
 }
 
 
+static void on_new_line_added(ScintillaObject *sci, gint idx)
+{
+	gint pos = sci_get_current_position(sci);
+
+	// simple indentation
+	if (doc_list[idx].use_auto_indention)
+	{
+		sci_cb_get_indent(sci, pos, FALSE);
+		sci_add_text(sci, indent);
+	}
+	// " * " auto completion in multiline C/C++ comments
+	sci_cb_auto_multiline(sci, pos);
+	if (app->pref_editor_auto_complete_constructs) sci_cb_auto_latex(sci, pos, idx);
+}
+
+
 void sci_cb_get_indent(ScintillaObject *sci, gint pos, gboolean use_this_line)
 {
 	// very simple indentation algorithm


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