diff options
Diffstat (limited to 'qbuffers.cpp')
-rw-r--r-- | qbuffers.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/qbuffers.cpp b/qbuffers.cpp index cbeee0b..1647ef3 100644 --- a/qbuffers.cpp +++ b/qbuffers.cpp @@ -38,13 +38,6 @@ namespace States { Ring ring; QRegisterTable qregisters; -/* - * Can be used to temporarily disable SCN_SAVEPOINTLEFT processing since - * a Q-Register may be modified without changing the logical current - * document and we don't want the wrong file to get modified. - */ -bool dirty_check_enabled = true; - static QRegister *register_argument = NULL; /* FIXME: clean up current_save_dot() usage */ @@ -74,11 +67,9 @@ QRegister::set_string(const gchar *str) edit(); dot = 0; - dirty_check_enabled = false; interface.ssm(SCI_BEGINUNDOACTION); interface.ssm(SCI_SETTEXT, 0, (sptr_t)(str ? : "")); interface.ssm(SCI_ENDUNDOACTION); - dirty_check_enabled = true; current_edit(); } @@ -129,12 +120,10 @@ QRegister::load(const gchar *filename) edit(); dot = 0; - dirty_check_enabled = false; interface.ssm(SCI_BEGINUNDOACTION); interface.ssm(SCI_CLEARALL); interface.ssm(SCI_APPENDTEXT, size, (sptr_t)contents); interface.ssm(SCI_ENDUNDOACTION); - dirty_check_enabled = true; g_free(contents); @@ -187,10 +176,12 @@ Buffer::load(const gchar *filename) g_free(contents); - interface.ssm(SCI_SETSAVEPOINT); + /* NOTE: currently buffer cannot be dirty */ +#if 0 interface.undo_info_update(this); undo.push_var(dirty); dirty = false; +#endif set_filename(filename); @@ -241,6 +232,18 @@ Ring::find(const gchar *filename) return cur; } +void +Ring::dirtify(void) +{ + if (!current || current->dirty) + return; + + interface.undo_info_update(current); + undo.push_var(current->dirty); + current->dirty = true; + interface.info_update(current); +} + bool Ring::is_any_dirty(void) { @@ -423,7 +426,6 @@ Ring::save(const gchar *filename) if (!g_file_set_contents(filename, buffer, size, NULL)) return false; - interface.ssm(SCI_SETSAVEPOINT); interface.undo_info_update(current); undo.push_var(current->dirty); current->dirty = false; |