SF.net SVN: geany:[5608] trunk
colombanw at users.sourceforge.net
colombanw at xxxxx
Sat Mar 19 22:48:44 UTC 2011
Revision: 5608
http://geany.svn.sourceforge.net/geany/?rev=5608&view=rev
Author: colombanw
Date: 2011-03-19 22:48:43 +0000 (Sat, 19 Mar 2011)
Log Message:
-----------
Create a new undo action when inserting templates
This makes sure the user can undo the template insertion without also
undoing a previous action.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/callbacks.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-03-18 15:57:15 UTC (rev 5607)
+++ trunk/ChangeLog 2011-03-19 22:48:43 UTC (rev 5608)
@@ -1,3 +1,10 @@
+2011-03-19 Colomban Wendling <colomban(at)geany(dot)org>
+
+ * src/callbacks.c:
+ Create a new undo action when inserting templates, making sure the user
+ can undo the template insertion without also undoing a previous action.
+
+
2011-03-18 Colomban Wendling <colomban(at)geany(dot)org>
* src/document.c, src/encodings.c, src/encodings.h:
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2011-03-18 15:57:15 UTC (rev 5607)
+++ trunk/src/callbacks.c 2011-03-19 22:48:43 UTC (rev 5608)
@@ -1299,7 +1299,9 @@
text = templates_get_template_function(doc, cur_tag);
+ sci_start_undo_action(doc->editor->sci);
sci_insert_text(doc->editor->sci, pos, text);
+ sci_end_undo_action(doc->editor->sci);
g_free(text);
}
@@ -1339,7 +1341,9 @@
verify_click_pos(doc); /* make sure that the click_pos is valid */
+ sci_start_undo_action(doc->editor->sci);
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
+ sci_end_undo_action(doc->editor->sci);
g_free(text);
}
@@ -1358,7 +1362,9 @@
verify_click_pos(doc); /* make sure that the click_pos is valid */
+ sci_start_undo_action(doc->editor->sci);
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
+ sci_end_undo_action(doc->editor->sci);
g_free(text);
}
@@ -1374,10 +1380,12 @@
g_return_if_fail(doc != NULL);
text = templates_get_template_changelog(doc);
+ sci_start_undo_action(doc->editor->sci);
sci_insert_text(doc->editor->sci, 0, text);
/* sets the cursor to the right position to type the changelog text,
* the template has 21 chars + length of name and email */
sci_goto_pos(doc->editor->sci, 21 + strlen(template_prefs.developer) + strlen(template_prefs.mail), TRUE);
+ sci_end_undo_action(doc->editor->sci);
g_free(text);
}
@@ -1398,8 +1406,10 @@
fname = doc->file_name;
text = templates_get_template_fileheader(FILETYPE_ID(ft), fname);
+ sci_start_undo_action(doc->editor->sci);
sci_insert_text(doc->editor->sci, 0, text);
sci_goto_pos(doc->editor->sci, 0, FALSE);
+ sci_end_undo_action(doc->editor->sci);
g_free(text);
}
@@ -1451,8 +1461,10 @@
{
verify_click_pos(doc); /* make sure that the click_pos is valid */
+ sci_start_undo_action(doc->editor->sci);
sci_insert_text(doc->editor->sci, editor_info.click_pos, time_str);
sci_goto_pos(doc->editor->sci, editor_info.click_pos + strlen(time_str), FALSE);
+ sci_end_undo_action(doc->editor->sci);
g_free(time_str);
}
else
@@ -1487,7 +1499,9 @@
text = g_strconcat("#include <", user_data, ">\n", NULL);
}
+ sci_start_undo_action(doc->editor->sci);
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
+ sci_end_undo_action(doc->editor->sci);
g_free(text);
if (pos >= 0)
sci_goto_pos(doc->editor->sci, pos, FALSE);
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