Skip to content

Commit

Permalink
jcore: refactor undo code from JStyledText to JUndoRedoChain
Browse files Browse the repository at this point in the history
  • Loading branch information
jafl committed Dec 30, 2023
1 parent 38d9742 commit 6bd1557
Show file tree
Hide file tree
Showing 18 changed files with 633 additions and 619 deletions.
3 changes: 2 additions & 1 deletion libjcore/Make.files
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
.cpp ./code/JSTStyler
.cpp ./code/JSpellChecker
.cpp ./code/jTextUtil
.cpp ./code/JUndo
.cpp ./code/JUndoRedoChain
.cpp ./code/jNew
.cpp ./code/JMemoryManager
.cpp ./code/JMMArrayTable
Expand All @@ -135,7 +137,6 @@
.cpp ./code/jSysUtil_UNIX
.cpp ./code/jTime
.cpp ./code/jTime_UNIX
.cpp ./code/JUndo
.cpp ./code/jVCSUtil
.cpp ./code/JWebBrowser
.cpp ./code/jWebUtil
Expand Down
6 changes: 4 additions & 2 deletions libjcore/code/JCoreLibVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ static const char* kCurrentJCoreLibVersionStr = "4.1.0";

// version 4.1.0:
//
// YOU MUST FULLY UPGRADE TO VERSION 4.0.0 BEFORE UPGRADING TO 4.1.0 BECAUSE:
// YOU SHOULD FULLY UPGRADE TO VERSION 4.0.0 BEFORE UPGRADING TO 4.1.0 TO CATCH
// ALL HARD-CODED STRINGS BECAUSE:
// JString:
// Removed "explicit" from JString(const JUtf8Byte*, const Copy)
// and made the default kNoCopy.
Expand All @@ -47,7 +48,8 @@ static const char* kCurrentJCoreLibVersionStr = "4.1.0";
// JList, JHashTable, etc:
// *** Renamed "element" to "item"
// JRegex:
// Made constructors explicit and added optional flags argument.
// *** Made constructors explicit and added optional flags argument.
// Refactored JUndoRedoChain out of JStyledText.

// version 4.0.0:
// *** Upgraded to C++20
Expand Down
3 changes: 2 additions & 1 deletion libjcore/code/JSTUndoStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
******************************************************************************/

#include "JSTUndoStyle.h"
#include "JUndoRedoChain.h"
#include "jAssert.h"

/******************************************************************************
Expand Down Expand Up @@ -58,7 +59,7 @@ JSTUndoStyle::Undo()

const JStyledText::TextRange r = itsRange;

text->ReplaceUndo(this, newUndo); // deletes us
text->GetUndoRedoChain()->ReplaceUndo(this, newUndo); // deletes us

// NO instance variables past this point; we have been deleted

Expand Down
3 changes: 2 additions & 1 deletion libjcore/code/JSTUndoTextBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "JSTUndoTextBase.h"
#include "JSTUndoPaste.h"
#include "JUndoRedoChain.h"
#include "jAssert.h"

/******************************************************************************
Expand Down Expand Up @@ -70,7 +71,7 @@ JSTUndoTextBase::UndoText

newUndo->SetCount(pasteCount);

text->ReplaceUndo(this, newUndo); // deletes us
text->GetUndoRedoChain()->ReplaceUndo(this, newUndo); // deletes us

// NO instance variables past this point; we have been deleted

Expand Down
Loading

0 comments on commit 6bd1557

Please sign in to comment.