diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index 638d11a13..8ae558198 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -551,6 +551,9 @@ including line numbers.
  • + SciTE can read settings in EditorConfig format when enabled with editor.config.enable property. +
  • +
  • Set the last X chosen when SCI_REPLACESEL called to ensure macros work when text insertion followed by caret up or down.
  • diff --git a/scintilla/src/CallTip.h b/scintilla/src/CallTip.h index 9c00a777d..a37138d5f 100644 --- a/scintilla/src/CallTip.h +++ b/scintilla/src/CallTip.h @@ -53,7 +53,9 @@ public: CallTip(); // Deleted so CallTip objects can not be copied. CallTip(const CallTip &) = delete; + CallTip(CallTip &&) = delete; CallTip &operator=(const CallTip &) = delete; + CallTip &operator=(CallTip &&) = delete; ~CallTip(); void PaintCT(Surface *surfaceWindow); diff --git a/scintilla/src/CellBuffer.cxx b/scintilla/src/CellBuffer.cxx index 893938f2f..f1ac548cc 100644 --- a/scintilla/src/CellBuffer.cxx +++ b/scintilla/src/CellBuffer.cxx @@ -53,6 +53,11 @@ public: LineVector() : starts(256), perLine(0) { Init(); } + // Deleted so LineVector objects can not be copied. + LineVector(const LineVector &) = delete; + LineVector(LineVector &&) = delete; + LineVector &operator=(const LineVector &) = delete; + LineVector &operator=(LineVector &&) = delete; ~LineVector() override { } void Init() override { diff --git a/scintilla/src/CellBuffer.h b/scintilla/src/CellBuffer.h index 7b34d996d..ae99bcf83 100644 --- a/scintilla/src/CellBuffer.h +++ b/scintilla/src/CellBuffer.h @@ -68,7 +68,9 @@ public: UndoHistory(); // Deleted so UndoHistory objects can not be copied. UndoHistory(const UndoHistory &) = delete; + UndoHistory(UndoHistory &&) = delete; void operator=(const UndoHistory &) = delete; + void operator=(UndoHistory &&) = delete; ~UndoHistory(); const char *AppendAction(actionType at, Sci::Position position, const char *data, Sci::Position lengthData, bool &startSequence, bool mayCoalesce=true); diff --git a/scintilla/src/EditModel.h b/scintilla/src/EditModel.h index eae18cacf..7ad719c12 100644 --- a/scintilla/src/EditModel.h +++ b/scintilla/src/EditModel.h @@ -54,8 +54,10 @@ public: EditModel(); // Deleted so EditModel objects can not be copied. - explicit EditModel(const EditModel &) = delete; + EditModel(const EditModel &) = delete; + EditModel(EditModel &&) = delete; EditModel &operator=(const EditModel &) = delete; + EditModel &operator=(EditModel &&) = delete; virtual ~EditModel(); virtual Sci::Line TopLineOfMain() const = 0; virtual Point GetVisibleOriginInMain() const = 0; diff --git a/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx index 97a971cd3..51bd0f634 100644 --- a/scintilla/src/EditView.cxx +++ b/scintilla/src/EditView.cxx @@ -186,8 +186,8 @@ EditView::EditView() { llc.SetLevel(LineLayoutCache::llcCaret); posCache.SetSize(0x400); tabArrowHeight = 4; - customDrawTabArrow = NULL; - customDrawWrapMarker = NULL; + customDrawTabArrow = nullptr; + customDrawWrapMarker = nullptr; } EditView::~EditView() { @@ -638,23 +638,6 @@ Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, Sci:: return rangeSubLine; } -#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH - -XYPOSITION EditView::EndSpaceWidth(const EditModel &model, const ViewStyle &vs, LineLayout *ll, Sci::Line line) { - int styleEnd = ll->EndLineStyle(); - const bool bracesIgnoreStyle = ((vs.braceHighlightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACELIGHT)) || - (vs.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD))); - if (!bracesIgnoreStyle) { - const Sci::Position lineLastCharacter = static_cast(model.pdoc->LineEnd(line)) - 1; - if ((lineLastCharacter == model.braces[0]) || (lineLastCharacter == model.braces[1])) { - styleEnd = model.bracesMatchStyle; - } - } - return vs.styles[styleEnd].spaceWidth; -} -#endif - - SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, bool charPosition, bool virtualSpace, const ViewStyle &vs) { pt.x = pt.x - vs.textStart; Sci::Line visibleLine = static_cast(floor(pt.y / vs.lineHeight)); @@ -683,11 +666,7 @@ SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditMo return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1)); } if (virtualSpace) { -#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH - const XYPOSITION spaceWidth = EndSpaceWidth(model,vs,ll,lineDoc); -#else const XYPOSITION spaceWidth = vs.styles[ll->EndLineStyle()].spaceWidth; -#endif const int spaceOffset = static_cast( (pt.x + subLineStart - ll->positions[rangeSubLine.end] + spaceWidth / 2) / spaceWidth); return SelectionPosition(rangeSubLine.end + posLineStart, spaceOffset); @@ -721,11 +700,7 @@ SelectionPosition EditView::SPositionFromLineX(Surface *surface, const EditModel if (positionInLine < rangeSubLine.end) { return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1)); } -#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH - const XYPOSITION spaceWidth = EndSpaceWidth(model,vs,ll,lineDoc); -#else const XYPOSITION spaceWidth = vs.styles[ll->EndLineStyle()].spaceWidth; -#endif const int spaceOffset = static_cast( (x + subLineStart - ll->positions[rangeSubLine.end] + spaceWidth / 2) / spaceWidth); return SelectionPosition(rangeSubLine.end + posLineStart, spaceOffset); @@ -1032,7 +1007,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle rcPlace.right = rcLine.right; rcPlace.left = rcPlace.right - vsDraw.aveCharWidth; } - if (customDrawWrapMarker == NULL) { + if (!customDrawWrapMarker) { DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour()); } else { customDrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour()); @@ -1452,7 +1427,7 @@ static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, c else rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; - if (customDrawWrapMarker == NULL) { + if (!customDrawWrapMarker) { DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour()); } else { customDrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour()); @@ -1738,10 +1713,11 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi surface->PenColour(textFore); const PRectangle rcTab(rcSegment.left + 1, rcSegment.top + tabArrowHeight, rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent); - if (customDrawTabArrow == NULL) - DrawTabArrow(surface, rcTab, static_cast(rcSegment.top + vsDraw.lineHeight / 2), vsDraw); + const int segmentTop = static_cast(rcSegment.top + vsDraw.lineHeight / 2); + if (!customDrawTabArrow) + DrawTabArrow(surface, rcTab, segmentTop, vsDraw); else - customDrawTabArrow(surface, rcTab, static_cast(rcSegment.top + vsDraw.lineHeight / 2)); + customDrawTabArrow(surface, rcTab, segmentTop); } } } else { diff --git a/scintilla/src/EditView.h b/scintilla/src/EditView.h index 8b6c8d56c..ac42f072b 100644 --- a/scintilla/src/EditView.h +++ b/scintilla/src/EditView.h @@ -10,8 +10,6 @@ namespace Scintilla { -#undef NP3_MATCH_BRACE_RECT_SEL_PATCH - struct PrintParameters { int magnification; int colourMode; @@ -94,7 +92,9 @@ public: EditView(); // Deleted so EditView objects can not be copied. EditView(const EditView &) = delete; + EditView(EditView &&) = delete; void operator=(const EditView &) = delete; + void operator=(EditView &&) = delete; virtual ~EditView(); bool SetTwoPhaseDraw(bool twoPhaseDraw); @@ -119,9 +119,6 @@ public: Point LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, Sci::Line topLine, const ViewStyle &vs, PointEnd pe); Range RangeDisplayLine(Surface *surface, const EditModel &model, Sci::Line lineVisible, const ViewStyle &vs); -#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH - XYPOSITION EndSpaceWidth(const EditModel &model, const ViewStyle &vs, LineLayout *ll, Sci::Line line); -#endif SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, bool charPosition, bool virtualSpace, const ViewStyle &vs); SelectionPosition SPositionFromLineX(Surface *surface, const EditModel &model, Sci::Line lineDoc, int x, const ViewStyle &vs); @@ -164,8 +161,10 @@ class AutoLineLayout { LineLayout *ll; public: AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) : llc(llc_), ll(ll_) {} - explicit AutoLineLayout(const AutoLineLayout &) = delete; + AutoLineLayout(const AutoLineLayout &) = delete; + AutoLineLayout(AutoLineLayout &&) = delete; AutoLineLayout &operator=(const AutoLineLayout &) = delete; + AutoLineLayout &operator=(AutoLineLayout &&) = delete; ~AutoLineLayout() { llc.Dispose(ll); ll = 0; diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 04d05b195..467969390 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -5167,9 +5167,6 @@ void Editor::SetBraceHighlight(Sci::Position pos0, Sci::Position pos1, int match Redraw(); } } -#ifdef NP3_MATCH_BRACE_RECT_SEL_PATCH - SetRectangularRange(); -#endif } void Editor::SetAnnotationHeights(Sci::Line start, Sci::Line end) { diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index 9b7a28989..4ed6c89fc 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -256,8 +256,10 @@ protected: // ScintillaBase subclass needs access to much of Editor Editor(); // Deleted so Editor objects can not be copied. - explicit Editor(const Editor &) = delete; + Editor(const Editor &) = delete; + Editor(Editor &&) = delete; Editor &operator=(const Editor &) = delete; + Editor &operator=(Editor &&) = delete; ~Editor() override; virtual void Initialise() = 0; virtual void Finalise(); diff --git a/scintilla/src/MarginView.cxx b/scintilla/src/MarginView.cxx index 09f1b636d..2b40b10bc 100644 --- a/scintilla/src/MarginView.cxx +++ b/scintilla/src/MarginView.cxx @@ -100,7 +100,7 @@ void DrawWrapMarker(Surface *surface, PRectangle rcPlace, MarginView::MarginView() { wrapMarkerPaddingRight = 3; - customDrawWrapMarker = NULL; + customDrawWrapMarker = nullptr; } void MarginView::DropGraphics(bool freeObjects) { @@ -398,7 +398,7 @@ void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcWrapMarker = rcMarker; rcWrapMarker.right -= wrapMarkerPaddingRight; rcWrapMarker.left = rcWrapMarker.right - vs.styles[STYLE_LINENUMBER].aveCharWidth; - if (customDrawWrapMarker == NULL) { + if (!customDrawWrapMarker) { DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore); } else { customDrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore); diff --git a/scintilla/src/PerLine.h b/scintilla/src/PerLine.h index c75a83f65..ad9f9ee75 100644 --- a/scintilla/src/PerLine.h +++ b/scintilla/src/PerLine.h @@ -30,7 +30,9 @@ public: MarkerHandleSet(); // Deleted so MarkerHandleSet objects can not be copied. MarkerHandleSet(const MarkerHandleSet &) = delete; + MarkerHandleSet(MarkerHandleSet &&) = delete; void operator=(const MarkerHandleSet &) = delete; + void operator=(MarkerHandleSet &&) = delete; ~MarkerHandleSet(); bool Empty() const noexcept; int MarkValue() const noexcept; ///< Bit set of marker numbers. @@ -72,9 +74,11 @@ class LineLevels : public PerLine { public: LineLevels() { } - // Deleted so Worker objects can not be copied. + // Deleted so LineLevels objects can not be copied. LineLevels(const LineLevels &) = delete; + LineLevels(LineLevels &&) = delete; void operator=(const LineLevels &) = delete; + void operator=(LineLevels &&) = delete; ~LineLevels() override; void Init() override; void InsertLine(Sci::Line line) override; @@ -93,7 +97,9 @@ public: } // Deleted so Worker objects can not be copied. LineState(const LineState &) = delete; + LineState(LineState &&) = delete; void operator=(const LineState &) = delete; + void operator=(LineState &&) = delete; ~LineState() override; void Init() override; void InsertLine(Sci::Line line) override; @@ -111,7 +117,9 @@ public: } // Deleted so Worker objects can not be copied. LineAnnotation(const LineAnnotation &) = delete; + LineAnnotation(LineAnnotation &&) = delete; void operator=(const LineAnnotation &) = delete; + void operator=(LineAnnotation &&) = delete; ~LineAnnotation() override; void Init() override; void InsertLine(Sci::Line line) override; @@ -138,7 +146,9 @@ public: } // Deleted so Worker objects can not be copied. LineTabstops(const LineTabstops &) = delete; + LineTabstops(LineTabstops &&) = delete; void operator=(const LineTabstops &) = delete; + void operator=(LineTabstops &&) = delete; ~LineTabstops() override; void Init() override; void InsertLine(Sci::Line line) override; diff --git a/scintilla/src/PositionCache.h b/scintilla/src/PositionCache.h index fcbb1cdf7..c294edebd 100644 --- a/scintilla/src/PositionCache.h +++ b/scintilla/src/PositionCache.h @@ -77,7 +77,9 @@ public: explicit LineLayout(int maxLineLength_); // Deleted so LineLayout objects can not be copied. LineLayout(const LineLayout &) = delete; + LineLayout(LineLayout &&) = delete; void operator=(const LineLayout &) = delete; + void operator=(LineLayout &&) = delete; virtual ~LineLayout(); void Resize(int maxLineLength_); void Free(); @@ -110,7 +112,9 @@ public: LineLayoutCache(); // Deleted so LineLayoutCache objects can not be copied. LineLayoutCache(const LineLayoutCache &) = delete; + LineLayoutCache(LineLayoutCache &&) = delete; void operator=(const LineLayoutCache &) = delete; + void operator=(LineLayoutCache &&) = delete; virtual ~LineLayoutCache(); void Deallocate(); enum { @@ -137,7 +141,9 @@ public: // Copy constructor not currently used, but needed for being element in std::vector. PositionCacheEntry(const PositionCacheEntry &); // Deleted so PositionCacheEntry objects can not be assigned. + PositionCacheEntry(PositionCacheEntry &&) = delete; void operator=(const PositionCacheEntry &) = delete; + void operator=(PositionCacheEntry &&) = delete; ~PositionCacheEntry(); void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock_); void Clear(); @@ -204,7 +210,9 @@ public: int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); // Deleted so BreakFinder objects can not be copied. BreakFinder(const BreakFinder &) = delete; + BreakFinder(BreakFinder &&) = delete; void operator=(const BreakFinder &) = delete; + void operator=(BreakFinder &&) = delete; ~BreakFinder(); TextSegment Next(); bool More() const; @@ -218,7 +226,9 @@ public: PositionCache(); // Deleted so PositionCache objects can not be copied. PositionCache(const PositionCache &) = delete; + PositionCache(PositionCache &&) = delete; void operator=(const PositionCache &) = delete; + void operator=(PositionCache &&) = delete; ~PositionCache(); void Clear(); void SetSize(size_t size_); diff --git a/scintilla/src/ScintillaBase.cxx b/scintilla/src/ScintillaBase.cxx index 9c4e8cf78..9855c1638 100644 --- a/scintilla/src/ScintillaBase.cxx +++ b/scintilla/src/ScintillaBase.cxx @@ -553,6 +553,11 @@ public: int lexLanguage; explicit LexState(Document *pdoc_); + // Deleted so LexState objects can not be copied. + LexState(const LexState &) = delete; + LexState(LexState &&) = delete; + LexState &operator=(const LexState &) = delete; + LexState &operator=(LexState &&) = delete; ~LexState() override; void SetLexer(uptr_t wParam); void SetLexerLanguage(const char *languageName); diff --git a/scintilla/src/ScintillaBase.h b/scintilla/src/ScintillaBase.h index 202098129..e886f22e2 100644 --- a/scintilla/src/ScintillaBase.h +++ b/scintilla/src/ScintillaBase.h @@ -53,8 +53,10 @@ protected: ScintillaBase(); // Deleted so ScintillaBase objects can not be copied. - explicit ScintillaBase(const ScintillaBase &) = delete; + ScintillaBase(const ScintillaBase &) = delete; + ScintillaBase(ScintillaBase &&) = delete; ScintillaBase &operator=(const ScintillaBase &) = delete; + ScintillaBase &operator=(ScintillaBase &&) = delete; ~ScintillaBase() override; void Initialise() override {} void Finalise() override; diff --git a/scintilla/src/SparseVector.h b/scintilla/src/SparseVector.h index 0667e54c4..2d3e9cfae 100644 --- a/scintilla/src/SparseVector.h +++ b/scintilla/src/SparseVector.h @@ -18,9 +18,6 @@ private: std::unique_ptr> starts; std::unique_ptr> values; T empty; - // Deleted so SparseVector objects can not be copied. - SparseVector(const SparseVector &) = delete; - void operator=(const SparseVector &) = delete; void ClearValue(Sci::Position partition) { values->SetValueAt(partition, T()); } @@ -30,6 +27,11 @@ public: values = std::make_unique>(); values->InsertEmpty(0, 2); } + // Deleted so SparseVector objects can not be copied. + SparseVector(const SparseVector &) = delete; + SparseVector(SparseVector &&) = delete; + void operator=(const SparseVector &) = delete; + void operator=(SparseVector &&) = delete; ~SparseVector() { starts.reset(); // starts dead here but not used by ClearValue. diff --git a/scintilla/src/Style.cxx b/scintilla/src/Style.cxx index cf61eb222..40586b916 100644 --- a/scintilla/src/Style.cxx +++ b/scintilla/src/Style.cxx @@ -60,10 +60,10 @@ bool FontSpecification::operator<(const FontSpecification &other) const { } FontMeasurements::FontMeasurements() { - Clear(); + ClearMeasurements(); } -void FontMeasurements::Clear() { +void FontMeasurements::ClearMeasurements() { ascent = 1; descent = 1; capitalHeight = 1; @@ -140,7 +140,7 @@ void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_, changeable = changeable_; hotspot = hotspot_; font.ClearFont(); - FontMeasurements::Clear(); + FontMeasurements::ClearMeasurements(); } void Style::ClearTo(const Style &source) { diff --git a/scintilla/src/Style.h b/scintilla/src/Style.h index e119bc65e..58cc3cd82 100644 --- a/scintilla/src/Style.h +++ b/scintilla/src/Style.h @@ -34,8 +34,10 @@ class FontAlias : public Font { public: FontAlias(); // FontAlias objects can not be assigned except for initialization - FontAlias &operator=(const FontAlias &) = delete; FontAlias(const FontAlias &); + FontAlias(FontAlias &&) = delete; + FontAlias &operator=(const FontAlias &) = delete; + FontAlias &operator=(FontAlias &&) = delete; ~FontAlias() override; void MakeAlias(Font &fontOrigin); void ClearFont(); @@ -49,7 +51,7 @@ struct FontMeasurements { XYPOSITION spaceWidth; int sizeZoomed; FontMeasurements(); - void Clear(); + void ClearMeasurements(); }; /** @@ -70,8 +72,10 @@ public: Style(); Style(const Style &source); + Style(Style &&) = delete; ~Style(); Style &operator=(const Style &source); + Style &operator=(Style &&) = delete; void Clear(ColourDesired fore_, ColourDesired back_, int size_, const char *fontName_, int characterSet_, diff --git a/scintilla/src/UniConversion.cxx b/scintilla/src/UniConversion.cxx index c17e85d3a..7aed2e7f4 100644 --- a/scintilla/src/UniConversion.cxx +++ b/scintilla/src/UniConversion.cxx @@ -105,9 +105,8 @@ constexpr unsigned char TrailByteValue(unsigned char c) { size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen) { size_t ui = 0; - const unsigned char *us = reinterpret_cast(s); for (size_t i = 0; i < len;) { - unsigned char ch = us[i]; + unsigned char ch = s[i]; const unsigned int byteCount = UTF8BytesOfLead[ch]; unsigned int value; @@ -132,26 +131,26 @@ size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen) { break; case 2: value = (ch & 0x1F) << 6; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch); tbuf[ui] = static_cast(value); break; case 3: value = (ch & 0xF) << 12; - ch = us[i++]; + ch = s[i++]; value += (TrailByteValue(ch) << 6); - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch); tbuf[ui] = static_cast(value); break; default: // Outside the BMP so need two surrogates value = (ch & 0x7) << 18; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch) << 12; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch) << 6; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch); tbuf[ui] = static_cast(((value - 0x10000) >> 10) + SURROGATE_LEAD_FIRST); ui++; @@ -165,9 +164,8 @@ size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen) { size_t UTF32FromUTF8(const char *s, size_t len, unsigned int *tbuf, size_t tlen) { size_t ui = 0; - const unsigned char *us = reinterpret_cast(s); for (size_t i = 0; i < len;) { - unsigned char ch = us[i]; + unsigned char ch = s[i]; const unsigned int byteCount = UTF8BytesOfLead[ch]; unsigned int value; @@ -191,23 +189,23 @@ size_t UTF32FromUTF8(const char *s, size_t len, unsigned int *tbuf, size_t tlen) break; case 2: value = (ch & 0x1F) << 6; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch); break; case 3: value = (ch & 0xF) << 12; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch) << 6; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch); break; default: value = (ch & 0x7) << 18; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch) << 12; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch) << 6; - ch = us[i++]; + ch = s[i++]; value += TrailByteValue(ch); break; } @@ -253,14 +251,14 @@ const unsigned char UTF8BytesOfLead[256] = { // the non-characters *FFFE, *FFFF and FDD0 .. FDEF return 3 or 4 as they can be // reasonably treated as code points in some circumstances. They will, however, // not have associated glyphs. -int UTF8Classify(const unsigned char *us, int len) noexcept { +int UTF8Classify(const unsigned char *us, size_t len) noexcept { // For the rules: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 if (us[0] < 0x80) { // ASCII return 1; } - const int byteCount = UTF8BytesOfLead[us[0]]; + const size_t byteCount = UTF8BytesOfLead[us[0]]; if (byteCount == 1 || byteCount > len) { // Invalid lead byte return UTF8MaskInvalid | 1; @@ -332,19 +330,19 @@ int UTF8DrawBytes(const unsigned char *us, int len) noexcept { // Replace invalid bytes in UTF-8 with the replacement character std::string FixInvalidUTF8(const std::string &text) { std::string result; - const unsigned char *us = reinterpret_cast(text.c_str()); + const char *s = text.c_str(); size_t remaining = text.size(); while (remaining > 0) { - const int utf8Status = UTF8Classify(us, static_cast(remaining)); + const int utf8Status = UTF8Classify(reinterpret_cast(s), remaining); if (utf8Status & UTF8MaskInvalid) { // Replacement character 0xFFFD = UTF8:"efbfbd". result.append("\xef\xbf\xbd"); - us++; + s++; remaining--; } else { - const int len = utf8Status&UTF8MaskWidth; - result.append(reinterpret_cast(us), len); - us += len; + const size_t len = utf8Status & UTF8MaskWidth; + result.append(s, len); + s += len; remaining -= len; } } diff --git a/scintilla/src/UniConversion.h b/scintilla/src/UniConversion.h index bece53f4d..4cdfe1fac 100644 --- a/scintilla/src/UniConversion.h +++ b/scintilla/src/UniConversion.h @@ -47,7 +47,7 @@ inline bool UTF8IsAscii(int ch) noexcept { } enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 }; -int UTF8Classify(const unsigned char *us, int len) noexcept; +int UTF8Classify(const unsigned char *us, size_t len) noexcept; // Similar to UTF8Classify but returns a length of 1 for invalid bytes // instead of setting the invalid flag diff --git a/scintilla/src/ViewStyle.h b/scintilla/src/ViewStyle.h index c2e052e03..2a4e7329a 100644 --- a/scintilla/src/ViewStyle.h +++ b/scintilla/src/ViewStyle.h @@ -32,7 +32,9 @@ public: FontNames(); // FontNames objects can not be copied. FontNames(const FontNames &) = delete; + FontNames(FontNames &&) = delete; FontNames &operator=(const FontNames &) = delete; + FontNames &operator=(FontNames &&) = delete; ~FontNames(); void Clear(); const char *Save(const char *name); @@ -44,7 +46,9 @@ public: FontRealised(); // FontRealised objects can not be copied. FontRealised(const FontRealised &) = delete; + FontRealised(FontRealised &&) = delete; FontRealised &operator=(const FontRealised &) = delete; + FontRealised &operator=(FontRealised &&) = delete; virtual ~FontRealised(); void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs); }; @@ -174,8 +178,10 @@ public: ViewStyle(); ViewStyle(const ViewStyle &source); + ViewStyle(ViewStyle &&) = delete; // Can only be copied through copy constructor which ensures font names initialised correctly ViewStyle &operator=(const ViewStyle &) = delete; + ViewStyle &operator=(ViewStyle &&) = delete; ~ViewStyle(); void CalculateMarginWidthAndMask(); void Init(size_t stylesSize_=256); diff --git a/scintilla/src/XPM.h b/scintilla/src/XPM.h index 2af0ae84e..92deb9e8a 100644 --- a/scintilla/src/XPM.h +++ b/scintilla/src/XPM.h @@ -25,6 +25,10 @@ class XPM { public: explicit XPM(const char *textForm); explicit XPM(const char *const *linesForm); + XPM(const XPM &) = delete; + XPM(XPM &&) = delete; + XPM &operator=(const XPM &) = delete; + XPM &operator=(XPM &&) = delete; ~XPM(); void Init(const char *textForm); void Init(const char *const *linesForm); @@ -50,7 +54,9 @@ public: explicit RGBAImage(const XPM &xpm); // Deleted so RGBAImage objects can not be copied. RGBAImage(const RGBAImage &) = delete; + RGBAImage(RGBAImage &&) = delete; RGBAImage &operator=(const RGBAImage &) = delete; + RGBAImage &operator=(RGBAImage &&) = delete; virtual ~RGBAImage(); int GetHeight() const { return height; } int GetWidth() const { return width; } @@ -72,6 +78,11 @@ class RGBAImageSet { mutable int width; ///< Memorize largest width of the set. public: RGBAImageSet(); + // Deleted so RGBAImageSet objects can not be copied. + RGBAImageSet(const RGBAImageSet &) = delete; + RGBAImageSet(RGBAImageSet &&) = delete; + RGBAImageSet &operator=(const RGBAImageSet &) = delete; + RGBAImageSet &operator=(RGBAImageSet &&) = delete; ~RGBAImageSet(); /// Remove all images. void Clear(); diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index ec215bb38..374ee9fd3 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -857,10 +857,10 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig if (rc.Width() > 0) { HDC hMemDC = ::CreateCompatibleDC(hdc); if (rc.Width() > width) - rc.left += static_cast((rc.Width() - width) / 2); + rc.left += floor((rc.Width() - width) / 2); rc.right = rc.left + width; if (rc.Height() > height) - rc.top += static_cast((rc.Height() - height) / 2); + rc.top += floor((rc.Height() - height) / 2); rc.bottom = rc.top + height; const BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0}, @@ -1472,10 +1472,10 @@ void SurfaceD2D::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) { if (pRenderTarget) { if (rc.Width() > width) - rc.left += static_cast((rc.Width() - width) / 2); + rc.left += floor((rc.Width() - width) / 2); rc.right = rc.left + width; if (rc.Height() > height) - rc.top += static_cast((rc.Height() - height) / 2); + rc.top += floor((rc.Height() - height) / 2); rc.bottom = rc.top + height; std::vector image(height * width * 4); diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index 89b74e544..3cfb63172 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -131,7 +131,6 @@ #define SCS_SETRECONVERTSTRING 0x00010000 #endif -typedef BOOL (WINAPI *TrackMouseEventSig)(LPTRACKMOUSEEVENT); typedef UINT_PTR (WINAPI *SetCoalescableTimerSig)(HWND hwnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, ULONG uToleranceDelay); @@ -217,6 +216,11 @@ public: IMContext(HWND hwnd_) : hwnd(hwnd_), hIMC(::ImmGetContext(hwnd_)) { } + // Deleted so IMContext objects can not be copied. + IMContext(const IMContext &) = delete; + IMContext(IMContext &&) = delete; + IMContext &operator=(const IMContext &) = delete; + IMContext &operator=(IMContext &&) = delete; ~IMContext() { if (hIMC) ::ImmReleaseContext(hwnd, hIMC); @@ -284,7 +288,9 @@ class ScintillaWin : explicit ScintillaWin(HWND hwnd); // Deleted so ScintillaWin objects can not be copied. ScintillaWin(const ScintillaWin &) = delete; + ScintillaWin(ScintillaWin &&) = delete; ScintillaWin &operator=(const ScintillaWin &) = delete; + ScintillaWin &operator=(ScintillaWin &&) = delete; ~ScintillaWin() override; void Init(); @@ -328,7 +334,7 @@ class ScintillaWin : bool ValidCodePage(int codePage) const override; sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override; bool SetIdle(bool on) override; - UINT_PTR timers[tickDwell+1]; + UINT_PTR timers[tickDwell+1] {}; bool FineTickerRunning(TickReason reason) override; void FineTickerStart(TickReason reason, int millis, int tolerance) override; void FineTickerCancel(TickReason reason) override; @@ -429,7 +435,7 @@ ScintillaWin::ScintillaWin(HWND hwnd) { capturedMouse = false; trackedMouseLeave = false; - SetCoalescableTimerFn = 0; + SetCoalescableTimerFn = nullptr; linesPerScroll = 0; wheelDelta = 0; // Wheel delta from roll @@ -488,9 +494,6 @@ void ScintillaWin::Init() { SetCoalescableTimerFn = (SetCoalescableTimerSig)::GetProcAddress(user32, "SetCoalescableTimer"); } - for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast(tr + 1)) { - timers[tr] = 0; - } vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(INDIC_HIDDEN, ColourDesired(0, 0, 0xff)); vs.indicators[SC_INDICATOR_INPUT] = Indicator(INDIC_DOTS, ColourDesired(0, 0, 0xff)); vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(INDIC_COMPOSITIONTHICK, ColourDesired(0, 0, 0xff)); @@ -2175,6 +2178,11 @@ public: ptr = ::GlobalLock(hand); } } + // Deleted so GlobalMemory objects can not be copied. + GlobalMemory(const GlobalMemory &) = delete; + GlobalMemory(GlobalMemory &&) = delete; + GlobalMemory &operator=(const GlobalMemory &) = delete; + GlobalMemory &operator=(GlobalMemory &&) = delete; ~GlobalMemory() { PLATFORM_ASSERT(!ptr); assert(!hand); diff --git a/src/Edit.c b/src/Edit.c index 716136a55..d8c6b7627 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -6717,12 +6717,8 @@ void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, boo IgnoreNotifyChangeEvent(); SciCall_MarkerDeleteAll(MARKER_NP3_OCCUR_LINE); if (!g_bCodeFoldingAvailable) { SciCall_SetProperty("fold", "0"); } - //DocLn const iLnCount = SciCall_GetLineCount(); - //for (DocLn iLine = 0; iLine < iLnCount; ++iLine) { - // if ((SciCall_GetFoldLevel(iLine) & SC_FOLDLEVELNUMBERMASK) != SC_FOLDLEVELBASE) { - // SciCall_SetFoldLevel(iLine, SC_FOLDLEVELBASE); - // } - //} + DocLn const iLnCount = SciCall_GetLineCount(); + for (DocLn iLine = 0; iLine < iLnCount; ++iLine) { SciCall_SetFoldLevel(iLine, SC_FOLDLEVELBASE); } SciCall_SetFoldFlags(0); Style_SetFolding(hwnd, g_bCodeFoldingAvailable && g_bShowCodeFolding); EditApplyLexerStyle(hwnd, 0, -1);