diff options
author | Neil <nyamatongwe@gmail.com> | 2025-03-06 11:18:50 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-03-06 11:18:50 +1100 |
commit | 102fa1d501808187235f93670591d5b9d1253778 (patch) | |
tree | 9b66d840ad8ac1ed8580743afa5673b8e335ef82 /src/Editor.cxx | |
parent | 00838f369d7ca189b498f70c8c446ccc64cc0e2f (diff) | |
download | scintilla-mirror-102fa1d501808187235f93670591d5b9d1253778.tar.gz |
Move static functions and variables into unnamed namespace and use constexpr.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index a696cb7e0..1557ce75e 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -106,15 +106,7 @@ constexpr bool IsLastStep(const DocModification &mh) noexcept { && ((mh.modificationType & finalMask) == finalMask); } -} - -Timer::Timer() noexcept : - ticking(false), ticksToWait(0), tickerID{} {} - -Idler::Idler() noexcept : - state(false), idlerID(nullptr) {} - -static constexpr bool IsAllSpacesOrTabs(std::string_view sv) noexcept { +constexpr bool IsAllSpacesOrTabs(std::string_view sv) noexcept { for (const char ch : sv) { // This is safe because IsSpaceOrTab() will return false for null terminators if (!IsSpaceOrTab(ch)) @@ -123,6 +115,14 @@ static constexpr bool IsAllSpacesOrTabs(std::string_view sv) noexcept { return true; } +} + +Timer::Timer() noexcept : + ticking(false), ticksToWait(0), tickerID{} {} + +Idler::Idler() noexcept : + state(false), idlerID(nullptr) {} + Editor::Editor() : durationWrapOneByte(0.000001, 0.00000001, 0.00001) { ctrlID = 0; @@ -4402,7 +4402,9 @@ void Editor::GoToLine(Sci::Line lineNo) { EnsureCaretVisible(); } -static bool Close(Point pt1, Point pt2, Point threshold) noexcept { +namespace { + +bool Close(Point pt1, Point pt2, Point threshold) noexcept { const Point ptDifference = pt2 - pt1; if (std::abs(ptDifference.x) > threshold.x) return false; @@ -4411,6 +4413,12 @@ static bool Close(Point pt1, Point pt2, Point threshold) noexcept { return true; } +constexpr bool AllowVirtualSpace(VirtualSpace virtualSpaceOptions, bool rectangular) noexcept { + return FlagSet(virtualSpaceOptions, (rectangular ? VirtualSpace::RectangularSelection : VirtualSpace::UserAccessible)); +} + +} + std::string Editor::RangeText(Sci::Position start, Sci::Position end) const { if (start < end) { const Sci::Position len = end - start; @@ -4756,10 +4764,6 @@ void Editor::MouseLeave() { } } -static constexpr bool AllowVirtualSpace(VirtualSpace virtualSpaceOptions, bool rectangular) noexcept { - return FlagSet(virtualSpaceOptions, (rectangular ? VirtualSpace::RectangularSelection : VirtualSpace::UserAccessible)); -} - void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, KeyMod modifiers) { SetHoverIndicatorPoint(pt); //Platform::DebugPrintf("ButtonDown %d %d = %d alt=%d %d\n", curTime, lastClickTime, curTime - lastClickTime, alt, inDragDrop); |