diff options
Diffstat (limited to 'src/Editor.cxx')
| -rw-r--r-- | src/Editor.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 2b4e55bc1..f059a8243 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -58,11 +58,13 @@ using namespace Scintilla; +namespace { + /* return whether this modification represents an operation that may reasonably be deferred (not done now OR [possibly] at all) */ -static bool CanDeferToLastStep(const DocModification &mh) noexcept { +bool CanDeferToLastStep(const DocModification &mh) noexcept { if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) return true; // CAN skip if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) @@ -72,7 +74,7 @@ static bool CanDeferToLastStep(const DocModification &mh) noexcept { return false; // PRESUMABLY must do } -static bool CanEliminate(const DocModification &mh) noexcept { +constexpr bool CanEliminate(const DocModification &mh) noexcept { return (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; } @@ -81,7 +83,7 @@ static bool CanEliminate(const DocModification &mh) noexcept { return whether this modification represents the FINAL step in a [possibly lengthy] multi-step Undo/Redo sequence */ -static bool IsLastStep(const DocModification &mh) noexcept { +constexpr bool IsLastStep(const DocModification &mh) noexcept { return (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 @@ -89,13 +91,15 @@ static bool IsLastStep(const DocModification &mh) noexcept { && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; } +} + Timer::Timer() noexcept : ticking(false), ticksToWait(0), tickerID{} {} Idler::Idler() noexcept : state(false), idlerID(0) {} -static inline bool IsAllSpacesOrTabs(const char *s, unsigned int len) noexcept { +static bool IsAllSpacesOrTabs(const char *s, unsigned int len) noexcept { for (unsigned int i = 0; i < len; i++) { // This is safe because IsSpaceOrTab() will return false for null terminators if (!IsSpaceOrTab(s[i])) @@ -2520,8 +2524,10 @@ void Editor::CheckModificationForWrap(DocModification mh) { } } +namespace { + // Move a position so it is still after the same character as before the insertion. -static inline Sci::Position MovePositionForInsertion(Sci::Position position, Sci::Position startInsertion, Sci::Position length) noexcept { +Sci::Position MovePositionForInsertion(Sci::Position position, Sci::Position startInsertion, Sci::Position length) noexcept { if (position > startInsertion) { return position + length; } @@ -2530,7 +2536,7 @@ static inline Sci::Position MovePositionForInsertion(Sci::Position position, Sci // Move a position so it is still after the same character as before the deletion if that // character is still present else after the previous surviving character. -static inline Sci::Position MovePositionForDeletion(Sci::Position position, Sci::Position startDeletion, Sci::Position length) noexcept { +Sci::Position MovePositionForDeletion(Sci::Position position, Sci::Position startDeletion, Sci::Position length) noexcept { if (position > startDeletion) { const Sci::Position endDeletion = startDeletion + length; if (position > endDeletion) { @@ -2543,6 +2549,8 @@ static inline Sci::Position MovePositionForDeletion(Sci::Position position, Sci: } } +} + void Editor::NotifyModified(Document *, DocModification mh, void *) { ContainerNeedsUpdate(SC_UPDATE_CONTENT); if (paintState == painting) { |
