aboutsummaryrefslogtreecommitdiffhomepage
path: root/qbuffers.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-13 02:12:36 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-13 02:12:36 +0100
commitdba9cbb38fd014bdddf1aed6905ec04faeb1dcf3 (patch)
tree795040a44ec00fddb7b1a62f55cf7a4311acd56f /qbuffers.cpp
parent2365774fd5e1cfa62c88efc5837e3e92a58c9166 (diff)
downloadsciteco-dba9cbb38fd014bdddf1aed6905ec04faeb1dcf3.tar.gz
fixed undoing of setting Q-Register string
Diffstat (limited to 'qbuffers.cpp')
-rw-r--r--qbuffers.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/qbuffers.cpp b/qbuffers.cpp
index a2fed34..3421d39 100644
--- a/qbuffers.cpp
+++ b/qbuffers.cpp
@@ -33,6 +33,7 @@ QRegisterTable qregisters;
static QRegister *register_argument = NULL;
+/* FIXME: clean up current_save_dot() usage */
static inline void
current_save_dot(void)
{
@@ -56,7 +57,6 @@ current_edit(void)
void
QRegister::set_string(const gchar *str)
{
- current_save_dot();
edit();
dot = 0;
@@ -67,6 +67,21 @@ QRegister::set_string(const gchar *str)
current_edit();
}
+void
+QRegister::undo_set_string(void)
+{
+ current_save_dot();
+ if (ring.current)
+ ring.current->undo_edit();
+ else if (qregisters.current)
+ qregisters.current->undo_edit();
+
+ undo.push_var<gint>(dot);
+ undo.push_msg(SCI_UNDO);
+
+ undo_edit();
+}
+
gchar *
QRegister::get_string(void)
{
@@ -361,8 +376,7 @@ StateSetQRegString::done(const gchar *str)
{
BEGIN_EXEC(&States::start);
- undo.push_var<gint>(register_argument->dot);
- undo.push_msg(SCI_UNDO);
+ register_argument->undo_set_string();
register_argument->set_string(str);
return &States::start;
@@ -461,8 +475,7 @@ StateCopyToQReg::got_register(QRegister *reg)
tr.lpstrText = (char *)g_malloc(len + 1);
editor_msg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
- undo.push_var<gint>(reg->dot);
- undo.push_msg(SCI_UNDO);
+ reg->undo_set_string();
reg->set_string(tr.lpstrText);
g_free(tr.lpstrText);