SF.net SVN: geany: [1440] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Apr 6 10:49:51 UTC 2007


Revision: 1440
          http://svn.sourceforge.net/geany/?rev=1440&view=rev
Author:   ntrel
Date:     2007-04-06 03:49:51 -0700 (Fri, 06 Apr 2007)

Log Message:
-----------
Only insert a space if construct completion occurs, to prevent unusual undo history.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-04-05 12:07:46 UTC (rev 1439)
+++ trunk/ChangeLog	2007-04-06 10:49:51 UTC (rev 1440)
@@ -1,3 +1,10 @@
+2007-04-06  Nick Treleaven  <nick.treleaven at btinternet.com>
+
+ * src/sci_cb.c:
+   Only insert a space if construct completion occurs, to prevent
+   unusual undo history.
+
+
 2007-04-05  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * tagmanager/tm_workspace.c:

Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2007-04-05 12:07:46 UTC (rev 1439)
+++ trunk/src/sci_cb.c	2007-04-06 10:49:51 UTC (rev 1440)
@@ -1092,6 +1092,10 @@
 		sci_goto_pos(sci, pos + 3 + space_len + (2 * strlen(indent)), TRUE);
 	}
 	result = (construct != NULL);
+	if (result)
+	{
+		sci_insert_text(sci, pos, " ");	// prefix all constructs with a space
+	}
 	g_free(construct);
 	return result;
 }
@@ -1166,13 +1170,10 @@
 	// get the whitespace for additional indentation
 	space = utils_get_whitespace(app->pref_editor_tab_width, FALSE);
 
-	sci_insert_text(sci, pos++, " ");	// the construct matching expects a space
+	sci_start_undo_action(sci);	// needed while we insert a space separately from construct
 	result = complete_constructs(idx, pos, buf, space, eol);
-	if (! result)
-	{
-		sci_set_current_position(sci, pos, FALSE);
-		SSM(sci, SCI_DELETEBACK, 0, 0);	// cancel the space
-	}
+	sci_end_undo_action(sci);
+
 	utils_free_pointers(eol, space, NULL);
 	return result;
 }


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