diff options
Diffstat (limited to 'src/Editor.cxx')
| -rw-r--r-- | src/Editor.cxx | 26 | 
1 files changed, 17 insertions, 9 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index b68643c8f..9821b1195 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 { +constexpr 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 constexpr 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])) @@ -2523,8 +2527,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 { +constexpr Sci::Position MovePositionForInsertion(Sci::Position position, Sci::Position startInsertion, Sci::Position length) noexcept {  	if (position > startInsertion) {  		return position + length;  	} @@ -2533,7 +2539,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 { +constexpr 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) { @@ -2546,6 +2552,8 @@ static inline Sci::Position MovePositionForDeletion(Sci::Position position, Sci:  	}  } +} +  void Editor::NotifyModified(Document *, DocModification mh, void *) {  	ContainerNeedsUpdate(SC_UPDATE_CONTENT);  	if (paintState == painting) { @@ -3234,7 +3242,7 @@ constexpr short LowShortFromWParam(uptr_t x) {  	return static_cast<short>(x & 0xffff);  } -unsigned int WithExtends(unsigned int iMessage) noexcept { +constexpr unsigned int WithExtends(unsigned int iMessage) noexcept {  	switch (iMessage) {  	case SCI_CHARLEFT: return SCI_CHARLEFTEXTEND;  	case SCI_CHARRIGHT: return SCI_CHARRIGHTEXTEND; @@ -3261,7 +3269,7 @@ unsigned int WithExtends(unsigned int iMessage) noexcept {  	}  } -int NaturalDirection(unsigned int iMessage) noexcept { +constexpr int NaturalDirection(unsigned int iMessage) noexcept {  	switch (iMessage) {  	case SCI_CHARLEFT:  	case SCI_CHARLEFTEXTEND: @@ -3292,7 +3300,7 @@ int NaturalDirection(unsigned int iMessage) noexcept {  	}  } -bool IsRectExtend(unsigned int iMessage, bool isRectMoveExtends) noexcept { +constexpr bool IsRectExtend(unsigned int iMessage, bool isRectMoveExtends) noexcept {  	switch (iMessage) {  	case SCI_CHARLEFTRECTEXTEND:  	case SCI_CHARRIGHTRECTEXTEND: | 
