From 9be9fcca0c9ab63180a2e9aeb64e25829034b7a4 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 18 Nov 2012 01:05:37 +0100 Subject: avoid using Scintilla's SAVEPOINT mechanism altogether: fixes some destructive commands * the only thing gained from (partially) using that mechanism is that no explicit calls to set the dirty-status of a buffer are necessary * however it had many disadvantages: * setting the buffer clean had to be done manually anyway (see previous commits) * when changing Q-Registers without affecting the current document, a flag had to be used to prevent setting the current document dirty * last but not least, it introduced a dependency on the order of the destructive operation and its UNDO token. * the UNDO token could trigger a SAVEPOINTLEFT notification resulting in additional rubout tokens to be pushed on the stack which screws the rubout stack. this can be avoided by clever ordering of the operations * using an explicit ring.dirtify() is therefore much better --- parser.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'parser.cpp') diff --git a/parser.cpp b/parser.cpp index ea3a9a9..1abd440 100644 --- a/parser.cpp +++ b/parser.cpp @@ -415,6 +415,8 @@ StateStart::delete_words(gint64 n) undo.push_msg(SCI_GOTOPOS, pos); undo.push_msg(SCI_UNDO); + ring.dirtify(); + return SUCCESS; } @@ -804,6 +806,7 @@ StateStart::custom(gchar chr) throw (Error) interface.ssm(SCI_BEGINUNDOACTION); interface.ssm(SCI_DELETERANGE, from, len); interface.ssm(SCI_ENDUNDOACTION); + ring.dirtify(); break; } @@ -1110,6 +1113,7 @@ StateInsert::initial(void) throw (Error) expressions.pop_num_calc(); interface.ssm(SCI_SCROLLCARET); interface.ssm(SCI_ENDUNDOACTION); + ring.dirtify(); undo.push_msg(SCI_UNDO); } @@ -1122,6 +1126,7 @@ StateInsert::process(const gchar *str, gint new_chars) throw (Error) (sptr_t)(str + strlen(str) - new_chars)); interface.ssm(SCI_SCROLLCARET); interface.ssm(SCI_ENDUNDOACTION); + ring.dirtify(); undo.push_msg(SCI_UNDO); } -- cgit v1.2.3