diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-18 01:05:37 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-18 01:05:37 +0100 |
commit | 9be9fcca0c9ab63180a2e9aeb64e25829034b7a4 (patch) | |
tree | 94cd667c59f75551921e988bdfd1edbaa4a3d946 /main.cpp | |
parent | ed6d0bdbf4b69061dd5db69d823c2ee39b98dcdd (diff) | |
download | sciteco-9be9fcca0c9ab63180a2e9aeb64e25829034b7a4.tar.gz |
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
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
@@ -47,30 +47,9 @@ Interface::stdio_vmsg(MessageType type, const gchar *fmt, va_list ap) void Interface::process_notify(SCNotification *notify) { - switch (notify->nmhdr.code) { #ifdef DEBUG - case SCN_SAVEPOINTREACHED: - g_printf("SCINTILLA SAVEPOINT REACHED\n"); - break; -#endif - case SCN_SAVEPOINTLEFT: -#ifdef DEBUG - g_printf("SCINTILLA SAVEPOINT LEFT\n"); + g_printf("SCINTILLA NOTIFY: code=%d\n", notify->nmhdr.code); #endif - - if (!dirty_check_enabled || - !ring.current || ring.current->dirty) - break; - - undo.push_msg(SCI_SETSAVEPOINT); - undo_info_update(ring.current); - undo.push_var(ring.current->dirty); - ring.current->dirty = true; - info_update(ring.current); - break; - default: - break; - } } static inline void |