From 39a5feaf8c080de9e35350b079f47f3914f8b77d Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 17 Nov 2012 00:34:54 +0100 Subject: fixed rubout for loading Q-Registers (with files) this is very similar to setting a string --- qbuffers.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'qbuffers.cpp') diff --git a/qbuffers.cpp b/qbuffers.cpp index 878194c..09888a4 100644 --- a/qbuffers.cpp +++ b/qbuffers.cpp @@ -113,14 +113,13 @@ QRegister::load(const gchar *filename) gchar *contents; gsize size; - current_save_dot(); - edit(); - dot = 0; - /* FIXME: prevent excessive allocations by reading file into buffer */ if (!g_file_get_contents(filename, &contents, &size, NULL)) return false; + edit(); + dot = 0; + interface.ssm(SCI_BEGINUNDOACTION); interface.ssm(SCI_CLEARALL); interface.ssm(SCI_APPENDTEXT, size, (sptr_t)contents); @@ -577,9 +576,10 @@ StateLoadQReg::done(const gchar *str) throw (Error) BEGIN_EXEC(&States::start); if (*str) { - undo.push_var(register_argument->dot); - undo.push_msg(SCI_UNDO); - register_argument->load(str); + register_argument->undo_load(); + if (!register_argument->load(str)) + throw Error("Cannot load \"%s\" into Q-Register \"%s\"", + str, register_argument->name); } else { if (ring.current) ring.undo_edit(); -- cgit v1.2.3