From e7e0244ee5f2dc3cee896ef695efbaf9a47ac519 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 23 Apr 2000 23:02:52 +0000 Subject: Fixing problems with fold information degrading when lines inserted and removed. New notifications before inserting and deleting text. --- src/Document.cxx | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) (limited to 'src/Document.cxx') diff --git a/src/Document.cxx b/src/Document.cxx index 709deaf80..6614a7fc9 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -342,15 +342,22 @@ void Document::DeleteChars(int pos, int len) { if (enteredCount == 0) { enteredCount++; if (!cb.IsReadOnly()) { + NotifyModified( + DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, + pos, len, + 0, 0)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); const char *text = cb.DeleteChars(pos*2, len * 2); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); ModifiedAt(pos); - int modFlags = SC_MOD_DELETETEXT | SC_PERFORMED_USER; - DocModification mh(modFlags, pos, len, LinesTotal() - prevLinesTotal, text); - NotifyModified(mh); + NotifyModified( + DocModification( + SC_MOD_DELETETEXT | SC_PERFORMED_USER, + pos, len, + LinesTotal() - prevLinesTotal, text)); } enteredCount--; } @@ -365,16 +372,22 @@ void Document::InsertStyledString(int position, char *s, int insertLength) { if (enteredCount == 0) { enteredCount++; if (!cb.IsReadOnly()) { + NotifyModified( + DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, + position / 2, insertLength / 2, + 0, 0)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); const char *text = cb.InsertString(position, s, insertLength); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); ModifiedAt(position / 2); - - int modFlags = SC_MOD_INSERTTEXT | SC_PERFORMED_USER; - DocModification mh(modFlags, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text); - NotifyModified(mh); + NotifyModified( + DocModification( + SC_MOD_INSERTTEXT | SC_PERFORMED_USER, + position / 2, insertLength / 2, + LinesTotal() - prevLinesTotal, text)); } enteredCount--; } @@ -389,7 +402,15 @@ int Document::Undo() { //Platform::DebugPrintf("Steps=%d\n", steps); for (int step=0; step