From eedb6a42a13adea87288e3eb13cd8f8f92e58ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Thu, 14 Jun 2007 15:47:09 +0000 Subject: [PATCH] Avoid creation of unwanted undo action when opening a saved-as file in a new tab. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1617 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 6 ++++++ src/callbacks.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4de602f7b..d6eb5b8b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-06-14 Enrico Tröger + + * src/callbacks.c: Avoid creation of unwanted undo action when opening + a saved-as file in a new tab. + + 2007-06-14 Nick Treleaven * src/templates.c, src/interface.c, src/templates.h, src/tools.c, diff --git a/src/callbacks.c b/src/callbacks.c index 9d36bb058..b7d862028 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -878,6 +878,9 @@ on_file_save_dialog_response (GtkDialog *dialog, // use old file type (or maybe NULL for auto detect would be better?) idx = document_new_file(utf8_filename, doc_list[idx].file_type); + sci_set_undo_collection(doc_list[idx].sci, FALSE); // avoid creation of an undo action + sci_empty_undo_buffer(doc_list[idx].sci); + len = sci_get_length(doc_list[old_idx].sci) + 1; data = (gchar*) g_malloc(len); sci_get_text(doc_list[old_idx].sci, len, data); @@ -891,6 +894,7 @@ on_file_save_dialog_response (GtkDialog *dialog, document_set_encoding(idx, doc_list[old_idx].encoding); sci_set_lines_wrapped(doc_list[idx].sci, doc_list[idx].line_breaking); sci_set_readonly(doc_list[idx].sci, doc_list[idx].readonly); + sci_set_undo_collection(doc_list[idx].sci, TRUE); ui_document_show_hide(idx);